KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.io.IOException JavaDoc;
29
30 import org.aspectj.compiler.base.bcg.CodeBuilder;
31 import org.aspectj.compiler.base.bcg.Label;
32
33 public final class VoidType extends PrimitiveType {
34
35     public String JavaDoc getName() { return "void"; }
36     public int getTypeIndex() { return Type.VOID; }
37     public Type getRefType() { return getTypeManager().getType("java.lang", "Void"); }
38     public Expr getNullExpr() { return getAST().makeNull(); }
39
40     public Expr makeObject(Expr expr) {
41         //XXX this is serious trouble
42
return getAST().makeCast(getTypeManager().getObjectType(), getAST().makeNull());
43     }
44
45     public Expr fromObject(Expr expr) {
46         return getAST().makeStaticCall(getTypeManager().getConversionsType(),
47                                        "voidValue", expr);
48     }
49
50     public VoidType(JavaCompiler compiler) {
51         super(compiler);
52     }
53
54     // constant fold
55

56     final LiteralExpr foldCast(LiteralExpr lit) { return unsupportedFold(); }
57     final LiteralExpr foldPlusOp(LiteralExpr rand) { return unsupportedFold(); }
58     final LiteralExpr foldMinusOp(LiteralExpr rand) { return unsupportedFold(); }
59     final LiteralExpr foldBitNotOp(LiteralExpr rand) { return unsupportedFold(); }
60     final LiteralExpr foldLogNotOp(LiteralExpr rand) { return unsupportedFold(); }
61     final LiteralExpr foldAddOp(LiteralExpr lit1, LiteralExpr lit2) { return unsupportedFold(); }
62     final LiteralExpr foldNumericOp(String JavaDoc op, LiteralExpr lit1, LiteralExpr lit2) { return unsupportedFold(); }
63     final LiteralExpr foldBitwiseOp(String JavaDoc op, LiteralExpr lit1, LiteralExpr lit2) { return unsupportedFold(); }
64     final LiteralExpr foldShiftOp(String JavaDoc op, LiteralExpr lit1, LiteralExpr lit2) { return unsupportedFold(); }
65     final LiteralExpr foldEqualityTestOp(String JavaDoc op, LiteralExpr lit1, LiteralExpr lit2) { return unsupportedFold(); }
66     final LiteralExpr foldNumericTestOp(String JavaDoc op, LiteralExpr lit1, LiteralExpr lit2) { return unsupportedFold(); }
67
68     // vm internal
69
public String JavaDoc getDescriptor() { return "V"; }
70     public int getSlotCount() { return 0; }
71
72     // code gen
73
public final void emitLoad(CodeBuilder cb, int loc) { }
74     public final void emitStore(CodeBuilder cb, int loc) { }
75     public final void emitReturn(CodeBuilder cb) { cb.emitRETURN(); }
76     final void emitPop(CodeBuilder cb) { }
77     final void emitDup(CodeBuilder cb) { }
78     final void emitDupX1(CodeBuilder cb) { }
79     final void emitDupX2(CodeBuilder cb) { }
80
81     final void emitZero(CodeBuilder cb) { unsupportedEmit(); }
82     final void emitOne(CodeBuilder cb) { unsupportedEmit(); }
83     final void emitMinusOne(CodeBuilder cb) { unsupportedEmit(); }
84     final void emitBitNot(CodeBuilder cb) { unsupportedEmit(); }
85     final void emitLogNot(CodeBuilder cb) { unsupportedEmit(); }
86     final void emitNeg(CodeBuilder cb) { unsupportedEmit(); }
87     final void emitAdd(CodeBuilder cb) { unsupportedEmit(); }
88     final void emitAload(CodeBuilder cb) { unsupportedEmit(); }
89     final void emitAstore(CodeBuilder cb) { unsupportedEmit(); }
90     final void emitNumericOp(CodeBuilder cb, String JavaDoc op) { unsupportedEmit(); }
91     final void emitBitwiseOp(CodeBuilder cb, String JavaDoc op) { unsupportedEmit(); }
92     final void emitShiftOp(CodeBuilder cb, String JavaDoc op) { unsupportedEmit(); }
93     final void emitCast(CodeBuilder cb, Type castTo) { unsupportedEmit(); }
94     final void emitEqualityCompare(CodeBuilder cb, String JavaDoc op, Label t, Label f) {
95         unsupportedEmit();
96     }
97     final void emitNumericCompare(CodeBuilder cb, String JavaDoc op, Label t, Label f) {
98         unsupportedEmit();
99     }
100
101
102 }
103
Popular Tags