Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: src/collection.js

Issue 21400002: Calling Map etc without new should throw TypeError (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/harmony/collections.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/collection.js
diff --git a/src/collection.js b/src/collection.js
index 63ddbbb966b523257f04c622beabaf9b277f5e5f..01537e87b0973cee8a65fc759c17fad43fbf7387 100644
--- a/src/collection.js
+++ b/src/collection.js
@@ -47,7 +47,7 @@ function SetConstructor() {
if (%_IsConstructCall()) {
%SetInitialize(this);
} else {
- return new $Set();
+ throw MakeTypeError('constructor_not_function', ['Set']);
}
}
@@ -141,7 +141,7 @@ function MapConstructor() {
if (%_IsConstructCall()) {
%MapInitialize(this);
} else {
- return new $Map();
+ throw MakeTypeError('constructor_not_function', ['Map']);
}
}
@@ -243,7 +243,7 @@ function WeakMapConstructor() {
if (%_IsConstructCall()) {
%WeakCollectionInitialize(this);
} else {
- return new $WeakMap();
+ throw MakeTypeError('constructor_not_function', ['WeakMap']);
}
}
@@ -335,7 +335,7 @@ function WeakSetConstructor() {
if (%_IsConstructCall()) {
%WeakCollectionInitialize(this);
} else {
- return new $WeakSet();
+ throw MakeTypeError('constructor_not_function', ['WeakSet']);
}
}
« no previous file with comments | « no previous file | test/mjsunit/harmony/collections.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698