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.ASTVisitor;
14 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
15 import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
18 * SingleMemberAnnotation node
20 public class SingleMemberAnnotation extends Annotation {
22 public Expression memberValue;
23 public MemberValuePair singlePair; // fake pair, only value has accurate positions
25 public SingleMemberAnnotation(TypeReference type, int sourceStart) {
27 this.sourceStart = sourceStart;
28 this.sourceEnd = type.sourceEnd;
32 * @see org.eclipse.jdt.internal.compiler.ast.Annotation#memberValuePairs()
34 public MemberValuePair[] memberValuePairs() {
35 this.singlePair = new MemberValuePair(VALUE, this.memberValue.sourceStart, this.memberValue.sourceEnd, this.memberValue);
36 return new MemberValuePair[] { singlePair };
39 public StringBuffer printExpression(int indent, StringBuffer output) {
40 super.printExpression(indent, output);
42 this.memberValue.printExpression(indent, output);
43 return output.append(')');
46 public void traverse(ASTVisitor visitor, BlockScope scope) {
47 if (visitor.visit(this, scope)) {
48 if (this.memberValue != null) {
49 this.memberValue.traverse(visitor, scope);
52 visitor.endVisit(this, scope);
54 public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
55 if (visitor.visit(this, scope)) {
56 if (this.memberValue != null) {
57 this.memberValue.traverse(visitor, scope);
60 visitor.endVisit(this, scope);