1) Moved net.sourceforge.phpeclipse.ui\src\net\sourceforge\phpdt back to net.sourcefo...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / FalseLiteral.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
12
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;
17
18 public class FalseLiteral extends MagicLiteral {
19         static final char[] source = { 'f', 'a', 'l', 's', 'e' };
20
21         public FalseLiteral(int s, int e) {
22                 super(s, e);
23         }
24
25         public void computeConstant() {
26
27                 constant = Constant.fromValue(false);
28         }
29
30         /**
31          * Code generation for false literal
32          * 
33          * @param currentScope
34          *            net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
35          * @param codeStream
36          *            net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
37          * @param valueRequired
38          *            boolean
39          */
40         // public void generateCode(BlockScope currentScope, CodeStream codeStream,
41         // boolean valueRequired) {
42         // int pc = codeStream.position;
43         // if (valueRequired)
44         // codeStream.iconst_0();
45         // codeStream.recordPositionsFrom(pc, this.sourceStart);
46         // }
47         // public void generateOptimizedBoolean(BlockScope currentScope, CodeStream
48         // codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
49         //
50         // // falseLabel being not nil means that we will not fall through into the
51         // FALSE case
52         //
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);
59         // }
60         // }
61         // }
62         // codeStream.recordPositionsFrom(pc, this.sourceStart);
63         // }
64         public TypeBinding literalType(BlockScope scope) {
65                 return BooleanBinding;
66         }
67
68         /**
69          * 
70          */
71         public char[] source() {
72                 return source;
73         }
74
75         public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
76                 visitor.visit(this, scope);
77                 visitor.endVisit(this, scope);
78         }
79 }