use of org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments in project xtext-xtend by eclipse.
the class VarArgFeatureCallArgumentsTest method test_11.
@Test
public void test_11() {
final IFeatureCallArguments arguments = this.toArgumentsWithoutReceiver("String s", "");
Assert.assertFalse(arguments.hasUnprocessedArguments());
}
use of org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments in project xtext-xtend by eclipse.
the class ReorderedFeatureCallArgumentsTest 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.assertFalse(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());
}
use of org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments in project xtext-xtend by eclipse.
the class ReorderedFeatureCallArgumentsTest method testBug457779_01.
@Test
public void testBug457779_01() {
final IFeatureCallArguments arguments = this.toArgumentsWithReceiver("String s, int i", "[], 1");
final XExpression first = arguments.getArgument(0);
Assert.assertNull(first);
final LightweightTypeReference firstType = arguments.getDeclaredTypeForLambda(0);
Assert.assertNull(firstType);
final XExpression third = arguments.getArgument(1);
Assert.assertTrue((third instanceof XNumberLiteral));
final LightweightTypeReference thirdType = arguments.getDeclaredTypeForLambda(1);
Assert.assertEquals("int", thirdType.getSimpleName());
final XExpression second = arguments.getArgument(2);
Assert.assertTrue((second instanceof XClosure));
final LightweightTypeReference secondType = arguments.getDeclaredTypeForLambda(2);
Assert.assertEquals("String", secondType.getSimpleName());
try {
arguments.getArgument(3);
Assert.fail("Expected exception");
} catch (final Throwable _t) {
if (_t instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t);
}
}
try {
arguments.getDeclaredTypeForLambda(3);
Assert.fail("Expected exception");
} catch (final Throwable _t_1) {
if (_t_1 instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t_1);
}
}
}
use of org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments in project xtext-xtend by eclipse.
the class ReorderedFeatureCallArgumentsTest method test_07.
@Test
public void test_07() {
final IFeatureCallArguments arguments = this.toArgumentsWithoutReceiver("String s, int i, long j, boolean k, float l, double m", "[], 1, [], 1, []");
this.withTypes(arguments, "int", "boolean", "String", "long", "float");
}
use of org.eclipse.xtext.xbase.typesystem.arguments.IFeatureCallArguments in project xtext-xtend by eclipse.
the class ReorderedFeatureCallArgumentsTest method testBug457779_02.
@Test
public void testBug457779_02() {
final IFeatureCallArguments arguments = this.toArgumentsWithoutReceiver("String s, int i", "[], 1");
final XExpression second = arguments.getArgument(0);
Assert.assertTrue((second instanceof XNumberLiteral));
final LightweightTypeReference secondType = arguments.getDeclaredTypeForLambda(0);
Assert.assertEquals("int", secondType.getSimpleName());
final XExpression first = arguments.getArgument(1);
Assert.assertTrue((first instanceof XClosure));
final LightweightTypeReference firstType = arguments.getDeclaredTypeForLambda(1);
Assert.assertEquals("String", firstType.getSimpleName());
try {
arguments.getArgument(2);
Assert.fail("Expected exception");
} catch (final Throwable _t) {
if (_t instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t);
}
}
try {
arguments.getDeclaredTypeForLambda(2);
Assert.fail("Expected exception");
} catch (final Throwable _t_1) {
if (_t_1 instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t_1);
}
}
}
Aggregations