Browse Source

ADD: fallback for Object.freeze

legacy-quote-reserved-properties
1111hui 8 years ago
parent
commit
4cff28b3a2
  1. 2
      src/Declaration.js
  2. 2
      test/form/prefer-const/_expected/amd.js
  3. 2
      test/form/prefer-const/_expected/cjs.js
  4. 2
      test/form/prefer-const/_expected/es.js
  5. 2
      test/form/prefer-const/_expected/iife.js
  6. 2
      test/form/prefer-const/_expected/umd.js

2
src/Declaration.js

@ -86,7 +86,7 @@ export class SyntheticNamespaceDeclaration {
return `${indentString}${name}: ${original.getName( es )}`;
});
return `${this.module.bundle.varOrConst} ${this.getName( es )} = Object.freeze({\n${members.join( ',\n' )}\n});\n\n`;
return `${this.module.bundle.varOrConst} ${this.getName( es )} = (Object.freeze || Object)({\n${members.join( ',\n' )}\n});\n\n`;
}
}

2
test/form/prefer-const/_expected/amd.js

@ -4,7 +4,7 @@ define(['external', 'other', 'another'], function (external, other, another) { '
const b = 2;
const namespace = Object.freeze({
const namespace = (Object.freeze || Object)({
a: a,
b: b
});

2
test/form/prefer-const/_expected/cjs.js

@ -8,7 +8,7 @@ const a = 1;
const b = 2;
const namespace = Object.freeze({
const namespace = (Object.freeze || Object)({
a: a,
b: b
});

2
test/form/prefer-const/_expected/es.js

@ -6,7 +6,7 @@ const a = 1;
const b = 2;
const namespace = Object.freeze({
const namespace = (Object.freeze || Object)({
a: a,
b: b
});

2
test/form/prefer-const/_expected/iife.js

@ -5,7 +5,7 @@ const myBundle = (function (external,other,another) {
const b = 2;
const namespace = Object.freeze({
const namespace = (Object.freeze || Object)({
a: a,
b: b
});

2
test/form/prefer-const/_expected/umd.js

@ -8,7 +8,7 @@
const b = 2;
const namespace = Object.freeze({
const namespace = (Object.freeze || Object)({
a: a,
b: b
});

Loading…
Cancel
Save