A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / AbstractVariableDeclaration.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.flow.FlowContext;
14 import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
15 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
16
17 public abstract class AbstractVariableDeclaration extends Statement {
18         public int modifiers;
19
20         public TypeReference type;
21
22         public Expression initialization;
23
24         public char[] name;
25
26         public int declarationEnd;
27
28         public int declarationSourceStart;
29
30         public int declarationSourceEnd;
31
32         public int modifiersSourceStart;
33
34         public AbstractVariableDeclaration() {
35         }
36
37         public FlowInfo analyseCode(BlockScope currentScope,
38                         FlowContext flowContext, FlowInfo flowInfo) {
39                 return flowInfo;
40         }
41
42         public abstract String name();
43
44         public StringBuffer printStatement(int indent, StringBuffer output) {
45
46                 printIndent(indent, output);
47                 printModifiers(this.modifiers, output);
48                 type.print(0, output).append(' ').append(this.name);
49                 if (initialization != null) {
50                         output.append(" = "); //$NON-NLS-1$
51                         initialization.printExpression(indent, output);
52                 }
53                 return output.append(';');
54         }
55
56         public void resolve(BlockScope scope) {
57         }
58
59         public String toString(int tab) {
60
61                 String s = tabString(tab);
62                 if (modifiers != AccDefault) {
63                         s += modifiersString(modifiers);
64                 }
65                 s += type.toString(0) + " " + new String(name()); //$NON-NLS-1$
66                 if (initialization != null)
67                         s += " = " + initialization.toStringExpression(tab); //$NON-NLS-1$
68                 return s;
69         }
70 }