mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-01 18:54:31 +01:00
The tests from #10023 for `super` and `new.target` in global eval, indirect eval and `Function` bodies check only that a SyntaxError is thrown. The interpreter also throws one at run time when `super` has no home object or constructor (class_ops.rs:450 and :555), so a case the parser let through would still pass them if it threw only at run time. Two tests in es2015_tests.rs put `x = 1` ahead of the forbidden form: - eval_code_with_a_forbidden_super_or_new_target_runs_none_of_it covers 13 cases of `super.y`, `super(...)` and `new.target` in global eval, indirect eval, direct eval in a plain function, and direct eval in a method or constructor that does not allow the form. Each leaves `x` at 0 and throws a SyntaxError. - a_function_body_with_super_is_not_made covers 5 `Function` calls with `super` in the body or a parameter default. Each throws a SyntaxError from `Function` itself, so no function is returned and `x` stays 0. Every case was already rejected by the parser; the tests change no behavior.