< prev index next >

## src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/YieldTree.java

Print this page

      20  *
      21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
      22  * or visit www.oracle.com if you need additional information or have any
      23  * questions.
      24  */
      25
      26 package jdk.nashorn.api.tree;
      27
      28 /**
      29  *  A tree node for <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-generator-function-definitions">yield expressions</a> used in generator functions.
      30  *
      31  * For example:
      32  * <pre>
      33  * <em>function*</em> id(){
      34  *     var index = 0;
      35  *     while(index &lt; 10)
      36  *         <em>yield index++;</em>
      37  * }
      38  * </pre>
      39  *

      40  * @since 9
      41  */

      42 public interface YieldTree extends ExpressionTree {
      43     /**
      44      * Returns the expression that is yielded.
      45      *
      46      * @return The expression that is yielded.
      47      */
      48     ExpressionTree getExpression();
      49
      50     /**
      51      * Is this a yield * expression in a generator function?
      52      *
      53      * For example:
      54      * <pre>
      55      * function* id(){
      56      *     yield 1;
      57      *     <em>yield * anotherGeneratorFunc();</em>
      58      *     yield 10;
      59      * }
      60      * </pre>
      61      *
      20  *
      21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
      22  * or visit www.oracle.com if you need additional information or have any
      23  * questions.
      24  */
      25
      26 package jdk.nashorn.api.tree;
      27
      28 /**
      29  *  A tree node for <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-generator-function-definitions">yield expressions</a> used in generator functions.
      30  *
      31  * For example:
      32  * <pre>
      33  * <em>function*</em> id(){
      34  *     var index = 0;
      35  *     while(index &lt; 10)
      36  *         <em>yield index++;</em>
      37  * }
      38  * </pre>
      39  *
      40  * @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
      41  * are deprecated with the intent to remove them in a future release.
      42  *
      43  * @since 9
      44  */
      45 @Deprecated(since="11", forRemoval=true)
      46 public interface YieldTree extends ExpressionTree {
      47     /**
      48      * Returns the expression that is yielded.
      49      *
      50      * @return The expression that is yielded.
      51      */
      52     ExpressionTree getExpression();
      53
      54     /**
      55      * Is this a yield * expression in a generator function?
      56      *
      57      * For example:
      58      * <pre>
      59      * function* id(){
      60      *     yield 1;
      61      *     <em>yield * anotherGeneratorFunc();</em>
      62      *     yield 10;
      63      * }
      64      * </pre>
      65      *

< prev index next >