protected XExpression getSyntacticalReceiver(final XAbstractFeatureCall call) { return new FeatureLinkHelper().getSyntacticReceiver(call); }
protected XExpression getSyntacticReceiver() { return new FeatureLinkHelper().getSyntacticReceiver(getFeatureCall()); } }
@Override protected List<XExpression> getSyntacticArguments() { return new FeatureLinkHelper().getSyntacticArguments(getFeatureCall()); }
@Override public List<JvmTypeParameter> getDeclaredTypeParameters() { return new FeatureLinkHelper().getDeclaredTypeParameters(getConstructor()); }
protected XExpression getSyntacticReceiver() { return new FeatureLinkHelper().getSyntacticReceiver(getFeatureCall()); }
@Override protected List<JvmTypeParameter> getDeclaredTypeParameters() { if (isAnonymousClassConstructorCall()) { JvmDeclaredType anonymousType = getConstructor().getDeclaringType(); JvmTypeReference superType = Iterables.getLast(anonymousType.getSuperTypes()); JvmType rawSuperType = superType.getType(); if (rawSuperType instanceof JvmTypeParameterDeclarator) { return ((JvmTypeParameterDeclarator) rawSuperType).getTypeParameters(); } return Collections.emptyList(); } return new FeatureLinkHelper().getDeclaredTypeParameters(getConstructor()); } }
@Override public void applyToComputationState() { super.applyToComputationState(); XExpression receiver = getReceiver(); if (receiver != null) { LightweightTypeReference receiverType = getReceiverType(); if (receiverType == null) { throw new IllegalStateException("Cannot determine receiver's type"); } LightweightTypeReference expectedReceiverType = new FeatureLinkHelper().getExpectedReceiverType(getFeature(), receiverType); TypeExpectation refinedExpectation = new TypeExpectation(expectedReceiverType, getState(), false); demandComputedTypes.refineExpectedType(receiver, refinedExpectation); } demandComputedTypes.mergeIntoParent(); } };
@Override public void applyToComputationState() { FeatureLinkHelper helper = new FeatureLinkHelper(); XExpression receiver = helper.getSyntacticReceiver(getFeatureCall()); state.withNonVoidExpectation().computeTypes(receiver); for(XExpression argument: helper.getSyntacticArguments(getFeatureCall())) { state.withNonVoidExpectation().computeTypes(argument); } }
@Override public void applyToComputationState() { ResolvedTypes resolvedTypes = getState().getResolvedTypes(); LightweightTypeReference actualType = resolvedTypes.getActualType(getFeature()); if (actualType == null) throw new IllegalStateException("Cannot determine actual type of already resolved implicit receiver"); LightweightTypeReference expectedReceiverType = new FeatureLinkHelper().getExpectedReceiverType(getOwner().getFeature(), actualType); if (expectedReceiverType != null) expectedReceiverType = expectedReceiverType.copyInto(resolvedTypes.getReferenceOwner()); TypeExpectation expectation = new TypeExpectation(expectedReceiverType, getState(), false); resolvedTypes.acceptType(getFeatureCall(), expectation, actualType.copyInto(resolvedTypes.getReferenceOwner()), false, ConformanceFlags.UNCHECKED); super.applyToComputationState(); }
protected void applyImplicitReceiver() { if (!isStatic()) { XExpression implicitReceiver = getImplicitReceiver(); if (implicitReceiver != null) { ResolvedTypes resolvedTypes = getState().getResolvedTypes(); LightweightTypeReference receiverType = getImplicitReceiverType(); if (receiverType == null) { throw new IllegalStateException("Cannot determine the receiver's type"); } LightweightTypeReference expectedReceiverType = new FeatureLinkHelper().getExpectedReceiverType(getFeature(), receiverType); if (expectedReceiverType != null) expectedReceiverType = expectedReceiverType.copyInto(resolvedTypes.getReferenceOwner()); if (receiverType.isSynonym()) { receiverType = receiverType.getMultiTypeComponents().get(0); } TypeExpectation expectation = new TypeExpectation(expectedReceiverType, getState(), false); resolvedTypes.acceptType(implicitReceiver, expectation, receiverType.copyInto(resolvedTypes.getReferenceOwner()), false, ConformanceFlags.UNCHECKED); if (implicitReceiver instanceof XAbstractFeatureCall) { new ImplicitReceiver(getFeatureCall(), (XAbstractFeatureCall) implicitReceiver, getState()).applyToComputationState(); } else { throw new IllegalStateException("unexpected implicit receiver, was: " + implicitReceiver); } } } }
protected IFeatureLinkingCandidate createResolvedLink(XAbstractFeatureCall featureCall, JvmIdentifiableElement resolvedTo) { ExpressionAwareStackedResolvedTypes resolvedTypes = this.resolvedTypes.pushTypes(featureCall); ExpressionTypeComputationState state = createExpressionComputationState(featureCall, resolvedTypes); FeatureLinkHelper helper = new FeatureLinkHelper(); XExpression syntacticReceiver = helper.getSyntacticReceiver(featureCall); if (syntacticReceiver != null) { AbstractTypeComputationState child = state.withNonVoidExpectation(); child.computeTypes(syntacticReceiver); } XExpression implicitReceiver = featureCall.getImplicitReceiver(); if (implicitReceiver != null) { AbstractTypeComputationState child = state.withNonVoidExpectation(); child.computeTypes(implicitReceiver); } XExpression implicitFirstArgument = featureCall.getImplicitFirstArgument(); if (implicitFirstArgument != null) { AbstractTypeComputationState child = state.withNonVoidExpectation(); child.computeTypes(implicitFirstArgument); } if (featureCall.isTypeLiteral() || featureCall.isPackageFragment()) { return new ResolvedTypeLiteral(featureCall, resolvedTo, getSingleExpectation(state), state); } return new ResolvedFeature(featureCall, resolvedTo, helper, getSingleExpectation(state), state); }
throw new IllegalStateException("Cannot determine receiver's type"); LightweightTypeReference expectedReceiverType = new FeatureLinkHelper().getExpectedReceiverType(getFeature(), receiverType); TypeExpectation refinedExpectation = new TypeExpectation(expectedReceiverType, getState(), false); demandComputedTypes.refineExpectedType(receiver, refinedExpectation);