コード例 #1
0
 private static void functionAdditionalResolve(
     ResolveSession resolveSession,
     JetNamedFunction namedFunction,
     DelegatingBindingTrace trace,
     JetFile file) {
   BodyResolver bodyResolver =
       createBodyResolverWithEmptyContext(trace, file, resolveSession.getModuleConfiguration());
   JetScope scope =
       resolveSession
           .getInjector()
           .getScopeProvider()
           .getResolutionScopeForDeclaration(namedFunction);
   FunctionDescriptor functionDescriptor =
       (FunctionDescriptor) resolveSession.resolveToDescriptor(namedFunction);
   bodyResolver.resolveFunctionBody(trace, namedFunction, functionDescriptor, scope);
 }
コード例 #2
0
  private static boolean initializerAdditionalResolve(
      ResolveSession resolveSession,
      JetClassInitializer classInitializer,
      DelegatingBindingTrace trace,
      JetFile file) {
    BodyResolver bodyResolver =
        createBodyResolverWithEmptyContext(trace, file, resolveSession.getModuleConfiguration());
    JetClassOrObject classOrObject =
        PsiTreeUtil.getParentOfType(classInitializer, JetClassOrObject.class);
    LazyClassDescriptor classOrObjectDescriptor =
        (LazyClassDescriptor) resolveSession.resolveToDescriptor(classOrObject);
    bodyResolver.resolveAnonymousInitializers(
        classOrObject,
        classOrObjectDescriptor.getUnsubstitutedPrimaryConstructor(),
        classOrObjectDescriptor.getScopeForPropertyInitializerResolution());

    return true;
  }
コード例 #3
0
  private static void delegationSpecifierAdditionalResolve(
      final ResolveSession resolveSession,
      final JetDelegationSpecifierList specifier,
      DelegatingBindingTrace trace,
      JetFile file) {
    BodyResolver bodyResolver =
        createBodyResolverWithEmptyContext(trace, file, resolveSession.getModuleConfiguration());

    JetClassOrObject classOrObject = (JetClassOrObject) specifier.getParent();
    LazyClassDescriptor descriptor =
        (LazyClassDescriptor) resolveSession.resolveToDescriptor(classOrObject);

    // Activate resolving of supertypes
    descriptor.getTypeConstructor().getSupertypes();

    bodyResolver.resolveDelegationSpecifierList(
        classOrObject,
        descriptor,
        descriptor.getUnsubstitutedPrimaryConstructor(),
        descriptor.getScopeForClassHeaderResolution(),
        descriptor.getScopeForMemberDeclarationResolution());
  }
コード例 #4
0
  private static void propertyAdditionalResolve(
      final ResolveSession resolveSession,
      final JetProperty jetProperty,
      DelegatingBindingTrace trace,
      JetFile file) {
    final JetScope propertyResolutionScope =
        resolveSession
            .getInjector()
            .getScopeProvider()
            .getResolutionScopeForDeclaration(jetProperty);

    BodyResolveContextForLazy bodyResolveContext =
        new BodyResolveContextForLazy(
            new Function<JetDeclaration, JetScope>() {
              @Override
              public JetScope apply(JetDeclaration declaration) {
                assert declaration.getParent() == jetProperty
                    : "Must be called only for property accessors, but called for " + declaration;
                return propertyResolutionScope;
              }
            });
    BodyResolver bodyResolver =
        createBodyResolver(
            trace, file, bodyResolveContext, resolveSession.getModuleConfiguration());
    PropertyDescriptor descriptor =
        (PropertyDescriptor) resolveSession.resolveToDescriptor(jetProperty);

    JetExpression propertyInitializer = jetProperty.getInitializer();

    if (propertyInitializer != null) {
      bodyResolver.resolvePropertyInitializer(
          jetProperty, descriptor, propertyInitializer, propertyResolutionScope);
    }

    bodyResolver.resolvePropertyAccessors(jetProperty, descriptor);
  }