Skip to content

Commit 9b0f5d4

Browse files
Introduce jsp_label_remove_all_labels interface that removes all jump labels registered at the moment of call for usage upon raise of SyntaxError during parse.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
1 parent bd9d1d4 commit 9b0f5d4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

jerry-core/parser/js/jsp-label.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ jsp_label_finalize (void)
4747
JERRY_ASSERT (label_set_p == NULL);
4848
} /* jsp_label_finalize */
4949

50+
/**
51+
* Remove all labels
52+
*
53+
* Note:
54+
* should be used only upon a SyntaxError is raised
55+
*/
56+
void
57+
jsp_label_remove_all_labels (void)
58+
{
59+
label_set_p = NULL;
60+
} /* jsp_label_remove_all_labels */
61+
5062
/**
5163
* Add label to the current label set
5264
*/

jerry-core/parser/js/jsp-label.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ typedef struct jsp_label_t
6767
extern void jsp_label_init (void);
6868
extern void jsp_label_finalize (void);
6969

70+
extern void jsp_label_remove_all_labels (void);
71+
7072
extern void jsp_label_push (jsp_label_t *out_label_p, jsp_label_type_flag_t type_mask, token id);
7173
extern void jsp_label_rewrite_jumps_and_pop (jsp_label_t *label_p, opcode_counter_t break_tgt_oc);
7274

0 commit comments

Comments
 (0)