5d941d0ae5031f3d05e843e85ffdd353c68aa27d
[phpeclipse.git] /
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpeclipse.internal.compiler.ast;
12
13 import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
14 import net.sourceforge.phpdt.internal.compiler.lookup.*;
15
16
17 public class JavadocReturnStatement extends ReturnStatement {
18         public char[] description;
19
20         public JavadocReturnStatement(int s, int e, char[] descr) {
21                 super(null, s, e);
22                 this.description = descr;
23                 this.bits |= InsideJavadoc;
24         }
25
26         public void resolve(BlockScope scope) {
27                 MethodScope methodScope = scope.methodScope();
28                 MethodBinding methodBinding;
29                 TypeBinding methodType =
30                         (methodScope.referenceContext instanceof AbstractMethodDeclaration)
31                                 ? ((methodBinding = ((AbstractMethodDeclaration) methodScope.referenceContext).binding) == null 
32                                         ? null 
33                                         : methodBinding.returnType)
34                                 : VoidBinding;
35                 if (methodType == null || methodType == VoidBinding) {
36                         scope.problemReporter().javadocUnexpectedTag(this.sourceStart, this.sourceEnd);
37                 }
38         }
39
40         /* (non-Javadoc)
41          * Redefine to capture javadoc specific signatures
42          * @see net.sourceforge.phpdt.internal.compiler.ast.ASTNode#traverse(net.sourceforge.phpdt.internal.compiler.ASTVisitor, net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
43          */
44         public void traverse(ASTVisitor visitor, BlockScope scope) {
45                 visitor.visit(this, scope);
46                 visitor.endVisit(this, scope);
47         }
48 }