src: disable harmony object literals
authorBen Noordhuis <info@bnoordhuis.nl>
Fri, 9 Jan 2015 16:03:21 +0000 (17:03 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Fri, 9 Jan 2015 19:57:25 +0000 (20:57 +0100)
Per the discussion in https://github.com/iojs/io.js/pull/272, upstream
V8 has disabled Harmony object literals for the time being.  Do the
same for feature parity.

PR-URL: https://github.com/iojs/io.js/pull/272
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Domenic Denicola <domenic@domenicdenicola.com>
src/node.cc
test/parallel/test-v8-features.js

index 0ff8aa2..e390058 100644 (file)
@@ -3360,6 +3360,8 @@ void Init(int* argc,
   // again when we upgrade.
   V8::SetFlagsFromString("--noharmony_classes",
                          sizeof("--noharmony_classes") - 1);
+  V8::SetFlagsFromString("--noharmony_object_literals",
+                         sizeof("--noharmony_object_literals") - 1);
 
 #if defined(NODE_V8_OPTIONS)
   // Should come before the call to V8::SetFlagsFromCommandLine()
index 5075726..aac9de4 100644 (file)
@@ -19,3 +19,13 @@ var args = ['--harmony_classes', '--use_strict', '-p', 'class C {}'];
 var cp = spawnSync(process.execPath, args);
 assert.equal(cp.status, 0);
 assert.equal(cp.stdout.toString('utf8').trim(), '[Function: C]');
+
+// Now do the same for --harmony_object_literals.
+assert.throws(function() { eval('({ f() {} })'); }, SyntaxError);
+v8.setFlagsFromString('--harmony_object_literals');
+eval('({ f() {} })');
+
+var args = ['--harmony_object_literals', '-p', '({ f() {} })'];
+var cp = spawnSync(process.execPath, args);
+assert.equal(cp.status, 0);
+assert.equal(cp.stdout.toString('utf8').trim(), '{ f: [Function: f] }');