src/jdk/nashorn/internal/ir/LexicalContext.java

changeset 1064
03c06c337d9d
parent 994
f5be4bdd0f6e
child 1109
f39081a16f71
     1.1 --- a/src/jdk/nashorn/internal/ir/LexicalContext.java	Fri Oct 17 14:24:26 2014 +0200
     1.2 +++ b/src/jdk/nashorn/internal/ir/LexicalContext.java	Mon Oct 20 12:06:36 2014 +0200
     1.3 @@ -440,6 +440,14 @@
     1.4      }
     1.5  
     1.6      /**
     1.7 +     * Is the topmost lexical context element body of a SplitNode?
     1.8 +     * @return true if it's the body of a split node.
     1.9 +     */
    1.10 +    public boolean isSplitBody() {
    1.11 +        return sp >= 2 && stack[sp - 1] instanceof Block && stack[sp - 2] instanceof SplitNode;
    1.12 +    }
    1.13 +
    1.14 +    /**
    1.15       * Get the parent function for a function in the lexical context
    1.16       * @param functionNode function for which to get parent
    1.17       * @return parent function of functionNode or null if none (e.g. if functionNode is the program)
    1.18 @@ -472,9 +480,6 @@
    1.19              final LexicalContextNode node = iter.next();
    1.20              if (node == until) {
    1.21                  break;
    1.22 -            } else if (node instanceof SplitNode) {
    1.23 -                // Don't bother popping scopes if we're going to do a return from a split method anyway.
    1.24 -                return 0;
    1.25              }
    1.26              assert !(node instanceof FunctionNode); // Can't go outside current function
    1.27              if (node instanceof WithNode || node instanceof Block && ((Block)node).needsScope()) {

mercurial