Search in sources :

Example 26 with XtendParameter

use of org.eclipse.xtend.core.xtend.XtendParameter in project xtext-xtend by eclipse.

the class LinkingTest method testBug342848_01.

@Test
public void testBug342848_01() throws Exception {
    String fileAsText = "import org.eclipse.xtext.xbase.lib.Functions\n" + "class Clazz { def void method(Functions$Function0<Integer> f) { f.apply } }";
    XtendFile file = file(fileAsText, true);
    XtendFunction function = (XtendFunction) ((XtendClass) file.getXtendTypes().get(0)).getMembers().get(0);
    XtendParameter parameter = function.getParameters().get(0);
    String identifier = parameter.getParameterType().getIdentifier();
    assertEquals(Functions.Function0.class.getName() + "<java.lang.Integer>", identifier);
}
Also used : XtendFile(org.eclipse.xtend.core.xtend.XtendFile) XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) XtendParameter(org.eclipse.xtend.core.xtend.XtendParameter) XtendClass(org.eclipse.xtend.core.xtend.XtendClass) Functions(org.eclipse.xtext.xbase.lib.Functions) Test(org.junit.Test)

Aggregations

XtendParameter (org.eclipse.xtend.core.xtend.XtendParameter)26 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)12 Test (org.junit.Test)12 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)11 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)11 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)10 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)9 XtendTypeDeclaration (org.eclipse.xtend.core.xtend.XtendTypeDeclaration)5 XtendAnnotationTarget (org.eclipse.xtend.core.xtend.XtendAnnotationTarget)4 JvmTypeReference (org.eclipse.xtext.common.types.JvmTypeReference)4 EObject (org.eclipse.emf.ecore.EObject)3 XtendField (org.eclipse.xtend.core.xtend.XtendField)3 Declaration (org.eclipse.xtend.lib.macro.declaration.Declaration)3 MutableNamedElement (org.eclipse.xtend.lib.macro.declaration.MutableNamedElement)3 NamedElement (org.eclipse.xtend.lib.macro.declaration.NamedElement)3 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)3 XBlockExpression (org.eclipse.xtext.xbase.XBlockExpression)3 XMemberFeatureCall (org.eclipse.xtext.xbase.XMemberFeatureCall)3 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)3 List (java.util.List)2