From: <th...@us...> - 2009-07-20 09:41:47
|
Revision: 6550 http://jython.svn.sourceforge.net/jython/?rev=6550&view=rev Author: thobes Date: 2009-07-20 09:41:42 +0000 (Mon, 20 Jul 2009) Log Message: ----------- Fix for problem with compiling coroutines, yield was not allowed in the iterator expression of for-nodes. Example of failing code: def err(): for x in (yield): pass Fixed by deferring the allocation of the registers for storing the iter until after the iter expression is evaluated. Modified Paths: -------------- trunk/jython/src/org/python/compiler/CodeCompiler.java Modified: trunk/jython/src/org/python/compiler/CodeCompiler.java =================================================================== --- trunk/jython/src/org/python/compiler/CodeCompiler.java 2009-07-20 04:13:32 UTC (rev 6549) +++ trunk/jython/src/org/python/compiler/CodeCompiler.java 2009-07-20 09:41:42 UTC (rev 6550) @@ -1089,14 +1089,14 @@ Label start_loop = new Label(); Label next_loop = new Label(); - int iter_tmp = code.getLocal("org/python/core/PyObject"); - int expr_tmp = code.getLocal("org/python/core/PyObject"); - setline(node); //parse the list visit(node.getInternalIter()); + int iter_tmp = code.getLocal("org/python/core/PyObject"); + int expr_tmp = code.getLocal("org/python/core/PyObject"); + //set up the loop iterator code.invokevirtual("org/python/core/PyObject", "__iter__", "()Lorg/python/core/PyObject;"); code.astore(iter_tmp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |