public class ThrowStatement extends Statement {
public Expression exception;
+
public TypeBinding exceptionType;
public ThrowStatement(Expression exception, int startPosition) {
this.sourceEnd = exception.sourceEnd;
}
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
exception.analyseCode(currentScope, flowContext, flowInfo);
// need to check that exception thrown is actually caught somewhere
- flowContext.checkExceptionHandlers(exceptionType, this, flowInfo, currentScope);
+ flowContext.checkExceptionHandlers(exceptionType, this, flowInfo,
+ currentScope);
return FlowInfo.DEAD_END;
}
/**
* Throw code generation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.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);
-// }
+
+ 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);
+ // }
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$