blob: 1abaa99a09a1fdc0e0a0429d93b6e1e37fffbc92 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005, 2016 IBM Corporation and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
*******************************************************************************/
package org.eclipse.dltk.python.parser.ast.statements;
import org.eclipse.dltk.ast.DLTKToken;
import org.eclipse.dltk.ast.expressions.Expression;
import org.eclipse.dltk.utils.CorePrinter;
/**
* Throw statement. Exception throwing.
*/
public class ThrowStatement extends SimpleStatement {
public ThrowStatement(DLTKToken throwToken, Expression expression) {
super(throwToken.getColumn(), -1, expression);
if (expression != null) {
this.setEnd(expression.sourceEnd());
}
}
@Override
public int getKind() {
return S_THROW;
}
@Override
public void printNode(CorePrinter output) {
output.formatPrintLn("throw: ");
Expression expression = this.getExpression();
if (expression != null) {
expression.printNode(output);
}
}
}