Open
Description
In ES2015+, calling constructors of classes and builtin classes (Map, Set, WeakMap and WeakSet) without new
throws TypeError
.
Map(); // throws `TypeError`
https://www.ecma-international.org/ecma-262/6.0/#sec-map-iterable
In Closure Compiler ADVANCED
mode, JSC_CONSTRUCTOR_NOT_CALLABLE
warning is correctly thrown in compile time.
But in SIMPLE
or WHITESPACE_ONLY
mode, no warnings are detected in compile time and the runtime doesn't throw any errors.
Should the polyfill runtime of Closure Compiler for the constructors throw runtime error for SIMPLE
and WHITESPACE_ONLY
mode?
I will send a PR if necessary.
Metadata
Metadata
Assignees
Labels
No labels