コード例 #1
0
  private void addDefaultConstructor(IRClass irClass) {
    _context.initBodyContext(false);
    _context.pushScope(true);

    List<IRStatement> statements = new ArrayList<IRStatement>();
    IRMethod irMethod =
        IRMethodFactory.createConstructorIRMethod(_cc().getSuperType(), new IRType[0]);
    statements.add(
        new IRMethodCallStatement(
            callSpecialMethod(
                getDescriptor(_cc().getSuperType()),
                irMethod,
                pushThis(),
                Collections.<IRExpression>emptyList())));
    statements.add(new IRReturnStatement());

    IRMethodStatement methodStatement =
        new IRMethodStatement(
            new IRStatementList(true, statements),
            "<init>",
            Opcodes.ACC_PUBLIC,
            IRTypeConstants.pVOID(),
            Collections.<IRSymbol>emptyList());

    irClass.addMethod(methodStatement);
  }
コード例 #2
0
 @Override
 public IRType getReturnType() {
   return IRTypeConstants.pVOID();
 }