From: <fwi...@us...> - 2009-01-05 13:51:17
|
Revision: 5850 http://jython.svn.sourceforge.net/jython/?rev=5850&view=rev Author: fwierzbicki Date: 2009-01-05 13:51:12 +0000 (Mon, 05 Jan 2009) Log Message: ----------- Raise now takes only 2 args. Modified Paths: -------------- branches/jy3k/grammar/Python.g branches/jy3k/src/org/python/compiler/CodeCompiler.java Modified: branches/jy3k/grammar/Python.g =================================================================== --- branches/jy3k/grammar/Python.g 2009-01-05 13:39:31 UTC (rev 5849) +++ branches/jy3k/grammar/Python.g 2009-01-05 13:51:12 UTC (rev 5850) @@ -699,11 +699,10 @@ : yield_expr -> ^(YIELD<Expr>[$yield_expr.start, actions.castExpr($yield_expr.tree)]) ; -//raise_stmt: 'raise' [test [',' test [',' test]]] +//raise_stmt: 'raise' [test ['from' test]] raise_stmt - : RAISE (t1=test[expr_contextType.Load] (COMMA t2=test[expr_contextType.Load] - (COMMA t3=test[expr_contextType.Load])?)?)? - -> ^(RAISE<Raise>[$RAISE, actions.castExpr($t1.tree), actions.castExpr($t2.tree), actions.castExpr($t3.tree)]) + : RAISE (t1=test[expr_contextType.Load] (FROM t2=test[expr_contextType.Load])?)? + -> ^(RAISE<Raise>[$RAISE, actions.castExpr($t1.tree), actions.castExpr($t2.tree)]) ; //import_stmt: import_name | import_from Modified: branches/jy3k/src/org/python/compiler/CodeCompiler.java =================================================================== --- branches/jy3k/src/org/python/compiler/CodeCompiler.java 2009-01-05 13:39:31 UTC (rev 5849) +++ branches/jy3k/src/org/python/compiler/CodeCompiler.java 2009-01-05 13:51:12 UTC (rev 5850) @@ -705,20 +705,16 @@ @Override public Object visitRaise(Raise node) throws Exception { setline(node); - if (node.getInternalExcepttype() != null) { visit(node.getInternalExcepttype()); stackProduce(); } - if (node.getInternalInst() != null) { visit(node.getInternalInst()); stackProduce(); } - if (node.getInternalTback() != null) { visit(node.getInternalTback()); stackProduce(); } - if (node.getInternalExcepttype() == null) { + if (node.getInternalExc() != null) { visit(node.getInternalExc()); stackProduce(); } + if (node.getInternalCause() != null) { visit(node.getInternalCause()); stackProduce(); } + if (node.getInternalExc() == null) { code.invokestatic("org/python/core/Py", "makeException", "()" + $pyExc); - } else if (node.getInternalInst() == null) { + } else if (node.getInternalCause() == null) { stackConsume(); code.invokestatic("org/python/core/Py", "makeException", "(" + $pyObj + ")" + $pyExc); - } else if (node.getInternalTback() == null) { + } else { stackConsume(2); code.invokestatic("org/python/core/Py", "makeException", "(" + $pyObj + $pyObj + ")" + $pyExc); - } else { - stackConsume(3); - code.invokestatic("org/python/core/Py", "makeException", "(" + $pyObj + $pyObj + $pyObj + ")" + $pyExc); } code.athrow(); return Exit; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |