本文整理汇总了Java中jdk.nashorn.internal.ir.WithNode类的典型用法代码示例。如果您正苦于以下问题:Java WithNode类的具体用法?Java WithNode怎么用?Java WithNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WithNode类属于jdk.nashorn.internal.ir包,在下文中一共展示了WithNode类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enterWithNode
import jdk.nashorn.internal.ir.WithNode; //导入依赖的package包/类
@Override
public boolean enterWithNode(final WithNode withNode) {
enterDefault(withNode);
type("WithStatement");
comma();
property("object");
withNode.getExpression().accept(this);
comma();
property("body");
withNode.getBody().accept(this);
return leave();
}
示例2: withStatement
import jdk.nashorn.internal.ir.WithNode; //导入依赖的package包/类
/**
* WithStatement :
* with ( Expression ) Statement
*
* See 12.10
*
* Parse WITH statement.
*/
private void withStatement() {
// Capture WITH token.
final int withLine = line;
final long withToken = token;
// WITH tested in caller.
next();
// ECMA 12.10.1 strict mode restrictions
if (isStrictMode) {
throw error(AbstractParser.message("strict.no.with"), withToken);
}
expect(LPAREN);
final Expression expression = expression();
expect(RPAREN);
final Block body = getStatement();
appendStatement(new WithNode(withLine, withToken, finish, expression, body));
}
示例3: withStatement
import jdk.nashorn.internal.ir.WithNode; //导入依赖的package包/类
/**
* WithStatement :
* with ( Expression ) Statement
*
* See 12.10
*
* Parse WITH statement.
*/
private void withStatement() {
// Capture WITH token.
final int withLine = line;
final long withToken = token;
// WITH tested in caller.
next();
// ECMA 12.10.1 strict mode restrictions
if (isStrictMode) {
throw error(AbstractParser.message("strict.no.with"), withToken);
}
// Get WITH expression.
WithNode withNode = new WithNode(withLine, withToken, finish);
try {
lc.push(withNode);
expect(LPAREN);
withNode = withNode.setExpression(lc, expression());
expect(RPAREN);
withNode = withNode.setBody(lc, getStatement());
} finally {
lc.pop(withNode);
}
appendStatement(withNode);
}
示例4: enterWithNode
import jdk.nashorn.internal.ir.WithNode; //导入依赖的package包/类
@Override
public boolean enterWithNode(final WithNode withNode) {
withNode.toString(sb, printTypes);
withNode.getBody().accept(this);
return false;
}
示例5: symbolNeedsToBeScope
import jdk.nashorn.internal.ir.WithNode; //导入依赖的package包/类
/**
* Determines if the symbol has to be a scope symbol. In general terms, it has to be a scope symbol if it can only
* be reached from the current block by traversing a function node, a split node, or a with node.
* @param symbol the symbol checked for needing to be a scope symbol
* @return true if the symbol has to be a scope symbol.
*/
private boolean symbolNeedsToBeScope(final Symbol symbol) {
if (symbol.isThis() || symbol.isInternal()) {
return false;
}
final FunctionNode func = lc.getCurrentFunction();
if ( func.allVarsInScope() || (!symbol.isBlockScoped() && func.isProgram())) {
return true;
}
boolean previousWasBlock = false;
for (final Iterator<LexicalContextNode> it = lc.getAllNodes(); it.hasNext();) {
final LexicalContextNode node = it.next();
if (node instanceof FunctionNode || isSplitArray(node)) {
// We reached the function boundary or a splitting boundary without seeing a definition for the symbol.
// It needs to be in scope.
return true;
} else if (node instanceof WithNode) {
if (previousWasBlock) {
// We reached a WithNode; the symbol must be scoped. Note that if the WithNode was not immediately
// preceded by a block, this means we're currently processing its expression, not its body,
// therefore it doesn't count.
return true;
}
previousWasBlock = false;
} else if (node instanceof Block) {
if (((Block)node).getExistingSymbol(symbol.getName()) == symbol) {
// We reached the block that defines the symbol without reaching either the function boundary, or a
// WithNode. The symbol need not be scoped.
return false;
}
previousWasBlock = true;
} else {
previousWasBlock = false;
}
}
throw new AssertionError();
}
示例6: enterWithNode
import jdk.nashorn.internal.ir.WithNode; //导入依赖的package包/类
@Override
public boolean enterWithNode(final WithNode withNode) {
curStat = new WithTreeImpl(withNode,
translateExpr(withNode.getExpression()),
translateBlock(withNode.getBody()));
return false;
}
示例7: symbolNeedsToBeScope
import jdk.nashorn.internal.ir.WithNode; //导入依赖的package包/类
/**
* Determines if the symbol has to be a scope symbol. In general terms, it has to be a scope symbol if it can only
* be reached from the current block by traversing a function node, a split node, or a with node.
* @param symbol the symbol checked for needing to be a scope symbol
* @return true if the symbol has to be a scope symbol.
*/
private boolean symbolNeedsToBeScope(final Symbol symbol) {
if (symbol.isThis() || symbol.isInternal()) {
return false;
}
final FunctionNode func = lc.getCurrentFunction();
if ( func.allVarsInScope() || (!symbol.isBlockScoped() && func.isProgram())) {
return true;
}
boolean previousWasBlock = false;
for (final Iterator<LexicalContextNode> it = lc.getAllNodes(); it.hasNext();) {
final LexicalContextNode node = it.next();
if (node instanceof FunctionNode || isSplitLiteral(node)) {
// We reached the function boundary or a splitting boundary without seeing a definition for the symbol.
// It needs to be in scope.
return true;
} else if (node instanceof WithNode) {
if (previousWasBlock) {
// We reached a WithNode; the symbol must be scoped. Note that if the WithNode was not immediately
// preceded by a block, this means we're currently processing its expression, not its body,
// therefore it doesn't count.
return true;
}
previousWasBlock = false;
} else if (node instanceof Block) {
if (((Block)node).getExistingSymbol(symbol.getName()) == symbol) {
// We reached the block that defines the symbol without reaching either the function boundary, or a
// WithNode. The symbol need not be scoped.
return false;
}
previousWasBlock = true;
} else {
previousWasBlock = false;
}
}
throw new AssertionError();
}
示例8: enterWithNode
import jdk.nashorn.internal.ir.WithNode; //导入依赖的package包/类
@Override
public boolean enterWithNode(final WithNode withNode) {
if (reachable) {
visitExpression(withNode.getExpression());
withNode.getBody().accept(this);
}
return false;
}
示例9: symbolNeedsToBeScope
import jdk.nashorn.internal.ir.WithNode; //导入依赖的package包/类
/**
* Determines if the symbol has to be a scope symbol. In general terms, it
* has to be a scope symbol if it can only be reached from the current block
* by traversing a function node, a split node, or a with node.
*
* @param symbol the symbol checked for needing to be a scope symbol
* @return true if the symbol has to be a scope symbol.
*/
private boolean symbolNeedsToBeScope(final Symbol symbol) {
if (symbol.isThis() || symbol.isInternal()) {
return false;
}
final FunctionNode func = lc.getCurrentFunction();
if (func.allVarsInScope() || (!symbol.isBlockScoped() && func.isProgram())) {
return true;
}
boolean previousWasBlock = false;
for (final Iterator<LexicalContextNode> it = lc.getAllNodes(); it.hasNext();) {
final LexicalContextNode node = it.next();
if (node instanceof FunctionNode || isSplitLiteral(node)) {
// We reached the function boundary or a splitting boundary without seeing a definition for the symbol.
// It needs to be in scope.
return true;
} else if (node instanceof WithNode) {
if (previousWasBlock) {
// We reached a WithNode; the symbol must be scoped. Note that if the WithNode was not immediately
// preceded by a block, this means we're currently processing its expression, not its body,
// therefore it doesn't count.
return true;
}
previousWasBlock = false;
} else if (node instanceof Block) {
if (((Block) node).getExistingSymbol(symbol.getName()) == symbol) {
// We reached the block that defines the symbol without reaching either the function boundary, or a
// WithNode. The symbol need not be scoped.
return false;
}
previousWasBlock = true;
} else {
previousWasBlock = false;
}
}
throw new AssertionError();
}