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.lookup.BlockScope;
16 import org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
17 import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
19 public abstract class AbstractVariableDeclaration extends Statement implements InvocationSite {
20 public int declarationEnd;
21 public int declarationSourceEnd;
22 public int declarationSourceStart;
23 public int hiddenVariableDepth; // used to diagnose hiding scenarii
24 public Expression initialization;
26 public int modifiersSourceStart;
30 public TypeReference type;
32 public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
36 * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#isSuperAccess()
38 public boolean isSuperAccess() {
43 * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#isTypeAccess()
45 public boolean isTypeAccess() {
50 public StringBuffer printStatement(int indent, StringBuffer output) {
52 printIndent(indent, output);
53 printModifiers(this.modifiers, output);
54 type.print(0, output).append(' ').append(this.name);
55 if (initialization != null) {
56 output.append(" = "); //$NON-NLS-1$
57 initialization.printExpression(indent, output);
59 return output.append(';');
62 public void resolve(BlockScope scope) {
63 // do nothing by default (redefined for local variables)
67 * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#setActualReceiverType(org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding)
69 public void setActualReceiverType(ReferenceBinding receiverType) {
70 // do nothing by default
74 * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#setDepth(int)
76 public void setDepth(int depth) {
78 this.hiddenVariableDepth = depth;
82 * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#setFieldIndex(int)
84 public void setFieldIndex(int depth) {
85 // do nothing by default