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

Unified Diff: test/mjsunit/strict-mode.js

Issue 873823003: Move object literal checking into checker classes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix assert Created 5 years, 11 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 | « test/mjsunit/object-literal-multiple-proto-fields.js ('k') | test/test262-es6/test262-es6.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/strict-mode.js
diff --git a/test/mjsunit/strict-mode.js b/test/mjsunit/strict-mode.js
index 62d003f9fabb75e62c032767864a2861d483fd01..00d6847ba68f961ed17c737739bbe6ebd21f5a67 100644
--- a/test/mjsunit/strict-mode.js
+++ b/test/mjsunit/strict-mode.js
@@ -169,18 +169,6 @@ assertThrows('\
"use strict";\
}', SyntaxError);
-// Duplicate data properties.
-CheckStrictMode("var x = { dupe : 1, nondupe: 3, dupe : 2 };", SyntaxError);
-CheckStrictMode("var x = { '1234' : 1, '2345' : 2, '1234' : 3 };", SyntaxError);
-CheckStrictMode("var x = { '1234' : 1, '2345' : 2, 1234 : 3 };", SyntaxError);
-CheckStrictMode("var x = { 3.14 : 1, 2.71 : 2, 3.14 : 3 };", SyntaxError);
-CheckStrictMode("var x = { 3.14 : 1, '3.14' : 2 };", SyntaxError);
-CheckStrictMode("var x = { \
- 123: 1, \
- 123.00000000000000000000000000000000000000000000000000000000000000000001: 2 \
-}", SyntaxError);
-
-// Non-conflicting data properties.
(function StrictModeNonDuplicate() {
"use strict";
var x = { 123 : 1, "0123" : 2 };
@@ -191,37 +179,50 @@ CheckStrictMode("var x = { \
};
})();
-// Two getters (non-strict)
-assertThrows("var x = { get foo() { }, get foo() { } };", SyntaxError);
-assertThrows("var x = { get foo(){}, get 'foo'(){}};", SyntaxError);
-assertThrows("var x = { get 12(){}, get '12'(){}};", SyntaxError);
-
-// Two setters (non-strict)
-assertThrows("var x = { set foo(v) { }, set foo(v) { } };", SyntaxError);
-assertThrows("var x = { set foo(v) { }, set 'foo'(v) { } };", SyntaxError);
-assertThrows("var x = { set 13(v) { }, set '13'(v) { } };", SyntaxError);
-
-// Setter and data (non-strict)
-assertThrows("var x = { foo: 'data', set foo(v) { } };", SyntaxError);
-assertThrows("var x = { set foo(v) { }, foo: 'data' };", SyntaxError);
-assertThrows("var x = { foo: 'data', set 'foo'(v) { } };", SyntaxError);
-assertThrows("var x = { set foo(v) { }, 'foo': 'data' };", SyntaxError);
-assertThrows("var x = { 'foo': 'data', set foo(v) { } };", SyntaxError);
-assertThrows("var x = { set 'foo'(v) { }, foo: 'data' };", SyntaxError);
-assertThrows("var x = { 'foo': 'data', set 'foo'(v) { } };", SyntaxError);
-assertThrows("var x = { set 'foo'(v) { }, 'foo': 'data' };", SyntaxError);
-assertThrows("var x = { 12: 1, set '12'(v){}};", SyntaxError);
-assertThrows("var x = { 12: 1, set 12(v){}};", SyntaxError);
-assertThrows("var x = { '12': 1, set '12'(v){}};", SyntaxError);
-assertThrows("var x = { '12': 1, set 12(v){}};", SyntaxError);
-
-// Getter and data (non-strict)
-assertThrows("var x = { foo: 'data', get foo() { } };", SyntaxError);
-assertThrows("var x = { get foo() { }, foo: 'data' };", SyntaxError);
-assertThrows("var x = { 'foo': 'data', get foo() { } };", SyntaxError);
-assertThrows("var x = { get 'foo'() { }, 'foo': 'data' };", SyntaxError);
-assertThrows("var x = { '12': 1, get '12'(){}};", SyntaxError);
-assertThrows("var x = { '12': 1, get 12(){}};", SyntaxError);
+// Duplicate data properties are allowed in ES6
+(function StrictModeDuplicateES6() {
+ 'use strict';
+ var x = {
+ 123: 1,
+ 123.00000000000000000000000000000000000000000000000000000000000000000001: 2
+ };
+ var x = { dupe : 1, nondupe: 3, dupe : 2 };
+ var x = { '1234' : 1, '2345' : 2, '1234' : 3 };
+ var x = { '1234' : 1, '2345' : 2, 1234 : 3 };
+ var x = { 3.14 : 1, 2.71 : 2, 3.14 : 3 };
+ var x = { 3.14 : 1, '3.14' : 2 };
+
+ var x = { get foo() { }, get foo() { } };
+ var x = { get foo(){}, get 'foo'(){}};
+ var x = { get 12(){}, get '12'(){}};
+
+ // Two setters
+ var x = { set foo(v) { }, set foo(v) { } };
+ var x = { set foo(v) { }, set 'foo'(v) { } };
+ var x = { set 13(v) { }, set '13'(v) { } };
+
+ // Setter and data
+ var x = { foo: 'data', set foo(v) { } };
+ var x = { set foo(v) { }, foo: 'data' };
+ var x = { foo: 'data', set 'foo'(v) { } };
+ var x = { set foo(v) { }, 'foo': 'data' };
+ var x = { 'foo': 'data', set foo(v) { } };
+ var x = { set 'foo'(v) { }, foo: 'data' };
+ var x = { 'foo': 'data', set 'foo'(v) { } };
+ var x = { set 'foo'(v) { }, 'foo': 'data' };
+ var x = { 12: 1, set '12'(v){}};
+ var x = { 12: 1, set 12(v){}};
+ var x = { '12': 1, set '12'(v){}};
+ var x = { '12': 1, set 12(v){}};
+
+ // Getter and data
+ var x = { foo: 'data', get foo() { } };
+ var x = { get foo() { }, foo: 'data' };
+ var x = { 'foo': 'data', get foo() { } };
+ var x = { get 'foo'() { }, 'foo': 'data' };
+ var x = { '12': 1, get '12'(){}};
+ var x = { '12': 1, get 12(){}};
+})();
// Assignment to eval or arguments
CheckStrictMode("function strict() { eval = undefined; }", SyntaxError);
« no previous file with comments | « test/mjsunit/object-literal-multiple-proto-fields.js ('k') | test/test262-es6/test262-es6.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698