Bug 1204402 - Fix export-entries.js and module-environment.js to not fail when classes are disabled, r=jorendorff

--HG--
extra : rebase_source : ae906d851b6ff4a66b22978d4c0111d2eb5fb0e7
This commit is contained in:
Eric Faust 2015-09-16 13:03:00 -07:00
Родитель 896a5460e1
Коммит cb66cd4258
2 изменённых файлов: 15 добавлений и 6 удалений

Просмотреть файл

@ -1,3 +1,5 @@
load(libdir + "class.js");
// Test localExportEntries property
function testArrayContents(actual, expected) {
@ -30,9 +32,11 @@ testLocalExportEntries(
'export const x = 1;',
[{exportName: 'x', moduleRequest: null, importName: null, localName: 'x'}]);
testLocalExportEntries(
'export class foo { constructor() {} };',
[{exportName: 'foo', moduleRequest: null, importName: null, localName: 'foo'}]);
if (classesEnabled()) {
testLocalExportEntries(
'export class foo { constructor() {} };',
[{exportName: 'foo', moduleRequest: null, importName: null, localName: 'foo'}]);
}
testLocalExportEntries(
'export default function f() {};',

Просмотреть файл

@ -1,3 +1,5 @@
load(libdir + "class.js");
// Test top-level module environment
function testInitialEnvironment(source, expected) {
@ -17,11 +19,14 @@ testInitialEnvironment('let x = 1;', ['x']);
testInitialEnvironment("if (true) { let x = 1; }", []);
testInitialEnvironment("if (true) { var x = 1; }", ['x']);
testInitialEnvironment('function x() {}', ['x']);
testInitialEnvironment("class x { constructor() {} }", ['x']);
testInitialEnvironment('export var x = 1;', ['x']);
testInitialEnvironment('export let x = 1;', ['x']);
testInitialEnvironment('export default class x { constructor() {} };', ['x']);
testInitialEnvironment('export default function x() {};', ['x']);
testInitialEnvironment('export default 1;', ['*default*']);
testInitialEnvironment('export default class { constructor() {} };', ['*default*']);
testInitialEnvironment('export default function() {};', ['*default*']);
if (classesEnabled()) {
testInitialEnvironment("class x { constructor() {} }", ['x']);
testInitialEnvironment('export default class x { constructor() {} };', ['x']);
testInitialEnvironment('export default class { constructor() {} };', ['*default*']);
}