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