use of org.eclipse.xtext.xbase.XAssignment in project xtext-xtend by eclipse.
the class AssignmentLinkingTest method testParameter.
@SuppressWarnings("deprecation")
@Test
public void testParameter() throws Exception {
XtendClass clazz = clazz("class SomeClass {\n" + " def void method(String aString) {\n" + " aString = 'foo'\n" + " }\n" + "}");
XAssignment assignment = getLastAssignment(clazz);
assertNotNull("feature is available", assignment.getFeature());
JvmIdentifiableElement linked = assignment.getFeature();
assertFalse("is resolved", linked.eIsProxy());
assertEquals("aString", linked.getIdentifier());
assertTrue(TypesPackage.Literals.JVM_FORMAL_PARAMETER.isInstance(linked));
assertNull(assignment.getInvalidFeatureIssueCode(), assignment.getInvalidFeatureIssueCode());
}
use of org.eclipse.xtext.xbase.XAssignment in project xtext-xtend by eclipse.
the class AssignmentLinkingTest method testQualifiedField.
@Test
public void testQualifiedField() throws Exception {
XtendClass clazz = clazz("class SomeClass {\n" + " def void method() {\n" + " this.aString = 'foo'\n" + " }" + " String aString\n" + "}");
XAssignment assignment = getLastAssignment(clazz);
assertLinksTo("SomeClass.aString", assignment);
assertNull(assignment.getImplicitReceiver());
}
use of org.eclipse.xtext.xbase.XAssignment in project xtext-xtend by eclipse.
the class AssignmentLinkingTest method testSugaredAssignment_onIt.
@Test
public void testSugaredAssignment_onIt() throws Exception {
XtendClass clazz = clazz("class SomeClass {\n" + " def void method(testdata.Properties1 it) {\n" + " prop2 = 'foo'\n" + " }" + "}");
XAssignment assignment = getLastAssignment(clazz);
assertLinksTo("testdata.Properties1.setProp2(java.lang.String)", assignment);
assertImplicitReceiver("it", assignment);
}
use of org.eclipse.xtext.xbase.XAssignment in project xtext-xtend by eclipse.
the class AssignmentLinkingTest method testBug447982_03.
@Test
public void testBug447982_03() throws Exception {
XtendClass clazz = clazz("class C {\n" + " def m() {\n" + " x = 1\n" + " } \n" + " int x\n" + " def setX(int x) {}\n" + "}");
XAssignment assignment = getLastAssignment(clazz);
assertLinksTo("C.x", TypesPackage.Literals.JVM_FIELD, assignment);
}
use of org.eclipse.xtext.xbase.XAssignment in project xtext-xtend by eclipse.
the class AssignmentLinkingTest method testBug447982_01.
@Test
public void testBug447982_01() throws Exception {
XtendClass clazz = clazz("class C {\n" + " def m() {\n" + " x = 1\n" + " } \n" + " def x(int x) {}\n" + " def setX(int x) {}\n" + "}");
XAssignment assignment = getLastAssignment(clazz);
assertLinksTo("C.setX(int)", TypesPackage.Literals.JVM_OPERATION, assignment);
}
Aggregations