Search in sources :

Example 36 with IFeatureCallArguments

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

the class ReorderedVarArgFeatureCallArgumentsTest method test_08.

@Test
public void test_08() {
    final IFeatureCallArguments arguments = this.toArgumentsWithoutReceiver("String s, int i, long j, boolean k", "[], 1, [], 1, [], 1");
    this.withTypes(arguments, "int", "boolean", "String", "long");
}
Also used : IFeatureCallArguments(org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments) Test(org.junit.Test)

Example 37 with IFeatureCallArguments

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

the class ReorderedVarArgFeatureCallArgumentsTest method test_04.

@Test
public void test_04() {
    final IFeatureCallArguments arguments = this.toArgumentsWithoutReceiver("String s, int i, int j, int k, int l, int m", "[], 1, [], 1, []");
    this.withIndizes(arguments, 1, 3, 0, 2, 4);
}
Also used : IFeatureCallArguments(org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments) Test(org.junit.Test)

Example 38 with IFeatureCallArguments

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

the class ReorderedVarArgFeatureCallArgumentsTest method test_05.

@Test
public void test_05() {
    final IFeatureCallArguments arguments = this.toArgumentsWithoutReceiver("String s, int i, int j, int k", "[], 1, [], 1, [], 1");
    this.withIndizes(arguments, 1, 3, 0, 2);
}
Also used : IFeatureCallArguments(org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments) Test(org.junit.Test)

Example 39 with IFeatureCallArguments

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

the class ReorderedVarArgFeatureCallArgumentsTest method test_01.

@Test
public void test_01() {
    final IFeatureCallArguments arguments = this.toArgumentsWithoutReceiver("String s, int i", "[], 1");
    Assert.assertEquals(2, arguments.getArgumentCount());
    Assert.assertTrue(arguments.hasUnprocessedArguments());
    final IFeatureCallArgumentSlot firstSlot = arguments.getNextUnprocessedArgumentSlot();
    Assert.assertTrue(firstSlot.isVarArg());
    Assert.assertFalse(firstSlot.isSuperfluous());
    XExpression _argumentExpression = firstSlot.getArgumentExpression();
    Assert.assertTrue((_argumentExpression instanceof XNumberLiteral));
    Assert.assertEquals("int", firstSlot.getDeclaredType().getSimpleName());
    Assert.assertFalse(arguments.isProcessed(0));
    firstSlot.markProcessed();
    Assert.assertTrue(arguments.isProcessed(0));
    Assert.assertTrue(arguments.hasUnprocessedArguments());
    final IFeatureCallArgumentSlot secondSlot = arguments.getNextUnprocessedArgumentSlot();
    Assert.assertFalse(secondSlot.isVarArg());
    Assert.assertFalse(secondSlot.isSuperfluous());
    XExpression _argumentExpression_1 = secondSlot.getArgumentExpression();
    Assert.assertTrue((_argumentExpression_1 instanceof XClosure));
    Assert.assertEquals("String", secondSlot.getDeclaredType().getSimpleName());
    Assert.assertFalse(arguments.isProcessed(1));
    secondSlot.markProcessed();
    Assert.assertTrue(arguments.isProcessed(1));
    Assert.assertFalse(arguments.hasUnprocessedArguments());
}
Also used : XClosure(org.eclipse.xtext.xbase.XClosure) 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)

Example 40 with IFeatureCallArguments

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

the class ReorderedVarArgFeatureCallArgumentsTest method test_09.

@Test
public void test_09() {
    final IFeatureCallArguments arguments = this.toArgumentsWithoutReceiver("String s, int i, long j", "[], 1, [], 1, [], 1");
    this.withTypes(arguments, "int", "long", "String");
}
Also used : IFeatureCallArguments(org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments) Test(org.junit.Test)

Aggregations

IFeatureCallArguments (org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments)53 Test (org.junit.Test)49 XExpression (org.eclipse.xtext.xbase.XExpression)28 XNumberLiteral (org.eclipse.xtext.xbase.XNumberLiteral)21 XStringLiteral (org.eclipse.xtext.xbase.XStringLiteral)16 IFeatureCallArgumentSlot (org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArgumentSlot)14 LightweightTypeReference (org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference)10 XClosure (org.eclipse.xtext.xbase.XClosure)8 XBlockExpression (org.eclipse.xtext.xbase.XBlockExpression)6 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)4 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)4 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)4 XFeatureCall (org.eclipse.xtext.xbase.XFeatureCall)4 XBooleanLiteral (org.eclipse.xtext.xbase.XBooleanLiteral)3