Search in sources :

Example 16 with IFeatureCallArgumentSlot

use of org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArgumentSlot in project xtext-xtend by eclipse.

the class VarArgFeatureCallArgumentsTest method test_09.

@Test
public void test_09() {
    final IFeatureCallArguments arguments = this.toArgumentsWithoutReceiver("String s", "\"\", 1");
    Assert.assertTrue(arguments.hasUnprocessedArguments());
    Assert.assertEquals(2, arguments.getArgumentCount());
    final IFeatureCallArgumentSlot valid = arguments.getNextUnprocessedArgumentSlot();
    Assert.assertTrue(valid.isVarArg());
    Assert.assertFalse(valid.isSuperfluous());
    final List<XExpression> expressions = valid.getArgumentExpressions();
    Assert.assertEquals(2, expressions.size());
    XExpression _head = IterableExtensions.<XExpression>head(expressions);
    Assert.assertTrue((_head instanceof XStringLiteral));
    XExpression _last = IterableExtensions.<XExpression>last(expressions);
    Assert.assertTrue((_last instanceof XNumberLiteral));
    valid.markProcessed();
    Assert.assertTrue(arguments.isProcessed(0));
    Assert.assertTrue(arguments.isProcessed(1));
    Assert.assertFalse(arguments.hasUnprocessedArguments());
}
Also used : XStringLiteral(org.eclipse.xtext.xbase.XStringLiteral) XExpression(org.eclipse.xtext.xbase.XExpression) XNumberLiteral(org.eclipse.xtext.xbase.XNumberLiteral) IFeatureCallArgumentSlot(org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArgumentSlot) IFeatureCallArguments(org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments) Test(org.junit.Test)

Aggregations

XExpression (org.eclipse.xtext.xbase.XExpression)16 IFeatureCallArgumentSlot (org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArgumentSlot)16 Test (org.junit.Test)16 IFeatureCallArguments (org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments)14 XNumberLiteral (org.eclipse.xtext.xbase.XNumberLiteral)12 XStringLiteral (org.eclipse.xtext.xbase.XStringLiteral)11 XClosure (org.eclipse.xtext.xbase.XClosure)4 AssignmentFeatureCallArguments (org.eclipse.xtext.xbase.typesystem.arguments.AssignmentFeatureCallArguments)2 XNullLiteral (org.eclipse.xtext.xbase.XNullLiteral)1