예제 #1
0
 public void genFunctionOrProperty(
     @NotNull JetTypeParameterListOwner functionOrProperty, @NotNull ClassBuilder classBuilder) {
   FunctionCodegen functionCodegen = new FunctionCodegen(context, classBuilder, state, this);
   if (functionOrProperty instanceof JetNamedFunction) {
     try {
       functionCodegen.gen((JetNamedFunction) functionOrProperty);
     } catch (ProcessCanceledException e) {
       throw e;
     } catch (CompilationException e) {
       throw e;
     } catch (Exception e) {
       throw new CompilationException(
           "Failed to generate function " + functionOrProperty.getName(), e, functionOrProperty);
     }
   } else if (functionOrProperty instanceof JetProperty) {
     try {
       new PropertyCodegen(context, classBuilder, functionCodegen, this)
           .gen((JetProperty) functionOrProperty);
     } catch (ProcessCanceledException e) {
       throw e;
     } catch (CompilationException e) {
       throw e;
     } catch (Exception e) {
       throw new CompilationException(
           "Failed to generate property " + functionOrProperty.getName(), e, functionOrProperty);
     }
   } else {
     throw new IllegalArgumentException("Unknown parameter: " + functionOrProperty);
   }
 }
예제 #2
0
  private void done() {
    if (clInit != null) {
      clInit.v.visitInsn(RETURN);
      FunctionCodegen.endVisit(clInit.v, "static initializer", element);
    }

    v.done();
  }