Search in sources :

Example 36 with XAbstractFeatureCall

use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.

the class LinkingTest method testParameterizedExtension_04.

@Test
public void testParameterizedExtension_04() 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<? extends XtendFile>> {\n" + "	extension T\n" + "	def m() {" + "		parse('').xtendTypes\n" + "	}\n" + "}\n");
    XtendClass c = (XtendClass) file.getXtendTypes().get(0);
    XAbstractFeatureCall substring = findSingleFeatureCall(c);
    assertEquals("org.eclipse.xtend.core.xtend.XtendFile.getXtendTypes()", substring.getFeature().getIdentifier());
}
Also used : XtendFile(org.eclipse.xtend.core.xtend.XtendFile) XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAbstractFeatureCall(org.eclipse.xtext.xbase.XAbstractFeatureCall) Test(org.junit.Test)

Example 37 with XAbstractFeatureCall

use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.

the class LinkingTest method testOverloadedMethod_04.

@Test
public void testOverloadedMethod_04() throws Exception {
    XtendFile file = file("package testPackage\n" + "class B extends A {\n" + "	def m() {\n" + "		super.m('')\n" + "	}\n" + "}\n" + "class A {\n" + "	def String m(String s) {\n" + "		return null\n" + "	}\n" + "	def String m(B b, String s) {\n" + "		return null\n" + "	}\n" + "}");
    XtendClass c = (XtendClass) file.getXtendTypes().get(0);
    XAbstractFeatureCall substring = findSingleFeatureCall(c);
    assertEquals("testPackage.A.m(java.lang.String)", substring.getFeature().getIdentifier());
}
Also used : XtendFile(org.eclipse.xtend.core.xtend.XtendFile) XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAbstractFeatureCall(org.eclipse.xtext.xbase.XAbstractFeatureCall) Test(org.junit.Test)

Example 38 with XAbstractFeatureCall

use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.

the class LinkingTest method testInstanceOverExtension_03.

@Test
public void testInstanceOverExtension_03() throws Exception {
    XtendClass clazz = clazz("" + "class C {" + "  def put(java.util.Map<Integer, Integer> map, int i, int j) {\n" + "    map.put(i, j)\n" + "  }\n" + "}");
    XAbstractFeatureCall substring = findSingleFeatureCall(clazz);
    assertEquals("java.util.Map.put(K,V)", substring.getFeature().getIdentifier());
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAbstractFeatureCall(org.eclipse.xtext.xbase.XAbstractFeatureCall) Test(org.junit.Test)

Example 39 with XAbstractFeatureCall

use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.

the class LinkingTest method testExtensionOverDemandConversion_01.

@Test
public void testExtensionOverDemandConversion_01() throws Exception {
    XtendClass clazz = clazz("" + "class C {" + "  def m(Object[] array) {\n" + "    array.get(0)\n" + "  }\n" + "}");
    XAbstractFeatureCall substring = findSingleFeatureCall(clazz);
    assertEquals("org.eclipse.xtext.xbase.lib.ArrayExtensions.get(T[],int)", substring.getFeature().getIdentifier());
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAbstractFeatureCall(org.eclipse.xtext.xbase.XAbstractFeatureCall) Test(org.junit.Test)

Example 40 with XAbstractFeatureCall

use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.

the class LinkingTest method testInstanceOverExtension_02.

@Test
public void testInstanceOverExtension_02() throws Exception {
    XtendClass clazz = clazz("" + "class C {" + "  def put(java.util.Map<String, String> map, String s1, String s2) {\n" + "    map.put(s1, s2)\n" + "  }\n" + "}");
    XAbstractFeatureCall substring = findSingleFeatureCall(clazz);
    assertEquals("java.util.Map.put(K,V)", substring.getFeature().getIdentifier());
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAbstractFeatureCall(org.eclipse.xtext.xbase.XAbstractFeatureCall) Test(org.junit.Test)

Aggregations

XAbstractFeatureCall (org.eclipse.xtext.xbase.XAbstractFeatureCall)122 Test (org.junit.Test)105 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)104 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)42 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)23 XBlockExpression (org.eclipse.xtext.xbase.XBlockExpression)21 XExpression (org.eclipse.xtext.xbase.XExpression)17 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)11 JvmIdentifiableElement (org.eclipse.xtext.common.types.JvmIdentifiableElement)9 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)8 XFeatureCall (org.eclipse.xtext.xbase.XFeatureCall)6 EObject (org.eclipse.emf.ecore.EObject)5 XtendTypeDeclaration (org.eclipse.xtend.core.xtend.XtendTypeDeclaration)5 XMemberFeatureCall (org.eclipse.xtext.xbase.XMemberFeatureCall)4 IFeatureLinkingCandidate (org.eclipse.xtext.xbase.typesystem.computation.IFeatureLinkingCandidate)4 Resource (org.eclipse.emf.ecore.resource.Resource)3 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)3 JvmDeclaredType (org.eclipse.xtext.common.types.JvmDeclaredType)3 AbstractDiagnostic (org.eclipse.xtext.diagnostics.AbstractDiagnostic)3 XClosure (org.eclipse.xtext.xbase.XClosure)3