diff options
author | Denis S. Fokin <Denis.Fokin@gmail.com> | 2015-10-29 14:35:35 +0300 |
---|---|---|
committer | Denis S. Fokin <Denis.Fokin@gmail.com> | 2015-10-29 14:35:35 +0300 |
commit | 65de49fac48ef400da91c0500eeea9b52e23f045 (patch) | |
tree | 91cc50316697e665cdcaa0e2a9be39333f68b5b4 /src/jdk/nashorn/internal/ir/BlockLexicalContext.java | |
parent | 8ec2a4d4e720accdab0fc5d069211bc7e03129e7 (diff) | |
parent | 79867aa8b3f50e06365efa3c2111912766300538 (diff) | |
download | jdk8u_nashorn-65de49fac48ef400da91c0500eeea9b52e23f045.tar.gz |
Merge with default before merge with jdk8u60
--HG--
branch : 8u40-verified-fixes
Diffstat (limited to 'src/jdk/nashorn/internal/ir/BlockLexicalContext.java')
-rw-r--r-- | src/jdk/nashorn/internal/ir/BlockLexicalContext.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/jdk/nashorn/internal/ir/BlockLexicalContext.java b/src/jdk/nashorn/internal/ir/BlockLexicalContext.java index 8fecddd0..7e16b5e6 100644 --- a/src/jdk/nashorn/internal/ir/BlockLexicalContext.java +++ b/src/jdk/nashorn/internal/ir/BlockLexicalContext.java @@ -40,14 +40,14 @@ import java.util.List; public class BlockLexicalContext extends LexicalContext { /** statement stack, each block on the lexical context maintains one of these, which is * committed to the block on pop */ - private Deque<List<Statement>> sstack = new ArrayDeque<>(); + private final Deque<List<Statement>> sstack = new ArrayDeque<>(); /** Last non debug statement emitted in this context */ protected Statement lastStatement; @Override public <T extends LexicalContextNode> T push(final T node) { - T pushed = super.push(node); + final T pushed = super.push(node); if (node instanceof Block) { sstack.push(new ArrayList<Statement>()); } @@ -68,7 +68,7 @@ public class BlockLexicalContext extends LexicalContext { * @param block the block to operate on * @return a modified block. */ - protected Block afterSetStatements(Block block) { + protected Block afterSetStatements(final Block block) { return block; } @@ -109,6 +109,16 @@ public class BlockLexicalContext extends LexicalContext { } /** + * Prepend a list of statement to the block being generated + * @param statements a list of statements to prepend + */ + public void prependStatements(final List<Statement> statements) { + assert statements != null; + sstack.peek().addAll(0, statements); + } + + + /** * Get the last statement that was emitted into a block * @return the last statement emitted */ |