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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpeclipse.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
14 import net.sourceforge.phpdt.internal.compiler.impl.Constant;
15 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
16 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
18 public class FalseLiteral extends MagicLiteral {
19 static final char[] source = {'f', 'a', 'l', 's', 'e'};
20 public FalseLiteral(int s , int e) {
23 public void computeConstant() {
25 constant = Constant.fromValue(false);}
27 * Code generation for false literal
29 * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
30 * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
31 * @param valueRequired boolean
33 //public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
34 // int pc = codeStream.position;
36 // codeStream.iconst_0();
37 // codeStream.recordPositionsFrom(pc, this.sourceStart);
39 //public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
41 // // falseLabel being not nil means that we will not fall through into the FALSE case
43 // int pc = codeStream.position;
44 // if (valueRequired) {
45 // if (falseLabel != null) {
46 // // implicit falling through the TRUE case
47 // if (trueLabel == null) {
48 // codeStream.goto_(falseLabel);
52 // codeStream.recordPositionsFrom(pc, this.sourceStart);
54 public TypeBinding literalType(BlockScope scope) {
55 return BooleanBinding;
60 public char[] source() {
63 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
64 visitor.visit(this, scope);
65 visitor.endVisit(this, scope);