Search in sources :

Example 96 with XtendFunction

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

the class UTF8ParserTest method testIdentifiers_01.

@Test
public void testIdentifiers_01() throws Exception {
    XtendFunction func = function("def \u03b1\u03c1\u03b5\u03c4\u03b7() {}");
    assertEquals("\u03b1\u03c1\u03b5\u03c4\u03b7", func.getName());
}
Also used : XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) Test(org.junit.Test)

Example 97 with XtendFunction

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

the class AbstractRichStringTest method richString.

protected RichString richString(String string) throws Exception {
    XtendClass clazz = clazz(getPrefix() + string + "}");
    XtendFunction function = (XtendFunction) clazz.getMembers().get(0);
    return (RichString) function.getExpression();
}
Also used : XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) RichString(org.eclipse.xtend.core.xtend.RichString) XtendClass(org.eclipse.xtend.core.xtend.XtendClass)

Example 98 with XtendFunction

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

the class LinkingErrorTest method testBug_350167_03.

@Test
public void testBug_350167_03() throws Exception {
    XtendFunction fun = function("def fun(Object o) {\n" + "	if (true) ''.toString != null else { . }\n" + "}");
    assertNoExceptions(fun);
}
Also used : XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) Test(org.junit.Test)

Example 99 with XtendFunction

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

the class LinkingErrorTest method testBug_350167_02.

@Test
public void testBug_350167_02() throws Exception {
    XtendFunction fun = function("def fun(Object o) {\n" + "	try { ''.toString } catch(NullPointerException e) { . }\n" + "}");
    assertNoExceptions(fun);
}
Also used : XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) Test(org.junit.Test)

Example 100 with XtendFunction

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

the class LinkingErrorTest method testNoException_01.

@Test
public void testNoException_01() throws Exception {
    XtendFunction function = function("def noException() {\n" + // exception case is Integeri
    "	    val closure = [Integeri| return i]\n" + "	    for (x : 1..100) closure.apply(x)\n" + "	}");
    JvmTypeReference type = associations.getDirectlyInferredOperation(function).getReturnType();
    assertTrue(type.getType() instanceof JvmVoid);
    assertFalse(type.getType().eIsProxy());
    assertNoExceptions(function);
}
Also used : XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) JvmVoid(org.eclipse.xtext.common.types.JvmVoid) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference) Test(org.junit.Test)

Aggregations

XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)441 Test (org.junit.Test)374 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)248 XBlockExpression (org.eclipse.xtext.xbase.XBlockExpression)198 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)182 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)116 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)101 XExpression (org.eclipse.xtext.xbase.XExpression)95 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)91 XMemberFeatureCall (org.eclipse.xtext.xbase.XMemberFeatureCall)78 XFeatureCall (org.eclipse.xtext.xbase.XFeatureCall)72 JvmIdentifiableElement (org.eclipse.xtext.common.types.JvmIdentifiableElement)60 JvmTypeReference (org.eclipse.xtext.common.types.JvmTypeReference)46 XtendTypeDeclaration (org.eclipse.xtend.core.xtend.XtendTypeDeclaration)39 JvmGenericType (org.eclipse.xtext.common.types.JvmGenericType)30 EObject (org.eclipse.emf.ecore.EObject)28 XAbstractFeatureCall (org.eclipse.xtext.xbase.XAbstractFeatureCall)23 LightweightTypeReference (org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference)23 RichString (org.eclipse.xtend.core.xtend.RichString)17 JvmFormalParameter (org.eclipse.xtext.common.types.JvmFormalParameter)16