nashorn/src/jdk/nashorn/internal/ir/ContinueNode.java
changeset 24751 ccbd9cd3f720
parent 17769 14ea7feaf658
equal deleted inserted replaced
24750:01ea334ab39a 24751:ccbd9cd3f720
    30 
    30 
    31 /**
    31 /**
    32  * IR representation for CONTINUE statements.
    32  * IR representation for CONTINUE statements.
    33  */
    33  */
    34 @Immutable
    34 @Immutable
    35 public class ContinueNode extends Statement {
    35 public class ContinueNode extends JumpStatement {
    36 
       
    37     private IdentNode label;
       
    38 
       
    39     /**
    36     /**
    40      * Constructor
    37      * Constructor
    41      *
    38      *
    42      * @param lineNumber line number
    39      * @param lineNumber line number
    43      * @param token      token
    40      * @param token      token
    44      * @param finish     finish
    41      * @param finish     finish
    45      * @param label      label for break or null if none
    42      * @param labelName  label name for continue or null if none
    46      */
    43      */
    47     public ContinueNode(final int lineNumber, final long token, final int finish, final IdentNode label) {
    44     public ContinueNode(final int lineNumber, final long token, final int finish, final String labelName) {
    48         super(lineNumber, token, finish);
    45         super(lineNumber, token, finish, labelName);
    49         this.label = label;
       
    50     }
    46     }
    51 
    47 
    52     @Override
    48     private ContinueNode(final ContinueNode continueNode, final LocalVariableConversion conversion) {
    53     public boolean hasGoto() {
    49         super(continueNode, conversion);
    54         return true;
       
    55     }
    50     }
    56 
    51 
    57     @Override
    52     @Override
    58     public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
    53     public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
    59         if (visitor.enterContinueNode(this)) {
    54         if (visitor.enterContinueNode(this)) {
    61         }
    56         }
    62 
    57 
    63         return this;
    58         return this;
    64     }
    59     }
    65 
    60 
    66     /**
    61     @Override
    67      * Get the label for this break node
    62     JumpStatement createNewJumpStatement(final LocalVariableConversion conversion) {
    68      * @return label, or null if none
    63         return new ContinueNode(this, conversion);
    69      */
       
    70     public IdentNode getLabel() {
       
    71         return label;
       
    72     }
    64     }
    73 
    65 
    74     @Override
    66     @Override
    75     public void toString(final StringBuilder sb) {
    67     String getStatementName() {
    76         sb.append("continue");
    68         return "continue";
    77 
       
    78         if (label != null) {
       
    79             sb.append(' ');
       
    80             label.toString(sb);
       
    81         }
       
    82     }
    69     }
    83 }
    70 }
    84 
    71