bc1151c21ddfaf132b2f1480203fc78710b733ee
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / internal / compiler / ast / NullLiteral.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpeclipse.internal.compiler.ast;
12
13 import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
14 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
15 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
16
17 public class NullLiteral extends MagicLiteral {
18
19         static final char[] source = {'n' , 'u' , 'l' , 'l'};
20
21         public NullLiteral(int s , int e) {
22
23                 super(s,e);
24         }
25
26         public void computeConstant() {
27         
28                 constant = NotAConstant; 
29         }
30
31         /**
32          * Code generation for the null literal
33          *
34          * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
35          * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
36          * @param valueRequired boolean
37          */ 
38 //      public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
39 //              int pc = codeStream.position;
40 //              if (valueRequired)
41 //                      codeStream.aconst_null();
42 //              codeStream.recordPositionsFrom(pc, this.sourceStart);
43 //      }
44         public TypeBinding literalType(BlockScope scope) {
45                 return NullBinding;
46         }
47
48         /**
49          * 
50          */
51         public char[] source() {
52                 return source;
53         }
54
55         public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
56                 visitor.visit(this, scope);
57                 visitor.endVisit(this, scope);
58         }
59 }