KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > compiler > base > ast > ContinueStmt


1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * This file is part of the compiler and core tools for the AspectJ(tm)
4  * programming language; see http://aspectj.org
5  *
6  * The contents of this file are subject to the Mozilla Public License
7  * Version 1.1 (the "License"); you may not use this file except in
8  * compliance with the License. You may obtain a copy of the License at
9  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is AspectJ.
17  *
18  * The Initial Developer of the Original Code is Xerox Corporation. Portions
19  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20  * All Rights Reserved.
21  *
22  * Contributor(s):
23  */

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 JavaDoc;
31
32 import java.util.*;
33
34 import org.aspectj.compiler.base.bcg.CodeBuilder;
35 import org.aspectj.compiler.base.bcg.Label;
36
37 /**
38   * @grammar continue label?
39   * @property String label
40   */

41 public class ContinueStmt extends Stmt {
42
43     public void unparse(CodeWriter writer) throws IOException JavaDoc {
44         writer.writeKeyword("continue");
45         if (label != null) {
46             writer.requiredSpace();
47             writer.write(label);
48         }
49         writer.closeStmt();
50     }
51
52     // ------------------------------
53
// INTRO from FlowCheckerPass
54

55     public void walkFlow(FlowCheckerPass w) {
56         try {
57             w.doContinue(getLabel());
58         } catch (UnsupportedOperationException JavaDoc e) {
59             showError((getLabel() == null) ?
60                       "continue outside of loop" :
61                       "not a loop label: " + getLabel());
62         } catch (java.util.NoSuchElementException JavaDoc 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     // ------------------------------
72
// INTRO from ByteCodeCleanupPass
73

74     public void walkCleanup(ByteCodeCleanupPass w) {
75         w.doContinue(getLabel());
76         w.setLive(false);
77     }
78
79     // ------------------------------
80
// bcg
81

82     protected void cgStmt(CodeBuilder cb) {
83         cb.doContinue(label);
84     }
85     // do not register a line number for me, since often I won't have a bytecode.
86
protected void registerLocation(CodeBuilder cb) { }
87
88     //BEGIN: Generated from @child and @property
89
protected String JavaDoc label;
90     public String JavaDoc getLabel() { return label; }
91     public void setLabel(String JavaDoc _label) { label = _label; }
92
93     public ContinueStmt(SourceLocation location, String JavaDoc _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 JavaDoc getDefaultDisplayName() {
110         return "ContinueStmt(label: "+label+")";
111     }
112
113     //END: Generated from @child and @property
114
}
115
Popular Tags