ReturnLocation.java
package edu.udel.cis.vsl.tass.model.impl.location;
import edu.udel.cis.vsl.tass.model.IF.SyntaxException;
import edu.udel.cis.vsl.tass.model.IF.location.ReturnLocationIF;
import edu.udel.cis.vsl.tass.model.IF.scope.LocalScopeIF;
import edu.udel.cis.vsl.tass.model.IF.statement.ReturnStatementIF;
public class ReturnLocation extends Location implements ReturnLocationIF {
private ReturnStatementIF statement = null;
public ReturnLocation(LocalScopeIF scope) {
super(scope, LocationKind.RETURN);
}
public void setStatement(ReturnStatementIF statement) {
if (this.statement != null)
throw new RuntimeException("Return statement already set!");
if (statement == null)
throw new NullPointerException("statement is null");
this.statement = statement;
super.addOutgoing(statement);
}
public ReturnStatementIF statement() {
return statement;
}
@Override
public void complete() throws SyntaxException {
if (statement == null)
throw new SyntaxException(this,
"statement for this return location is null");
super.complete();
}
}