use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.
the class LinkingTest method testInstanceExtensionOverStaticConversion_01.
@Test
public void testInstanceExtensionOverStaticConversion_01() throws Exception {
XtendClass clazz = clazz("" + "class C {" + " def void get(Object[] array, int i) {}\n" + " def m(Object[] array) {\n" + " array.get(0)\n" + " }\n" + "}");
XAbstractFeatureCall substring = findSingleFeatureCall(clazz);
assertEquals("C.get(java.lang.Object[],int)", substring.getFeature().getIdentifier());
}
use of org.eclipse.xtext.xbase.XAbstractFeatureCall 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());
}
use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.
the class TypeProviderTest method findSingleFeatureCall.
private XAbstractFeatureCall findSingleFeatureCall(XtendClass xtendClass) {
XtendFunction function = (XtendFunction) xtendClass.getMembers().get(xtendClass.getMembers().size() - 1);
XBlockExpression block = (XBlockExpression) function.getExpression();
return (XAbstractFeatureCall) block.getExpressions().get(0);
}
use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.
the class TypeProviderTest method testParameterizedExtension_05.
@Test
public void testParameterizedExtension_05() throws Exception {
XtendFile file = file("package testPackage\n" + "import org.eclipse.xtext.testing.util.ParseHelper\n" + "import org.eclipse.xtend.core.xtend.XtendFile\n" + "class C<F extends XtendFile> extends ParseHelper<F> {\n" + " def m() {" + " parse('')\n" + " }\n" + "}\n");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XAbstractFeatureCall parse = findSingleFeatureCall(c);
assertEquals("org.eclipse.xtext.testing.util.ParseHelper.parse(java.lang.CharSequence)", parse.getFeature().getIdentifier());
assertEquals("F", getType(parse).getSimpleName());
}
use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.
the class TypeProviderTest method testParameterizedExtension_02.
@Test
public void testParameterizedExtension_02() throws Exception {
XtendFile file = file("package testPackage\n" + "import org.eclipse.xtext.testing.util.ParseHelper\n" + "import org.eclipse.xtend.core.xtend.XtendFile\n" + "class C<T extends ParseHelper<XtendFile>> {\n" + " extension T\n" + " def m() {" + " parse('')\n" + " }\n" + "}\n");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XAbstractFeatureCall parse = findSingleFeatureCall(c);
assertEquals("org.eclipse.xtext.testing.util.ParseHelper.parse(java.lang.CharSequence)", parse.getFeature().getIdentifier());
assertEquals("XtendFile", getType(parse).getSimpleName());
}
Aggregations