@Override public LightweightTypeReference getActualType(XExpression expression) { IResolvedTypes delegate = getDelegate(expression); return delegate.getActualType(expression); }
protected LightweightTypeReference getLightweightType(XExpression expr) { IResolvedTypes resolvedTypes = getResolvedTypes(expr); LightweightTypeReference actualType = resolvedTypes.getActualType(expr); return actualType; }
protected LightweightTypeReference getLightweightType(JvmIdentifiableElement identifiable) { IResolvedTypes resolvedTypes = getResolvedTypes(identifiable); LightweightTypeReference actualType = resolvedTypes.getActualType(identifiable); return actualType; }
@Override public LightweightTypeReference getActualType(XExpression expression) { return delegate().getActualType(expression); }
protected LightweightTypeReference getActualType(EObject context, JvmIdentifiableElement element) { return typeResolver.resolveTypes(context).getActualType(element); }
@Override public LightweightTypeReference getActualType(JvmIdentifiableElement identifiable) { for(int i = 0; i < resolvers.size(); i++) { AbstractRootedReentrantTypeResolver resolver = resolvers.get(i); if (resolver.isHandled(identifiable)) { IResolvedTypes delegate = getDelegate(i); return delegate.getActualType(identifiable); } } return null; }
private boolean mustCheckForMandatoryTypeCast(IResolvedTypes resolvedTypes, XExpression expression) { if (resolvedTypes.isRefinedType(expression)) { return true; } LightweightTypeReference actualType = resolvedTypes.getActualType(expression); if (actualType != null && actualType.isMultiType()) { return true; } return false; }
private LightweightTypeReference determineReturnType(JvmOperation operation) { // operation could have been removed by AA, thus the resource is possibly null if(operation != null && operation.eResource() != null) { return batchTypeResolver.resolveTypes(operation).getActualType(operation); } return null; }
/** Compute the expected type of the given expression. * * @param expr the expression. * @return the expected type of the argument. */ protected LightweightTypeReference getExpectedType(XExpression expr) { final IResolvedTypes resolvedTypes = getTypeResolver().resolveTypes(expr); final LightweightTypeReference actualType = resolvedTypes.getActualType(expr); return actualType; }
protected LightweightTypeReference resolveType(XExpression element, Class<?> clazz) { LightweightTypeReference elementType = typeResolver.resolveTypes(element).getActualType(element); return elementType != null && elementType.isType(clazz) ? elementType : null; }
/** Compute the expected type of the given expression. * * @param expr the expression. * @return the expected type of the argument. */ protected LightweightTypeReference getExpectedType(XExpression expr) { final IResolvedTypes resolvedTypes = getTypeResolver().resolveTypes(expr); final LightweightTypeReference actualType = resolvedTypes.getActualType(expr); return actualType; }
/** * @param context unused in this context but required for dispatching * @param indicator unused in this context but required for dispatching */ protected Object _doEvaluate(XStringLiteral literal, IEvaluationContext context, CancelIndicator indicator) { LightweightTypeReference type = typeResolver.resolveTypes(literal).getActualType(literal); if (type != null && (type.isType(Character.TYPE) || type.isType(Character.class))) { return literal.getValue().charAt(0); } return literal.getValue(); }
protected LightweightTypeReference getReceiverType(XAbstractFeatureCall featureCall, IResolvedTypes resolvedTypes, ITypeReferenceOwner owner) { XExpression receiver = featureCall.getActualReceiver(); if (receiver == null) { // static feature call JvmOperation operation = (JvmOperation) featureCall.getFeature(); JvmDeclaredType declaringType = operation.getDeclaringType(); return owner.newParameterizedTypeReference(declaringType); } return resolvedTypes.getActualType(receiver); } }
protected IScope createImplicitStaticScope(QualifiedName implicitName, XAbstractFeatureCall featureCall, IFeatureScopeSession session, IResolvedTypes resolvedTypes, IScope parent) { IEObjectDescription thisDescription = session.getLocalElement(implicitName); if (thisDescription != null) { JvmIdentifiableElement thisElement = (JvmIdentifiableElement) thisDescription.getEObjectOrProxy(); LightweightTypeReference type = resolvedTypes.getActualType(thisElement); if (type != null && !type.isUnknown()) { TypeBucket receiverBucket = new TypeBucket(-1, Collections.singletonList(type.getType()), resolvedFeaturesProvider); return createStaticFeatureScope(featureCall, null, type, receiverBucket, parent, session); } } return parent; }
protected EvaluationResult _internalEvaluate(final XNumberLiteral it, final EvaluationContext context) { final Number value = this.numberLiterals.numberValue(it, this.numberLiterals.getJavaType(it)); boolean _isPrimitive = context.getResolvedTypes().getActualType(it).isPrimitive(); return new EvaluationResult(value, _isPrimitive); }
protected IScope createConstructorDelegates(EObject context, IScope parent, IFeatureScopeSession session, IResolvedTypes resolvedTypes) { if (session.isConstructorContext()) { IEObjectDescription thisDescription = session.getLocalElement(THIS); if (thisDescription != null) { JvmIdentifiableElement thisElement = (JvmIdentifiableElement) thisDescription.getEObjectOrProxy(); LightweightTypeReference type = resolvedTypes.getActualType(thisElement); if (type != null && !type.isUnknown()) { return createConstructorDelegateScope(context, type, parent, session); } } } return parent; }
protected JvmTypeReference doGetTypReferenceWithAnotherTypeReference() { IResolvedTypes resolveTypes = typeResolver.resolveTypes(expression); LightweightTypeReference actualType = returnType ? resolveTypes.getReturnType(expression) : resolveTypes.getActualType(expression); if (actualType == null) { actualType = returnType ? resolvedTypes.getExpectedReturnType(expression) : resolvedTypes.getExpectedType(expression); } if (actualType == null) return null; return toJavaCompliantTypeReference(convertLocalType(actualType), session); }
@Check public void checkVariableIsNotInferredAsVoid(XVariableDeclaration declaration) { if (declaration.getType() != null) return; LightweightTypeReference variableType = typeResolver.resolveTypes(declaration).getActualType((JvmIdentifiableElement) declaration); // TODO move to type resolver if (variableType != null && variableType.isPrimitiveVoid()) { error("void is an invalid type for the variable " + declaration.getName(), declaration, XbasePackage.Literals.XVARIABLE_DECLARATION__NAME, INVALID_USE_OF_TYPE); } }
protected IScope createImplicitExtensionScope(QualifiedName implicitName, EObject featureCall, IFeatureScopeSession session, IResolvedTypes resolvedTypes, IScope parent) { IEObjectDescription thisDescription = session.getLocalElement(implicitName); if (thisDescription != null) { JvmIdentifiableElement thisElement = (JvmIdentifiableElement) thisDescription.getEObjectOrProxy(); LightweightTypeReference type = resolvedTypes.getActualType(thisElement); if (type != null && !type.isUnknown()) { XFeatureCall implicitReceiver = xbaseFactory.createXFeatureCall(); implicitReceiver.setFeature(thisElement); return createStaticExtensionsScope(featureCall, implicitReceiver, type, true, parent, session); } } return parent; }
protected Object _doEvaluate(XIfExpression ifExpression, IEvaluationContext context, CancelIndicator indicator) { Object conditionResult = internalEvaluate(ifExpression.getIf(), context, indicator); if (Boolean.TRUE.equals(conditionResult)) { return internalEvaluate(ifExpression.getThen(), context, indicator); } else { if (ifExpression.getElse() == null) return getDefaultObjectValue(typeResolver.resolveTypes(ifExpression).getActualType(ifExpression)); return internalEvaluate(ifExpression.getElse(), context, indicator); } }