KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > compiler > crosscuts > ast > ProceedExpr


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.crosscuts.ast;
26
27 import org.aspectj.compiler.base.ast.*;
28 import org.aspectj.compiler.base.*;
29 import org.aspectj.compiler.crosscuts.*;
30 import org.aspectj.compiler.base.bcg.CodeBuilder;
31
32 import java.util.*;
33
34 /**
35   * @grammar proceed(args)
36   * @child Exprs args
37   * @property AroundAdviceDec enclosingAround
38   */

39 public class ProceedExpr extends Expr {
40     protected Type discoverType() { return enclosingAround.getResultType(); }
41     
42     public boolean isLegalStmt() {
43         return true;
44     }
45     
46     protected void cgValue(CodeBuilder cb) {
47         getCompiler().internalError(this, "should no longer exist");
48     }
49
50     
51     /** returns all possible exceptions thrown by proceed
52      */

53     public Set getPossibleExceptions(boolean deFacto) {
54         if (deFacto) {
55             Set set = new HashSet();
56             set.add(getTypeManager().getThrowableType());
57             return set;
58         } else {
59             return Collections.EMPTY_SET;
60         }
61     }
62         
63     
64     
65     // ------------------------------
66
// INTRO from FlowCheckerPass
67

68     public void walkFlow(FlowCheckerPass w) {
69         w.process(getArgs());
70         w.setExns(FlowCheckerPass.ESet.getEmpty().add(getTypeManager().getThrowableType()));
71     }
72     
73     //BEGIN: Generated from @child and @property
74
protected Exprs args;
75     public Exprs getArgs() { return args; }
76     public void setArgs(Exprs _args) {
77         if (_args != null) _args.setParent(this);
78         args = _args;
79     }
80     
81     protected AroundAdviceDec enclosingAround;
82     public AroundAdviceDec getEnclosingAround() { return enclosingAround; }
83     public void setEnclosingAround(AroundAdviceDec _enclosingAround) { enclosingAround = _enclosingAround; }
84     
85     public ProceedExpr(SourceLocation location, Exprs _args, AroundAdviceDec _enclosingAround) {
86         super(location);
87         setArgs(_args);
88         setEnclosingAround(_enclosingAround);
89     }
90     protected ProceedExpr(SourceLocation source) {
91         super(source);
92     }
93     
94     public ASTObject copyWalk(CopyWalker walker) {
95         ProceedExpr ret = new ProceedExpr(getSourceLocation());
96         ret.preCopy(walker, this);
97         if (args != null) ret.setArgs( (Exprs)walker.process(args) );
98         ret.enclosingAround = enclosingAround;
99         return ret;
100     }
101     
102     public ASTObject getChildAt(int childIndex) {
103         switch(childIndex) {
104         case 0: return args;
105         default: return super.getChildAt(childIndex);
106         }
107     }
108      public String JavaDoc getChildNameAt(int childIndex) {
109         switch(childIndex) {
110         case 0: return "args";
111         default: return super.getChildNameAt(childIndex);
112         }
113     }
114      public void setChildAt(int childIndex, ASTObject child) {
115         switch(childIndex) {
116         case 0: setArgs((Exprs)child); return;
117         default: super.setChildAt(childIndex, child); return;
118         }
119     }
120      public int getChildCount() {
121         return 1;
122     }
123     
124     public String JavaDoc getDefaultDisplayName() {
125         return "ProceedExpr(enclosingAround: "+enclosingAround+")";
126     }
127     
128     //END: Generated from @child and @property
129
}
130
Popular Tags