示例#1
0
        public void AddParam(AstId id, DemiTasse.ast.AstType type)
        {
            if (GetParam(id) != null)
                throw new SymbolException("Param " + id.s + " already defined");

            _params.Add(new VarRec(id, type, VarRec.PARAM, _params.Count + 1));
        }
示例#2
0
        public void AddClassVar(AstId vid, DemiTasse.ast.AstType type, AstExp e)
        {
            if(GetClassVar(vid) != null)
                throw new SymbolException("ClassVar " + vid.s + " already defined");

            _vars.Add(new VarRec(vid, type, VarRec.CLASS, _vars.Count+1, e));
        }
示例#3
0
 public TypeVisitor(DemiTasse.symbol.SymbolTable symtab, ClassRec c, MethodRec m)
 {
     symTable = symtab;
     currClass = c;
     currMethod = m;
     hasReturn = false;
 }
示例#4
0
        public void AddLocal(AstId vid, DemiTasse.ast.AstType type)
        {
            if (GetLocal(vid) != null)
                throw new SymbolException("Var " + vid.s + " already defined");

            _locals.Add(new VarRec(vid, type, VarRec.LOCAL,
            _locals.Count + 1));
        }
示例#5
0
        public void AddMethod(AstId mid, DemiTasse.ast.AstType rtype)
        {
            if (_methods.ContainsKey(mid.s))
                throw new SymbolException("Method " + mid.s + " already defined");

            MethodRec m = new MethodRec(mid, rtype);

            _methods.Add(mid.s, m);
        }