Browse Source

src: disable harmony object literals

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>
v1.8.0-commit
Ben Noordhuis 10 years ago
parent
commit
4e58211bb7
  1. 2
      src/node.cc
  2. 10
      test/parallel/test-v8-features.js

2
src/node.cc

@ -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()

10
test/parallel/test-v8-features.js

@ -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] }');

Loading…
Cancel
Save