protected IRExpression pushOuterForOuterSymbol() { IRExpression root = pushOuter(); IType currentClass = getGosuClass(); while (currentClass instanceof IBlockClass) { currentClass = currentClass.getEnclosingType(); IRMethod irMethod = IRMethodFactory.createIRMethod( currentClass, OUTER_ACCESS, currentClass.getEnclosingType(), new IType[] {currentClass}, AccessibilityUtil.forOuterAccess(), true); root = callMethod(irMethod, null, Collections.singletonList(root)); } IType outer = currentClass.getEnclosingType(); while (outer instanceof IBlockClass) { IType enclosing = getRuntimeEnclosingType(outer); IRMethod irMethod = IRMethodFactory.createIRMethod( outer, OUTER_ACCESS, enclosing, new IType[] {outer}, AccessibilityUtil.forOuterAccess(), true); root = callMethod(irMethod, null, Collections.singletonList(root)); outer = enclosing; } return root; }
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); }