@Override protected ExpressionAwareStackedResolvedTypes pushTypes(XExpression expression) { return getResolvedTypes().pushTypes(expression); }
protected ExpressionAwareStackedResolvedTypes pushTypes(XExpression expression) { return getResolvedTypes().pushTypes(expression); }
protected IConstructorLinkingCandidate createResolvedLink(XConstructorCall constructorCall, JvmConstructor resolvedTo) { StackedResolvedTypes stackedResolvedTypes = resolvedTypes.pushTypes(constructorCall); ExpressionTypeComputationState state = createExpressionComputationState(constructorCall, stackedResolvedTypes); return new ResolvedConstructor(constructorCall, resolvedTo, getSingleExpectation(state), state); }
protected StackedResolvedTypes declareTypeParameters(ResolvedTypes resolvedTypes, JvmIdentifiableElement declarator, Map<JvmIdentifiableElement, ResolvedTypes> resolvedTypesByContext) { StackedResolvedTypes childResolvedTypes = resolvedTypes.pushTypes(); if (declarator instanceof JvmTypeParameterDeclarator) { JvmTypeParameterDeclarator casted = (JvmTypeParameterDeclarator) declarator; if (isStatic(declarator) && !(declarator instanceof JvmConstructor)) { childResolvedTypes.replaceDeclaredTypeParameters(casted.getTypeParameters()); } else { childResolvedTypes.addDeclaredTypeParameters(casted.getTypeParameters()); } } resolvedTypesByContext.put(declarator, childResolvedTypes); return childResolvedTypes; }
StackedResolvedTypes demandComputedTypes = resolvedTypes.pushTypes(); final AbstractTypeComputationState forked = withNonVoidExpectation(demandComputedTypes); ForwardingResolvedTypes demandResolvedTypes = new ForwardingResolvedTypes() {
protected IConstructorLinkingCandidate createCandidate(XConstructorCall constructorCall, IIdentifiableElementDescription description) { StackedResolvedTypes stackedResolvedTypes = resolvedTypes.pushTypes(constructorCall); ExpressionTypeComputationState state = createExpressionComputationState(constructorCall, stackedResolvedTypes); if (description instanceof ScopeProviderAccess.ErrorDescription) { return new UnresolvableConstructorCall(constructorCall, ((ScopeProviderAccess.ErrorDescription) description).getNode(), description.getName().toString(), state); } else if (description.getElementOrProxy() instanceof JvmType) { return new TypeInsteadOfConstructorLinkingCandidate(constructorCall, description, state); } else { return new ConstructorLinkingCandidate(constructorCall, description, getSingleExpectation(state), state); } }
protected IFeatureLinkingCandidate createCandidate(XAbstractFeatureCall featureCall, final StackedResolvedTypes demandComputedTypes, IIdentifiableElementDescription description) { if (description.getSyntacticReceiverType() != null) { return createCandidateWithReceiverType(featureCall, demandComputedTypes, description); } // pretty much the same constraints as in #createCandidateWithReceiverType ExpressionAwareStackedResolvedTypes resolvedTypes = this.resolvedTypes.pushTypes(featureCall); ExpressionTypeComputationState state = createExpressionComputationState(featureCall, resolvedTypes); if (description instanceof ScopeProviderAccess.ErrorDescription) { ScopeProviderAccess.ErrorDescription errorDescription = (ScopeProviderAccess.ErrorDescription) description; boolean followUpError = errorDescription.isFollowUpError(); if (followUpError) { return new FollowUpError(featureCall, state); } return new UnresolvableFeatureCall(featureCall, errorDescription.getNode(), description.getName().toString(), state); } else if (description.isTypeLiteral()) { return new TypeLiteralLinkingCandidate(featureCall, description, getSingleExpectation(state), state); } else { return new FeatureLinkingCandidate(featureCall, description, getSingleExpectation(state), state); } }
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); }