Disallow continue referring to a non-IterationStatement. Fix #287
Simplifies handling of labels (their definition/references can be easily figured out at parse time, no need to do it in `figure_out_scope`).
This commit is contained in:
@@ -324,7 +324,7 @@ merge(Compressor.prototype, {
|
||||
|| (ab instanceof AST_Continue && self === loop_body(lct))
|
||||
|| (ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct))) {
|
||||
if (ab.label) {
|
||||
remove(ab.label.thedef.references, ab.label);
|
||||
remove(ab.label.thedef.references, ab);
|
||||
}
|
||||
CHANGED = true;
|
||||
var body = as_statement_array(stat.body).slice(0, -1);
|
||||
@@ -346,7 +346,7 @@ merge(Compressor.prototype, {
|
||||
|| (ab instanceof AST_Continue && self === loop_body(lct))
|
||||
|| (ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct))) {
|
||||
if (ab.label) {
|
||||
remove(ab.label.thedef.references, ab.label);
|
||||
remove(ab.label.thedef.references, ab);
|
||||
}
|
||||
CHANGED = true;
|
||||
stat = stat.clone();
|
||||
@@ -385,7 +385,7 @@ merge(Compressor.prototype, {
|
||||
&& loop_body(lct) === self) || (stat instanceof AST_Continue
|
||||
&& loop_body(lct) === self)) {
|
||||
if (stat.label) {
|
||||
remove(stat.label.thedef.references, stat.label);
|
||||
remove(stat.label.thedef.references, stat);
|
||||
}
|
||||
} else {
|
||||
a.push(stat);
|
||||
|
||||
Reference in New Issue
Block a user