use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.
the class LinkingTest method testBug345827_03.
@Test
public void testBug345827_03() throws Exception {
XtendFunction function = function("def String name(String param) {\n" + " var name = ''\n" + " name()" + "}");
XBlockExpression block = (XBlockExpression) function.getExpression();
XFeatureCall featureCall = (XFeatureCall) block.getExpressions().get(1);
assertSame(associator.getDirectlyInferredOperation(function), featureCall.getFeature());
}
use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.
the class LinkingTest method testOverloadStaticInstance_01.
@Test
public void testOverloadStaticInstance_01() throws Exception {
XtendFile file = file("class C {\n" + " def void m(CharSequence c) {\n" + " m('')\n" + " }\n" + " def static void m(String s) {}\n" + "}");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XtendFunction m = (XtendFunction) c.getMembers().get(0);
XBlockExpression body = (XBlockExpression) m.getExpression();
XFeatureCall featureCall = (XFeatureCall) body.getExpressions().get(0);
JvmIdentifiableElement feature = featureCall.getFeature();
assertEquals("C.m(java.lang.String)", feature.getIdentifier());
assertNull(featureCall.getImplicitReceiver());
assertNull(featureCall.getImplicitFirstArgument());
}
use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.
the class LinkingTest method testStaticImports_05.
@Test
public void testStaticImports_05() throws Exception {
String fileAsText = "import static java.util.Collections.* class Clazz { def void method() {singletonList('')} }";
XtendFile file = file(fileAsText, true);
XtendFunction function = (XtendFunction) ((XtendClass) file.getXtendTypes().get(0)).getMembers().get(0);
XFeatureCall featureCall = (XFeatureCall) ((XBlockExpression) function.getExpression()).getExpressions().get(0);
String identifier = featureCall.getFeature().getIdentifier();
assertEquals("java.util.Collections.singletonList(T)", identifier);
}
use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.
the class LinkingTest method testBug403580_02.
@Test
public void testBug403580_02() throws Exception {
XtendFile file = file("abstract class C {\n" + " def void m() {\n" + " overloaded [ String s | s.length ]\n" + " }\n" + " def void overloaded(Object o)" + " def <T> void overloaded(Comparable<T> c)" + "}\n");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XtendFunction m = (XtendFunction) c.getMembers().get(0);
XBlockExpression body = (XBlockExpression) m.getExpression();
XFeatureCall featureCall = (XFeatureCall) body.getExpressions().get(0);
JvmIdentifiableElement method = featureCall.getFeature();
assertEquals("C.overloaded(java.lang.Comparable)", method.getIdentifier());
}
use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.
the class LinkingTest method testStaticImports_10.
@Test
public void testStaticImports_10() throws Exception {
String fileAsText = "import static extension java.util.Collections.* class Clazz { def void method() { singletonList('')} }";
XtendFile file = file(fileAsText, true);
XtendFunction function = (XtendFunction) ((XtendClass) file.getXtendTypes().get(0)).getMembers().get(0);
XFeatureCall featureCall = (XFeatureCall) ((XBlockExpression) function.getExpression()).getExpressions().get(0);
String identifier = featureCall.getFeature().getIdentifier();
assertEquals("java.util.Collections.singletonList(T)", identifier);
}
Aggregations