01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.compiler.ast;
11:
12: import org.eclipse.jdt.internal.compiler.ASTVisitor;
13: import org.eclipse.jdt.internal.compiler.lookup.*;
14:
15: public class JavadocSingleNameReference extends SingleNameReference {
16:
17: public int tagSourceStart, tagSourceEnd;
18:
19: public JavadocSingleNameReference(char[] source, long pos,
20: int tagStart, int tagEnd) {
21: super (source, pos);
22: this .tagSourceStart = tagStart;
23: this .tagSourceEnd = tagEnd;
24: this .bits |= InsideJavadoc;
25: }
26:
27: public void resolve(BlockScope scope) {
28: resolve(
29: scope,
30: true,
31: scope.compilerOptions().reportUnusedParameterIncludeDocCommentReference);
32: }
33:
34: /**
35: * Resolve without warnings
36: */
37: public void resolve(BlockScope scope, boolean warn,
38: boolean considerParamRefAsUsage) {
39:
40: LocalVariableBinding variableBinding = scope
41: .findVariable(this .token);
42: if (variableBinding != null
43: && variableBinding.isValidBinding()
44: && ((variableBinding.tagBits & TagBits.IsArgument) != 0)) {
45: this .binding = variableBinding;
46: if (considerParamRefAsUsage) {
47: variableBinding.useFlag = LocalVariableBinding.USED;
48: }
49: return;
50: }
51: if (warn) {
52: try {
53: MethodScope methScope = (MethodScope) scope;
54: scope.problemReporter().javadocUndeclaredParamTagName(
55: this .token, this .sourceStart, this .sourceEnd,
56: methScope.referenceMethod().modifiers);
57: } catch (Exception e) {
58: scope.problemReporter().javadocUndeclaredParamTagName(
59: this .token, this .sourceStart, this .sourceEnd,
60: -1);
61: }
62: }
63: }
64:
65: /* (non-Javadoc)
66: * Redefine to capture javadoc specific signatures
67: * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
68: */
69: public void traverse(ASTVisitor visitor, BlockScope scope) {
70: visitor.visit(this , scope);
71: visitor.endVisit(this , scope);
72: }
73:
74: /* (non-Javadoc)
75: * Redefine to capture javadoc specific signatures
76: * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
77: */
78: public void traverse(ASTVisitor visitor, ClassScope scope) {
79: visitor.visit(this, scope);
80: visitor.endVisit(this, scope);
81: }
82: }
|