From c9ef8be16ca02f0edd1eb6e170a28b4814d285b5 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 17 Mar 2016 07:05:33 -0700 Subject: [PATCH] addressed PR feedback --- src/compiler/emitter.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 78e83c148e6a3..5972e4c69eba8 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4221,15 +4221,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge const isExported = getCombinedNodeFlags(node) & NodeFlags.Export; if (languageVersion >= ScriptTarget.ES6 && (!isExported || modulekind === ModuleKind.ES6)) { // emit ES6 destructuring only if target module is ES6 or variable is not exported - // exported variables in CJS\AMD are prefixed with 'exports.' so result javascript { exports.toString } = 1; is illegal + // exported variables in CJS/AMD are prefixed with 'exports.' so result javascript { exports.toString } = 1; is illegal const isTopLevelDeclarationInSystemModule = modulekind === ModuleKind.System && shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/true); if (isTopLevelDeclarationInSystemModule) { - // in System modules top level variables are hoisted - // so variable declarations with destructuring are turned into destructuring assignments + // In System modules top level variables are hoisted + // so variable declarations with destructuring are turned into destructuring assignments. + // As a result, they will need parentheses to disambiguate object binding assignments from blocks. write("("); }