This commit is contained in:
Dmitry Jemerov
2008-08-06 01:40:02 +04:00
parent 16431a0dca
commit 69a4de08b8
3 changed files with 13 additions and 1 deletions

View File

@@ -53,7 +53,7 @@ public class ReturnAnnotator extends PyAnnotator {
*/
}
private class YieldVisitor extends PyElementVisitor {
private static class YieldVisitor extends PyElementVisitor {
private boolean _haveYield = false;
public boolean haveYield() {
@@ -71,5 +71,10 @@ public class ReturnAnnotator extends PyAnnotator {
node.acceptChildren(this);
}
}
@Override
public void visitPyFunction(final PyFunction node) {
// do not go to nested functions
}
}
}

View File

@@ -0,0 +1,4 @@
def foo():
def a():
yield 1
return False

View File

@@ -47,6 +47,9 @@ public class PythonHighlightingTest extends DaemonAnalyzerTestCase {
doTest();
}
public void testYieldInNestedFunction() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(getTestName(true) + ".py", true, true);