1 11 package org.eclipse.jdt.internal.compiler.ast; 12 13 import org.eclipse.jdt.internal.compiler.codegen.*; 14 import org.eclipse.jdt.internal.compiler.lookup.*; 15 16 public abstract class BranchStatement extends Statement { 17 18 public char[] label; 19 public BranchLabel targetLabel; 20 public SubRoutineStatement[] subroutines; 21 public int initStateIndex = -1; 22 23 26 public BranchStatement(char[] label, int sourceStart,int sourceEnd) { 27 this.label = label ; 28 this.sourceStart = sourceStart; 29 this.sourceEnd = sourceEnd; 30 } 31 32 37 public void generateCode(BlockScope currentScope, CodeStream codeStream) { 38 if ((this.bits & ASTNode.IsReachable) == 0) { 39 return; 40 } 41 int pc = codeStream.position; 42 43 if (this.subroutines != null){ 46 for (int i = 0, max = this.subroutines.length; i < max; i++){ 47 SubRoutineStatement sub = this.subroutines[i]; 48 boolean didEscape = sub.generateSubRoutineInvocation(currentScope, codeStream, this.targetLabel, this.initStateIndex, null); 49 if (didEscape) { 50 codeStream.recordPositionsFrom(pc, this.sourceStart); 51 SubRoutineStatement.reenterAllExceptionHandlers(this.subroutines, i, codeStream); 52 if (this.initStateIndex != -1) { 53 codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.initStateIndex); 54 codeStream.addDefinitelyAssignedVariables(currentScope, this.initStateIndex); 55 } 56 return; 57 } 58 } 59 } 60 codeStream.goto_(this.targetLabel); 61 codeStream.recordPositionsFrom(pc, this.sourceStart); 62 SubRoutineStatement.reenterAllExceptionHandlers(this.subroutines, -1, codeStream); 63 if (this.initStateIndex != -1) { 64 codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.initStateIndex); 65 codeStream.addDefinitelyAssignedVariables(currentScope, this.initStateIndex); 66 } 67 } 68 69 public void resolve(BlockScope scope) { 70 } 72 } 73 | Popular Tags |