Skip to content

Commit c9ef8be

Browse files
committed
addressed PR feedback
1 parent 6cf57b1 commit c9ef8be

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/compiler/emitter.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4221,15 +4221,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42214221
const isExported = getCombinedNodeFlags(node) & NodeFlags.Export;
42224222
if (languageVersion >= ScriptTarget.ES6 && (!isExported || modulekind === ModuleKind.ES6)) {
42234223
// emit ES6 destructuring only if target module is ES6 or variable is not exported
4224-
// exported variables in CJS\AMD are prefixed with 'exports.' so result javascript { exports.toString } = 1; is illegal
4224+
// exported variables in CJS/AMD are prefixed with 'exports.' so result javascript { exports.toString } = 1; is illegal
42254225

42264226
const isTopLevelDeclarationInSystemModule =
42274227
modulekind === ModuleKind.System &&
42284228
shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/true);
42294229

42304230
if (isTopLevelDeclarationInSystemModule) {
4231-
// in System modules top level variables are hoisted
4232-
// so variable declarations with destructuring are turned into destructuring assignments
4231+
// In System modules top level variables are hoisted
4232+
// so variable declarations with destructuring are turned into destructuring assignments.
4233+
// As a result, they will need parentheses to disambiguate object binding assignments from blocks.
42334234
write("(");
42344235
}
42354236

0 commit comments

Comments
 (0)