Ejemplo n.º 1
0
  private String inventAnonymousClassName(JetElement declaration) {
    String top = peekFromStack(nameStack);
    Integer cnt = anonymousSubclassesCount.get(top);
    if (cnt == null) {
      cnt = 0;
    }
    String name = top + "$" + (cnt + 1);
    ClassDescriptor descriptor = bindingContext.get(CLASS, declaration);
    if (descriptor == null) {
      if (declaration instanceof JetFunctionLiteralExpression
          || declaration instanceof JetNamedFunction
          || declaration instanceof JetObjectLiteralExpression) {
      } else {
        throw new IllegalStateException(
            "Class-less declaration which is not JetFunctionLiteralExpression|JetNamedFunction|JetObjectLiteralExpression : "
                + declaration.getClass().getName());
      }
    }
    anonymousSubclassesCount.put(top, cnt + 1);

    return name;
  }
Ejemplo n.º 2
0
 @Override
 public void visitJetElement(JetElement element) {
   super.visitJetElement(element);
   element.acceptChildren(this);
 }