use of org.eclipse.xtend.core.xtend.RichStringForLoop in project xtext-xtend by eclipse.
the class ParserTest method testRichStringFOR_03.
@Test
public void testRichStringFOR_03() throws Exception {
XtendFunction function = function("def withForLoop(String it) '''�it��val it = 1..10��FOR i: it SEPARATOR it��ENDFOR�'''");
final RichString richString = (RichString) function.getExpression();
assertTrue(richString.getExpressions().get(0) instanceof RichStringLiteral);
assertTrue(richString.getExpressions().get(1) instanceof XFeatureCall);
JvmOperation operation = associations.getDirectlyInferredOperation(function);
assertSame(operation.getParameters().get(0), ((XAbstractFeatureCall) richString.getExpressions().get(1)).getFeature());
assertTrue(richString.getExpressions().get(2) instanceof RichStringLiteral);
assertTrue(richString.getExpressions().get(3) instanceof XVariableDeclaration);
assertTrue(richString.getExpressions().get(4) instanceof RichStringLiteral);
assertTrue(richString.getExpressions().get(5) instanceof RichStringForLoop);
final RichStringForLoop rsFor = (RichStringForLoop) richString.getExpressions().get(5);
assertTrue(rsFor.getForExpression() instanceof XFeatureCall);
assertSame(richString.getExpressions().get(3), ((XAbstractFeatureCall) rsFor.getForExpression()).getFeature());
assertEquals("i", rsFor.getDeclaredParam().getName());
assertTrue(rsFor.getSeparator() instanceof XFeatureCall);
assertSame(richString.getExpressions().get(3), ((XAbstractFeatureCall) rsFor.getSeparator()).getFeature());
}
use of org.eclipse.xtend.core.xtend.RichStringForLoop in project xtext-xtend by eclipse.
the class ForLoopStartImpl method setLoop.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLoop(RichStringForLoop newLoop) {
RichStringForLoop oldLoop = loop;
loop = newLoop;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProcessedRichStringPackage.FOR_LOOP_START__LOOP, oldLoop, loop));
}
use of org.eclipse.xtend.core.xtend.RichStringForLoop in project xtext-xtend by eclipse.
the class ParserTest method testRichStringFOR_01.
@Test
public void testRichStringFOR_01() throws Exception {
XtendFunction function = function("def withForLoop() '''�FOR i: 1..10��i��ENDFOR�'''");
final RichString richString = (RichString) function.getExpression();
final RichStringForLoop rsFor = (RichStringForLoop) richString.getExpressions().get(1);
assertTrue(rsFor.getForExpression() instanceof XBinaryOperation);
assertEquals("i", rsFor.getDeclaredParam().getName());
RichString eachRichString = (RichString) rsFor.getEachExpression();
assertEquals(3, eachRichString.getExpressions().size());
XExpression variableReference = eachRichString.getExpressions().get(1);
assertTrue(variableReference instanceof XFeatureCall);
assertSame(rsFor.getDeclaredParam(), ((XAbstractFeatureCall) variableReference).getFeature());
}
use of org.eclipse.xtend.core.xtend.RichStringForLoop in project xtext-xtend by eclipse.
the class ParserTest method testRichStringFOR_02.
@Test
public void testRichStringFOR_02() throws Exception {
XtendFunction function = function("def withForLoop() '''�FOR i: 1..10 BEFORE 'a' SEPARATOR '\t' AFTER i��ENDFOR�'''");
final RichString richString = (RichString) function.getExpression();
final RichStringForLoop rsFor = (RichStringForLoop) richString.getExpressions().get(1);
assertTrue(rsFor.getForExpression() instanceof XBinaryOperation);
assertEquals("i", rsFor.getDeclaredParam().getName());
assertTrue(rsFor.getSeparator() instanceof XStringLiteral);
assertTrue(rsFor.getBefore() instanceof XStringLiteral);
assertTrue(rsFor.getAfter() instanceof XFeatureCall);
assertTrue(((XAbstractFeatureCall) rsFor.getAfter()).getFeature().eIsProxy());
}
Aggregations