@Override public LightweightTypeReference getExpectedType(XExpression expression) { IResolvedTypes delegate = getDelegate(expression); return delegate.getExpectedType(expression); }
protected LightweightTypeReference getLightweightExpectedType(XExpression expr) { IResolvedTypes resolvedTypes = getResolvedTypes(expr); LightweightTypeReference expectedType = resolvedTypes.getExpectedType(expr); return expectedType; }
@Override public LightweightTypeReference getExpectedType(XExpression expression) { return delegate().getExpectedType(expression); }
protected LightweightTypeReference getExpectedType(XExpression expression) { return typeResolver.resolveTypes(expression).getExpectedType(expression); }
protected Object internalEvaluate(XExpression expression, IEvaluationContext context, CancelIndicator indicator) throws EvaluationException { if (indicator.isCanceled()) throw new InterpreterCanceledException(); Object result = doEvaluate(expression, context, indicator); final LightweightTypeReference expectedType = typeResolver.resolveTypes(expression).getExpectedType(expression); if(expectedType != null) result = wrapOrUnwrapArray(result, expectedType); return result; }
/** * @param context unused in this context but required for dispatching * @param indicator unused in this context but required for dispatching */ @SuppressWarnings("unchecked") protected Object _doEvaluate(XNumberLiteral literal, IEvaluationContext context, CancelIndicator indicator) { IResolvedTypes resolvedTypes = typeResolver.resolveTypes(literal); LightweightTypeReference expectedType = resolvedTypes.getExpectedType(literal); Class<? extends Number> type = numberLiterals.getJavaType(literal); if (expectedType != null && expectedType.isSubtypeOf(Number.class)) { try { Class<?> expectedClassType = getJavaType(expectedType.toJavaCompliantTypeReference().getType()); if (expectedClassType.isPrimitive()) { expectedClassType = ReflectionUtil.getObjectType(expectedClassType); } if (Number.class != expectedClassType && Number.class.isAssignableFrom(expectedClassType)) { type = (Class<? extends Number>) expectedClassType; } } catch (ClassNotFoundException e) { } } return numberLiterals.numberValue(literal, type); }
protected LightweightTypeReference getTypeForVariableDeclaration(XExpression expr) { IResolvedTypes resolvedTypes = getResolvedTypes(expr); LightweightTypeReference actualType = resolvedTypes.getActualType(expr); if (actualType.isPrimitiveVoid()) { LightweightTypeReference expectedType = resolvedTypes.getExpectedType(expr); if (expectedType == null) { expectedType = resolvedTypes.getExpectedReturnType(expr); if (expectedType == null) { expectedType = resolvedTypes.getReturnType(expr); } } if (expectedType != null && !expectedType.isPrimitiveVoid()) { actualType = expectedType; } } return actualType; }
private LightweightTypeReference findRealReturnType(XExpression expression) { if (expression == null) return null; JvmIdentifiableElement logicalContainer = getLogicalContainerProvider().getLogicalContainer(expression); if (logicalContainer instanceof JvmOperation) { return getLightweightType(logicalContainer); } if (expression instanceof XClosure) { IResolvedTypes resolvedTypes = batchTypeResolver.resolveTypes(expression); LightweightTypeReference type = resolvedTypes.getExpectedType(expression); if (type == null) { type = resolvedTypes.getActualType(expression); } if (type == null) { return null; } FunctionTypeReference functionType = type.tryConvertToFunctionTypeReference(false); if (functionType != null) { return functionType.getReturnType(); } return null; } XExpression containerExpression = EcoreUtil2.getContainerOfType(expression.eContainer(), XExpression.class); if (containerExpression == null) { LightweightTypeReference returnType = getLightweightReturnType(expression); return returnType; } return findRealReturnType(containerExpression); }
LightweightTypeReference expectedType = batchTypeResolver.resolveTypes(literal).getExpectedType(literal); boolean skipTypeName = false; if (expectedType != null && expectedType.isArray()) {