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