Java Code Examples for jdk.nashorn.internal.ir.Block#needsScope()
The following examples show how to use
jdk.nashorn.internal.ir.Block#needsScope() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FindScopeDepths.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
static int findInternalDepth(final LexicalContext lc, final FunctionNode fn, final Block block, final Symbol symbol) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (definedInBlock(b, symbol)) { return scopesToStart; } if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; //don't go past body block, but process it } b = iter.next(); } return -1; }
Example 2
Source File: FindScopeDepths.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
static int findInternalDepth(final LexicalContext lc, final FunctionNode fn, final Block block, final Symbol symbol) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (definedInBlock(b, symbol)) { return scopesToStart; } if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; //don't go past body block, but process it } b = iter.next(); } return -1; }
Example 3
Source File: FindScopeDepths.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
static int findScopesToStart(final LexicalContext lc, final FunctionNode fn, final Block block) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; } b = iter.next(); } return scopesToStart; }
Example 4
Source File: FindScopeDepths.java From hottub with GNU General Public License v2.0 | 6 votes |
static int findInternalDepth(final LexicalContext lc, final FunctionNode fn, final Block block, final Symbol symbol) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (definedInBlock(b, symbol)) { return scopesToStart; } if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; //don't go past body block, but process it } b = iter.next(); } return -1; }
Example 5
Source File: FindScopeDepths.java From hottub with GNU General Public License v2.0 | 6 votes |
static int findScopesToStart(final LexicalContext lc, final FunctionNode fn, final Block block) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; } b = iter.next(); } return scopesToStart; }
Example 6
Source File: FindScopeDepths.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static int findInternalDepth(final LexicalContext lc, final FunctionNode fn, final Block block, final Symbol symbol) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (definedInBlock(b, symbol)) { return scopesToStart; } if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; //don't go past body block, but process it } b = iter.next(); } return -1; }
Example 7
Source File: FindScopeDepths.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static int findScopesToStart(final LexicalContext lc, final FunctionNode fn, final Block block) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; } b = iter.next(); } return scopesToStart; }
Example 8
Source File: FindScopeDepths.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
static int findInternalDepth(final LexicalContext lc, final FunctionNode fn, final Block block, final Symbol symbol) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (definedInBlock(b, symbol)) { return scopesToStart; } if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; //don't go past body block, but process it } b = iter.next(); } return -1; }
Example 9
Source File: FindScopeDepths.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
static int findScopesToStart(final LexicalContext lc, final FunctionNode fn, final Block block) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; } b = iter.next(); } return scopesToStart; }
Example 10
Source File: FindScopeDepths.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
static int findInternalDepth(final LexicalContext lc, final FunctionNode fn, final Block block, final Symbol symbol) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (definedInBlock(b, symbol)) { return scopesToStart; } if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; //don't go past body block, but process it } b = iter.next(); } return -1; }
Example 11
Source File: FindScopeDepths.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
static int findScopesToStart(final LexicalContext lc, final FunctionNode fn, final Block block) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; } b = iter.next(); } return scopesToStart; }
Example 12
Source File: FindScopeDepths.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
static int findInternalDepth(final LexicalContext lc, final FunctionNode fn, final Block block, final Symbol symbol) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (definedInBlock(b, symbol)) { return scopesToStart; } if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; //don't go past body block, but process it } b = iter.next(); } return -1; }
Example 13
Source File: FindScopeDepths.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
static int findScopesToStart(final LexicalContext lc, final FunctionNode fn, final Block block) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; } b = iter.next(); } return scopesToStart; }
Example 14
Source File: FindScopeDepths.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
static int findScopesToStart(final LexicalContext lc, final FunctionNode fn, final Block block) { final Block bodyBlock = findBodyBlock(lc, fn, block); final Iterator<Block> iter = lc.getBlocks(block); Block b = iter.next(); int scopesToStart = 0; while (true) { if (b.needsScope()) { scopesToStart++; } if (b == bodyBlock) { break; } b = iter.next(); } return scopesToStart; }
Example 15
Source File: CodeGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private int getScopeProtoDepth(final Block startingBlock, final Symbol symbol) { int depth = 0; final String name = symbol.getName(); for(final Iterator<Block> blocks = lc.getBlocks(startingBlock); blocks.hasNext();) { final Block currentBlock = blocks.next(); if (currentBlock.getExistingSymbol(name) == symbol) { return depth; } if (currentBlock.needsScope()) { ++depth; } } return -1; }
Example 16
Source File: CodeGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveBlock(final Block block) { method.label(block.getBreakLabel()); symbolInfo(block); if (block.needsScope() && !block.isTerminal()) { popBlockScope(block); } return block; }
Example 17
Source File: CodeGenerator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private int getScopeProtoDepth(final Block startingBlock, final Symbol symbol) { int depth = 0; final String name = symbol.getName(); for(final Iterator<Block> blocks = lc.getBlocks(startingBlock); blocks.hasNext();) { final Block currentBlock = blocks.next(); if (currentBlock.getExistingSymbol(name) == symbol) { return depth; } if (currentBlock.needsScope()) { ++depth; } } return -1; }
Example 18
Source File: CodeGenerator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveBlock(final Block block) { method.label(block.getBreakLabel()); symbolInfo(block); if (block.needsScope() && !block.isTerminal()) { popBlockScope(block); } return block; }
Example 19
Source File: CodeGenerator.java From nashorn with GNU General Public License v2.0 | 5 votes |
private int getScopeProtoDepth(final Block startingBlock, final Symbol symbol) { int depth = 0; final String name = symbol.getName(); for(final Iterator<Block> blocks = lc.getBlocks(startingBlock); blocks.hasNext();) { final Block currentBlock = blocks.next(); if (currentBlock.getExistingSymbol(name) == symbol) { return depth; } if (currentBlock.needsScope()) { ++depth; } } return -1; }
Example 20
Source File: CodeGenerator.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveBlock(final Block block) { method.label(block.getBreakLabel()); symbolInfo(block); if (block.needsScope() && !block.isTerminal()) { popBlockScope(block); } return block; }