def isVarNameUsed(self, nm): '''Check whether var name is already used''' ret = False sym = G.symTab().lookup(nm) if sym != None: ret = ret or isinstance(sym.decl(), ClassDecl) #ret = ret or isinstance(sym.decl(), MethodDecl) #FIXME - probably need this ret = ret or (isinstance(sym.decl(), VarDecl) and sym.scope() == G.symTab().getScope()) return ret
def isMethodNameUsed(self, nm): '''Check whether method name is already used''' sym = G.symTab().lookup(nm) return sym != None
def isClassNameUsed(self, nm): '''Check whether class name is already used''' sym = G.symTab().lookup(nm) return sym != None
def beginScope(self, b=True): '''shorten the call to add a new scope''' self.valid_scope = b G.symTab().beginScope()
def endScope(self, b=True): '''shorten the call to end a new scope''' if self.valid_scope: G.symTab().endScope() self.valid_scope = b