blob: c8934d0facff26db541bbbe120d6541484ae5380 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
namespace WixToolset.Core.Link
{
using System;
using System.Collections.Generic;
using System.Linq;
using WixToolset.Data;
/// <summary>
/// Symbol with section representing a single unique symbol.
/// </summary>
internal class SymbolWithSection
{
private HashSet<SymbolWithSection> possibleConflicts;
private HashSet<SymbolWithSection> redundants;
/// <summary>
/// Creates a symbol for a symbol.
/// </summary>
/// <param name="symbol">Symbol for the symbol</param>
public SymbolWithSection(IntermediateSection section, IntermediateSymbol symbol)
{
this.Symbol = symbol;
this.Section = section;
this.Name = String.Concat(this.Symbol.Definition.Name, ":", this.Symbol.Id.Id);
}
/// <summary>
/// Gets the accessibility of the symbol which is a direct reflection of the accessibility of the row's accessibility.
/// </summary>
/// <value>Accessbility of the symbol.</value>
public AccessModifier Access => this.Symbol.Id.Access;
/// <summary>
/// Gets the name of the symbol.
/// </summary>
/// <value>Name of the symbol.</value>
public string Name { get; }
/// <summary>
/// Gets the symbol for this symbol.
/// </summary>
/// <value>Symbol for this symbol.</value>
public IntermediateSymbol Symbol { get; }
/// <summary>
/// Gets the section for the symbol.
/// </summary>
/// <value>Section for the symbol.</value>
public IntermediateSection Section { get; }
/// <summary>
/// Gets any duplicates of this symbol with sections that are possible conflicts.
/// </summary>
public IEnumerable<SymbolWithSection> PossiblyConflicts => this.possibleConflicts ?? Enumerable.Empty<SymbolWithSection>();
/// <summary>
/// Gets any duplicates of this symbol with sections that are redundant.
/// </summary>
public IEnumerable<SymbolWithSection> Redundants => this.redundants ?? Enumerable.Empty<SymbolWithSection>();
/// <summary>
/// Adds a duplicate symbol with sections that is a possible conflict.
/// </summary>
/// <param name="symbolWithSection">Symbol with section that is a possible conflict of this symbol.</param>
public void AddPossibleConflict(SymbolWithSection symbolWithSection)
{
if (null == this.possibleConflicts)
{
this.possibleConflicts = new HashSet<SymbolWithSection>();
}
this.possibleConflicts.Add(symbolWithSection);
}
/// <summary>
/// Adds a duplicate symbol that is redundant.
/// </summary>
/// <param name="symbolWithSection">Symbol with section that is redundant of this symbol.</param>
public void AddRedundant(SymbolWithSection symbolWithSection)
{
if (null == this.redundants)
{
this.redundants = new HashSet<SymbolWithSection>();
}
this.redundants.Add(symbolWithSection);
}
}
}
|