1016 boolean canExit = false;
1017 if(reachable) {
1018 jumpToLabel(body, endLabel);
1019 canExit = true;
1020 }
1021 doesNotContinueSequentially();
1022
1023 for (final Block inlinedFinally : tryNode.getInlinedFinallies()) {
1024 final Block finallyBody = TryNode.getLabelledInlinedFinallyBlock(inlinedFinally);
1025 joinOnLabel(finallyBody.getEntryLabel());
1026 // NOTE: the jump to inlined finally can end up in dead code, so it is not necessarily reachable.
1027 if (reachable) {
1028 finallyBody.accept(this);
1029 // All inlined finallies end with a jump or a return
1030 assert !reachable;
1031 }
1032 }
1033
1034 joinOnLabel(catchLabel);
1035 for(final CatchNode catchNode: tryNode.getCatches()) {
1036 final IdentNode exception = catchNode.getException();
1037 onAssignment(exception, LvarType.OBJECT);
1038 final Expression condition = catchNode.getExceptionCondition();
1039 if(condition != null) {
1040 visitExpression(condition);
1041 }
1042 final Map<Symbol, LvarType> afterConditionTypes = localVariableTypes;
1043 final Block catchBody = catchNode.getBody();
1044 // TODO: currently, we consider that the catch blocks are always reachable from the try block as currently
1045 // we lack enough analysis to prove that no statement before a break/continue/return in the try block can
1046 // throw an exception.
1047 reachable = true;
1048 catchBody.accept(this);
1049 final Symbol exceptionSymbol = exception.getSymbol();
1050 if(reachable) {
1051 localVariableTypes = cloneMap(localVariableTypes);
1052 localVariableTypes.remove(exceptionSymbol);
1053 jumpToLabel(catchBody, endLabel);
1054 canExit = true;
1055 }
1056 localVariableTypes = cloneMap(afterConditionTypes);
|
1016 boolean canExit = false;
1017 if(reachable) {
1018 jumpToLabel(body, endLabel);
1019 canExit = true;
1020 }
1021 doesNotContinueSequentially();
1022
1023 for (final Block inlinedFinally : tryNode.getInlinedFinallies()) {
1024 final Block finallyBody = TryNode.getLabelledInlinedFinallyBlock(inlinedFinally);
1025 joinOnLabel(finallyBody.getEntryLabel());
1026 // NOTE: the jump to inlined finally can end up in dead code, so it is not necessarily reachable.
1027 if (reachable) {
1028 finallyBody.accept(this);
1029 // All inlined finallies end with a jump or a return
1030 assert !reachable;
1031 }
1032 }
1033
1034 joinOnLabel(catchLabel);
1035 for(final CatchNode catchNode: tryNode.getCatches()) {
1036 final IdentNode exception = (IdentNode) catchNode.getException();
1037 onAssignment(exception, LvarType.OBJECT);
1038 final Expression condition = catchNode.getExceptionCondition();
1039 if(condition != null) {
1040 visitExpression(condition);
1041 }
1042 final Map<Symbol, LvarType> afterConditionTypes = localVariableTypes;
1043 final Block catchBody = catchNode.getBody();
1044 // TODO: currently, we consider that the catch blocks are always reachable from the try block as currently
1045 // we lack enough analysis to prove that no statement before a break/continue/return in the try block can
1046 // throw an exception.
1047 reachable = true;
1048 catchBody.accept(this);
1049 final Symbol exceptionSymbol = exception.getSymbol();
1050 if(reachable) {
1051 localVariableTypes = cloneMap(localVariableTypes);
1052 localVariableTypes.remove(exceptionSymbol);
1053 jumpToLabel(catchBody, endLabel);
1054 canExit = true;
1055 }
1056 localVariableTypes = cloneMap(afterConditionTypes);
|