本文整理汇总了C#中SymbolTable.GetDeclarationNodeLinkToSymbol方法的典型用法代码示例。如果您正苦于以下问题:C# SymbolTable.GetDeclarationNodeLinkToSymbol方法的具体用法?C# SymbolTable.GetDeclarationNodeLinkToSymbol怎么用?C# SymbolTable.GetDeclarationNodeLinkToSymbol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolTable
的用法示例。
在下文中一共展示了SymbolTable.GetDeclarationNodeLinkToSymbol方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateCode
public override void GenerateCode(FileManager fileManager, SymbolTable symbolTable, CodeGeneratorHelper labelHelper)
{
AppendNodeComment(fileManager);
SyntaxTreeDeclarationNode declNode = symbolTable.GetDeclarationNodeLinkToSymbol(this.Identifier) as SyntaxTreeDeclarationNode;
fileManager.Output.Append(Macro.LoadAccu(declNode.GetMemoryAddress()));
}
示例2: GenerateCode
public override void GenerateCode(FileManager fileManager, SymbolTable symbolTable, CodeGeneratorHelper codeGeneratorHelper)
{
AppendNodeComment(fileManager);
this._children[1].GenerateCode(fileManager, symbolTable, codeGeneratorHelper);
SyntaxTreeIdentNode identNode = this._children[0] as SyntaxTreeIdentNode;
Symbol identSymbol = identNode.Identifier;
SyntaxTreeDeclarationNode declNode = symbolTable.GetDeclarationNodeLinkToSymbol(identSymbol) as SyntaxTreeDeclarationNode;
fileManager.Output.Append(Macro.StoreAccu(declNode.GetMemoryAddress()));
}
示例3: CheckForDuplicateDeclarations
bool CheckForDuplicateDeclarations(SymbolTable symbolTable)
{
return this._rootNode.RunDelegateForType(typeof(SyntaxTreeDeclarationNode), delegate(SyntaxTreeNode node)
{
SyntaxTreeDeclarationNode declNode = node as SyntaxTreeDeclarationNode;
Symbol symbol = declNode.Identifier;
if (!symbolTable.IsIdentifierSymbol(symbol))
{
string message = declNode.ContextErrorString("Declaration node contains not an identifier symbol.");
Logger.Error(message);
return false;
}
SyntaxTreeNode nodeFromSymbol = symbolTable.GetDeclarationNodeLinkToSymbol(symbol);
if (nodeFromSymbol != declNode)
{
string message = declNode.ContextErrorString("Duplicate declaration of an identifier {0}.", symbolTable.GetRepresentationOfSymbol(symbol));
Logger.Error(message);
return false;
}
return true;
});
}
示例4: CheckForUndeclaredIdentifiers
bool CheckForUndeclaredIdentifiers(SymbolTable symbolTable)
{
return this._rootNode.RunDelegateForType(typeof(SyntaxTreeIdentNode), delegate(SyntaxTreeNode node)
{
SyntaxTreeIdentNode identNode = node as SyntaxTreeIdentNode;
Symbol symbol = identNode.Identifier;
if (symbolTable.GetDeclarationNodeLinkToSymbol(symbol) == null)
{
string message = identNode.ContextErrorString("Identifier {0} was not declared.", symbolTable.GetRepresentationOfSymbol(symbol));
Logger.Error(message);
return false;
}
identNode.DeclarationNode = symbolTable.GetDeclarationNodeLinkToSymbol(symbol);
return true;
});
}