本文整理汇总了Java中jdk.nashorn.internal.ir.Block.getToken方法的典型用法代码示例。如果您正苦于以下问题:Java Block.getToken方法的具体用法?Java Block.getToken怎么用?Java Block.getToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.nashorn.internal.ir.Block
的用法示例。
在下文中一共展示了Block.getToken方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleBlock
import jdk.nashorn.internal.ir.Block; //导入方法依赖的package包/类
private boolean handleBlock(final Block block, final boolean sortStats) {
// FIXME: revisit this!
if (block.isSynthetic()) {
final int statCount = block.getStatementCount();
switch (statCount) {
case 0: {
final EmptyNode emptyNode = new EmptyNode(-1, block.getToken(), block.getFinish());
curStat = new EmptyStatementTreeImpl(emptyNode);
return false;
}
case 1: {
curStat = translateStat(block.getStatements().get(0));
return false;
}
default: {
// fall through
break;
}
}
}
final List<? extends Statement> stats = block.getStatements();
curStat = new BlockTreeImpl(block,
translateStats(sortStats? getOrderedStatements(stats) : stats));
return false;
}
示例2: createBlockSplitNode
import jdk.nashorn.internal.ir.Block; //导入方法依赖的package包/类
/**
* Create a new split node from statements contained in a parent block.
*
* @param parent Parent block.
* @param statements Statements to include.
*
* @return New split node.
*/
private SplitNode createBlockSplitNode(final Block parent, final FunctionNode function, final List<Statement> statements, final long weight) {
final long token = parent.getToken();
final int finish = parent.getFinish();
final String name = function.uniqueName(SPLIT_PREFIX.symbolName());
final Block newBlock = new Block(token, finish, statements);
return new SplitNode(name, newBlock, compiler.findUnit(weight + WeighNodes.FUNCTION_WEIGHT));
}
示例3: createFunctionNode
import jdk.nashorn.internal.ir.Block; //导入方法依赖的package包/类
private FunctionNode createFunctionNode(final ParserContextFunctionNode function, final long startToken, final IdentNode ident, final List<IdentNode> parameters, final FunctionNode.Kind kind, final int functionLine, final Block body) {
// assert body.isFunctionBody() || body.getFlag(Block.IS_PARAMETER_BLOCK) && ((BlockStatement) body.getLastStatement()).getBlock().isFunctionBody();
// Start new block.
final FunctionNode functionNode =
new FunctionNode(
source,
functionLine,
body.getToken(),
Token.descPosition(body.getToken()),
startToken,
function.getLastToken(),
namespace,
ident,
function.getName(),
parameters,
function.getParameterExpressions(),
kind,
function.getFlags(),
body,
function.getEndParserState(),
function.getModule(),
function.getDebugFlags());
printAST(functionNode);
return functionNode;
}
示例4: createJumpToInlinedFinally
import jdk.nashorn.internal.ir.Block; //导入方法依赖的package包/类
private static JumpToInlinedFinally createJumpToInlinedFinally(final FunctionNode fn, final List<Block> inlinedFinallies, final Block finallyBlock) {
final String labelName = fn.uniqueName(":finally");
final long token = finallyBlock.getToken();
final int finish = finallyBlock.getFinish();
inlinedFinallies.add(new Block(token, finish, new LabelNode(finallyBlock.getFirstStatementLineNumber(),
token, finish, labelName, finallyBlock)));
return new JumpToInlinedFinally(labelName);
}
示例5: prependFinally
import jdk.nashorn.internal.ir.Block; //导入方法依赖的package包/类
private static Block prependFinally(final Block finallyBlock, final Statement statement) {
final Block inlinedFinally = ensureUniqueNamesIn(finallyBlock);
if (isTerminalFinally(finallyBlock)) {
return inlinedFinally;
}
final List<Statement> stmts = inlinedFinally.getStatements();
final List<Statement> newStmts = new ArrayList<>(stmts.size() + 1);
newStmts.addAll(stmts);
newStmts.add(statement);
return new Block(inlinedFinally.getToken(), statement.getFinish(), newStmts);
}