Exemple #1
0
  private void putCapturedInLocal(
      @NotNull Type type,
      @Nullable StackValue stackValue,
      @Nullable ValueParameterDescriptor valueParameterDescriptor,
      int capturedParamIndex) {
    if (!asFunctionInline && Type.VOID_TYPE != type) {
      // TODO remap only inlinable closure => otherwise we could get a lot of problem
      boolean couldBeRemapped = !shouldPutValue(type, stackValue, valueParameterDescriptor);
      StackValue remappedIndex = couldBeRemapped ? stackValue : null;

      ParameterInfo info;
      if (capturedParamIndex >= 0) {
        CapturedParamDesc capturedParamInfoInLambda =
            activeLambda.getCapturedVars().get(capturedParamIndex);
        info =
            invocationParamBuilder.addCapturedParam(
                capturedParamInfoInLambda, capturedParamInfoInLambda.getFieldName());
        info.setRemapValue(remappedIndex);
      } else {
        info = invocationParamBuilder.addNextParameter(type, false, remappedIndex);
      }

      putParameterOnStack(info);
    }
  }