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