From 38afa9e7bc7eacc021f8805f607368a05751e3c3 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 25 Jun 2020 14:43:50 -0700 Subject: The Great Tuple to Symbol Rename (tm) --- .../Link/ResolveReferencesCommand.cs | 104 ++++++++++----------- 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 'src/WixToolset.Core/Link/ResolveReferencesCommand.cs') diff --git a/src/WixToolset.Core/Link/ResolveReferencesCommand.cs b/src/WixToolset.Core/Link/ResolveReferencesCommand.cs index 4ffb5443..d2be0699 100644 --- a/src/WixToolset.Core/Link/ResolveReferencesCommand.cs +++ b/src/WixToolset.Core/Link/ResolveReferencesCommand.cs @@ -6,7 +6,7 @@ namespace WixToolset.Core.Link using System.Collections.Generic; using System.Linq; using WixToolset.Data; - using WixToolset.Data.Tuples; + using WixToolset.Data.Symbols; using WixToolset.Extensibility.Services; /// @@ -15,19 +15,19 @@ namespace WixToolset.Core.Link internal class ResolveReferencesCommand { private readonly IntermediateSection entrySection; - private readonly IDictionary tuplesWithSections; - private HashSet referencedTuples; + private readonly IDictionary symbolsWithSections; + private HashSet referencedSymbols; private HashSet resolvedSections; - public ResolveReferencesCommand(IMessaging messaging, IntermediateSection entrySection, IDictionary tuplesWithSections) + public ResolveReferencesCommand(IMessaging messaging, IntermediateSection entrySection, IDictionary symbolsWithSections) { this.Messaging = messaging; this.entrySection = entrySection; - this.tuplesWithSections = tuplesWithSections; + this.symbolsWithSections = symbolsWithSections; this.BuildingMergeModule = (SectionType.Module == entrySection.Type); } - public IEnumerable ReferencedTupleWithSections => this.referencedTuples; + public IEnumerable ReferencedSymbolWithSections => this.referencedSymbols; public IEnumerable ResolvedSections => this.resolvedSections; @@ -41,7 +41,7 @@ namespace WixToolset.Core.Link public void Execute() { this.resolvedSections = new HashSet(); - this.referencedTuples = new HashSet(); + this.referencedSymbols = new HashSet(); this.RecursivelyResolveReferences(this.entrySection); } @@ -60,10 +60,10 @@ namespace WixToolset.Core.Link } // Process all of the references contained in this section using the collection of - // tuples provided. Then recursively call this method to process the - // located tuple's section. All in all this is a very simple depth-first + // symbols provided. Then recursively call this method to process the + // located symbol's section. All in all this is a very simple depth-first // search of the references per-section. - foreach (var wixSimpleReferenceRow in section.Tuples.OfType()) + foreach (var wixSimpleReferenceRow in section.Symbols.OfType()) { // If we're building a Merge Module, ignore all references to the Media table // because Merge Modules don't have Media tables. @@ -72,44 +72,44 @@ namespace WixToolset.Core.Link continue; } - if (!this.tuplesWithSections.TryGetValue(wixSimpleReferenceRow.SymbolicName, out var tupleWithSection)) + if (!this.symbolsWithSections.TryGetValue(wixSimpleReferenceRow.SymbolicName, out var symbolWithSection)) { this.Messaging.Write(ErrorMessages.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName)); } - else // see if the tuple (and any of its duplicates) are appropriately accessible. + else // see if the symbol (and any of its duplicates) are appropriately accessible. { - var accessible = this.DetermineAccessibleTuples(section, tupleWithSection); + var accessible = this.DetermineAccessibleSymbols(section, symbolWithSection); if (!accessible.Any()) { - this.Messaging.Write(ErrorMessages.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName, tupleWithSection.Access)); + this.Messaging.Write(ErrorMessages.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName, symbolWithSection.Access)); } else if (1 == accessible.Count) { - var accessibleTuple = accessible[0]; - this.referencedTuples.Add(accessibleTuple); + var accessibleSymbol = accessible[0]; + this.referencedSymbols.Add(accessibleSymbol); - if (null != accessibleTuple.Section) + if (null != accessibleSymbol.Section) { - this.RecursivelyResolveReferences(accessibleTuple.Section); + this.RecursivelyResolveReferences(accessibleSymbol.Section); } } - else // display errors for the duplicate tuples. + else // display errors for the duplicate symbols. { - var accessibleTuple = accessible[0]; + var accessibleSymbol = accessible[0]; var referencingSourceLineNumber = wixSimpleReferenceRow.SourceLineNumbers?.ToString(); if (String.IsNullOrEmpty(referencingSourceLineNumber)) { - this.Messaging.Write(ErrorMessages.DuplicateSymbol(accessibleTuple.Tuple.SourceLineNumbers, accessibleTuple.Name)); + this.Messaging.Write(ErrorMessages.DuplicateSymbol(accessibleSymbol.Symbol.SourceLineNumbers, accessibleSymbol.Name)); } else { - this.Messaging.Write(ErrorMessages.DuplicateSymbol(accessibleTuple.Tuple.SourceLineNumbers, accessibleTuple.Name, referencingSourceLineNumber)); + this.Messaging.Write(ErrorMessages.DuplicateSymbol(accessibleSymbol.Symbol.SourceLineNumbers, accessibleSymbol.Name, referencingSourceLineNumber)); } foreach (var accessibleDuplicate in accessible.Skip(1)) { - this.Messaging.Write(ErrorMessages.DuplicateSymbol2(accessibleDuplicate.Tuple.SourceLineNumbers)); + this.Messaging.Write(ErrorMessages.DuplicateSymbol2(accessibleDuplicate.Symbol.SourceLineNumbers)); } } } @@ -117,67 +117,67 @@ namespace WixToolset.Core.Link } /// - /// Determine if the tuple and any of its duplicates are accessbile by referencing section. + /// Determine if the symbol and any of its duplicates are accessbile by referencing section. /// - /// Section referencing the tuple. - /// Tuple being referenced. - /// List of tuples accessible by referencing section. - private List DetermineAccessibleTuples(IntermediateSection referencingSection, TupleWithSection tupleWithSection) + /// Section referencing the symbol. + /// Symbol being referenced. + /// List of symbols accessible by referencing section. + private List DetermineAccessibleSymbols(IntermediateSection referencingSection, SymbolWithSection symbolWithSection) { - var accessibleTuples = new List(); + var accessibleSymbols = new List(); - if (this.AccessibleTuple(referencingSection, tupleWithSection)) + if (this.AccessibleSymbol(referencingSection, symbolWithSection)) { - accessibleTuples.Add(tupleWithSection); + accessibleSymbols.Add(symbolWithSection); } - foreach (var dupe in tupleWithSection.PossiblyConflicts) + foreach (var dupe in symbolWithSection.PossiblyConflicts) { - // don't count overridable WixActionTuples - var tupleAction = tupleWithSection.Tuple as WixActionTuple; - var dupeAction = dupe.Tuple as WixActionTuple; - if (tupleAction?.Overridable != dupeAction?.Overridable) + // don't count overridable WixActionSymbols + var symbolAction = symbolWithSection.Symbol as WixActionSymbol; + var dupeAction = dupe.Symbol as WixActionSymbol; + if (symbolAction?.Overridable != dupeAction?.Overridable) { continue; } - if (this.AccessibleTuple(referencingSection, dupe)) + if (this.AccessibleSymbol(referencingSection, dupe)) { - accessibleTuples.Add(dupe); + accessibleSymbols.Add(dupe); } } - foreach (var dupe in tupleWithSection.Redundants) + foreach (var dupe in symbolWithSection.Redundants) { - if (this.AccessibleTuple(referencingSection, dupe)) + if (this.AccessibleSymbol(referencingSection, dupe)) { - accessibleTuples.Add(dupe); + accessibleSymbols.Add(dupe); } } - return accessibleTuples; + return accessibleSymbols; } /// - /// Determine if a single tuple is accessible by the referencing section. + /// Determine if a single symbol is accessible by the referencing section. /// - /// Section referencing the tuple. - /// Tuple being referenced. - /// True if tuple is accessible. - private bool AccessibleTuple(IntermediateSection referencingSection, TupleWithSection tupleWithSection) + /// Section referencing the symbol. + /// Symbol being referenced. + /// True if symbol is accessible. + private bool AccessibleSymbol(IntermediateSection referencingSection, SymbolWithSection symbolWithSection) { - switch (tupleWithSection.Access) + switch (symbolWithSection.Access) { case AccessModifier.Public: return true; case AccessModifier.Internal: - return tupleWithSection.Section.CompilationId.Equals(referencingSection.CompilationId) || (null != tupleWithSection.Section.LibraryId && tupleWithSection.Section.LibraryId.Equals(referencingSection.LibraryId)); + return symbolWithSection.Section.CompilationId.Equals(referencingSection.CompilationId) || (null != symbolWithSection.Section.LibraryId && symbolWithSection.Section.LibraryId.Equals(referencingSection.LibraryId)); case AccessModifier.Protected: - return tupleWithSection.Section.CompilationId.Equals(referencingSection.CompilationId); + return symbolWithSection.Section.CompilationId.Equals(referencingSection.CompilationId); case AccessModifier.Private: - return referencingSection == tupleWithSection.Section; + return referencingSection == symbolWithSection.Section; default: - throw new ArgumentOutOfRangeException(nameof(tupleWithSection.Access)); + throw new ArgumentOutOfRangeException(nameof(symbolWithSection.Access)); } } } -- cgit v1.2.3-55-g6feb