Search in sources :

Example 11 with XAssignment

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

the class AssignmentLinkingTest method testBug447982_02.

@Test
public void testBug447982_02() throws Exception {
    XtendClass clazz = clazz("class C {\n" + "	def static m() {\n" + "		x = 1\n" + "	} \n" + "	def static x(int x) {}\n" + "	def static setX(int x) {}\n" + "}");
    XAssignment assignment = getLastAssignment(clazz);
    assertLinksTo("C.setX(int)", TypesPackage.Literals.JVM_OPERATION, assignment);
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAssignment(org.eclipse.xtext.xbase.XAssignment) Test(org.junit.Test)

Example 12 with XAssignment

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

the class AssignmentLinkingTest method testUnqualifiedField_onThis.

@Test
public void testUnqualifiedField_onThis() throws Exception {
    XtendClass clazz = clazz("class SomeClass {\n" + "  def void method() {\n" + "    aString = 'foo'\n" + "  }" + "  String aString\n" + "}");
    XAssignment assignment = getLastAssignment(clazz);
    assertLinksTo("SomeClass.aString", assignment);
    assertImplicitReceiver("SomeClass", assignment);
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAssignment(org.eclipse.xtext.xbase.XAssignment) Test(org.junit.Test)

Example 13 with XAssignment

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

the class AssignmentLinkingTest method testSugaredAssignment_onExtension.

@Test
public void testSugaredAssignment_onExtension() throws Exception {
    XtendClass clazz = clazz("class SomeClass {\n" + "  def void method() {\n" + "    prop2 = 'foo'\n" + "  }\n" + "  extension testdata.Properties1" + "}");
    XAssignment assignment = getLastAssignment(clazz);
    assertLinksTo("testdata.Properties1.setProp2(java.lang.String)", assignment);
    assertImplicitReceiver("SomeClass._properties1", assignment);
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAssignment(org.eclipse.xtext.xbase.XAssignment) Test(org.junit.Test)

Example 14 with XAssignment

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

the class AssignmentLinkingTest method testLocalVariable.

@Test
public void testLocalVariable() throws Exception {
    XtendClass clazz = clazz("class SomeClass {\n" + "  def void method() {\n" + "    var aString = ''\n" + "    aString = 'foo'\n" + "  }\n" + "}");
    XAssignment assignment = getLastAssignment(clazz);
    assertLinksTo("aString", XbasePackage.Literals.XVARIABLE_DECLARATION, assignment);
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAssignment(org.eclipse.xtext.xbase.XAssignment) Test(org.junit.Test)

Example 15 with XAssignment

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

the class AssignmentLinkingTest method testUnqualifiedField_withConflict_onIt.

@Test
public void testUnqualifiedField_withConflict_onIt() throws Exception {
    XtendClass clazz = clazz("class SomeClass {\n" + "  def void method(testdata.Properties1 it) {\n" + "    prop1 = 'foo'\n" + "  }" + "}");
    XAssignment assignment = getLastAssignment(clazz);
    assertLinksTo("testdata.Properties1.prop1", assignment);
    assertImplicitReceiver("it", assignment);
}
Also used : XtendClass(org.eclipse.xtend.core.xtend.XtendClass) XAssignment(org.eclipse.xtext.xbase.XAssignment) Test(org.junit.Test)

Aggregations

XAssignment (org.eclipse.xtext.xbase.XAssignment)22 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)19 Test (org.junit.Test)19 XBlockExpression (org.eclipse.xtext.xbase.XBlockExpression)4 XFeatureCall (org.eclipse.xtext.xbase.XFeatureCall)3 XtendConstructor (org.eclipse.xtend.core.xtend.XtendConstructor)2 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)2 JvmIdentifiableElement (org.eclipse.xtext.common.types.JvmIdentifiableElement)2 XConstructorCall (org.eclipse.xtext.xbase.XConstructorCall)2 XExpression (org.eclipse.xtext.xbase.XExpression)2 EPackage (org.eclipse.emf.ecore.EPackage)1 RichString (org.eclipse.xtend.core.xtend.RichString)1 RichStringLiteral (org.eclipse.xtend.core.xtend.RichStringLiteral)1 XtendAnnotationType (org.eclipse.xtend.core.xtend.XtendAnnotationType)1 XtendEnum (org.eclipse.xtend.core.xtend.XtendEnum)1 XtendField (org.eclipse.xtend.core.xtend.XtendField)1 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)1 XtendFormalParameter (org.eclipse.xtend.core.xtend.XtendFormalParameter)1 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)1 XtendInterface (org.eclipse.xtend.core.xtend.XtendInterface)1