Java Code Examples for jdk.nashorn.internal.ir.Block#getExistingSymbol()
The following examples show how to use
jdk.nashorn.internal.ir.Block#getExistingSymbol() .
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 | 5 votes |
private static boolean definedInBlock(final Block block, final Symbol symbol) { if (symbol.isGlobal()) { if (block.isGlobalScope()) { return true; } //globals cannot be defined anywhere else return false; } return block.getExistingSymbol(symbol.getName()) == symbol; }
Example 2
Source File: FindScopeDepths.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static boolean definedInBlock(final Block block, final Symbol symbol) { if (symbol.isGlobal()) { if (block.isGlobalScope()) { return true; } //globals cannot be defined anywhere else return false; } return block.getExistingSymbol(symbol.getName()) == symbol; }
Example 3
Source File: FindScopeDepths.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static boolean definedInBlock(final Block block, final Symbol symbol) { if (symbol.isGlobal()) { if (block.isGlobalScope()) { return true; } //globals cannot be defined anywhere else return false; } return block.getExistingSymbol(symbol.getName()) == symbol; }
Example 4
Source File: FindScopeDepths.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static boolean definedInBlock(final Block block, final Symbol symbol) { if (symbol.isGlobal()) { if (block.isGlobalScope()) { return true; } //globals cannot be defined anywhere else return false; } return block.getExistingSymbol(symbol.getName()) == symbol; }
Example 5
Source File: FindScopeDepths.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static boolean definedInBlock(final Block block, final Symbol symbol) { if (symbol.isGlobal()) { //globals cannot be defined anywhere else return block.isGlobalScope(); } return block.getExistingSymbol(symbol.getName()) == symbol; }
Example 6
Source File: FindScopeDepths.java From hottub with GNU General Public License v2.0 | 5 votes |
private static boolean definedInBlock(final Block block, final Symbol symbol) { if (symbol.isGlobal()) { if (block.isGlobalScope()) { return true; } //globals cannot be defined anywhere else return false; } return block.getExistingSymbol(symbol.getName()) == symbol; }
Example 7
Source File: Attr.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Is the symbol denoted by the specified name in the current lexical context defined in the program level * @param name the name of the symbol * @return true if the symbol denoted by the specified name in the current lexical context defined in the program level. */ private boolean isProgramLevelSymbol(final String name) { for(final Iterator<Block> it = lc.getBlocks(); it.hasNext();) { final Block next = it.next(); if(next.getExistingSymbol(name) != null) { return next == lc.getFunctionBody(lc.getOutermostFunction()); } } throw new AssertionError("Couldn't find symbol " + name + " in the context"); }
Example 8
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 9
Source File: Attr.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Is the symbol denoted by the specified name in the current lexical context defined in the program level * @param name the name of the symbol * @return true if the symbol denoted by the specified name in the current lexical context defined in the program level. */ private boolean isProgramLevelSymbol(final String name) { for(final Iterator<Block> it = lc.getBlocks(); it.hasNext();) { final Block next = it.next(); if(next.getExistingSymbol(name) != null) { return next == lc.getFunctionBody(lc.getOutermostFunction()); } } throw new AssertionError("Couldn't find symbol " + name + " in the context"); }
Example 10
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 11
Source File: FindScopeDepths.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private static boolean definedInBlock(final Block block, final Symbol symbol) { if (symbol.isGlobal()) { if (block.isGlobalScope()) { return true; } //globals cannot be defined anywhere else return false; } return block.getExistingSymbol(symbol.getName()) == symbol; }
Example 12
Source File: Attr.java From nashorn with GNU General Public License v2.0 | 5 votes |
/** * Is the symbol denoted by the specified name in the current lexical context defined in the program level * @param name the name of the symbol * @return true if the symbol denoted by the specified name in the current lexical context defined in the program level. */ private boolean isProgramLevelSymbol(final String name) { for(final Iterator<Block> it = lc.getBlocks(); it.hasNext();) { final Block next = it.next(); if(next.getExistingSymbol(name) != null) { return next == lc.getFunctionBody(lc.getOutermostFunction()); } } throw new AssertionError("Couldn't find symbol " + name + " in the context"); }
Example 13
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; }