X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThrowStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThrowStatement.java index 6aa082a..b6c5e29 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThrowStatement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThrowStatement.java @@ -1,20 +1,18 @@ /******************************************************************************* - * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others. + * Copyright (c) 2000, 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 + * 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-v05.html + * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * IBM Corporation - initial API and implementation - ******************************************************************************/ + *******************************************************************************/ package net.sourceforge.phpdt.internal.compiler.ast; -import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor; -import net.sourceforge.phpdt.internal.compiler.codegen.CodeStream; +import net.sourceforge.phpdt.internal.compiler.ASTVisitor; import net.sourceforge.phpdt.internal.compiler.flow.FlowContext; import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo; -import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions; import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope; import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding; @@ -33,37 +31,42 @@ public class ThrowStatement extends Statement { exception.analyseCode(currentScope, flowContext, flowInfo); // need to check that exception thrown is actually caught somewhere flowContext.checkExceptionHandlers(exceptionType, this, flowInfo, currentScope); - return FlowInfo.DeadEnd; + return FlowInfo.DEAD_END; } /** * Throw code generation * - * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope - * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream + * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope + * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream */ - public void generateCode(BlockScope currentScope, CodeStream codeStream) { - - if ((bits & IsReachableMASK) == 0) - return; - int pc = codeStream.position; - exception.generateCode(currentScope, codeStream, true); - codeStream.athrow(); - codeStream.recordPositionsFrom(pc, this.sourceStart); - } +// public void generateCode(BlockScope currentScope, CodeStream codeStream) { +// +// if ((bits & IsReachableMASK) == 0) +// return; +// int pc = codeStream.position; +// exception.generateCode(currentScope, codeStream, true); +// codeStream.athrow(); +// codeStream.recordPositionsFrom(pc, this.sourceStart); +// } public void resolve(BlockScope scope) { exceptionType = exception.resolveTypeExpecting(scope, scope.getJavaLangThrowable()); - if (exceptionType == NullBinding - && scope.environment().options.complianceLevel <= CompilerOptions.JDK1_3){ - // if compliant with 1.4, this problem will not be reported - scope.problemReporter().cannotThrowNull(this); - } +// if (exceptionType == NullBinding +// && scope.environment().options.complianceLevel <= CompilerOptions.JDK1_3){ +// // if compliant with 1.4, this problem will not be reported +// scope.problemReporter().cannotThrowNull(this); +// } exception.implicitWidening(exceptionType, exceptionType); } + public StringBuffer printStatement(int indent, StringBuffer output) { + printIndent(indent, output).append("throw "); //$NON-NLS-1$ + exception.printExpression(0, output); + return output.append(';'); + } public String toString(int tab) { String s = tabString(tab); s = s + "throw "; //$NON-NLS-1$ @@ -71,9 +74,9 @@ public class ThrowStatement extends Statement { return s; } - public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { + public void traverse(ASTVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) exception.traverse(visitor, blockScope); visitor.endVisit(this, blockScope); } -} \ No newline at end of file +}