Esempio n. 1
0
 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;
     });
 }