Basic Reafctoring functionality adapted from Leif Frenzels sources in eclipse-magazin...
[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 public FalseLiteral(int s , int e) {
21         super(s,e);
22 }
23 public void computeConstant() {
24
25         constant = Constant.fromValue(false);}
26 /**
27  * Code generation for false literal
28  *
29  * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
30  * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
31  * @param valueRequired boolean
32  */
33 //public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
34 //      int pc = codeStream.position;
35 //      if (valueRequired)
36 //              codeStream.iconst_0();
37 //      codeStream.recordPositionsFrom(pc, this.sourceStart);
38 //}
39 //public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
40 //
41 //      // falseLabel being not nil means that we will not fall through into the FALSE case
42 //
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);
49 //                      }
50 //              }
51 //      }
52 //      codeStream.recordPositionsFrom(pc, this.sourceStart);
53 //}
54 public TypeBinding literalType(BlockScope scope) {
55         return BooleanBinding;
56 }
57 /**
58  * 
59  */
60 public char[] source() {
61         return source;
62 }
63 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
64         visitor.visit(this, scope);
65         visitor.endVisit(this, scope);
66 }
67 }