PR feedback

This commit is contained in:
Ron Buckton 2017-05-30 15:29:31 -07:00
parent b69afd16dc
commit 423d8a077d
2 changed files with 15 additions and 1 deletions

View file

@ -3360,10 +3360,13 @@ namespace ts {
const classStatements = visitNodes(body.statements, visitor, isStatement, 0, 1);
const remainingStatements = visitNodes(body.statements, visitor, isStatement, 1, body.statements.length - 1);
const varStatement = cast(firstOrUndefined(classStatements), isVariableStatement);
// We know there is only one variable declaration here as we verified this in an
// earlier call to isTypeScriptClassWrapper
const variable = varStatement.declarationList.declarations[0];
const initializer = skipOuterExpressions(variable.initializer);
// Under certain conditions, the 'ts' transformer may may introduce a class alias, which
// Under certain conditions, the 'ts' transformer may introduce a class alias, which
// we see as an assignment, for example:
//
// (function () {

View file

@ -573,6 +573,17 @@ namespace ts {
addConstructorDecorationStatement(statements, node);
if (facts & ClassFacts.UseImmediatelyInvokedFunctionExpression) {
// When we emit a TypeScript class down to ES5, we must wrap it in an IIFE so that the
// 'es2015' transformer can properly nest static initializers and decorators. The result
// looks something like:
//
// var C = function () {
// class C {
// }
// C.static_prop = 1;
// return C;
// }();
//
const closingBraceLocation = createTokenRange(skipTrivia(currentSourceFile.text, node.members.end), SyntaxKind.CloseBraceToken);
const localName = getInternalName(node);