Search in sources :

Example 16 with XFeatureCall

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

the class LinkingShadowingTest method testOperationWithTwoParams_overloaded.

@Test
public void testOperationWithTwoParams_overloaded() throws Exception {
    XtendClass clazz = clazz("class SomeClass {\n" + "  def void method() {\n" + "    methodWithParam('foo', 'bar')\n" + "  }\n" + "  def methodWithParam(String s1, String s2) {}\n" + "  def methodWithParam(StringBuffer s1, String s2) {}\n" + "}");
    XFeatureCall featureCall = (XFeatureCall) getFirstFeatureCall(clazz);
    assertLinksTo("SomeClass.methodWithParam(java.lang.String,java.lang.String)", featureCall);
    assertNull(featureCall.getImplicitFirstArgument());
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) Test(org.junit.Test)

Example 17 with XFeatureCall

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

the class LinkingShadowingTest method testOperationWithTwoParams_noConflict.

@Test
public void testOperationWithTwoParams_noConflict() throws Exception {
    XtendClass clazz = clazz("class SomeClass {\n" + "  def void method() {\n" + "    methodWithParam('foo', 'bar')\n" + "  }\n" + "  def methodWithParam(String s1, String s2) {}" + "}");
    XFeatureCall featureCall = (XFeatureCall) getFirstFeatureCall(clazz);
    assertLinksTo("SomeClass.methodWithParam(java.lang.String,java.lang.String)", featureCall);
    assertNull(featureCall.getImplicitFirstArgument());
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) Test(org.junit.Test)

Example 18 with XFeatureCall

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

the class LinkingShadowingTest method testStaticMethod_overloaded_noImport.

@Test
public void testStaticMethod_overloaded_noImport() throws Exception {
    XtendClass clazz = clazz("class SomeClass extends org.junit.Assert {\n" + "  def void method() {\n" + "    assertTrue(false)\n" + "  }\n" + "}");
    XFeatureCall featureCall = (XFeatureCall) getFirstFeatureCall(clazz);
    assertLinksTo("org.junit.Assert.assertTrue(boolean)", featureCall);
    assertNull(featureCall.getImplicitFirstArgument());
    assertNull(featureCall.getImplicitReceiver());
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) Test(org.junit.Test)

Example 19 with XFeatureCall

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

the class LinkingShadowingTest method testOperationWithParam_overloaded_itPresent.

@Test
public void testOperationWithParam_overloaded_itPresent() throws Exception {
    XtendClass clazz = clazz("class SomeClass {\n" + "  def void method(String it) {\n" + "    methodWithParam('foo')\n" + "  }\n" + "  def methodWithParam(String s) {}\n" + "  def methodWithParam(StringBuffer s) {}\n" + "}");
    XFeatureCall featureCall = (XFeatureCall) getFirstFeatureCall(clazz);
    assertLinksTo("SomeClass.methodWithParam(java.lang.String)", featureCall);
    assertNull(featureCall.getImplicitFirstArgument());
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) Test(org.junit.Test)

Example 20 with XFeatureCall

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

the class LinkingShadowingTest method testOperationWithParam_itPresent.

@Test
public void testOperationWithParam_itPresent() throws Exception {
    XtendClass clazz = clazz("class SomeClass {\n" + "  def void method(String it) {\n" + "    methodWithParam('foo')\n" + "  }\n" + "  def methodWithParam(String s) {}" + "}");
    XFeatureCall featureCall = (XFeatureCall) getFirstFeatureCall(clazz);
    assertLinksTo("SomeClass.methodWithParam(java.lang.String)", featureCall);
    assertNull(featureCall.getImplicitFirstArgument());
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) Test(org.junit.Test)

Aggregations

XFeatureCall (org.eclipse.xtext.xbase.XFeatureCall)93 Test (org.junit.Test)81 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)72 XBlockExpression (org.eclipse.xtext.xbase.XBlockExpression)67 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)62 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)29 JvmIdentifiableElement (org.eclipse.xtext.common.types.JvmIdentifiableElement)26 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)20 XMemberFeatureCall (org.eclipse.xtext.xbase.XMemberFeatureCall)19 XExpression (org.eclipse.xtext.xbase.XExpression)14 RichString (org.eclipse.xtend.core.xtend.RichString)7 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)7 XAbstractFeatureCall (org.eclipse.xtext.xbase.XAbstractFeatureCall)6 XtendConstructor (org.eclipse.xtend.core.xtend.XtendConstructor)5 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)5 LightweightTypeReference (org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference)5 EObject (org.eclipse.emf.ecore.EObject)4 XtendField (org.eclipse.xtend.core.xtend.XtendField)4 JvmFormalParameter (org.eclipse.xtext.common.types.JvmFormalParameter)4 ParameterInfo (org.eclipse.jdt.internal.corext.refactoring.ParameterInfo)3