Closed claudepache closed 7 years ago
... or maybe the requirement should be only for non-anonymous well-known intrinsic objects.
I think we should just make it an invariant that all well-known intrinsics that are functions be given names. Basically, add
The value of the name property of %ThrowTypeError% is "ThrowTypeError".
to 9.2.7.1. I'll open a PR.
By the way @claudepache, how did you get a reference to this intrinsic in order to observe its name?
how did you get a reference to this intrinsic in order to observe its name?
var ThrowTypeError = (function() { "use strict"; return Object.getOwnPropertyDescriptor(arguments, "callee").get })()
The Function.prototype.toString() definition says:
However, the intrinsic %ThrowTypeError% is anonymous, and ECMA262 requires the name property only for non-anonymous built-in functions (Section 17)
In implementation reality, the name property of %ThrowTypeError% varies between undefined (Chakra) and "" (SM, V8, JSC).
Possible fix: use anonymous in place of the name for anonymous function.