KickJava   Java API By Example, From Geeks To Geeks.

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


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.FlowCheckerPass;
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 ! rand1
39  *
40  */

41 public class LogNotOpExpr extends UnopExpr {
42
43     protected LiteralExpr halfFold(Type type, LiteralExpr lit) {
44         return type.foldLogNotOp(lit);
45     }
46
47     protected Type discoverType() {
48         if (! getRand1().getType().isBoolean()) {
49             showOperatorTypeError(getRand1().getType());
50         }
51         return getTypeManager().booleanType;
52     }
53
54     protected Type getLiftType() {
55         return getType();
56     }
57
58     // ------------------------------
59
// INTRO from FlowCheckerPass
60

61     public void walkFlow(FlowCheckerPass w) {
62         w.processBoolean(getRand1());
63         FlowCheckerPass.Vars p1 = w.getVars();
64
65         w.setVars(p1.getFalse(), p1.getTrue());
66     }
67
68     // ------------------------------
69
// INTRO from FlowCheckerPass
70

71     public void normalizeFlow(FlowCheckerPass w) {
72     }
73
74     // ------------------------------
75
// bcg
76
protected void cgTest(CodeBuilder cb, Label tdest, Label fdest) {
77         getRand1().cgTest(cb, fdest, tdest);
78     }
79     protected void cgValue(CodeBuilder cb) {
80         getRand1().cgValue(cb);
81         getTypeManager().booleanType.emitLogNot(cb);
82     }
83
84     //BEGIN: Generated from @child and @property
85

86     public LogNotOpExpr(SourceLocation location, String JavaDoc _op, Expr _rand1) {
87         super(location, _op, _rand1);
88
89     }
90     protected LogNotOpExpr(SourceLocation source) {
91         super(source);
92     }
93
94     public ASTObject copyWalk(CopyWalker walker) {
95         LogNotOpExpr ret = new LogNotOpExpr(getSourceLocation());
96         ret.preCopy(walker, this);
97         ret.op = op;
98         if (rand1 != null) ret.setRand1( (Expr)walker.process(rand1) );
99         return ret;
100     }
101
102
103     public String JavaDoc getDefaultDisplayName() {
104         return "LogNotOpExpr(op: "+op+")";
105     }
106
107     //END: Generated from @child and @property
108
}
109
Popular Tags