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.codegen.Label;
15 import net.sourceforge.phpdt.internal.compiler.impl.Constant;
16 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
17 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
19 public class FalseLiteral extends MagicLiteral {
20 static final char[] source = {'f', 'a', 'l', 's', 'e'};
21 public FalseLiteral(int s , int e) {
24 public void computeConstant() {
26 constant = Constant.fromValue(false);}
28 * Code generation for false literal
30 * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
31 * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
32 * @param valueRequired boolean
34 //public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
35 // int pc = codeStream.position;
37 // codeStream.iconst_0();
38 // codeStream.recordPositionsFrom(pc, this.sourceStart);
40 //public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
42 // // falseLabel being not nil means that we will not fall through into the FALSE case
44 // int pc = codeStream.position;
45 // if (valueRequired) {
46 // if (falseLabel != null) {
47 // // implicit falling through the TRUE case
48 // if (trueLabel == null) {
49 // codeStream.goto_(falseLabel);
53 // codeStream.recordPositionsFrom(pc, this.sourceStart);
55 public TypeBinding literalType(BlockScope scope) {
56 return BooleanBinding;
61 public char[] source() {
64 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
65 visitor.visit(this, scope);
66 visitor.endVisit(this, scope);