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.phpdt.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' };
21 public FalseLiteral(int s, int e) {
25 public void computeConstant() {
27 constant = Constant.fromValue(false);
31 * Code generation for false literal
34 * net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
36 * net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
37 * @param valueRequired
40 // public void generateCode(BlockScope currentScope, CodeStream codeStream,
41 // boolean valueRequired) {
42 // int pc = codeStream.position;
44 // codeStream.iconst_0();
45 // codeStream.recordPositionsFrom(pc, this.sourceStart);
47 // public void generateOptimizedBoolean(BlockScope currentScope, CodeStream
48 // codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
50 // // falseLabel being not nil means that we will not fall through into the
53 // int pc = codeStream.position;
54 // if (valueRequired) {
55 // if (falseLabel != null) {
56 // // implicit falling through the TRUE case
57 // if (trueLabel == null) {
58 // codeStream.goto_(falseLabel);
62 // codeStream.recordPositionsFrom(pc, this.sourceStart);
64 public TypeBinding literalType(BlockScope scope) {
65 return BooleanBinding;
71 public char[] source() {
75 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
76 visitor.visit(this, scope);
77 visitor.endVisit(this, scope);