archives

« Bugzilla Issues Index

#3766 — 14.3.9 DefineMethod: Allocate function object with [[Construct]] method for class constructors


14.3.9 Runtime Semantics: DefineMethod

Step 5:

When FunctionCreate is called with FunctionKind=Method, the resulting function object will not have a [[Construct]] internal method. This is incorrect if DefineMethod is called from ClassDefinitionEvaluation.


A simple solution to fix this:

> 5. If the optional parameter functionPrototype was provided, let kind be Normal; else let kind be Method.
> 6. Let closure be FunctionCreate(kind, StrictFormalParameters, ...


Because we know that only ClassDefinitionEvaluation provides the optional functionPrototype parameter.


fixed in rev33 editor's draft


fixed in rev33