Browse Source

Quote names in module definition if legacy option is set

gh-1132
chge 8 years ago
parent
commit
c6089e7584
  1. 3
      src/Declaration.js
  2. 2
      test/form/legacy/_expected/amd.js
  3. 2
      test/form/legacy/_expected/cjs.js
  4. 2
      test/form/legacy/_expected/es.js
  5. 2
      test/form/legacy/_expected/iife.js
  6. 2
      test/form/legacy/_expected/umd.js

3
src/Declaration.js

@ -82,6 +82,9 @@ export class SyntheticNamespaceDeclaration {
if ( original.isReassigned ) {
return `${indentString}get ${name} () { return ${original.getName( es )}; }`;
}
if (legacy) {
name = `'${name}'`;
}
return `${indentString}${name}: ${original.getName( es )}`;
});

2
test/form/legacy/_expected/amd.js

@ -4,7 +4,7 @@ define(function () { 'use strict';
var namespace = (Object.freeze || Object)({
foo: foo
'foo': foo
});
const x = 'foo';

2
test/form/legacy/_expected/cjs.js

@ -4,7 +4,7 @@ const foo = 42;
var namespace = (Object.freeze || Object)({
foo: foo
'foo': foo
});
const x = 'foo';

2
test/form/legacy/_expected/es.js

@ -2,7 +2,7 @@ const foo = 42;
var namespace = (Object.freeze || Object)({
foo: foo
'foo': foo
});
const x = 'foo';

2
test/form/legacy/_expected/iife.js

@ -5,7 +5,7 @@
var namespace = (Object.freeze || Object)({
foo: foo
'foo': foo
});
const x = 'foo';

2
test/form/legacy/_expected/umd.js

@ -8,7 +8,7 @@
var namespace = (Object.freeze || Object)({
foo: foo
'foo': foo
});
const x = 'foo';

Loading…
Cancel
Save