Interface YieldTree

All Superinterfaces:
ExpressionTree, Tree

public interface YieldTree extends ExpressionTree
A tree node for yield expressions used in generator functions. For example:
 function* id(){
     var index = 0;
     while(index < 10)
         yield index++;
 }
 
Since:
9
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.openjdk.nashorn.api.tree.Tree

    Tree.Kind
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the expression that is yielded.
    boolean
    Is this a yield * expression in a generator function? For example:

    Methods inherited from interface org.openjdk.nashorn.api.tree.Tree

    accept, getEndPosition, getKind, getStartPosition
  • Method Details

    • getExpression

      ExpressionTree getExpression()
      Returns the expression that is yielded.
      Returns:
      The expression that is yielded.
    • isStar

      boolean isStar()
      Is this a yield * expression in a generator function? For example:
       function* id(){
           yield 1;
           yield * anotherGeneratorFunc();
           yield 10;
       }
       
      Returns:
      true if this is a yield * expression