satisfy the tabnanny

fix broken references to filename var in generateXXX methods
This commit is contained in:
Jeremy Hylton 2000-02-17 17:56:29 +00:00
parent 1e862e8a37
commit 873bdc18e4
2 changed files with 396 additions and 392 deletions

View File

@ -177,13 +177,12 @@ class CodeGenerator:
def _generateFunctionOrLambdaCode(self, func):
self.name = func.name
self.filename = filename
# keep a lookout for 'def foo((x,y)):'
args, hasTupleArg = self.generateArglist(func.argnames)
self.code = PyAssembler(args=args, name=func.name,
filename=filename)
filename=self.filename)
self.namespace = self.OPTIMIZED
if func.varargs:
self.code.setVarArgs()
@ -239,7 +238,7 @@ class CodeGenerator:
def generateClassCode(self, klass):
self.code = PyAssembler(name=klass.name,
filename=filename)
filename=self.filename)
self.emit('SET_LINENO', klass.lineno)
lnf = walk(klass.code, LocalNameFinder(), 0)
self.locals.push(lnf.getLocals())
@ -927,6 +926,12 @@ class CompiledModule:
mtime = struct.pack('i', mtime)
return magic + mtime
def compile(filename):
buf = open(filename).read()
mod = CompiledModule(buf, filename)
mod.compile()
mod.dump(filename + 'c')
if __name__ == "__main__":
import getopt
@ -945,7 +950,4 @@ if __name__ == "__main__":
for filename in args:
if VERBOSE:
print filename
buf = open(filename).read()
mod = CompiledModule(buf, filename)
mod.compile()
mod.dump(filename + 'c')
compile(filename)

View File

@ -177,13 +177,12 @@ class CodeGenerator:
def _generateFunctionOrLambdaCode(self, func):
self.name = func.name
self.filename = filename
# keep a lookout for 'def foo((x,y)):'
args, hasTupleArg = self.generateArglist(func.argnames)
self.code = PyAssembler(args=args, name=func.name,
filename=filename)
filename=self.filename)
self.namespace = self.OPTIMIZED
if func.varargs:
self.code.setVarArgs()
@ -239,7 +238,7 @@ class CodeGenerator:
def generateClassCode(self, klass):
self.code = PyAssembler(name=klass.name,
filename=filename)
filename=self.filename)
self.emit('SET_LINENO', klass.lineno)
lnf = walk(klass.code, LocalNameFinder(), 0)
self.locals.push(lnf.getLocals())
@ -927,6 +926,12 @@ class CompiledModule:
mtime = struct.pack('i', mtime)
return magic + mtime
def compile(filename):
buf = open(filename).read()
mod = CompiledModule(buf, filename)
mod.compile()
mod.dump(filename + 'c')
if __name__ == "__main__":
import getopt
@ -945,7 +950,4 @@ if __name__ == "__main__":
for filename in args:
if VERBOSE:
print filename
buf = open(filename).read()
mod = CompiledModule(buf, filename)
mod.compile()
mod.dump(filename + 'c')
compile(filename)