use of org.eclipse.xtext.common.types.JvmFormalParameter in project xtext-eclipse by eclipse.
the class Oven method fireproof.
public void fireproof(final String input) throws Exception {
try {
final EObject file = this._parseHelper.parse(input);
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(file);
Assert.assertNotNull(resolvedTypes);
if ((file != null)) {
Iterable<EObject> _iterable = IteratorExtensions.<EObject>toIterable(file.eAllContents());
for (final EObject content : _iterable) {
boolean _matched = false;
if (content instanceof XAbstractFeatureCall) {
_matched = true;
this.assertExpressionTypeIsResolved(((XExpression) content), resolvedTypes);
XExpression _implicitReceiver = ((XAbstractFeatureCall) content).getImplicitReceiver();
boolean _tripleNotEquals = (_implicitReceiver != null);
if (_tripleNotEquals) {
this.assertExpressionTypeIsResolved(((XAbstractFeatureCall) content).getImplicitReceiver(), resolvedTypes);
}
XExpression _implicitFirstArgument = ((XAbstractFeatureCall) content).getImplicitFirstArgument();
boolean _tripleNotEquals_1 = (_implicitFirstArgument != null);
if (_tripleNotEquals_1) {
this.assertExpressionTypeIsResolved(((XAbstractFeatureCall) content).getImplicitFirstArgument(), resolvedTypes);
}
}
if (!_matched) {
if (content instanceof XClosure) {
_matched = true;
this.assertExpressionTypeIsResolved(((XExpression) content), resolvedTypes);
final Consumer<JvmFormalParameter> _function = (JvmFormalParameter it) -> {
this.assertIdentifiableTypeIsResolved(it, resolvedTypes);
};
((XClosure) content).getImplicitFormalParameters().forEach(_function);
}
}
if (!_matched) {
if (content instanceof XExpression) {
_matched = true;
this.assertExpressionTypeIsResolved(((XExpression) content), resolvedTypes);
}
}
if (!_matched) {
if (content instanceof JvmIdentifiableElement) {
_matched = true;
this.assertIdentifiableTypeIsResolved(((JvmIdentifiableElement) content), resolvedTypes);
}
}
}
}
} catch (final Throwable _t) {
if (_t instanceof Throwable) {
final Throwable e = (Throwable) _t;
String _message = e.getMessage();
final ComparisonFailure error = new ComparisonFailure(_message, input, "");
error.setStackTrace(e.getStackTrace());
throw error;
} else {
throw Exceptions.sneakyThrow(_t);
}
}
}
use of org.eclipse.xtext.common.types.JvmFormalParameter in project xtext-eclipse by eclipse.
the class JdtBasedTypeFactory method setParameterNamesAndAnnotations.
private void setParameterNamesAndAnnotations(IMethodBinding method, ITypeBinding[] parameterTypes, String[] parameterNames, JvmExecutable result) {
InternalEList<JvmFormalParameter> parameters = (InternalEList<JvmFormalParameter>) result.getParameters();
for (int i = 0; i < parameterTypes.length; i++) {
IAnnotationBinding[] parameterAnnotations;
try {
parameterAnnotations = method.getParameterAnnotations(i);
} catch (AbortCompilation aborted) {
parameterAnnotations = null;
}
ITypeBinding parameterType = parameterTypes[i];
String parameterName = parameterNames == null ? null : /* lazy */
i < parameterNames.length ? parameterNames[i] : "arg" + i;
JvmFormalParameter formalParameter = createFormalParameter(parameterType, parameterName, parameterAnnotations);
parameters.addUnique(formalParameter);
}
}
use of org.eclipse.xtext.common.types.JvmFormalParameter in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testTypeParamEndsWithDollar_02.
@Test
public void testTypeParamEndsWithDollar_02() {
String typeName = "org.eclipse.xtext.common.types.testSetups.TypeParamEndsWithDollar";
JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
JvmOperation function = (JvmOperation) type.findAllFeaturesByName("function2").iterator().next();
JvmFormalParameter parameter = function.getParameters().get(0);
JvmType parameterType = parameter.getParameterType().getType();
assertEquals(function.getTypeParameters().get(0), parameterType);
JvmFormalParameter secondParameter = function.getParameters().get(1);
JvmType secondParameterType = secondParameter.getParameterType().getType();
assertEquals(type.getTypeParameters().get(0), secondParameterType);
}
use of org.eclipse.xtext.common.types.JvmFormalParameter in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method test_twoListParamsNoResult_02.
@Test
public void test_twoListParamsNoResult_02() {
JvmOperation twoListParamsNoResult = getMethodFromParameterizedMethods("twoListParamsNoResult(java.util.List,java.util.List)");
JvmFormalParameter firstParam = twoListParamsNoResult.getParameters().get(0);
JvmTypeReference paramType = firstParam.getParameterType();
assertNotNull(paramType);
assertFalse(paramType.getType().eIsProxy());
assertEquals("java.util.List<T>", paramType.getIdentifier());
assertTrue(paramType instanceof JvmParameterizedTypeReference);
JvmParameterizedTypeReference parameterized = (JvmParameterizedTypeReference) paramType;
JvmType rawType = parameterized.getType();
assertFalse(rawType.eIsProxy());
assertEquals("java.util.List", rawType.getIdentifier());
}
use of org.eclipse.xtext.common.types.JvmFormalParameter in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testTypeParamEndsWithDollar_01.
@Test
public void testTypeParamEndsWithDollar_01() {
String typeName = "org.eclipse.xtext.common.types.testSetups.TypeParamEndsWithDollar";
JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
JvmOperation function = (JvmOperation) type.findAllFeaturesByName("function1").iterator().next();
JvmFormalParameter parameter = function.getParameters().get(0);
JvmType parameterType = parameter.getParameterType().getType();
assertEquals(function.getTypeParameters().get(0), parameterType);
}
Aggregations