IClass getExceptionType() { if(exceptionType instanceof IClass) return (IClass)exceptionType; return (IClass) (exceptionType = getType((Class)exceptionType)); }
@Override public void generate() { body(); }
@Override public Label getSerialStart() { return tryBlock.getStart(); }
void appendEpisode(KernelCatch catchBlock) { initEpisode(catchBlock); if (catches == null) { catches = new ArrayList<>(); getChildren().addAfter(tryBlock, catchBlock); } else { KernelCatch previous = catches.get(catches.size() - 1); IClass exceptionType = catchBlock.getExceptionType(); if (exceptionType != null && exceptionType.isChildOrEqual(previous.getExceptionType())) { throw new ASMSupportException("Unreachable catch block for " + exceptionType + ". It is already handled by the catch block for " + exceptionType); } getChildren().addAfter(previous, catchBlock); } catches.add(catchBlock); // Add Exception Table: addTreCatchInfo(tryBlock.getStart(), tryBlock.getEnd(), catchBlock.getStart(), catchBlock.getExceptionType()); }
@Override public void generate() { LocalVariable exception = getLocalAnonymousVariableModel(getExceptionType()); OperatorFactory.newOperator(Store.class, new Class[] { KernelProgramBlock.class, LocalVariable.class }, getExecutor(), exception); body(exception); }
@Override public void generate() { LocalVariable exception = getLocalAnonymousVariableModel(targetParent.getType(AnyException.class)); OperatorFactory.newOperator(Store.class, new Class[] { KernelProgramBlock.class, LocalVariable.class }, this, exception); // new Store(this, exception); ExceptionSerialBlock.this.finallyBlock.generateTo(this); if (!this.isFinish()) { throw_(exception); } }
void appendEpisode(KernelFinally finallyBlock) { if (this.finallyBlock != null) { throw new ASMSupportException("Finally block already exists."); } initEpisode(finallyBlock); this.finallyBlock = finallyBlock; // add implicit catch block; implicitCatch = new ImplicitCatch(); implicitCatch.setParent(targetParent); getChildren().setTail(implicitCatch); getChildren().setTail(finallyBlock); }
@Override public KernelFinally finally_(KernelFinally block) { ExceptionSerialBlock serial = getSerial(); if (serial.getFinally() != null) { throw new ASMSupportException("Already exists finally block."); } getSerial().appendEpisode(block); return block; }
@Override public KernelCatch catch_(KernelCatch catchBlock) { ExceptionSerialBlock serial = getSerial(); if (serial.getFinally() != null) { throw new ASMSupportException("Exists finally block. please create catch before finally block"); } getSerial().appendEpisode(catchBlock); return catchBlock; }
public ExceptionSerialBlock(KernelProgramBlock parent, KernelTry tryBlock) { super(parent); this.tryBlock = tryBlock; initEpisode(tryBlock); getChildren().add(tryBlock); }
@Override public void generate() { body(); }
@Override public final KernelTry try_(final KernelTry t) { new ExceptionSerialBlock(getExecutor(), t); return t; }
@Override protected void doExecute(MethodExecuteContext context) { for (InstructionNode node : getChildren()) { node.execute(context); } }
@Override protected void doExecute(MethodExecuteContext context) { for (InstructionNode node : getChildren()) { node.execute(context); } }
@Override public Catch catch_(Catch catchBlock) { catchBlock.parent = parent; getDelegate().catch_(catchBlock.getDelegate()); return catchBlock; }
@Override public Catch catch_(Catch catchBlock) { catchBlock.parent = parent; getDelegate().catch_(catchBlock.getDelegate()); return catchBlock; }
@Override public KernelCatch catch_(KernelCatch catchBlock) { ExceptionSerialBlock serial = getSerial(); if (serial.getFinally() != null) { throw new ASMSupportException("Exists finally block. please create catch before finally block"); } getSerial().appendEpisode(catchBlock); return catchBlock; }
@Override public KernelFinally finally_(KernelFinally block) { ExceptionSerialBlock serial = getSerial(); if (serial.getFinally() != null) { throw new ASMSupportException("Already exists finally block."); } getSerial().appendEpisode(block); return block; }