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.BranchLabel; 15 import org.eclipse.jdt.internal.compiler.codegen.CodeStream; 16 import org.eclipse.jdt.internal.compiler.impl.BooleanConstant; 17 import org.eclipse.jdt.internal.compiler.lookup.BlockScope; 18 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; 19 20 public class FalseLiteral extends MagicLiteral { 21 static final char[] source = {'f', 'a', 'l', 's', 'e'}; 22 public FalseLiteral(int s , int e) { 23 super(s,e); 24 } 25 public void computeConstant() { 26 constant = BooleanConstant.fromValue(false); 27 } 28 35 public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { 36 int pc = codeStream.position; 37 if (valueRequired) { 38 codeStream.generateConstant(this.constant, this.implicitConversion); 39 } 40 codeStream.recordPositionsFrom(pc, this.sourceStart); 41 } 42 public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired) { 43 44 46 int pc = codeStream.position; 47 if (valueRequired) { 48 if (falseLabel != null) { 49 if (trueLabel == null) { 51 codeStream.goto_(falseLabel); 52 } 53 } 54 } 55 codeStream.recordPositionsFrom(pc, this.sourceStart); 56 } 57 public TypeBinding literalType(BlockScope scope) { 58 return TypeBinding.BOOLEAN; 59 } 60 63 public char[] source() { 64 return source; 65 } 66 public void traverse(ASTVisitor visitor, BlockScope scope) { 67 visitor.visit(this, scope); 68 visitor.endVisit(this, scope); 69 } 70 } 71 | Popular Tags |