Ejemplo n.º 1
0
  @Override
  public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
    FunctionDescriptor functionDescriptor =
        (FunctionDescriptor) bindingContext.get(DECLARATION_TO_DESCRIPTOR, expression);
    // working around a problem with shallow analysis
    if (functionDescriptor == null) return;

    String name = inventAnonymousClassName(expression);
    ClassDescriptor classDescriptor = recordClassForFunction(functionDescriptor);
    recordClosure(
        bindingTrace,
        expression,
        classDescriptor,
        peekFromStack(classStack),
        JvmClassName.byInternalName(name),
        true);

    classStack.push(classDescriptor);
    nameStack.push(name);
    super.visitFunctionLiteralExpression(expression);
    nameStack.pop();
    classStack.pop();
  }