Exemple #1
0
  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);
    }
  }
Exemple #2
0
  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());
    }
  }
Exemple #3
0
  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);
      }
    }
  }