internal QuickAttributeChecker AddAliasesIfAny(SyntaxList <UsingDirectiveSyntax> usingsSyntax) { if (usingsSyntax.Count == 0) { return(this); } QuickAttributeChecker newChecker = null; foreach (var usingDirective in usingsSyntax) { if (usingDirective.Alias != null) { string name = usingDirective.Alias.Name.Identifier.ValueText; string target = usingDirective.Name.GetUnqualifiedName().Identifier.ValueText; if (_nameToAttributeMap.TryGetValue(target, out var foundAttributes)) { // copy the QuickAttributes from alias target to alias name (newChecker ?? (newChecker = new QuickAttributeChecker(this))).AddName(name, foundAttributes); } } } if (newChecker != null) { #if DEBUG newChecker._sealed = true; #endif return(newChecker); } return(this); }
private QuickAttributeChecker(QuickAttributeChecker previous) { _nameToAttributeMap = new Dictionary <string, QuickAttributes>( previous._nameToAttributeMap, StringComparer.Ordinal ); // NOTE: caller must seal }
private static QuickAttributeChecker CreatePredefinedQuickAttributeChecker() { var result = new QuickAttributeChecker(); result.AddName(AttributeDescription.TypeIdentifierAttribute.Name, QuickAttributes.TypeIdentifier); result.AddName(AttributeDescription.TypeForwardedToAttribute.Name, QuickAttributes.TypeForwardedTo); #if DEBUG result._sealed = true; #endif return(result); }