Skip to content

Commit

Permalink
Merge d8cd599 into ada4ca8
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican authored Feb 27, 2022
2 parents ada4ca8 + d8cd599 commit 71825f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 6 additions & 5 deletions boa_engine/src/bytecompiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1515,11 +1515,12 @@ impl<'b> ByteCompiler<'b> {
break;
}
}
assert!(
found,
"Undefined label '{}'",
self.interner().resolve_expect(label_name)
);
if !found {
return self.context.throw_syntax_error(format!(
"Cannot use the undeclared label '{}'",
self.interner().resolve_expect(label_name)
));
}
} else {
self.jump_info
.last_mut()
Expand Down
3 changes: 1 addition & 2 deletions boa_engine/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,14 @@ fn for_loop_iteration_variable_does_not_leak() {
}

#[test]
#[should_panic]
fn test_invalid_break_target() {
let src = r#"
while (false) {
break nonexistent;
}
"#;

let _ = &exec(src);
assert!(Context::default().eval(src).is_err());
}

#[test]
Expand Down

0 comments on commit 71825f1

Please sign in to comment.