use of org.eclipse.xtext.common.types.JvmTypeParameter in project xtext-xtend by eclipse.
the class JvmModelTests method testJvmTypeParameter_01.
@Test
public void testJvmTypeParameter_01() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo< {");
_builder.newLine();
_builder.append("}");
_builder.newLine();
XtendTypeDeclaration _head = IterableExtensions.<XtendTypeDeclaration>head(this.file(_builder.toString(), false, false).getXtendTypes());
final JvmGenericType clazz = this._iXtendJvmAssociations.getInferredType(((XtendClass) _head));
EList<JvmTypeParameter> _typeParameters = clazz.getTypeParameters();
String _plus = ("" + _typeParameters);
Assert.assertTrue(_plus, clazz.getTypeParameters().isEmpty());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.common.types.JvmTypeParameter in project xtext-xtend by eclipse.
the class JvmModelTests method testJvmTypeParameter_03.
@Test
public void testJvmTypeParameter_03() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("new <() {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
XtendTypeDeclaration _head = IterableExtensions.<XtendTypeDeclaration>head(this.file(_builder.toString(), false, false).getXtendTypes());
final JvmGenericType clazz = this._iXtendJvmAssociations.getInferredType(((XtendClass) _head));
final JvmConstructor member = IterableExtensions.<JvmConstructor>head(Iterables.<JvmConstructor>filter(clazz.getMembers(), JvmConstructor.class));
EList<JvmTypeParameter> _typeParameters = member.getTypeParameters();
String _plus = ("" + _typeParameters);
Assert.assertTrue(_plus, member.getTypeParameters().isEmpty());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.common.types.JvmTypeParameter in project xtext-xtend by eclipse.
the class CompilationUnitImpl method toXtendTypeParameterDeclaration.
public XtendTypeParameterDeclarationImpl toXtendTypeParameterDeclaration(final JvmTypeParameter delegate) {
final Function1<JvmTypeParameter, XtendTypeParameterDeclarationImpl> _function = (JvmTypeParameter it) -> {
XtendTypeParameterDeclarationImpl _xtendTypeParameterDeclarationImpl = new XtendTypeParameterDeclarationImpl();
final Procedure1<XtendTypeParameterDeclarationImpl> _function_1 = (XtendTypeParameterDeclarationImpl it_1) -> {
it_1.setDelegate(delegate);
it_1.setCompilationUnit(this);
};
return ObjectExtensions.<XtendTypeParameterDeclarationImpl>operator_doubleArrow(_xtendTypeParameterDeclarationImpl, _function_1);
};
return this.<JvmTypeParameter, XtendTypeParameterDeclarationImpl>getOrCreate(delegate, _function);
}
use of org.eclipse.xtext.common.types.JvmTypeParameter in project xtext-xtend by eclipse.
the class CompilationUnitImpl method toTypeParameterDeclaration.
public TypeParameterDeclaration toTypeParameterDeclaration(final JvmTypeParameter delegate) {
final Function1<JvmTypeParameter, JvmTypeParameterDeclarationImpl> _function = (JvmTypeParameter it) -> {
JvmTypeParameterDeclarationImpl _xifexpression = null;
boolean _isBelongedToCompilationUnit = this.isBelongedToCompilationUnit(delegate);
if (_isBelongedToCompilationUnit) {
MutableJvmTypeParameterDeclarationImpl _mutableJvmTypeParameterDeclarationImpl = new MutableJvmTypeParameterDeclarationImpl();
final Procedure1<MutableJvmTypeParameterDeclarationImpl> _function_1 = (MutableJvmTypeParameterDeclarationImpl it_1) -> {
it_1.setDelegate(delegate);
it_1.setCompilationUnit(this);
};
_xifexpression = ObjectExtensions.<MutableJvmTypeParameterDeclarationImpl>operator_doubleArrow(_mutableJvmTypeParameterDeclarationImpl, _function_1);
} else {
JvmTypeParameterDeclarationImpl _jvmTypeParameterDeclarationImpl = new JvmTypeParameterDeclarationImpl();
final Procedure1<JvmTypeParameterDeclarationImpl> _function_2 = (JvmTypeParameterDeclarationImpl it_1) -> {
it_1.setDelegate(delegate);
it_1.setCompilationUnit(this);
};
_xifexpression = ObjectExtensions.<JvmTypeParameterDeclarationImpl>operator_doubleArrow(_jvmTypeParameterDeclarationImpl, _function_2);
}
return _xifexpression;
};
return this.<JvmTypeParameter, JvmTypeParameterDeclarationImpl>getOrCreate(delegate, _function);
}
use of org.eclipse.xtext.common.types.JvmTypeParameter in project xtext-xtend by eclipse.
the class CompilationUnitImpl method toType.
public Type toType(final JvmType delegate) {
final Function1<JvmType, Type> _function = (JvmType it) -> {
Type _switchResult = null;
boolean _matched = false;
if (delegate instanceof JvmDeclaredType) {
_matched = true;
_switchResult = this.toTypeDeclaration(((JvmDeclaredType) delegate));
}
if (!_matched) {
if (delegate instanceof JvmTypeParameter) {
_matched = true;
_switchResult = this.toTypeParameterDeclaration(((JvmTypeParameter) delegate));
}
}
if (!_matched) {
if (delegate instanceof JvmVoid) {
_matched = true;
VoidTypeImpl _voidTypeImpl = new VoidTypeImpl();
final Procedure1<VoidTypeImpl> _function_1 = (VoidTypeImpl it_1) -> {
it_1.setDelegate(((JvmVoid) delegate));
it_1.setCompilationUnit(this);
};
_switchResult = ObjectExtensions.<VoidTypeImpl>operator_doubleArrow(_voidTypeImpl, _function_1);
}
}
if (!_matched) {
if (delegate instanceof JvmPrimitiveType) {
_matched = true;
PrimitiveTypeImpl _primitiveTypeImpl = new PrimitiveTypeImpl();
final Procedure1<PrimitiveTypeImpl> _function_1 = (PrimitiveTypeImpl it_1) -> {
it_1.setDelegate(((JvmPrimitiveType) delegate));
it_1.setCompilationUnit(this);
};
_switchResult = ObjectExtensions.<PrimitiveTypeImpl>operator_doubleArrow(_primitiveTypeImpl, _function_1);
}
}
return _switchResult;
};
return this.<JvmType, Type>getOrCreate(delegate, _function);
}
Aggregations