use of org.eclipse.xtend.core.xtend.XtendVariableDeclaration in project xtext-xtend by eclipse.
the class ParserTest method testExtensionOnLocalVar_01.
@Test
public void testExtensionOnLocalVar_01() throws Exception {
XtendClass clazz = clazz("class Foo { def m() { extension var s = '' } }");
assertEquals(1, clazz.getMembers().size());
XtendFunction m = (XtendFunction) clazz.getMembers().get(0);
XBlockExpression body = (XBlockExpression) m.getExpression();
assertEquals(1, body.getExpressions().size());
XtendVariableDeclaration variableDeclaration = (XtendVariableDeclaration) body.getExpressions().get(0);
assertTrue(variableDeclaration.isWriteable());
assertTrue(variableDeclaration.isExtension());
}
use of org.eclipse.xtend.core.xtend.XtendVariableDeclaration in project xtext-xtend by eclipse.
the class ParserTest method testExtensionOnLocalVar_02.
@Test
public void testExtensionOnLocalVar_02() throws Exception {
XtendClass clazz = clazz("class Foo { def m() { val extension Object s = '' } }");
assertEquals(1, clazz.getMembers().size());
XtendFunction m = (XtendFunction) clazz.getMembers().get(0);
XBlockExpression body = (XBlockExpression) m.getExpression();
assertEquals(1, body.getExpressions().size());
XtendVariableDeclaration variableDeclaration = (XtendVariableDeclaration) body.getExpressions().get(0);
assertFalse(variableDeclaration.isWriteable());
assertTrue(variableDeclaration.isExtension());
}
Aggregations