1 /* 2 * ASReturnStatement.java 3 * 4 * Copyright (c) 2007-2008 David Holroyd 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package uk.co.badgersinfoil.metaas.dom; 20 21 /** 22 * A return statement, such as <code>return;</code> or <code>return res;</code>. 23 * 24 * <p>Instances can be created using {@link StatementContainer#newReturn(Expression)}:</p> 25 * <pre class="eg">method.newReturn();</pre> 26 * <p>Will result in ActionScript code like,</p> 27 * <pre class="eg">return;</pre> 28 * <p>or, with an expression,this Java code,</p> 29 * <pre class="eg">method.newReturn("doIt()");</pre> 30 * <p>will result in ActionScript code like,</p> 31 * <pre class="eg">return doIt();</pre> 32 * 33 * @see StatementContainer#newReturn() 34 * @see StatementContainer#newReturn(Expression) 35 */ 36 public interface ASReturnStatement extends Statement { 37 38 /** 39 * Returns a string representation of the expression who's value 40 * this statement would return when executed, or null if there is 41 * no such expression. 42 */ 43 public String getExpressionString(); 44 45 public Expression getExpression(); 46 47 /** 48 * Changes the expression that this statement would return when 49 * executed. If null is given, any expression will be removed. 50 * 51 * @throws SyntaxException if the given string is not null and is not 52 * a valid ActionScript expression. 53 */ 54 public void setExpression(String expr); 55 56 public void setExpression(Expression expr); 57 }