1 24 25 package org.aspectj.compiler.base.ast; 26 27 import org.aspectj.compiler.base.*; 28 import org.aspectj.compiler.base.JavaCompiler; 29 import org.aspectj.compiler.base.CodeWriter; 30 import java.io.IOException ; 31 32 import java.util.*; 33 34 import org.aspectj.compiler.base.bcg.CodeBuilder; 35 import org.aspectj.compiler.base.bcg.Label; 36 37 41 public class ContinueStmt extends Stmt { 42 43 public void unparse(CodeWriter writer) throws IOException { 44 writer.writeKeyword("continue"); 45 if (label != null) { 46 writer.requiredSpace(); 47 writer.write(label); 48 } 49 writer.closeStmt(); 50 } 51 52 55 public void walkFlow(FlowCheckerPass w) { 56 try { 57 w.doContinue(getLabel()); 58 } catch (UnsupportedOperationException e) { 59 showError((getLabel() == null) ? 60 "continue outside of loop" : 61 "not a loop label: " + getLabel()); 62 } catch (java.util.NoSuchElementException e) { 63 showError((getLabel() == null) ? 64 "continue outside of loop" : 65 "undefined label: " + getLabel()); 66 } 67 w.setLive(false); 68 w.setVars(w.getAllVars()); 69 } 70 71 74 public void walkCleanup(ByteCodeCleanupPass w) { 75 w.doContinue(getLabel()); 76 w.setLive(false); 77 } 78 79 82 protected void cgStmt(CodeBuilder cb) { 83 cb.doContinue(label); 84 } 85 protected void registerLocation(CodeBuilder cb) { } 87 88 protected String label; 90 public String getLabel() { return label; } 91 public void setLabel(String _label) { label = _label; } 92 93 public ContinueStmt(SourceLocation location, String _label) { 94 super(location); 95 setLabel(_label); 96 } 97 protected ContinueStmt(SourceLocation source) { 98 super(source); 99 } 100 101 public ASTObject copyWalk(CopyWalker walker) { 102 ContinueStmt ret = new ContinueStmt(getSourceLocation()); 103 ret.preCopy(walker, this); 104 ret.label = label; 105 return ret; 106 } 107 108 109 public String getDefaultDisplayName() { 110 return "ContinueStmt(label: "+label+")"; 111 } 112 113 } 115 | Popular Tags |