1) Need to syncronize also the type of variable values not only the values (makes...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / 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.phpdt.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
35          *            net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
36          * @param codeStream
37          *            net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
38          * @param valueRequired
39          *            boolean
40          */
41         // public void generateCode(BlockScope currentScope, CodeStream codeStream,
42         // boolean valueRequired) {
43         // int pc = codeStream.position;
44         // if (valueRequired)
45         // codeStream.aconst_null();
46         // codeStream.recordPositionsFrom(pc, this.sourceStart);
47         // }
48         public TypeBinding literalType(BlockScope scope) {
49                 return NullBinding;
50         }
51
52         /**
53          * 
54          */
55         public char[] source() {
56                 return source;
57         }
58
59         public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
60                 visitor.visit(this, scope);
61                 visitor.endVisit(this, scope);
62         }
63 }