use of org.eclipse.n4js.n4JS.Expression in project n4js by eclipse.
the class SwitchStatementImpl method basicSetExpression.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExpression(Expression newExpression, NotificationChain msgs) {
Expression oldExpression = expression;
expression = newExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, N4JSPackage.SWITCH_STATEMENT__EXPRESSION, oldExpression, newExpression);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.n4js.n4JS.Expression in project n4js by eclipse.
the class AssignmentRelation method toString.
@Override
public String toString() {
String str = "";
str += leftSymbol.toString() + " := ";
int count = 0;
for (Object obj : rhsObjects) {
if (count++ > 0) {
str += " | ";
}
str += (obj instanceof Expression) ? FGUtils.getSourceText((EObject) obj) : obj;
}
return str;
}
use of org.eclipse.n4js.n4JS.Expression in project n4js by eclipse.
the class AssignmentRelationFactory method findInAssignmentExpression.
private void findInAssignmentExpression(Multimap<Symbol, Object> assgns, AssignmentExpression ae) {
Expression lhs = ae.getLhs();
Expression rhs = ae.getRhs();
handleSubexpressions(assgns, lhs, rhs);
}
use of org.eclipse.n4js.n4JS.Expression in project n4js by eclipse.
the class AssignmentRelationFactory method handleSubexpressions.
private void handleSubexpressions(Multimap<Symbol, Object> assgns, ControlFlowElement lhs, Expression rhs) {
rhs = ASTUtils.unwrapParentheses(rhs);
if (rhs instanceof AssignmentExpression) {
AssignmentExpression ae = (AssignmentExpression) rhs;
Expression innerRhs = ae.getRhs();
// The inner assignment is handled already.
handleSubexpressions(assgns, lhs, innerRhs);
} else if (rhs instanceof ConditionalExpression) {
ConditionalExpression ce = (ConditionalExpression) rhs;
Expression trueExpr = ce.getTrueExpression();
Expression falseExpr = ce.getFalseExpression();
handleSubexpressions(assgns, lhs, trueExpr);
handleSubexpressions(assgns, lhs, falseExpr);
} else if (rhs instanceof BinaryLogicalExpression) {
BinaryLogicalExpression ble = (BinaryLogicalExpression) rhs;
if (ble.getOp() == BinaryLogicalOperator.OR) {
handleSubexpressions(assgns, lhs, ble.getLhs());
}
handleSubexpressions(assgns, lhs, ble.getRhs());
} else {
createRelation(assgns, lhs, rhs);
}
}
use of org.eclipse.n4js.n4JS.Expression in project n4js by eclipse.
the class AssignmentRelationFactory method findInCorrespondingDestructNodes.
private void findInCorrespondingDestructNodes(Multimap<Symbol, Object> assgns, ControlFlowElement cfe) {
DestructNode dNode = DestructureUtils.getCorrespondingDestructNode(cfe);
if (dNode == null) {
return;
}
EObject parentOfDestrNode = DestructureUtils.getTop(cfe);
if (parentOfDestrNode instanceof ForStatement) {
ForStatement fs = (ForStatement) parentOfDestrNode;
Expression fsExpr = fs.getExpression();
if (fsExpr instanceof ArrayLiteral) {
ArrayLiteral al = (ArrayLiteral) fsExpr;
EObject rootOfDestrNode = DestructureUtils.getRoot(cfe);
for (ArrayElement arrElem : al.getElements()) {
dNode = DestructNode.unify(rootOfDestrNode, arrElem.getExpression());
findInDestructNodes(assgns, dNode);
}
}
} else {
findInDestructNodes(assgns, dNode);
}
}
Aggregations