/// <summary> /// Adds a new identifier to the identifier database that corresponds to a C# symbol, /// adds a tag, and returns the identifier. /// It is guaranteed to be distinct from other identifiers. /// </summary> /// <param name="classSymbol">The class symbol.</param> /// <param name="tag">The tag.</param> /// <returns></returns> public Identifier RegisterAndGetIdentifierWithTag(ISymbol classSymbol, string tag) { var taggedSymbol = new TaggedSymbol(classSymbol, tag); Identifier identifier = new Identifier(taggedSymbol); this.registeredGlobalSymbols.Add(taggedSymbol, identifier); return(identifier); }
public override bool Equals(object obj) { if (!(obj is TaggedSymbol)) { return(false); } TaggedSymbol other = (TaggedSymbol)obj; return(this.Symbol == other.Symbol && this.Tag == other.Tag); }
/// <summary> /// Gets the identifier that corresponds to a C# symbol and tag. If it doesn't exist, it is created. /// </summary> /// <param name="symbol">The symbol.</param> /// <param name="tag">The tag.</param> public Identifier GetIdentifierReferenceWithTag(ISymbol symbol, string tag) { var taggedSymbol = new TaggedSymbol(symbol, tag); if (this.references.ContainsKey(taggedSymbol)) { return(this.references[taggedSymbol]); } Identifier reference = new Identifier(taggedSymbol); this.references.Add(taggedSymbol, reference); return(reference); }
public Identifier(TaggedSymbol symbol) { this.Symbol = symbol; }