1 11 package org.eclipse.jdt.internal.compiler.ast; 12 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.impl.Constant; 17 import org.eclipse.jdt.internal.compiler.lookup.*; 18 19 public class NullLiteral extends MagicLiteral { 20 21 static final char[] source = {'n' , 'u' , 'l' , 'l'}; 22 23 public NullLiteral(int s , int e) { 24 25 super(s,e); 26 } 27 28 public void computeConstant() { 29 30 constant = Constant.NotAConstant; 31 } 32 33 40 public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { 41 int pc = codeStream.position; 42 if (valueRequired) { 43 codeStream.aconst_null(); 44 codeStream.generateImplicitConversion(this.implicitConversion); 45 } 46 codeStream.recordPositionsFrom(pc, this.sourceStart); 47 } 48 public TypeBinding literalType(BlockScope scope) { 49 return TypeBinding.NULL; 50 } 51 52 public int nullStatus(FlowInfo flowInfo) { 53 return FlowInfo.NULL; 54 } 55 56 public Object reusableJSRTarget() { 57 return TypeBinding.NULL; 58 } 59 60 public char[] source() { 61 return source; 62 } 63 64 public void traverse(ASTVisitor visitor, BlockScope scope) { 65 visitor.visit(this, scope); 66 visitor.endVisit(this, scope); 67 } 68 } 69 | Popular Tags |