use of org.eclipse.n4js.n4JS.Statement in project n4js by eclipse.
the class AbstractCaseClauseFactory method buildComplexNode.
static ComplexNode buildComplexNode(ReentrantASTIterator astpp, AbstractCaseClause abstrCaseClause) {
ComplexNode cNode = new ComplexNode(astpp.container(), abstrCaseClause);
Node entryNode = new HelperNode(NodeNames.ENTRY, astpp.pos(), abstrCaseClause);
List<Node> stmtNodes = new LinkedList<>();
Node caseConditionNode = null;
if (abstrCaseClause instanceof CaseClause) {
CaseClause caseClause = (CaseClause) abstrCaseClause;
caseConditionNode = DelegatingNodeFactory.create(astpp, NodeNames.CONDITION, caseClause, caseClause.getExpression());
}
EList<Statement> stmts = abstrCaseClause.getStatements();
for (int i = 0; i < stmts.size(); i++) {
Statement stmt = stmts.get(i);
Node blockNode = new DelegatingNode("stmt_" + i, astpp.pos(), abstrCaseClause, stmt);
stmtNodes.add(blockNode);
astpp.visitUtil(blockNode.getDelegatedControlFlowElement());
}
Node exitNode = new HelperNode(NodeNames.EXIT, astpp.pos(), abstrCaseClause);
cNode.addNode(entryNode);
cNode.addNode(caseConditionNode);
for (Node blockNode : stmtNodes) cNode.addNode(blockNode);
cNode.addNode(exitNode);
List<Node> nodes = new LinkedList<>();
nodes.add(entryNode);
nodes.add(caseConditionNode);
nodes.addAll(stmtNodes);
nodes.add(exitNode);
cNode.connectInternalSucc(nodes);
cNode.setEntryNode(entryNode);
cNode.setExitNode(exitNode);
return cNode;
}
use of org.eclipse.n4js.n4JS.Statement in project n4js by eclipse.
the class BlockFactory method buildComplexNode.
static ComplexNode buildComplexNode(ReentrantASTIterator astpp, org.eclipse.n4js.n4JS.Block block) {
ComplexNode cNode = new ComplexNode(astpp.container(), block);
Node entryNode = new HelperNode(NodeNames.ENTRY, astpp.pos(), block);
List<Node> blockNodes = new LinkedList<>();
EList<Statement> stmts = block.getStatements();
for (int i = 0; i < stmts.size(); i++) {
Statement stmt = stmts.get(i);
Node blockNode = DelegatingNodeFactory.create(astpp, "stmt_" + i, block, stmt);
blockNodes.add(blockNode);
}
Node exitNode = new HelperNode(NodeNames.EXIT, astpp.pos(), block);
cNode.addNode(entryNode);
for (Node blockNode : blockNodes) cNode.addNode(blockNode);
cNode.addNode(exitNode);
List<Node> nodes = new LinkedList<>();
nodes.add(entryNode);
nodes.addAll(blockNodes);
nodes.add(exitNode);
cNode.connectInternalSucc(nodes);
cNode.setEntryNode(entryNode);
cNode.setExitNode(exitNode);
if (FGUtils.isCFContainer(block)) {
exitNode.addCatchToken(new CatchToken(ControlFlowType.CatchesAll));
} else {
LabelledStatement lblStmt = ASTUtils.getLabelledStatement(block);
if (lblStmt != null) {
exitNode.addCatchToken(new CatchToken(ControlFlowType.Break, lblStmt));
}
}
return cNode;
}
use of org.eclipse.n4js.n4JS.Statement in project n4js by eclipse.
the class PropertyMethodDeclarationImpl 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;
}
use of org.eclipse.n4js.n4JS.Statement in project n4js by eclipse.
the class N4MethodDeclarationImpl 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;
}
use of org.eclipse.n4js.n4JS.Statement in project n4js by eclipse.
the class ArrowFunctionImpl method implicitReturnExpr.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression implicitReturnExpr() {
Expression _xifexpression = null;
boolean _isSingleExprImplicitReturn = this.isSingleExprImplicitReturn();
if (_isSingleExprImplicitReturn) {
Statement _get = this.getBody().getStatements().get(0);
_xifexpression = ((ExpressionStatement) _get).getExpression();
} else {
_xifexpression = null;
}
return _xifexpression;
}
Aggregations