Refactored packagename to net.sourceforge.phpdt.internal.compiler.ast
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / Literal.java
index 9ab2ad8..3c4fcbf 100644 (file)
@@ -1,46 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
 package net.sourceforge.phpdt.internal.compiler.ast;
 
-import java.util.List;
-import java.util.ArrayList;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
 
-/**
- * Here is the Superclass of the Literal expressions.
- * @author Matthieu Casanova
- */
-public abstract class Literal extends Expression {
-
-  /**
-   * Create a Literal.
-   * @param sourceStart starting offset
-   * @param sourceEnd ending offset
-   */
-  public Literal(final int sourceStart, final int sourceEnd) {
-    super(sourceStart, sourceEnd);
-  }
 
-  public abstract char[] source();
+public abstract class Literal extends Expression {
+       
+public Literal(int s,int e) {
+       sourceStart = s ;
+       sourceEnd= e;
+}
 
-  /**
-   * Get the variables from outside (parameters, globals ...)
-   * @return an empty list
-   */
-  public List getOutsideVariable() {
-    return new ArrayList();
-  }
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+       return flowInfo;
+}
 
-  /**
-   * get the modified variables.
-   * @return an empty list
-   */
-  public List getModifiedVariable() {
-    return new ArrayList();
-  }
+public abstract void computeConstant() ;
+       //ON ERROR constant STAYS NULL
+public abstract TypeBinding literalType(BlockScope scope);
+public StringBuffer printExpression(int indent, StringBuffer output){
+       
+               return output.append(source());
+        }
+public TypeBinding resolveType(BlockScope scope) {
+       // compute the real value, which must range its type's range
 
-  /**
-   * Get the variables used.
-   * @return an empty list
-   */
-  public List getUsedVariable() {
-    return new ArrayList();
-  }
+       computeConstant();
+       if (constant == null) {
+               scope.problemReporter().constantOutOfRange(this);
+               constant = Constant.NotAConstant;
+               return null;
+       }
+       this.resolvedType = literalType(scope);
+       return this.resolvedType;
+}
+public abstract char[] source() ;
 }