Skip to content

Commit 4e58211

Browse files
committed
src: disable harmony object literals
Per the discussion in #272, upstream V8 has disabled Harmony object literals for the time being. Do the same for feature parity. PR-URL: #272 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Domenic Denicola <[email protected]>
1 parent a2751e3 commit 4e58211

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/node.cc

+2
Original file line numberDiff line numberDiff line change
@@ -3360,6 +3360,8 @@ void Init(int* argc,
33603360
// again when we upgrade.
33613361
V8::SetFlagsFromString("--noharmony_classes",
33623362
sizeof("--noharmony_classes") - 1);
3363+
V8::SetFlagsFromString("--noharmony_object_literals",
3364+
sizeof("--noharmony_object_literals") - 1);
33633365

33643366
#if defined(NODE_V8_OPTIONS)
33653367
// Should come before the call to V8::SetFlagsFromCommandLine()

test/parallel/test-v8-features.js

+10
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,13 @@ var args = ['--harmony_classes', '--use_strict', '-p', 'class C {}'];
1919
var cp = spawnSync(process.execPath, args);
2020
assert.equal(cp.status, 0);
2121
assert.equal(cp.stdout.toString('utf8').trim(), '[Function: C]');
22+
23+
// Now do the same for --harmony_object_literals.
24+
assert.throws(function() { eval('({ f() {} })'); }, SyntaxError);
25+
v8.setFlagsFromString('--harmony_object_literals');
26+
eval('({ f() {} })');
27+
28+
var args = ['--harmony_object_literals', '-p', '({ f() {} })'];
29+
var cp = spawnSync(process.execPath, args);
30+
assert.equal(cp.status, 0);
31+
assert.equal(cp.stdout.toString('utf8').trim(), '{ f: [Function: f] }');

0 commit comments

Comments
 (0)