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 JavadocReturnStatement extends ReturnStatement {
16:
17: public JavadocReturnStatement(int s, int e) {
18: super (null, s, e);
19: this .bits |= (ASTNode.InsideJavadoc | ASTNode.Empty);
20: }
21:
22: /* (non-Javadoc)
23: * @see org.eclipse.jdt.internal.compiler.ast.Statement#resolve(org.eclipse.jdt.internal.compiler.lookup.BlockScope)
24: */
25: public void resolve(BlockScope scope) {
26: MethodScope methodScope = scope.methodScope();
27: MethodBinding methodBinding = null;
28: TypeBinding methodType = (methodScope.referenceContext instanceof AbstractMethodDeclaration) ? ((methodBinding = ((AbstractMethodDeclaration) methodScope.referenceContext).binding) == null ? null
29: : methodBinding.returnType)
30: : TypeBinding.VOID;
31: if (methodType == null || methodType == TypeBinding.VOID) {
32: scope.problemReporter().javadocUnexpectedTag(
33: this .sourceStart, this .sourceEnd);
34: } else if ((this .bits & ASTNode.Empty) != 0) {
35: scope.problemReporter().javadocEmptyReturnTag(
36: this .sourceStart, this .sourceEnd,
37: scope.getDeclarationModifiers());
38: }
39: }
40:
41: /* (non-Javadoc)
42: * @see org.eclipse.jdt.internal.compiler.ast.Statement#printStatement(int, java.lang.StringBuffer)
43: */
44: public StringBuffer printStatement(int tab, StringBuffer output) {
45: printIndent(tab, output).append("return"); //$NON-NLS-1$
46: if ((this .bits & ASTNode.Empty) == 0)
47: output.append(' ').append(" <not empty>"); //$NON-NLS-1$
48: return output;
49: }
50:
51: /* (non-Javadoc)
52: * Redefine to capture javadoc specific signatures
53: * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
54: */
55: public void traverse(ASTVisitor visitor, BlockScope scope) {
56: visitor.visit(this , scope);
57: visitor.endVisit(this , scope);
58: }
59:
60: /* (non-Javadoc)
61: * Redefine to capture javadoc specific signatures
62: * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
63: */
64: public void traverse(ASTVisitor visitor, ClassScope scope) {
65: visitor.visit(this, scope);
66: visitor.endVisit(this, scope);
67: }
68: }
|