protected IScope createStaticScope(final EObject context, Resource resource, IScope parent) { JvmDeclaredType contextType = getContextType(context); List<IJvmFeatureDescriptionProvider> descriptionProviders = getStaticFeatureDescriptionProviders(resource, contextType); Function<JvmFeatureDescription, ITypeArgumentContext> contextFactory = new Function<JvmFeatureDescription, ITypeArgumentContext>() { public ITypeArgumentContext apply(JvmFeatureDescription from) { JvmIdentifiableElement feature = from.getEObjectOrProxy(); if (feature instanceof JvmExecutable && context instanceof XAbstractFeatureCall) { XAbstractFeatureCall featureCall = (XAbstractFeatureCall) context; List<XExpression> arguments = featureCallToJavaMapping.getActualArguments( featureCall, feature, from.getImplicitReceiver(), from.getImplicitArgument()); ITypeArgumentContext result = typeArgumentContextHelper.getTypeArgumentContext( featureCall, arguments, null, feature); return result; } return null; } }; return jvmFeatureScopeProvider.createFeatureScopeForTypeRef( parent, null, contextFactory, descriptionProviders); }
protected JvmFeatureScope createFeatureScopeForTypeRef( final JvmTypeReference receiverType, final EObject expression, JvmDeclaredType currentContext, XExpression implicitReceiver, IScope parent) { class ContextFactory implements Function<JvmFeatureDescription, ITypeArgumentContext> { public ITypeArgumentContext apply(JvmFeatureDescription from) { JvmIdentifiableElement feature = from.getEObjectOrProxy(); if (feature instanceof JvmExecutable && expression instanceof XAbstractFeatureCall) { XAbstractFeatureCall featureCall = (XAbstractFeatureCall) expression; List<XExpression> arguments = featureCallToJavaMapping.getActualArguments( featureCall, feature, from.getImplicitReceiver(), from.getImplicitArgument()); ITypeArgumentContext result = typeArgumentContextHelper.getTypeArgumentContext( featureCall, arguments, Providers.of(receiverType), feature); return result; } return null; } } if (expression instanceof XAssignment) { List<IJvmFeatureDescriptionProvider> providers = getFeatureDescriptionProvidersForAssignment( receiverType, (XAssignment) expression, currentContext, implicitReceiver); return jvmFeatureScopeProvider.createFeatureScopeForTypeRef( parent, receiverType, new ContextFactory(), providers); } else { List<IJvmFeatureDescriptionProvider> providers = getFeatureDescriptionProviders( receiverType, expression, currentContext, implicitReceiver); return jvmFeatureScopeProvider.createFeatureScopeForTypeRef( parent, receiverType, new ContextFactory(), providers); } }