Exemplo n.º 1
0
	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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
	def isMethodNameUsed(self, nm):
		'''Check whether method name is already used'''
		sym = G.symTab().lookup(nm)
		return sym != None
Exemplo n.º 4
0
	def isClassNameUsed(self, nm):
		'''Check whether class name is already used'''
		sym = G.symTab().lookup(nm)
		return sym != None
Exemplo n.º 5
0
 def beginScope(self, b=True):
     '''shorten the call to add a new scope'''
     self.valid_scope = b
     G.symTab().beginScope()
Exemplo n.º 6
0
 def isMethodNameUsed(self, nm):
     '''Check whether method name is already used'''
     sym = G.symTab().lookup(nm)
     return sym != None
Exemplo n.º 7
0
 def isClassNameUsed(self, nm):
     '''Check whether class name is already used'''
     sym = G.symTab().lookup(nm)
     return sym != None
Exemplo n.º 8
0
 def endScope(self, b=True):
     '''shorten the call to end a new scope'''
     if self.valid_scope:
         G.symTab().endScope()
     self.valid_scope = b
Exemplo n.º 9
0
	def beginScope(self, b=True):
		'''shorten the call to add a new scope'''
		self.valid_scope = b
		G.symTab().beginScope()
Exemplo n.º 10
0
	def endScope(self, b=True):
		'''shorten the call to end a new scope'''
		if self.valid_scope:
			G.symTab().endScope()
		self.valid_scope = b