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>
This commit is contained in:
Родитель
a2751e3e1e
Коммит
4e58211bb7
|
@ -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()
|
||||
|
|
|
@ -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] }');
|
||||
|
|
Загрузка…
Ссылка в новой задаче