Search in sources :

Example 21 with XAbstractFeatureCall

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

the class LinkingShadowingTest method testField_local_shadowsInvisibleOnIt.

@Test
public void testField_local_shadowsInvisibleOnIt() throws Exception {
    XtendClass clazz = clazz("class SomeClass {\n" + "  def method(testdata.LinkingType it) {\n" + "    protectedField\n" + "  }\n" + "  String protectedField\n" + "}");
    XAbstractFeatureCall featureCall = getFirstFeatureCall(clazz);
    assertLinksTo("SomeClass.protectedField", featureCall);
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAbstractFeatureCall(org.eclipse.xtext.xbase.XAbstractFeatureCall) Test(org.junit.Test)

Example 22 with XAbstractFeatureCall

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

the class LinkingShadowingTest method testField_inherited_shadows_sugarOnIt.

@Test
public void testField_inherited_shadows_sugarOnIt() throws Exception {
    XtendClass clazz = clazz("class SomeClass extends testdata.LinkingTypeEquallyNamed {\n" + "  def method(testdata.LinkingTypeEquallyNamed it) {\n" + "    fieldOverloadsMethod\n" + "  }\n" + "}");
    XAbstractFeatureCall featureCall = getFirstFeatureCall(clazz);
    assertLinksTo("testdata.LinkingTypeEquallyNamed.fieldOverloadsMethod", featureCall);
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAbstractFeatureCall(org.eclipse.xtext.xbase.XAbstractFeatureCall) Test(org.junit.Test)

Example 23 with XAbstractFeatureCall

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

the class LinkingShadowingTest method getFeatureCall.

protected XAbstractFeatureCall getFeatureCall(XtendClass clazz, int expressionInFunction) {
    XtendFunction function = (XtendFunction) clazz.getMembers().get(0);
    XBlockExpression body = (XBlockExpression) function.getExpression();
    XAbstractFeatureCall result = (XAbstractFeatureCall) body.getExpressions().get(expressionInFunction);
    return result;
}
Also used : XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) XBlockExpression(org.eclipse.xtext.xbase.XBlockExpression) XAbstractFeatureCall(org.eclipse.xtext.xbase.XAbstractFeatureCall)

Example 24 with XAbstractFeatureCall

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

the class LinkingShadowingTest method testOperationWithParam_overloaded.

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

Example 25 with XAbstractFeatureCall

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

the class LinkingShadowingTest method testField_local_shadows_sugarOnIt.

@Test
public void testField_local_shadows_sugarOnIt() throws Exception {
    XtendClass clazz = clazz("class SomeClass {\n" + "  def method(testdata.LinkingType it) {\n" + "    fieldOverloadsMethod\n" + "  }\n" + "  String fieldOverloadsMethod\n" + "}");
    XAbstractFeatureCall featureCall = getFirstFeatureCall(clazz);
    assertLinksTo("SomeClass.fieldOverloadsMethod", featureCall);
}
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