@@ -417,7 +417,7 @@ class SwitchCase extends Stmt, @case {
417417 SwitchStmt getSwitch ( ) { result .getACase ( ) = this }
418418
419419 /**
420- * PREVIEW FEATURE in Java 12 . Subject to removal in a future release.
420+ * PREVIEW FEATURE in Java 13 . Subject to removal in a future release.
421421 *
422422 * Gets the switch expression to which this case belongs, if any.
423423 */
@@ -432,7 +432,7 @@ class SwitchCase extends Stmt, @case {
432432 }
433433
434434 /**
435- * PREVIEW FEATURE in Java 12 . Subject to removal in a future release.
435+ * PREVIEW FEATURE in Java 13 . Subject to removal in a future release.
436436 *
437437 * Holds if this `case` is a switch labeled rule of the form `... -> ...`.
438438 */
@@ -443,14 +443,14 @@ class SwitchCase extends Stmt, @case {
443443 }
444444
445445 /**
446- * PREVIEW FEATURE in Java 12 . Subject to removal in a future release.
446+ * PREVIEW FEATURE in Java 13 . Subject to removal in a future release.
447447 *
448448 * Gets the expression on the right-hand side of the arrow, if any.
449449 */
450450 Expr getRuleExpression ( ) { result .getParent ( ) = this and result .getIndex ( ) = - 1 }
451451
452452 /**
453- * PREVIEW FEATURE in Java 12 . Subject to removal in a future release.
453+ * PREVIEW FEATURE in Java 13 . Subject to removal in a future release.
454454 *
455455 * Gets the statement on the right-hand side of the arrow, if any.
456456 */
@@ -465,7 +465,7 @@ class ConstCase extends SwitchCase {
465465 Expr getValue ( ) { result .getParent ( ) = this and result .getIndex ( ) = 0 }
466466
467467 /**
468- * PREVIEW FEATURE in Java 12 . Subject to removal in a future release.
468+ * PREVIEW FEATURE in Java 13 . Subject to removal in a future release.
469469 *
470470 * Gets the `case` constant at the specified index.
471471 */
@@ -558,10 +558,11 @@ class ThrowStmt extends Stmt, @throwstmt {
558558 }
559559}
560560
561- /** A `break` or `continue` statement. */
561+ /** A `break`, `yield` or `continue` statement. */
562562class JumpStmt extends Stmt {
563563 JumpStmt ( ) {
564564 this instanceof BreakStmt or
565+ this instanceof YieldStmt or
565566 this instanceof ContinueStmt
566567 }
567568
@@ -585,9 +586,7 @@ class JumpStmt extends Stmt {
585586 )
586587 }
587588
588- private SwitchExpr getSwitchExprTarget ( ) {
589- this .( BreakStmt ) .hasValue ( ) and result = this .getParent + ( )
590- }
589+ private SwitchExpr getSwitchExprTarget ( ) { result = this .( YieldStmt ) .getParent + ( ) }
591590
592591 private StmtParent getEnclosingTarget ( ) {
593592 result = getSwitchExprTarget ( )
@@ -598,7 +597,7 @@ class JumpStmt extends Stmt {
598597 }
599598
600599 /**
601- * Gets the statement or `switch` expression that this `break` or `continue` jumps to.
600+ * Gets the statement or `switch` expression that this `break`, `yield` or `continue` jumps to.
602601 */
603602 StmtParent getTarget ( ) {
604603 result = getLabelTarget ( )
@@ -615,34 +614,31 @@ class BreakStmt extends Stmt, @breakstmt {
615614 /** Holds if this `break` statement has an explicit label. */
616615 predicate hasLabel ( ) { exists ( string s | s = this .getLabel ( ) ) }
617616
618- /**
619- * PREVIEW FEATURE in Java 12. Subject to removal in a future release.
620- *
621- * Gets the value of this `break` statement, if any.
622- */
623- Expr getValue ( ) { result .getParent ( ) = this }
624-
625- /**
626- * PREVIEW FEATURE in Java 12. Subject to removal in a future release.
627- *
628- * Holds if this `break` statement has a value.
629- */
630- predicate hasValue ( ) { exists ( Expr e | e .getParent ( ) = this ) }
631-
632617 /** Gets a printable representation of this statement. May include more detail than `toString()`. */
633618 override string pp ( ) {
634- if this .hasLabel ( )
635- then result = "break " + this .getLabel ( )
636- else
637- if this .hasValue ( )
638- then result = "break ..."
639- else result = "break"
619+ if this .hasLabel ( ) then result = "break " + this .getLabel ( ) else result = "break"
640620 }
641621
642622 /** This statement's Halstead ID (used to compute Halstead metrics). */
643623 override string getHalsteadID ( ) { result = "BreakStmt" }
644624}
645625
626+ /**
627+ * PREVIEW FEATURE in Java 13. Subject to removal in a future release.
628+ *
629+ * A `yield` statement.
630+ */
631+ class YieldStmt extends Stmt , @yieldstmt {
632+ /**
633+ * Gets the value of this `yield` statement.
634+ */
635+ Expr getValue ( ) { result .getParent ( ) = this }
636+
637+ override string pp ( ) { result = "yield ..." }
638+
639+ override string getHalsteadID ( ) { result = "YieldStmt" }
640+ }
641+
646642/** A `continue` statement. */
647643class ContinueStmt extends Stmt , @continuestmt {
648644 /** Gets the label targeted by this `continue` statement, if any. */
0 commit comments