Error should be thrown later when calling super multiple times (#4256)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
This commit is contained in:
+7
-5
@@ -577,11 +577,7 @@ vm_super_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
ecma_property_t *prop_p = ecma_op_get_this_property (frame_ctx_p->lex_env_p);
|
||||
|
||||
if (ecma_op_this_binding_is_initialized (prop_p))
|
||||
{
|
||||
completion_value = ecma_raise_reference_error (ECMA_ERR_MSG ("Super constructor may only be called once"));
|
||||
}
|
||||
else if (!ecma_is_constructor (func_value))
|
||||
if (!ecma_is_constructor (func_value))
|
||||
{
|
||||
completion_value = ecma_raise_type_error (ECMA_ERR_MSG ("Class extends value is not a constructor."));
|
||||
}
|
||||
@@ -609,6 +605,12 @@ vm_super_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
ecma_free_value (proto_value);
|
||||
}
|
||||
|
||||
if (!ECMA_IS_VALUE_ERROR (completion_value) && ecma_op_this_binding_is_initialized (prop_p))
|
||||
{
|
||||
ecma_free_value (completion_value);
|
||||
completion_value = ecma_raise_reference_error (ECMA_ERR_MSG ("Super constructor may only be called once"));
|
||||
}
|
||||
}
|
||||
|
||||
/* Free registers. */
|
||||
|
||||
@@ -303,7 +303,6 @@
|
||||
<test id="language/line-terminators/S7.3_A2.3.js"><reason>No longer a SyntaxError in ES11</reason></test>
|
||||
<test id="language/line-terminators/S7.3_A2.4.js"><reason>No longer a SyntaxError in ES11</reason></test>
|
||||
<test id="language/module-code/export-unresolvable.js"><reason></reason></test>
|
||||
<test id="language/statements/class/definition/this-check-ordering.js"><reason></reason></test>
|
||||
<test id="language/statements/class/syntax/early-errors/class-body-static-method-get-propname-prototype.js"><reason></reason></test>
|
||||
<test id="language/statements/for-of/iterator-next-reference.js"><reason>ES2018 change: next method must be cached</reason></test>
|
||||
<test id="language/statements/for/S12.6.3_A9.1.js"><reason></reason></test>
|
||||
|
||||
@@ -4060,7 +4060,6 @@
|
||||
<test id="language/statements/class/class-name-ident-yield-escaped.js"><reason></reason></test>
|
||||
<test id="language/statements/class/class-name-ident-yield.js"><reason></reason></test>
|
||||
<test id="language/statements/class/constructor-inferred-observable-iteration.js"><reason></reason></test>
|
||||
<test id="language/statements/class/definition/this-check-ordering.js"><reason></reason></test>
|
||||
<test id="language/statements/class/dstr/async-gen-meth-ary-init-iter-no-close.js"><reason></reason></test>
|
||||
<test id="language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js"><reason></reason></test>
|
||||
<test id="language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-id.js"><reason></reason></test>
|
||||
|
||||
Reference in New Issue
Block a user