示例#1
0
        }                                               // the method declaration itself

        public MethodSymbolTable(ClassSymbolTable parentClass, DeclaringNode methodDeclaring, ErrorSummary errorSummary)
        {
            _parentClass         = parentClass;
            MethodDeclaring      = methodDeclaring;
            _methodVarDeclarings = new Dictionary <string, DeclaringNode>();
            _errorSummary        = errorSummary;
        }
示例#2
0
 public object Visit(InterfaceDeclaringNode n, object o)
 {
     _currentScopeLevel = 1;
     _currentClassST    = new ClassSymbolTable(n, _stdlib, _errorSummary);
     n.InterfaceMethods.Accept(this, null);
     AddToGlobalTable(n.Identifier.Value, _currentClassST);
     return(null);
 }
示例#3
0
 private void AddToGlobalTable(string ident, ClassSymbolTable classST)
 {
     if (_globalTable.ContainsKey(ident))
     {
         _errorSummary.AddError(new SemanticError($"'{ident}' is already declared", classST.ClassDeclaring.SourcePosition));
     }
     else
     {
         _globalTable.Add(ident, classST);
     }
 }
示例#4
0
 public object Visit(ClassDeclaringNode n, object o)
 {
     _currentScopeLevel = 1;
     _currentClassST    = new ClassSymbolTable(n, _stdlib, _errorSummary);
     n.Implements.Accept(this, null);
     n.Variables.Accept(this, null);
     n.Constructor.Accept(this, null);
     n.Methods.Accept(this, null);
     AddToGlobalTable(n.Identifier.Value, _currentClassST);
     return(null);
 }