no indentation of HTML and phpdocs
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / internal / compiler / ast / TrueLiteral.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.phpeclipse.internal.compiler.ast;
12
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;
18
19
20 public class TrueLiteral extends MagicLiteral {
21         static final char[] source = {'t' , 'r' , 'u' , 'e'};
22 public TrueLiteral(int s , int e) {
23         super(s,e);
24 }
25 public void computeConstant() {
26
27         constant = Constant.fromValue(true);}
28 /**
29  * Code generation for the true literal
30  *
31  * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
32  * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
33  * @param valueRequired boolean
34  */ 
35 //public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
36 //      int pc = codeStream.position;
37 //      if (valueRequired)
38 //              codeStream.iconst_1();
39 //      codeStream.recordPositionsFrom(pc, this.sourceStart);
40 //}
41 //public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
42 //
43 //      // trueLabel being not nil means that we will not fall through into the TRUE case
44 //
45 //      int pc = codeStream.position;
46 //      // constant == true
47 //      if (valueRequired) {
48 //              if (falseLabel == null) {
49 //                      // implicit falling through the FALSE case
50 //                      if (trueLabel != null) {
51 //                              codeStream.goto_(trueLabel);
52 //                      }
53 //              }
54 //      }
55 //      codeStream.recordPositionsFrom(pc, this.sourceStart);
56 //}
57 public TypeBinding literalType(BlockScope scope) {
58         return BooleanBinding;
59 }
60 /**
61  * 
62  */
63 public char[] source() {
64         return source;
65 }
66 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
67         visitor.visit(this, scope);
68         visitor.endVisit(this, scope);
69 }
70 }