1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 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 org.eclipse.jdt.internal.compiler.ast;
13 import org.eclipse.jdt.internal.compiler.flow.FlowContext;
14 import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
15 import org.eclipse.jdt.internal.compiler.impl.*;
16 import org.eclipse.jdt.internal.compiler.lookup.*;
18 public abstract class Literal extends Expression {
20 public Literal(int s, int e) {
26 public FlowInfo analyseCode(
27 BlockScope currentScope,
28 FlowContext flowContext,
34 public abstract void computeConstant();
36 public abstract TypeBinding literalType(BlockScope scope);
38 public StringBuffer printExpression(int indent, StringBuffer output){
40 return output.append(source());
43 public TypeBinding resolveType(BlockScope scope) {
44 // compute the real value, which must range its type's range
45 this.resolvedType = literalType(scope);
47 // in case of error, constant did remain null
49 if (constant == null) {
50 scope.problemReporter().constantOutOfRange(this, this.resolvedType);
51 constant = Constant.NotAConstant;
53 return this.resolvedType;
56 public abstract char[] source();