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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations