From: Finn B. <bc...@us...> - 2001-07-29 14:59:16
|
Update of /cvsroot/jython/jython/Tools/jythonc In directory usw-pr-cvs1:/tmp/cvs-serv23530/Tools/jythonc Modified Files: BaseEvaluator.py SimpleCompiler.py Log Message: Patch [ #444911 ] which fixes bug #444292 local var binding overrides fix Index: BaseEvaluator.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/BaseEvaluator.py,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -d -r2.10 -r2.11 *** BaseEvaluator.py 2001/05/27 18:50:56 2.10 --- BaseEvaluator.py 2001/07/29 14:59:13 2.11 *************** *** 13,16 **** --- 13,17 ---- self.lineno = -1 self.visitor = PythonVisitor(self) + self.imp_accu = None def parse(self, node): *************** *** 165,168 **** --- 166,171 ---- def freeTemp(self, tmp): pass + def makeFreeDecl(self,type,value): pass + def expr_stmt(self, lhss, rhs): if len(lhss) == 0: *************** *** 272,289 **** if asname is None: asname = modname - self.set_name(asname, module.getattr(modname)) asnames.append(asname) modnames.append(modname) topmodname = jast.StringConstant(".".join(top)) ! modnames = jast.FilledArray( "String", map(lambda x: jast.StringConstant(x), modnames)) ! asnames = jast.FilledArray( ! "String", ! map(lambda x: jast.StringConstant(x), asnames)) ! return jast.InvokeStatic( ! "org.python.core.imp", "importFromAs", ! [topmodname, modnames, asnames, self.frame.frame]) #external interfaces --- 275,306 ---- if asname is None: asname = modname asnames.append(asname) modnames.append(modname) topmodname = jast.StringConstant(".".join(top)) ! modnamesArray = jast.FilledArray( "String", map(lambda x: jast.StringConstant(x), modnames)) ! ! do_import = jast.InvokeStatic("org.python.core.imp", "importFrom", ! [topmodname, modnamesArray, ! self.frame.frame]) ! ! if not self.imp_accu: ! imp_accu = self.imp_accu = jast.Identifier("imp_accu") ! self.makeFreeDecl("PyObject[]",imp_accu) ! else: ! imp_accu = self.imp_accu ! ! stmts = [jast.Set(imp_accu,do_import)] ! ! for i in range(len(asnames)): ! asname = asnames[i] ! modname = modnames[i] ! code = jast.Subscript(imp_accu,i) ! stmts.append(self.set_name(asname, ! module.getattr(modname).makeReference(code))) ! ! return stmts #external interfaces Index: SimpleCompiler.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/SimpleCompiler.py,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** SimpleCompiler.py 2001/05/27 18:50:56 2.14 --- SimpleCompiler.py 2001/07/29 14:59:13 2.15 *************** *** 254,257 **** --- 254,259 ---- self.listComprehensionStack = [] + self.free_decls = [] + def isAlwaysFalse(self, name): if self.options is None: *************** *** 282,286 **** ret = BaseEvaluator.parse(self, node) #print 'parse', ret ! decs = self.frame.getDeclarations() if len(decs) != 0: return [decs, jast.SimpleComment('Code'), ret] --- 284,288 ---- ret = BaseEvaluator.parse(self, node) #print 'parse', ret ! decs = self.free_decls + self.frame.getDeclarations() if len(decs) != 0: return [decs, jast.SimpleComment('Code'), ret] *************** *** 296,299 **** --- 298,304 ---- self.frame.freetemp(tmp.asAny()) + def makeFreeDecl(self,type,value): + self.free_decls.append(jast.Declare(type,value)) + #primitive values def int_const(self, value): *************** *** 436,451 **** ret = [] for dotted, asname in names: ! modname = jast.StringConstant(".".join(dotted)) if asname: ! self.set_name(asname, self.get_module(dotted,0)) ! asname = jast.StringConstant(asname) ! ret.append(jast.InvokeStatic("org.python.core.imp", ! "importOneAs", ! [modname, asname, self.frame.frame])) else: ! self.set_name(dotted[0], self.get_module(dotted,1)) ! ret.append(jast.InvokeStatic("org.python.core.imp", ! "importOne", ! [modname, self.frame.frame])) return ret --- 441,455 ---- ret = [] for dotted, asname in names: ! modnameConst = jast.StringConstant(".".join(dotted)) if asname: ! code = jast.InvokeStatic("org.python.core.imp","importOneAs", ! [modnameConst, self.frame.frame]) ! code = self.get_module(dotted,0).makeReference(code) ! ret.append(self.set_name(asname,code)) else: ! code = jast.InvokeStatic("org.python.core.imp","importOne", ! [modnameConst, self.frame.frame]) ! code = self.get_module(dotted,1).makeReference(code) ! ret.append(self.set_name(dotted[0],code)) return ret |