Ejemplo n.º 1
0
  public void gen(@NotNull KtNamedFunction function) {
    SimpleFunctionDescriptor functionDescriptor =
        bindingContext.get(BindingContext.FUNCTION, function);
    assert functionDescriptor != null
        : "No descriptor for function "
            + function.getText()
            + "\n"
            + "in "
            + function.getContainingFile().getVirtualFile();

    if (owner.getContextKind() != OwnerKind.DEFAULT_IMPLS || function.hasBody()) {
      generateMethod(
          JvmDeclarationOriginKt.OtherOrigin(function, functionDescriptor),
          functionDescriptor,
          new FunctionGenerationStrategy.FunctionDefault(state, functionDescriptor, function));
    }

    generateDefaultIfNeeded(
        owner.intoFunction(functionDescriptor),
        functionDescriptor,
        owner.getContextKind(),
        DefaultParameterValueLoader.DEFAULT,
        function);

    generateOverloadsWithDefaultValues(function, functionDescriptor, functionDescriptor);
  }
Ejemplo n.º 2
0
 public void generateMethod(
     @NotNull JvmDeclarationOrigin origin,
     @NotNull FunctionDescriptor descriptor,
     @NotNull FunctionGenerationStrategy strategy) {
   generateMethod(origin, descriptor, owner.intoFunction(descriptor), strategy);
 }