1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.ast;
13 import org.eclipse.jdt.internal.compiler.ASTVisitor;
14 import org.eclipse.jdt.internal.compiler.codegen.*;
15 import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
16 import org.eclipse.jdt.internal.compiler.lookup.*;
18 public class NullLiteral extends MagicLiteral {
20 static final char[] source = {'n' , 'u' , 'l' , 'l'};
22 public NullLiteral(int s , int e) {
27 public void computeConstant() {
29 constant = NotAConstant;
33 * Code generation for the null literal
35 * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
36 * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
37 * @param valueRequired boolean
39 public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
40 int pc = codeStream.position;
42 codeStream.aconst_null();
43 codeStream.generateImplicitConversion(this.implicitConversion);
45 codeStream.recordPositionsFrom(pc, this.sourceStart);
47 public TypeBinding literalType(BlockScope scope) {
51 public int nullStatus(FlowInfo flowInfo) {
58 public char[] source() {
62 public void traverse(ASTVisitor visitor, BlockScope scope) {
63 visitor.visit(this, scope);
64 visitor.endVisit(this, scope);