コード例 #1
0
    public void serialize(FunctionDescriptor fun) {
      serialize(fun.getModality());
      sb.append(" ");

      if (!fun.getAnnotations().isEmpty()) {
        new Serializer(sb).serializeSeparated(fun.getAnnotations(), " ");
        sb.append(" ");
      }

      if (!fun.getOverriddenDescriptors().isEmpty()) {
        sb.append("override /*" + fun.getOverriddenDescriptors().size() + "*/ ");
      }

      if (fun instanceof ConstructorDescriptor) {
        sb.append("/*constructor*/ ");
      }
      sb.append("fun ");
      if (!fun.getTypeParameters().isEmpty()) {
        sb.append("<");
        new Serializer(sb).serializeCommaSeparated(fun.getTypeParameters());
        sb.append(">");
      }

      if (fun.getReceiverParameter().exists()) {
        new TypeSerializer(sb).serialize(fun.getReceiverParameter());
        sb.append(".");
      }

      sb.append(fun.getName());
      sb.append("(");
      new TypeSerializer(sb).serializeCommaSeparated(fun.getValueParameters());
      sb.append("): ");
      new TypeSerializer(sb).serialize(fun.getReturnType());
    }
コード例 #2
0
ファイル: JsDescriptorUtils.java プロジェクト: hhariri/kotlin
 @Nullable
 public static FunctionDescriptor getOverriddenDescriptor(
     @NotNull FunctionDescriptor functionDescriptor) {
   Set<? extends FunctionDescriptor> overriddenDescriptors =
       functionDescriptor.getOverriddenDescriptors();
   if (overriddenDescriptors.isEmpty()) {
     return null;
   } else {
     // TODO: for now translator can't deal with multiple inheritance good enough
     return overriddenDescriptors.iterator().next();
   }
 }