aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Link/ResolveReferencesCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Link/ResolveReferencesCommand.cs')
-rw-r--r--src/WixToolset.Core/Link/ResolveReferencesCommand.cs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/WixToolset.Core/Link/ResolveReferencesCommand.cs b/src/WixToolset.Core/Link/ResolveReferencesCommand.cs
index 266871bd..c05464e9 100644
--- a/src/WixToolset.Core/Link/ResolveReferencesCommand.cs
+++ b/src/WixToolset.Core/Link/ResolveReferencesCommand.cs
@@ -7,19 +7,21 @@ namespace WixToolset.Link
7 using System.Linq; 7 using System.Linq;
8 using WixToolset.Data; 8 using WixToolset.Data;
9 using WixToolset.Data.Tuples; 9 using WixToolset.Data.Tuples;
10 using WixToolset.Extensibility.Services;
10 11
11 /// <summary> 12 /// <summary>
12 /// Resolves all the simple references in a section. 13 /// Resolves all the simple references in a section.
13 /// </summary> 14 /// </summary>
14 internal class ResolveReferencesCommand : ICommand 15 internal class ResolveReferencesCommand
15 { 16 {
16 private IntermediateSection entrySection; 17 private IntermediateSection entrySection;
17 private IDictionary<string, Symbol> symbols; 18 private IDictionary<string, Symbol> symbols;
18 private HashSet<Symbol> referencedSymbols; 19 private HashSet<Symbol> referencedSymbols;
19 private HashSet<IntermediateSection> resolvedSections; 20 private HashSet<IntermediateSection> resolvedSections;
20 21
21 public ResolveReferencesCommand(IntermediateSection entrySection, IDictionary<string, Symbol> symbols) 22 public ResolveReferencesCommand(IMessaging messaging, IntermediateSection entrySection, IDictionary<string, Symbol> symbols)
22 { 23 {
24 this.Messaging = messaging;
23 this.entrySection = entrySection; 25 this.entrySection = entrySection;
24 this.symbols = symbols; 26 this.symbols = symbols;
25 } 27 }
@@ -30,6 +32,8 @@ namespace WixToolset.Link
30 32
31 public IEnumerable<IntermediateSection> ResolvedSections { get { return this.resolvedSections; } } 33 public IEnumerable<IntermediateSection> ResolvedSections { get { return this.resolvedSections; } }
32 34
35 private IMessaging Messaging { get; }
36
33 /// <summary> 37 /// <summary>
34 /// Resolves all the simple references in a section. 38 /// Resolves all the simple references in a section.
35 /// </summary> 39 /// </summary>
@@ -69,14 +73,14 @@ namespace WixToolset.Link
69 73
70 if (!this.symbols.TryGetValue(wixSimpleReferenceRow.SymbolicName, out var symbol)) 74 if (!this.symbols.TryGetValue(wixSimpleReferenceRow.SymbolicName, out var symbol))
71 { 75 {
72 Messaging.Instance.OnMessage(WixErrors.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName)); 76 this.Messaging.Write(ErrorMessages.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName));
73 } 77 }
74 else // see if the symbol (and any of its duplicates) are appropriately accessible. 78 else // see if the symbol (and any of its duplicates) are appropriately accessible.
75 { 79 {
76 IList<Symbol> accessible = DetermineAccessibleSymbols(section, symbol); 80 IList<Symbol> accessible = DetermineAccessibleSymbols(section, symbol);
77 if (!accessible.Any()) 81 if (!accessible.Any())
78 { 82 {
79 Messaging.Instance.OnMessage(WixErrors.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName, symbol.Access)); 83 this.Messaging.Write(ErrorMessages.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName, symbol.Access));
80 } 84 }
81 else if (1 == accessible.Count) 85 else if (1 == accessible.Count)
82 { 86 {
@@ -95,16 +99,16 @@ namespace WixToolset.Link
95 99
96 if (String.IsNullOrEmpty(referencingSourceLineNumber)) 100 if (String.IsNullOrEmpty(referencingSourceLineNumber))
97 { 101 {
98 Messaging.Instance.OnMessage(WixErrors.DuplicateSymbol(accessibleSymbol.Row.SourceLineNumbers, accessibleSymbol.Name)); 102 this.Messaging.Write(ErrorMessages.DuplicateSymbol(accessibleSymbol.Row.SourceLineNumbers, accessibleSymbol.Name));
99 } 103 }
100 else 104 else
101 { 105 {
102 Messaging.Instance.OnMessage(WixErrors.DuplicateSymbol(accessibleSymbol.Row.SourceLineNumbers, accessibleSymbol.Name, referencingSourceLineNumber)); 106 this.Messaging.Write(ErrorMessages.DuplicateSymbol(accessibleSymbol.Row.SourceLineNumbers, accessibleSymbol.Name, referencingSourceLineNumber));
103 } 107 }
104 108
105 foreach (Symbol accessibleDuplicate in accessible.Skip(1)) 109 foreach (Symbol accessibleDuplicate in accessible.Skip(1))
106 { 110 {
107 Messaging.Instance.OnMessage(WixErrors.DuplicateSymbol2(accessibleDuplicate.Row.SourceLineNumbers)); 111 this.Messaging.Write(ErrorMessages.DuplicateSymbol2(accessibleDuplicate.Row.SourceLineNumbers));
108 } 112 }
109 } 113 }
110 } 114 }