KickJava   Java API By Example, From Geeks To Geeks.

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


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.*;
29
30 /**
31   * Used to keep track of the (currently FieldDec) that produces a Stmt
32   * so that we can handle getLexicalType correctly both for accessibility and
33   * for within matching for introduced fields with non-empty initializers
34   *
35   * @grammar stmt;
36   * @child Stmt stmt
37   * @property Dec fromDec
38   */

39 public class FromDecStmt extends Stmt {
40     public Type getLexicalType() {
41         return fromDec.getLexicalType();
42     }
43
44     public void unparse(CodeWriter writer) {
45         writer.write(stmt);
46     }
47
48     public ASTObject postFixAST(final ASTFixerPass fixer) {
49         return stmt;
50     }
51
52     public ASTObject postCleanup(ByteCodeCleanupPass w) {
53         return stmt;
54     }
55
56     //BEGIN: Generated from @child and @property
57
protected Stmt stmt;
58     public Stmt getStmt() { return stmt; }
59     public void setStmt(Stmt _stmt) {
60         if (_stmt != null) _stmt.setParent(this);
61         stmt = _stmt;
62     }
63
64     protected Dec fromDec;
65     public Dec getFromDec() { return fromDec; }
66     public void setFromDec(Dec _fromDec) { fromDec = _fromDec; }
67
68     public FromDecStmt(SourceLocation location, Stmt _stmt, Dec _fromDec) {
69         super(location);
70         setStmt(_stmt);
71         setFromDec(_fromDec);
72     }
73     protected FromDecStmt(SourceLocation source) {
74         super(source);
75     }
76
77     public ASTObject copyWalk(CopyWalker walker) {
78         FromDecStmt ret = new FromDecStmt(getSourceLocation());
79         ret.preCopy(walker, this);
80         if (stmt != null) ret.setStmt( (Stmt)walker.process(stmt) );
81         ret.fromDec = fromDec;
82         return ret;
83     }
84
85     public ASTObject getChildAt(int childIndex) {
86         switch(childIndex) {
87         case 0: return stmt;
88         default: return super.getChildAt(childIndex);
89         }
90     }
91      public String JavaDoc getChildNameAt(int childIndex) {
92         switch(childIndex) {
93         case 0: return "stmt";
94         default: return super.getChildNameAt(childIndex);
95         }
96     }
97      public void setChildAt(int childIndex, ASTObject child) {
98         switch(childIndex) {
99         case 0: setStmt((Stmt)child); return;
100         default: super.setChildAt(childIndex, child); return;
101         }
102     }
103      public int getChildCount() {
104         return 1;
105     }
106
107     public String JavaDoc getDefaultDisplayName() {
108         return "FromDecStmt(fromDec: "+fromDec+")";
109     }
110
111     //END: Generated from @child and @property
112
}
113
114
115
Popular Tags