本文整理汇总了Java中jdk.nashorn.internal.ir.ExpressionStatement类的典型用法代码示例。如果您正苦于以下问题:Java ExpressionStatement类的具体用法?Java ExpressionStatement怎么用?Java ExpressionStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpressionStatement类属于jdk.nashorn.internal.ir包,在下文中一共展示了ExpressionStatement类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getDirective
import jdk.nashorn.internal.ir.ExpressionStatement; //导入依赖的package包/类
/**
* Directive value or null if statement is not a directive.
*
* @param stmt Statement to be checked
* @return Directive value if the given statement is a directive
*/
private String getDirective(final Node stmt) {
if (stmt instanceof ExpressionStatement) {
final Node expr = ((ExpressionStatement)stmt).getExpression();
if (expr instanceof LiteralNode) {
final LiteralNode<?> lit = (LiteralNode<?>)expr;
final long litToken = lit.getToken();
final TokenType tt = Token.descType(litToken);
// A directive is either a string or an escape string
if (tt == TokenType.STRING || tt == TokenType.ESCSTRING) {
// Make sure that we don't unescape anything. Return as seen in source!
return source.getString(lit.getStart(), Token.descLength(litToken));
}
}
}
return null;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:Parser.java
示例2: enterExpressionStatement
import jdk.nashorn.internal.ir.ExpressionStatement; //导入依赖的package包/类
@Override
public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
// handle debugger statement
final Node expression = expressionStatement.getExpression();
if (expression instanceof RuntimeNode) {
expression.accept(this);
return false;
}
enterDefault(expressionStatement);
type("ExpressionStatement");
comma();
property("expression");
expression.accept(this);
return leave();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:JSONWriter.java
示例3: leaveExpressionStatement
import jdk.nashorn.internal.ir.ExpressionStatement; //导入依赖的package包/类
@Override
public Node leaveExpressionStatement(final ExpressionStatement expressionStatement) {
final Expression expr = expressionStatement.getExpression();
ExpressionStatement node = expressionStatement;
final FunctionNode currentFunction = lc.getCurrentFunction();
if (currentFunction.isProgram()) {
if (!isInternalExpression(expr) && !isEvalResultAssignment(expr)) {
node = expressionStatement.setExpression(
new BinaryNode(
Token.recast(
expressionStatement.getToken(),
TokenType.ASSIGN),
compilerConstant(RETURN),
expr));
}
}
return addStatement(node);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:Lower.java
示例4: leaveBlock
import jdk.nashorn.internal.ir.ExpressionStatement; //导入依赖的package包/类
@Override
public Node leaveBlock(final Block block) {
if (!artificialBlock) {
if (lc.isFunctionBody()) {
// Prepend declaration-only var statements to the top of the statement list.
lc.prependStatements(getCurrentFunctionState().varStatements);
} else if (lc.isSplitBody()) {
appendSplitReturn(FALLTHROUGH_STATE, NO_LINE_NUMBER);
if (getCurrentFunctionState().fn.isProgram()) {
// If we're splitting the program, make sure every shard ends with "return :return" and
// begins with ":return = :return-in;".
lc.prependStatement(new ExpressionStatement(NO_LINE_NUMBER, NO_TOKEN, NO_FINISH,
new BinaryNode(Token.toDesc(TokenType.ASSIGN, 0, 0), createReturnIdent(), createReturnParamIdent())));
}
}
}
return block;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:SplitIntoFunctions.java
示例5: enterExpressionStatement
import jdk.nashorn.internal.ir.ExpressionStatement; //导入依赖的package包/类
@Override
public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
// handle debugger statement
final Node expression = expressionStatement.getExpression();
if (expression instanceof RuntimeNode) {
assert false : "should not reach here: RuntimeNode";
return false;
}
enterDefault(expressionStatement);
type("ExpressionStatement");
comma();
property("expression");
expression.accept(this);
return leave();
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:JSONWriter.java
示例6: leaveExpressionStatement
import jdk.nashorn.internal.ir.ExpressionStatement; //导入依赖的package包/类
@Override
public Node leaveExpressionStatement(final ExpressionStatement expressionStatement) {
final Expression expr = expressionStatement.getExpression();
ExpressionStatement node = expressionStatement;
final FunctionNode currentFunction = lc.getCurrentFunction();
if (currentFunction.isProgram()) {
if (!isInternalExpression(expr) && !isEvalResultAssignment(expr)) {
node = expressionStatement.setExpression(
new BinaryNode(
Token.recast(
expressionStatement.getToken(),
TokenType.ASSIGN),
compilerConstant(RETURN),
expr));
}
}
if (es6 && expressionStatement.destructuringDeclarationType() != null) {
throwNotImplementedYet("es6.destructuring", expressionStatement);
}
return addStatement(node);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:Lower.java
示例7: debuggerStatement
import jdk.nashorn.internal.ir.ExpressionStatement; //导入依赖的package包/类
/**
* DebuggerStatement :
* debugger ;
*
* See 12.15
*
* Parse debugger statement.
*/
private void debuggerStatement() {
// Capture DEBUGGER token.
final int debuggerLine = line;
final long debuggerToken = token;
// DEBUGGER tested in caller.
next();
endOfLine();
appendStatement(new ExpressionStatement(debuggerLine, debuggerToken, finish, new RuntimeNode(debuggerToken, finish, RuntimeNode.Request.DEBUGGER, new ArrayList<Expression>())));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:Parser.java
示例8: leaveVarNode
import jdk.nashorn.internal.ir.ExpressionStatement; //导入依赖的package包/类
@Override
public Node leaveVarNode(final VarNode varNode) {
addStatement(varNode);
if (varNode.getFlag(VarNode.IS_LAST_FUNCTION_DECLARATION) && lc.getCurrentFunction().isProgram()) {
new ExpressionStatement(varNode.getLineNumber(), varNode.getToken(), varNode.getFinish(), new IdentNode(varNode.getName())).accept(this);
}
return varNode;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:Lower.java
示例9: enterExpressionStatement
import jdk.nashorn.internal.ir.ExpressionStatement; //导入依赖的package包/类
@Override
public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
final Expression expr = expressionStatement.getExpression();
if(!expr.isSelfModifying()) {
tagNeverOptimistic(expr);
}
return true;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:OptimisticTypesCalculator.java
注:本文中的jdk.nashorn.internal.ir.ExpressionStatement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论