Ejemplo n.º 1
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);
      }
    }
  }
Ejemplo n.º 2
0
  public void resolveSecondaryConstructorBody(
      @NotNull final DataFlowInfo outerDataFlowInfo,
      @NotNull final BindingTrace trace,
      @NotNull final JetSecondaryConstructor constructor,
      @NotNull final ConstructorDescriptor descriptor,
      @NotNull LexicalScope declaringScope) {
    ForceResolveUtil.forceResolveAllContents(descriptor.getAnnotations());

    final CallChecker callChecker = new ConstructorHeaderCallChecker(descriptor);
    resolveFunctionBody(
        outerDataFlowInfo,
        trace,
        constructor,
        descriptor,
        declaringScope,
        new Function1<LexicalScope, DataFlowInfo>() {
          @Override
          public DataFlowInfo invoke(@NotNull LexicalScope headerInnerScope) {
            return resolveSecondaryConstructorDelegationCall(
                outerDataFlowInfo, trace, headerInnerScope, constructor, descriptor, callChecker);
          }
        },
        callChecker);
  }