Java Code Examples for jdk.nashorn.internal.ir.ExpressionStatement#getExpression()

The following examples show how to use jdk.nashorn.internal.ir.ExpressionStatement#getExpression() . 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: Lower.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@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);
}
 
Example 2
Source File: JSONWriter.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example 3
Source File: Lower.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@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);
}
 
Example 4
Source File: JSONWriter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example 5
Source File: Lower.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@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);
}
 
Example 6
Source File: JSONWriter.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example 7
Source File: JSONWriter.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example 8
Source File: Lower.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
@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);
}
 
Example 9
Source File: JSONWriter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example 10
Source File: JSONWriter.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example 11
Source File: Lower.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@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);
}
 
Example 12
Source File: JSONWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example 13
Source File: Lower.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@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);
}
 
Example 14
Source File: JSONWriter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example 15
Source File: Lower.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@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);
}
 
Example 16
Source File: OptimisticTypesCalculator.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
    final Expression expr = expressionStatement.getExpression();
    if(!expr.isSelfModifying()) {
        tagNeverOptimistic(expr);
    }
    return true;
}
 
Example 17
Source File: OptimisticTypesCalculator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
    final Expression expr = expressionStatement.getExpression();
    if(!expr.isSelfModifying()) {
        tagNeverOptimistic(expr);
    }
    return true;
}
 
Example 18
Source File: OptimisticTypesCalculator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
    final Expression expr = expressionStatement.getExpression();
    if(!expr.isSelfModifying()) {
        tagNeverOptimistic(expr);
    }
    return true;
}
 
Example 19
Source File: OptimisticTypesCalculator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
    final Expression expr = expressionStatement.getExpression();
    if(!expr.isSelfModifying()) {
        tagNeverOptimistic(expr);
    }
    return true;
}
 
Example 20
Source File: OptimisticTypesCalculator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
    final Expression expr = expressionStatement.getExpression();
    if(!expr.isSelfModifying()) {
        tagNeverOptimistic(expr);
    }
    return true;
}