Java Code Examples for jdk.nashorn.internal.ir.Symbol#isScope()
The following examples show how to use
jdk.nashorn.internal.ir.Symbol#isScope() .
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: MapCreator.java From nashorn with GNU General Public License v2.0 | 6 votes |
/** * Compute property flags given local state of a field. May be overridden and extended, * * @param symbol symbol to check * @param hasArguments does the created object have an "arguments" property * * @return flags to use for fields */ protected int getPropertyFlags(final Symbol symbol, final boolean hasArguments) { int flags = 0; if (symbol.isParam()) { flags |= Property.IS_ALWAYS_OBJECT | Property.IS_PARAMETER; } if (hasArguments) { flags |= Property.IS_ALWAYS_OBJECT | Property.HAS_ARGUMENTS; } if (symbol.isScope()) { flags |= Property.NOT_CONFIGURABLE; } if (symbol.canBePrimitive()) { flags |= Property.CAN_BE_PRIMITIVE; } if (symbol.canBeUndefined()) { flags |= Property.CAN_BE_UNDEFINED; } return flags; }
Example 2
Source File: FinalizeTypes.java From nashorn with GNU General Public License v2.0 | 5 votes |
private static void updateSymbolsLog(final FunctionNode functionNode, final Symbol symbol, final boolean loseSlot) { if (LOG.isEnabled()) { if (!symbol.isScope()) { LOG.finest("updateSymbols: ", symbol, " => scope, because all vars in ", functionNode.getName(), " are in scope"); } if (loseSlot && symbol.hasSlot()) { LOG.finest("updateSymbols: ", symbol, " => no slot, because all vars in ", functionNode.getName(), " are in scope"); } } }
Example 3
Source File: FinalizeTypes.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void updateSymbolsLog(final FunctionNode functionNode, final Symbol symbol, final boolean loseSlot) { if (LOG.isEnabled()) { if (!symbol.isScope()) { LOG.finest("updateSymbols: ", symbol, " => scope, because all vars in ", functionNode.getName(), " are in scope"); } if (loseSlot && symbol.hasSlot()) { LOG.finest("updateSymbols: ", symbol, " => no slot, because all vars in ", functionNode.getName(), " are in scope"); } } }
Example 4
Source File: MapCreator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Compute property flags given local state of a field. May be overridden and extended, * * @param symbol symbol to check * @param hasArguments does the created object have an "arguments" property * * @return flags to use for fields */ protected int getPropertyFlags(final Symbol symbol, final boolean hasArguments) { int flags = 0; if (symbol.isParam()) { flags |= Property.IS_ALWAYS_OBJECT | Property.IS_PARAMETER; } if (hasArguments) { flags |= Property.IS_ALWAYS_OBJECT | Property.HAS_ARGUMENTS; } if (symbol.isScope()) { flags |= Property.NOT_CONFIGURABLE; } if (symbol.canBePrimitive()) { flags |= Property.CAN_BE_PRIMITIVE; } if (symbol.canBeUndefined()) { flags |= Property.CAN_BE_UNDEFINED; } if (symbol.isFunctionDeclaration()) { flags |= Property.IS_FUNCTION_DECLARATION; } return flags; }
Example 5
Source File: FinalizeTypes.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void updateSymbolsLog(final FunctionNode functionNode, final Symbol symbol, final boolean loseSlot) { if (LOG.isEnabled()) { if (!symbol.isScope()) { LOG.finest("updateSymbols: ", symbol, " => scope, because all vars in ", functionNode.getName(), " are in scope"); } if (loseSlot && symbol.hasSlot()) { LOG.finest("updateSymbols: ", symbol, " => no slot, because all vars in ", functionNode.getName(), " are in scope"); } } }
Example 6
Source File: AssignSymbols.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * If the symbol isn't already a scope symbol, but it needs to be (see {@link #symbolNeedsToBeScope(Symbol)}, it is * promoted to a scope symbol and its block marked as needing a scope. * @param symbol the symbol that might be scoped */ private void maybeForceScope(final Symbol symbol) { if (!symbol.isScope() && symbolNeedsToBeScope(symbol)) { Symbol.setSymbolIsScope(lc, symbol); } }
Example 7
Source File: MapCreator.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
/** * Compute property flags given local state of a field. May be overridden and extended, * * @param symbol symbol to check * @param hasArguments does the created object have an "arguments" property * * @return flags to use for fields */ static int getPropertyFlags(final Symbol symbol, final boolean hasArguments, final boolean evalCode, final boolean dualFields) { int flags = 0; if (symbol.isParam()) { flags |= Property.IS_PARAMETER; } if (hasArguments) { flags |= Property.HAS_ARGUMENTS; } // See ECMA 5.1 10.5 Declaration Binding Instantiation. // Step 2 If code is eval code, then let configurableBindings // be true else let configurableBindings be false. // We have to make vars, functions declared in 'eval' code // configurable. But vars, functions from any other code is // not configurable. if (symbol.isScope() && !evalCode) { flags |= Property.NOT_CONFIGURABLE; } if (symbol.isFunctionDeclaration()) { flags |= Property.IS_FUNCTION_DECLARATION; } if (symbol.isConst()) { flags |= Property.NOT_WRITABLE; } if (symbol.isBlockScoped()) { flags |= Property.IS_LEXICAL_BINDING; } // Mark symbol as needing declaration. Access before declaration will throw a ReferenceError. if (symbol.isBlockScoped() && symbol.isScope()) { flags |= Property.NEEDS_DECLARATION; } if (dualFields) { flags |= Property.DUAL_FIELDS; } return flags; }
Example 8
Source File: AssignSymbols.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
/** * If the symbol isn't already a scope symbol, but it needs to be (see {@link #symbolNeedsToBeScope(Symbol)}, it is * promoted to a scope symbol and its block marked as needing a scope. * @param symbol the symbol that might be scoped */ private void maybeForceScope(final Symbol symbol) { if (!symbol.isScope() && symbolNeedsToBeScope(symbol)) { Symbol.setSymbolIsScope(lc, symbol); } }
Example 9
Source File: Attr.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * If the symbol isn't already a scope symbol, and it is either not local to the current function, or it is being * referenced from within a with block, we force it to be a scope symbol. * @param symbol the symbol that might be scoped */ private void maybeForceScope(final Symbol symbol) { if (!symbol.isScope() && symbolNeedsToBeScope(symbol)) { Symbol.setSymbolIsScope(lc, symbol); } }
Example 10
Source File: Attr.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * If the symbol isn't already a scope symbol, and it is either not local to the current function, or it is being * referenced from within a with block, we force it to be a scope symbol. * @param symbol the symbol that might be scoped */ private void maybeForceScope(final Symbol symbol) { if (!symbol.isScope() && symbolNeedsToBeScope(symbol)) { Symbol.setSymbolIsScope(lc, symbol); } }
Example 11
Source File: MapCreator.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Compute property flags given local state of a field. May be overridden and extended, * * @param symbol symbol to check * @param hasArguments does the created object have an "arguments" property * * @return flags to use for fields */ static int getPropertyFlags(final Symbol symbol, final boolean hasArguments, final boolean evalCode, final boolean dualFields) { int flags = 0; if (symbol.isParam()) { flags |= Property.IS_PARAMETER; } if (hasArguments) { flags |= Property.HAS_ARGUMENTS; } // See ECMA 5.1 10.5 Declaration Binding Instantiation. // Step 2 If code is eval code, then let configurableBindings // be true else let configurableBindings be false. // We have to make vars, functions declared in 'eval' code // configurable. But vars, functions from any other code is // not configurable. if (symbol.isScope() && !evalCode) { flags |= Property.NOT_CONFIGURABLE; } if (symbol.isFunctionDeclaration()) { flags |= Property.IS_FUNCTION_DECLARATION; } if (symbol.isConst()) { flags |= Property.NOT_WRITABLE; } if (symbol.isBlockScoped()) { flags |= Property.IS_LEXICAL_BINDING; } // Mark symbol as needing declaration. Access before declaration will throw a ReferenceError. if (symbol.isBlockScoped() && symbol.isScope()) { flags |= Property.NEEDS_DECLARATION; } if (dualFields) { flags |= Property.DUAL_FIELDS; } return flags; }
Example 12
Source File: AssignSymbols.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * If the symbol isn't already a scope symbol, but it needs to be (see {@link #symbolNeedsToBeScope(Symbol)}, it is * promoted to a scope symbol and its block marked as needing a scope. * @param symbol the symbol that might be scoped */ private void maybeForceScope(final Symbol symbol) { if (!symbol.isScope() && symbolNeedsToBeScope(symbol)) { Symbol.setSymbolIsScope(lc, symbol); } }
Example 13
Source File: MapCreator.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Compute property flags given local state of a field. May be overridden and extended, * * @param symbol symbol to check * @param hasArguments does the created object have an "arguments" property * * @return flags to use for fields */ static int getPropertyFlags(final Symbol symbol, final boolean hasArguments, final boolean evalCode, final boolean dualFields) { int flags = 0; if (symbol.isParam()) { flags |= Property.IS_PARAMETER; } if (hasArguments) { flags |= Property.HAS_ARGUMENTS; } // See ECMA 5.1 10.5 Declaration Binding Instantiation. // Step 2 If code is eval code, then let configurableBindings // be true else let configurableBindings be false. // We have to make vars, functions declared in 'eval' code // configurable. But vars, functions from any other code is // not configurable. if (symbol.isScope() && !evalCode) { flags |= Property.NOT_CONFIGURABLE; } if (symbol.isFunctionDeclaration()) { flags |= Property.IS_FUNCTION_DECLARATION; } if (symbol.isConst()) { flags |= Property.NOT_WRITABLE; } if (symbol.isBlockScoped()) { flags |= Property.IS_LEXICAL_BINDING; } // Mark symbol as needing declaration. Access before declaration will throw a ReferenceError. if (symbol.isBlockScoped() && symbol.isScope()) { flags |= Property.NEEDS_DECLARATION; } if (dualFields) { flags |= Property.DUAL_FIELDS; } return flags; }
Example 14
Source File: AssignSymbols.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * If the symbol isn't already a scope symbol, but it needs to be (see {@link #symbolNeedsToBeScope(Symbol)}, it is * promoted to a scope symbol and its block marked as needing a scope. * @param symbol the symbol that might be scoped */ private void maybeForceScope(final Symbol symbol) { if (!symbol.isScope() && symbolNeedsToBeScope(symbol)) { Symbol.setSymbolIsScope(lc, symbol); } }
Example 15
Source File: MapCreator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Compute property flags given local state of a field. May be overridden and extended, * * @param symbol symbol to check * @param hasArguments does the created object have an "arguments" property * * @return flags to use for fields */ static int getPropertyFlags(final Symbol symbol, final boolean hasArguments, final boolean evalCode, final boolean dualFields) { int flags = 0; if (symbol.isParam()) { flags |= Property.IS_PARAMETER; } if (hasArguments) { flags |= Property.HAS_ARGUMENTS; } // See ECMA 5.1 10.5 Declaration Binding Instantiation. // Step 2 If code is eval code, then let configurableBindings // be true else let configurableBindings be false. // We have to make vars, functions declared in 'eval' code // configurable. But vars, functions from any other code is // not configurable. if (symbol.isScope() && !evalCode) { flags |= Property.NOT_CONFIGURABLE; } if (symbol.isFunctionDeclaration()) { flags |= Property.IS_FUNCTION_DECLARATION; } if (symbol.isConst()) { flags |= Property.NOT_WRITABLE; } if (symbol.isBlockScoped()) { flags |= Property.IS_LEXICAL_BINDING; } // Mark symbol as needing declaration. Access before declaration will throw a ReferenceError. if (symbol.isBlockScoped() && symbol.isScope()) { flags |= Property.NEEDS_DECLARATION; } if (dualFields) { flags |= Property.DUAL_FIELDS; } return flags; }
Example 16
Source File: AssignSymbols.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * If the symbol isn't already a scope symbol, but it needs to be (see {@link #symbolNeedsToBeScope(Symbol)}, it is * promoted to a scope symbol and its block marked as needing a scope. * @param symbol the symbol that might be scoped */ private void maybeForceScope(final Symbol symbol) { if (!symbol.isScope() && symbolNeedsToBeScope(symbol)) { Symbol.setSymbolIsScope(lc, symbol); } }
Example 17
Source File: MapCreator.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Compute property flags given local state of a field. May be overridden and extended, * * @param symbol symbol to check * @param hasArguments does the created object have an "arguments" property * * @return flags to use for fields */ static int getPropertyFlags(final Symbol symbol, final boolean hasArguments, final boolean evalCode, final boolean dualFields) { int flags = 0; if (symbol.isParam()) { flags |= Property.IS_PARAMETER; } if (hasArguments) { flags |= Property.HAS_ARGUMENTS; } // See ECMA 5.1 10.5 Declaration Binding Instantiation. // Step 2 If code is eval code, then let configurableBindings // be true else let configurableBindings be false. // We have to make vars, functions declared in 'eval' code // configurable. But vars, functions from any other code is // not configurable. if (symbol.isScope() && !evalCode) { flags |= Property.NOT_CONFIGURABLE; } if (symbol.isFunctionDeclaration()) { flags |= Property.IS_FUNCTION_DECLARATION; } if (symbol.isConst()) { flags |= Property.NOT_WRITABLE; } if (symbol.isBlockScoped()) { flags |= Property.IS_LEXICAL_BINDING; } // Mark symbol as needing declaration. Access before declaration will throw a ReferenceError. if (symbol.isBlockScoped() && symbol.isScope()) { flags |= Property.NEEDS_DECLARATION; } if (dualFields) { flags |= Property.DUAL_FIELDS; } return flags; }
Example 18
Source File: AssignSymbols.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * If the symbol isn't already a scope symbol, but it needs to be (see {@link #symbolNeedsToBeScope(Symbol)}, it is * promoted to a scope symbol and its block marked as needing a scope. * @param symbol the symbol that might be scoped */ private void maybeForceScope(final Symbol symbol) { if (!symbol.isScope() && symbolNeedsToBeScope(symbol)) { Symbol.setSymbolIsScope(lc, symbol); } }
Example 19
Source File: AssignSymbols.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * If the symbol isn't already a scope symbol, but it needs to be (see {@link #symbolNeedsToBeScope(Symbol)}, it is * promoted to a scope symbol and its block marked as needing a scope. * @param symbol the symbol that might be scoped */ private void maybeForceScope(final Symbol symbol) { if (!symbol.isScope() && symbolNeedsToBeScope(symbol)) { Symbol.setSymbolIsScope(lc, symbol); } }
Example 20
Source File: Attr.java From nashorn with GNU General Public License v2.0 | 4 votes |
/** * If the symbol isn't already a scope symbol, and it is either not local to the current function, or it is being * referenced from within a with block, we force it to be a scope symbol. * @param symbol the symbol that might be scoped */ private void maybeForceScope(final Symbol symbol) { if (!symbol.isScope() && symbolNeedsToBeScope(symbol)) { Symbol.setSymbolIsScope(lc, symbol); } }