KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > compiler > base > cst > UnresolvedExpr


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.cst;
26
27 import java.util.*;
28 import org.aspectj.compiler.base.ast.*;
29
30 import org.aspectj.compiler.base.JavaCompiler;
31 import org.aspectj.compiler.base.CodeWriter;
32 import java.io.IOException JavaDoc;
33
34 import org.aspectj.compiler.base.bcg.CodeBuilder;
35
36 /**
37   * @grammar packageName.name ?qualified
38   * @child Name name
39   */

40
41 public class UnresolvedExpr extends AssignableExpr {
42     // bcg
43
// these are abstract in AssignableExpr
44
protected void cgLvalue(CodeBuilder cb) {}
45     protected void cgLtoRvalue(CodeBuilder cb) {}
46     protected void cgAssignment(CodeBuilder cb) {}
47     protected void cgDupLvalue(CodeBuilder cb) {}
48     protected void cgDupRvalue(CodeBuilder cb) {}
49     // end bcg
50

51     public Type discoverType() {
52         return null;
53     }
54
55     //INTRO from ScopeWalker
56
public ASTObject postScope(ScopeWalker walker) {
57         Expr newExpr = name.resolveExpr(walker.getScope());
58         //showWarning("new expr: " + newExpr.unparse() + ", " + newExpr.isSynthetic());
59
//newExpr.setSource(this);
60
if (isLhs() && !(newExpr instanceof AssignableExpr)) {
61             showError("assignable expression required here");
62             return this;
63         }
64             
65         return newExpr;
66     }
67     
68     //BEGIN: Generated from @child and @property
69
protected Name name;
70     public Name getName() { return name; }
71     public void setName(Name _name) {
72         if (_name != null) _name.setParent(this);
73         name = _name;
74     }
75     
76     public UnresolvedExpr(SourceLocation location, Name _name) {
77         super(location);
78         setName(_name);
79     }
80     protected UnresolvedExpr(SourceLocation source) {
81         super(source);
82     }
83     
84     public ASTObject copyWalk(CopyWalker walker) {
85         UnresolvedExpr ret = new UnresolvedExpr(getSourceLocation());
86         ret.preCopy(walker, this);
87         if (name != null) ret.setName( (Name)walker.process(name) );
88         return ret;
89     }
90     
91     public ASTObject getChildAt(int childIndex) {
92         switch(childIndex) {
93         case 0: return name;
94         default: return super.getChildAt(childIndex);
95         }
96     }
97      public String JavaDoc getChildNameAt(int childIndex) {
98         switch(childIndex) {
99         case 0: return "name";
100         default: return super.getChildNameAt(childIndex);
101         }
102     }
103      public void setChildAt(int childIndex, ASTObject child) {
104         switch(childIndex) {
105         case 0: setName((Name)child); return;
106         default: super.setChildAt(childIndex, child); return;
107         }
108     }
109      public int getChildCount() {
110         return 1;
111     }
112     
113     public String JavaDoc getDefaultDisplayName() {
114         return "UnresolvedExpr()";
115     }
116     
117     //END: Generated from @child and @property
118
}
119
Popular Tags