use of org.eclipse.xtend.core.xtend.XtendParameter in project xtext-xtend by eclipse.
the class XtendCopyQualifiedNameService method toQualifiedName.
protected String toQualifiedName(final XtendFunction it) {
StringConcatenation _builder = new StringConcatenation();
String _fullyQualifiedName = this.toFullyQualifiedName(it);
_builder.append(_fullyQualifiedName);
_builder.append("(");
final Function1<XtendParameter, String> _function = (XtendParameter it_1) -> {
return it_1.getParameterType().getSimpleName();
};
CharSequence _qualifiedNames = this.<XtendParameter>toQualifiedNames(it.getParameters(), _function);
_builder.append(_qualifiedNames);
_builder.append(")");
return _builder.toString();
}
use of org.eclipse.xtend.core.xtend.XtendParameter in project xtext-xtend by eclipse.
the class Bug464760Test method testBug464760.
@Test
public void testBug464760() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void myMethod() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\"foo\".myExtension");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("def void myExtension(/*will be deleted programmatically*/Object notype) {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
Resource _resource = this.resourceHelper.resource(_builder);
final XtextResource resource = ((XtextResource) _resource);
EObject _rootASTElement = resource.getParseResult().getRootASTElement();
final XtendFile xtendFile = ((XtendFile) _rootASTElement);
XtendMember _get = IterableExtensions.<XtendTypeDeclaration>head(xtendFile.getXtendTypes()).getMembers().get(1);
XtendParameter _head = IterableExtensions.<XtendParameter>head(((XtendFunction) _get).getParameters());
_head.setParameterType(null);
final Runnable _function = () -> {
EcoreUtil.resolveAll(resource);
};
final LoggingTester.LogCapture loggings = LoggingTester.captureLogging(Level.ERROR, BatchLinkableResource.class, _function);
loggings.assertNoLogEntries();
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendParameter in project xtext-xtend by eclipse.
the class CompilationUnitImpl method toXtendParameterDeclaration.
public XtendParameterDeclarationImpl toXtendParameterDeclaration(final XtendParameter delegate) {
final Function1<XtendParameter, XtendParameterDeclarationImpl> _function = (XtendParameter it) -> {
XtendParameterDeclarationImpl _xtendParameterDeclarationImpl = new XtendParameterDeclarationImpl();
final Procedure1<XtendParameterDeclarationImpl> _function_1 = (XtendParameterDeclarationImpl it_1) -> {
it_1.setDelegate(delegate);
it_1.setCompilationUnit(this);
};
return ObjectExtensions.<XtendParameterDeclarationImpl>operator_doubleArrow(_xtendParameterDeclarationImpl, _function_1);
};
return this.<XtendParameter, XtendParameterDeclarationImpl>getOrCreate(delegate, _function);
}
use of org.eclipse.xtend.core.xtend.XtendParameter in project xtext-xtend by eclipse.
the class ParserTest method testExtensionOnMethodParameter_01.
@Test
public void testExtensionOnMethodParameter_01() throws Exception {
XtendClass clazz = clazz("class Foo { def m(extension Object o) {} }");
assertEquals(1, clazz.getMembers().size());
XtendFunction m = (XtendFunction) clazz.getMembers().get(0);
List<XtendParameter> parameters = m.getParameters();
assertEquals(1, parameters.size());
XtendParameter singleParameter = parameters.get(0);
assertTrue(singleParameter.isExtension());
}
use of org.eclipse.xtend.core.xtend.XtendParameter in project xtext-xtend by eclipse.
the class TypeProviderTest method testBug380063NoException.
@Test
public void testBug380063NoException() throws Exception {
XtendClass clazz = clazz("class Foo<T> { " + "def foo(java.util.List<? extends T> l) { " + " l.add(null)" + "}}");
XtendFunction function = (XtendFunction) clazz.getMembers().get(0);
XtendParameter xtendParameter = function.getParameters().get(0);
XBlockExpression expr = (XBlockExpression) function.getExpression();
XMemberFeatureCall call = (XMemberFeatureCall) expr.getExpressions().get(0);
LightweightTypeReference type = getType(call.getMemberCallTarget());
assertEquals("List<? extends T>", type.getSimpleName());
assertEquals("List<? extends T>", xtendParameter.getParameterType().getSimpleName());
}
Aggregations