コード例 #1
0
ファイル: BodyResolver.java プロジェクト: abond/kotlin
  private void resolvePropertyDeclarationBodies(@NotNull BodiesResolveContext c) {

    // Member properties
    Set<JetProperty> processed = Sets.newHashSet();
    for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry :
        c.getDeclaredClasses().entrySet()) {
      if (!(entry.getKey() instanceof JetClass)) continue;
      JetClass jetClass = (JetClass) entry.getKey();
      ClassDescriptorWithResolutionScopes classDescriptor = entry.getValue();

      for (JetProperty property : jetClass.getProperties()) {
        PropertyDescriptor propertyDescriptor = c.getProperties().get(property);
        assert propertyDescriptor != null;

        resolveProperty(
            c,
            classDescriptor.getScopeForMemberDeclarationResolution(),
            property,
            propertyDescriptor);
        processed.add(property);
      }
    }

    // Top-level properties & properties of objects
    for (Map.Entry<JetProperty, PropertyDescriptor> entry : c.getProperties().entrySet()) {
      JetProperty property = entry.getKey();
      if (processed.contains(property)) continue;

      PropertyDescriptor propertyDescriptor = entry.getValue();

      resolveProperty(c, null, property, propertyDescriptor);
    }
  }
コード例 #2
0
ファイル: BodyResolver.java プロジェクト: abond/kotlin
  private void resolveDelegationSpecifierLists(@NotNull BodiesResolveContext c) {
    // TODO : Make sure the same thing is not initialized twice
    for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry :
        c.getDeclaredClasses().entrySet()) {
      JetClassOrObject classOrObject = entry.getKey();
      ClassDescriptorWithResolutionScopes descriptor = entry.getValue();

      resolveDelegationSpecifierList(
          c.getOuterDataFlowInfo(),
          classOrObject,
          descriptor,
          descriptor.getUnsubstitutedPrimaryConstructor(),
          descriptor.getScopeForClassHeaderResolution(),
          descriptor.getScopeForMemberDeclarationResolution());
    }
  }
コード例 #3
0
ファイル: BodyResolver.java プロジェクト: abond/kotlin
 public void resolveAnonymousInitializer(
     @NotNull DataFlowInfo outerDataFlowInfo,
     @NotNull JetClassInitializer anonymousInitializer,
     @NotNull ClassDescriptorWithResolutionScopes classDescriptor) {
   LexicalScope scopeForInitializers = classDescriptor.getScopeForInitializerResolution();
   if (!classDescriptor.getConstructors().isEmpty()) {
     JetExpression body = anonymousInitializer.getBody();
     if (body != null) {
       expressionTypingServices.getType(
           scopeForInitializers, body, NO_EXPECTED_TYPE, outerDataFlowInfo, trace);
     }
     processModifiersOnInitializer(anonymousInitializer, scopeForInitializers);
   } else {
     trace.report(ANONYMOUS_INITIALIZER_IN_TRAIT.on(anonymousInitializer));
     processModifiersOnInitializer(anonymousInitializer, scopeForInitializers);
   }
 }
コード例 #4
0
ファイル: BodyResolver.java プロジェクト: abond/kotlin
  private void resolvePrimaryConstructorParameters(@NotNull BodiesResolveContext c) {
    for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry :
        c.getDeclaredClasses().entrySet()) {
      JetClassOrObject klass = entry.getKey();
      ClassDescriptorWithResolutionScopes classDescriptor = entry.getValue();
      ConstructorDescriptor unsubstitutedPrimaryConstructor =
          classDescriptor.getUnsubstitutedPrimaryConstructor();
      if (unsubstitutedPrimaryConstructor != null) {
        ForceResolveUtil.forceResolveAllContents(unsubstitutedPrimaryConstructor.getAnnotations());

        LexicalScope parameterScope =
            getPrimaryConstructorParametersScope(
                classDescriptor.getScopeForClassHeaderResolution(),
                unsubstitutedPrimaryConstructor);
        valueParameterResolver.resolveValueParameters(
            klass.getPrimaryConstructorParameters(),
            unsubstitutedPrimaryConstructor.getValueParameters(),
            parameterScope,
            c.getOuterDataFlowInfo(),
            trace);
      }
    }
  }