X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Forg%2Feclipse%2Fjdt%2Finternal%2Fcompiler%2Fast%2FSingleMemberAnnotation.java;fp=src%2Forg%2Feclipse%2Fjdt%2Finternal%2Fcompiler%2Fast%2FSingleMemberAnnotation.java;h=ff9881f28776a3ecb5eb3212e701c4d5ca177ceb;hb=c17753cd9e62cd1a71df3d88af908de0425ac33d;hp=0000000000000000000000000000000000000000;hpb=040fa5af2cd00017cf3575950cdaade34a6d7f6c;p=org.ibex.tool.git diff --git a/src/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java b/src/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java new file mode 100644 index 0000000..ff9881f --- /dev/null +++ b/src/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 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 org.eclipse.jdt.internal.compiler.ast; + +import org.eclipse.jdt.internal.compiler.ASTVisitor; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope; + +/** + * SingleMemberAnnotation node + */ +public class SingleMemberAnnotation extends Annotation { + + public Expression memberValue; + public MemberValuePair singlePair; // fake pair, only value has accurate positions + + public SingleMemberAnnotation(TypeReference type, int sourceStart) { + this.type = type; + this.sourceStart = sourceStart; + this.sourceEnd = type.sourceEnd; + } + + /** + * @see org.eclipse.jdt.internal.compiler.ast.Annotation#memberValuePairs() + */ + public MemberValuePair[] memberValuePairs() { + this.singlePair = new MemberValuePair(VALUE, this.memberValue.sourceStart, this.memberValue.sourceEnd, this.memberValue); + return new MemberValuePair[] { singlePair }; + } + + public StringBuffer printExpression(int indent, StringBuffer output) { + super.printExpression(indent, output); + output.append('('); + this.memberValue.printExpression(indent, output); + return output.append(')'); + } + + public void traverse(ASTVisitor visitor, BlockScope scope) { + if (visitor.visit(this, scope)) { + if (this.memberValue != null) { + this.memberValue.traverse(visitor, scope); + } + } + visitor.endVisit(this, scope); + } + public void traverse(ASTVisitor visitor, CompilationUnitScope scope) { + if (visitor.visit(this, scope)) { + if (this.memberValue != null) { + this.memberValue.traverse(visitor, scope); + } + } + visitor.endVisit(this, scope); + } +}