Search in sources :

Example 1 with Statement

use of org.eclipse.n4js.n4JS.Statement in project n4js by eclipse.

the class MethodDeclarationImpl method existsExplicitSuperCall.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public boolean existsExplicitSuperCall() {
    final Function1<ExpressionStatement, Expression> _function = new Function1<ExpressionStatement, Expression>() {

        public Expression apply(final ExpressionStatement it) {
            return it.getExpression();
        }
    };
    final Function1<ParameterizedCallExpression, Boolean> _function_1 = new Function1<ParameterizedCallExpression, Boolean>() {

        public Boolean apply(final ParameterizedCallExpression it) {
            Expression _target = it.getTarget();
            return Boolean.valueOf((_target instanceof SuperLiteral));
        }
    };
    final boolean existsSuperCall = IteratorExtensions.<ParameterizedCallExpression>exists(Iterators.<ParameterizedCallExpression>filter(IteratorExtensions.<ExpressionStatement, Expression>map(Iterators.<ExpressionStatement>filter(EcoreUtilN4.<Statement>getAllDirectlyFoundContentsOfType(this.getBody(), Statement.class), ExpressionStatement.class), _function), ParameterizedCallExpression.class), _function_1);
    return existsSuperCall;
}
Also used : Expression(org.eclipse.n4js.n4JS.Expression) ParameterizedCallExpression(org.eclipse.n4js.n4JS.ParameterizedCallExpression) Statement(org.eclipse.n4js.n4JS.Statement) ExpressionStatement(org.eclipse.n4js.n4JS.ExpressionStatement) ExpressionStatement(org.eclipse.n4js.n4JS.ExpressionStatement) Function1(org.eclipse.xtext.xbase.lib.Functions.Function1) ParameterizedCallExpression(org.eclipse.n4js.n4JS.ParameterizedCallExpression) SuperLiteral(org.eclipse.n4js.n4JS.SuperLiteral)

Example 2 with Statement

use of org.eclipse.n4js.n4JS.Statement in project n4js by eclipse.

the class IterationStatementImpl method basicSetStatement.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetStatement(Statement newStatement, NotificationChain msgs) {
    Statement oldStatement = statement;
    statement = newStatement;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, N4JSPackage.ITERATION_STATEMENT__STATEMENT, oldStatement, newStatement);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : Statement(org.eclipse.n4js.n4JS.Statement) IterationStatement(org.eclipse.n4js.n4JS.IterationStatement) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 3 with Statement

use of org.eclipse.n4js.n4JS.Statement in project n4js by eclipse.

the class LabelledStatementImpl method basicSetStatement.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetStatement(Statement newStatement, NotificationChain msgs) {
    Statement oldStatement = statement;
    statement = newStatement;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, N4JSPackage.LABELLED_STATEMENT__STATEMENT, oldStatement, newStatement);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : Statement(org.eclipse.n4js.n4JS.Statement) LabelledStatement(org.eclipse.n4js.n4JS.LabelledStatement) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 4 with Statement

use of org.eclipse.n4js.n4JS.Statement in project n4js by eclipse.

the class IfStatementImpl method basicSetIfStmt.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetIfStmt(Statement newIfStmt, NotificationChain msgs) {
    Statement oldIfStmt = ifStmt;
    ifStmt = newIfStmt;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, N4JSPackage.IF_STATEMENT__IF_STMT, oldIfStmt, newIfStmt);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : Statement(org.eclipse.n4js.n4JS.Statement) IfStatement(org.eclipse.n4js.n4JS.IfStatement) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 5 with Statement

use of org.eclipse.n4js.n4JS.Statement in project n4js by eclipse.

the class GuardFactory method createGuardForTruthy.

private static Guard createGuardForTruthy(EObject topContainer, Expression expr, boolean negateTree) {
    if (SymbolFactory.canCreate(expr)) {
        EObject parent = expr.eContainer();
        boolean isTruthy = false;
        isTruthy |= parent instanceof Statement;
        isTruthy |= parent instanceof ParenExpression;
        isTruthy |= parent instanceof ConditionalExpression;
        isTruthy |= parent instanceof BinaryLogicalExpression;
        isTruthy |= parent instanceof UnaryExpression && ((UnaryExpression) parent).getOp() == UnaryOperator.NOT;
        if (isTruthy) {
            GuardAssertion asserts = FlowAssertionFactory.getGuard(topContainer, expr, negateTree, false);
            Guard guard = createIsTruthyGuard(expr, asserts);
            return guard;
        }
    }
    return null;
}
Also used : BinaryLogicalExpression(org.eclipse.n4js.n4JS.BinaryLogicalExpression) Statement(org.eclipse.n4js.n4JS.Statement) EObject(org.eclipse.emf.ecore.EObject) ConditionalExpression(org.eclipse.n4js.n4JS.ConditionalExpression) ParenExpression(org.eclipse.n4js.n4JS.ParenExpression) UnaryExpression(org.eclipse.n4js.n4JS.UnaryExpression)

Aggregations

Statement (org.eclipse.n4js.n4JS.Statement)16 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)6 ExpressionStatement (org.eclipse.n4js.n4JS.ExpressionStatement)6 Expression (org.eclipse.n4js.n4JS.Expression)4 IfStatement (org.eclipse.n4js.n4JS.IfStatement)4 EObject (org.eclipse.emf.ecore.EObject)3 ForStatement (org.eclipse.n4js.n4JS.ForStatement)3 LabelledStatement (org.eclipse.n4js.n4JS.LabelledStatement)3 ParameterizedCallExpression (org.eclipse.n4js.n4JS.ParameterizedCallExpression)3 SuperLiteral (org.eclipse.n4js.n4JS.SuperLiteral)3 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)3 LinkedList (java.util.LinkedList)2 ComplexNode (org.eclipse.n4js.flowgraphs.model.ComplexNode)2 HelperNode (org.eclipse.n4js.flowgraphs.model.HelperNode)2 Node (org.eclipse.n4js.flowgraphs.model.Node)2 BinaryLogicalExpression (org.eclipse.n4js.n4JS.BinaryLogicalExpression)2 ConditionalExpression (org.eclipse.n4js.n4JS.ConditionalExpression)2 DoStatement (org.eclipse.n4js.n4JS.DoStatement)2 IterationStatement (org.eclipse.n4js.n4JS.IterationStatement)2 ParenExpression (org.eclipse.n4js.n4JS.ParenExpression)2