forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The V8 development branch has unshipped ES6 classes pending resolution of a number of inheritance edge cases. Disable classes in io.js for the sake of feature parity. See nodejs#251 for background and discussion. PR-URL: nodejs#272 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Domenic Denicola <domenic@domenicdenicola.com>
- Loading branch information
1 parent
bc629c0
commit a2751e3
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var common = require('../common'); | ||
var assert = require('assert'); | ||
var spawnSync = require('child_process').spawnSync; | ||
var v8 = require('v8'); | ||
|
||
// --harmony_classes implies --harmony_scoping; ensure that scoping still works | ||
// when classes are disabled. | ||
assert.throws(function() { eval('"use strict"; class C {}'); }, SyntaxError); | ||
eval('"use strict"; let x = 42'); // Should not throw. | ||
eval('"use strict"; const y = 42'); // Should not throw. | ||
|
||
v8.setFlagsFromString('--harmony_classes'); | ||
eval('"use strict"; class C {}'); // Should not throw. | ||
eval('"use strict"; let x = 42'); // Should not throw. | ||
eval('"use strict"; const y = 42'); // Should not throw. | ||
|
||
// Verify that the --harmony_classes flag unlocks classes again. | ||
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]'); |