diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 49434e80aba..e2d31162127 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2592,7 +2592,7 @@ namespace ts { } // Currently, we only support generators that were originally async function bodies. - if (asteriskToken && node.emitFlags & NodeEmitFlags.AsyncFunctionBody) { + if (asteriskToken && getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { transformFlags |= TransformFlags.AssertGenerator; } @@ -2667,7 +2667,7 @@ namespace ts { // down-level generator. // Currently we do not support transforming any other generator fucntions // down level. - if (asteriskToken && node.emitFlags & NodeEmitFlags.AsyncFunctionBody) { + if (asteriskToken && getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { transformFlags |= TransformFlags.AssertGenerator; } } @@ -2698,7 +2698,7 @@ namespace ts { // down-level generator. // Currently we do not support transforming any other generator fucntions // down level. - if (asteriskToken && node.emitFlags & NodeEmitFlags.AsyncFunctionBody) { + if (asteriskToken && getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { transformFlags |= TransformFlags.AssertGenerator; } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c764b50b2ce..bf7e4ef92e6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9421,8 +9421,8 @@ namespace ts { let container = getSuperContainer(node, /*stopOnFunctions*/ true); let needToCaptureLexicalThis = false; + // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting while (container && container.kind === SyntaxKind.ArrowFunction) { container = getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < ScriptTarget.ES6; @@ -14439,6 +14439,7 @@ namespace ts { // constructors of derived classes must contain at least one super call somewhere in their function body. const containingClassDecl = node.parent; if (getClassExtendsHeritageClauseElement(containingClassDecl)) { + captureLexicalThis(node.parent, containingClassDecl); const classExtendsNull = classDeclarationExtendsNull(containingClassDecl); const superCall = getSuperCallInConstructor(node); if (superCall) { @@ -17713,9 +17714,11 @@ namespace ts { } function checkGrammarModuleElementContext(node: Statement, errorMessage: DiagnosticMessage): boolean { - if (node.parent.kind !== SyntaxKind.SourceFile && node.parent.kind !== SyntaxKind.ModuleBlock && node.parent.kind !== SyntaxKind.ModuleDeclaration) { - return grammarErrorOnFirstToken(node, errorMessage); + const isInAppropriateContext = node.parent.kind === SyntaxKind.SourceFile || node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.ModuleDeclaration; + if (!isInAppropriateContext) { + grammarErrorOnFirstToken(node, errorMessage); } + return !isInAppropriateContext; } function checkExportSpecifier(node: ExportSpecifier) { @@ -17756,7 +17759,7 @@ namespace ts { checkExpressionCached(node.expression); } - checkExternalModuleExports(container); + checkExternalModuleExports(container); if (node.isExportEquals && !isInAmbientContext(node)) { if (modulekind === ModuleKind.ES6) { diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts index 1bca13a4bdb..116a8e849a3 100644 --- a/src/compiler/comments.ts +++ b/src/compiler/comments.ts @@ -5,7 +5,7 @@ namespace ts { export interface CommentWriter { reset(): void; setSourceFile(sourceFile: SourceFile): void; - emitNodeWithComments(node: Node, emitCallback: (node: Node) => void): void; + emitNodeWithComments(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; emitBodyWithDetachedComments(node: Node, detachedRange: TextRange, emitCallback: (node: Node) => void): void; emitTrailingCommentsOfPosition(pos: number): void; } @@ -34,22 +34,24 @@ namespace ts { emitTrailingCommentsOfPosition, }; - function emitNodeWithComments(node: Node, emitCallback: (node: Node) => void) { + function emitNodeWithComments(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) { if (disabled) { - emitCallback(node); + emitCallback(emitContext, node); return; } if (node) { - const { pos, end } = node.commentRange || node; - const emitFlags = node.emitFlags; + const { pos, end } = getCommentRange(node); + const emitFlags = getEmitFlags(node); if ((pos < 0 && end < 0) || (pos === end)) { // Both pos and end are synthesized, so just emit the node without comments. - if (emitFlags & NodeEmitFlags.NoNestedComments) { - disableCommentsAndEmit(node, emitCallback); + if (emitFlags & EmitFlags.NoNestedComments) { + disabled = true; + emitCallback(emitContext, node); + disabled = false; } else { - emitCallback(node); + emitCallback(emitContext, node); } } else { @@ -58,8 +60,8 @@ namespace ts { } const isEmittedNode = node.kind !== SyntaxKind.NotEmittedStatement; - const skipLeadingComments = pos < 0 || (emitFlags & NodeEmitFlags.NoLeadingComments) !== 0; - const skipTrailingComments = end < 0 || (emitFlags & NodeEmitFlags.NoTrailingComments) !== 0; + const skipLeadingComments = pos < 0 || (emitFlags & EmitFlags.NoLeadingComments) !== 0; + const skipTrailingComments = end < 0 || (emitFlags & EmitFlags.NoTrailingComments) !== 0; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. @@ -90,11 +92,13 @@ namespace ts { performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & NodeEmitFlags.NoNestedComments) { - disableCommentsAndEmit(node, emitCallback); + if (emitFlags & EmitFlags.NoNestedComments) { + disabled = true; + emitCallback(emitContext, node); + disabled = false; } else { - emitCallback(node); + emitCallback(emitContext, node); } if (extendedDiagnostics) { @@ -125,9 +129,9 @@ namespace ts { } const { pos, end } = detachedRange; - const emitFlags = node.emitFlags; - const skipLeadingComments = pos < 0 || (emitFlags & NodeEmitFlags.NoLeadingComments) !== 0; - const skipTrailingComments = disabled || end < 0 || (emitFlags & NodeEmitFlags.NoTrailingComments) !== 0; + const emitFlags = getEmitFlags(node); + const skipLeadingComments = pos < 0 || (emitFlags & EmitFlags.NoLeadingComments) !== 0; + const skipTrailingComments = disabled || end < 0 || (emitFlags & EmitFlags.NoTrailingComments) !== 0; if (!skipLeadingComments) { emitDetachedCommentsAndUpdateCommentsInfo(detachedRange); @@ -137,8 +141,10 @@ namespace ts { performance.measure("commentTime", "preEmitBodyWithDetachedComments"); } - if (emitFlags & NodeEmitFlags.NoNestedComments) { - disableCommentsAndEmit(node, emitCallback); + if (emitFlags & EmitFlags.NoNestedComments && !disabled) { + disabled = true; + emitCallback(node); + disabled = false; } else { emitCallback(node); @@ -284,17 +290,6 @@ namespace ts { detachedCommentsInfo = undefined; } - function disableCommentsAndEmit(node: Node, emitCallback: (node: Node) => void): void { - if (disabled) { - emitCallback(node); - } - else { - disabled = true; - emitCallback(node); - disabled = false; - } - } - function hasDetachedComments(pos: number) { return detachedCommentsInfo !== undefined && lastOrUndefined(detachedCommentsInfo).nodePos === pos; } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index c3954416c48..bcb808fa833 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -840,6 +840,72 @@ namespace ts { }; } + /** + * High-order function, creates a function that executes a function composition. + * For example, `chain(a, b)` is the equivalent of `x => ((a', b') => y => b'(a'(y)))(a(x), b(x))` + * + * @param args The functions to chain. + */ + export function chain(...args: ((t: T) => (u: U) => U)[]): (t: T) => (u: U) => U; + export function chain(a: (t: T) => (u: U) => U, b: (t: T) => (u: U) => U, c: (t: T) => (u: U) => U, d: (t: T) => (u: U) => U, e: (t: T) => (u: U) => U): (t: T) => (u: U) => U { + if (e) { + const args: ((t: T) => (u: U) => U)[] = []; + for (let i = 0; i < arguments.length; i++) { + args[i] = arguments[i]; + } + + return t => compose(...map(args, f => f(t))); + } + else if (d) { + return t => compose(a(t), b(t), c(t), d(t)); + } + else if (c) { + return t => compose(a(t), b(t), c(t)); + } + else if (b) { + return t => compose(a(t), b(t)); + } + else if (a) { + return t => compose(a(t)); + } + else { + return t => u => u; + } + } + + /** + * High-order function, composes functions. Note that functions are composed inside-out; + * for example, `compose(a, b)` is the equivalent of `x => b(a(x))`. + * + * @param args The functions to compose. + */ + export function compose(...args: ((t: T) => T)[]): (t: T) => T; + export function compose(a: (t: T) => T, b: (t: T) => T, c: (t: T) => T, d: (t: T) => T, e: (t: T) => T): (t: T) => T { + if (e) { + const args: ((t: T) => T)[] = []; + for (let i = 0; i < arguments.length; i++) { + args[i] = arguments[i]; + } + + return t => reduceLeft<(t: T) => T, T>(args, (u, f) => f(u), t); + } + else if (d) { + return t => d(c(b(a(t)))); + } + else if (c) { + return t => c(b(a(t))); + } + else if (b) { + return t => b(a(t)); + } + else if (a) { + return t => a(t); + } + else { + return t => t; + } + } + function formatStringFromArgs(text: string, args: { [index: number]: any; }, baseIndex?: number): string { baseIndex = baseIndex || 0; @@ -1790,7 +1856,6 @@ namespace ts { this.transformFlags = TransformFlags.None; this.parent = undefined; this.original = undefined; - this.transformId = 0; } export let objectAllocator: ObjectAllocator = { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 90742f30c16..b3242e211de 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -206,10 +206,8 @@ const _super = (function (geti, seti) { const sourceMap = createSourceMapWriter(host, writer); const { - emitStart, - emitEnd, - emitTokenStart, - emitTokenEnd + emitNodeWithSourceMap, + emitTokenWithSourceMap } = sourceMap; const comments = createCommentWriter(host, writer, sourceMap); @@ -234,36 +232,27 @@ const _super = (function (geti, seti) { let isOwnFileEmit: boolean; let emitSkipped = false; - performance.mark("beforeTransform"); + const sourceFiles = getSourceFilesToEmit(host, targetSourceFile); // Transform the source files - const transformed = transformFiles( - resolver, - host, - getSourceFilesToEmit(host, targetSourceFile), - transformers); - + performance.mark("beforeTransform"); + const { + transformed, + emitNodeWithSubstitution, + emitNodeWithNotification + } = transformFiles(resolver, host, sourceFiles, transformers); performance.measure("transformTime", "beforeTransform"); - // Extract helpers from the result - const { - getTokenSourceMapRange, - isSubstitutionEnabled, - isEmitNotificationEnabled, - onSubstituteNode, - onEmitNode - } = transformed; - - performance.mark("beforePrint"); - // Emit each output file - forEachTransformedEmitFile(host, transformed.getSourceFiles(), emitFile, emitOnlyDtsFiles); - - // Clean up after transformation - transformed.dispose(); - + performance.mark("beforePrint"); + forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); performance.measure("printTime", "beforePrint"); + // Clean up emit nodes on parse tree + for (const sourceFile of sourceFiles) { + disposeEmitNodes(sourceFile); + } + return { emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), @@ -358,154 +347,137 @@ const _super = (function (geti, seti) { currentFileIdentifiers = node.identifiers; sourceMap.setSourceFile(node); comments.setSourceFile(node); - emitNodeWithNotification(node, emitWorker); + pipelineEmitWithNotification(EmitContext.SourceFile, node); } /** * Emits a node. */ function emit(node: Node) { - emitNodeWithNotification(node, emitWithComments); - } - - - /** - * Emits a node with comments. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from emit. - */ - function emitWithComments(node: Node) { - emitNodeWithComments(node, emitWithSourceMap); + pipelineEmitWithNotification(EmitContext.Unspecified, node); } /** - * Emits a node with source maps. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from emitWithComments. + * Emits an IdentifierName. */ - function emitWithSourceMap(node: Node) { - emitNodeWithSourceMap(node, emitWorker); - } - function emitIdentifierName(node: Identifier) { - if (node) { - emitNodeWithNotification(node, emitIdentifierNameWithComments); - } - } - - function emitIdentifierNameWithComments(node: Identifier) { - emitNodeWithComments(node, emitWorker); + pipelineEmitWithNotification(EmitContext.IdentifierName, node); } /** * Emits an expression node. */ function emitExpression(node: Expression) { - emitNodeWithNotification(node, emitExpressionWithComments); + pipelineEmitWithNotification(EmitContext.Expression, node); } /** - * Emits an expression with comments. + * Emits a node with possible notification. * - * NOTE: Do not call this method directly. It is part of the emitExpression pipeline - * and should only be called indirectly from emitExpression. + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called from printSourceFile, emit, emitExpression, or + * emitIdentifierName. */ - function emitExpressionWithComments(node: Expression) { - emitNodeWithComments(node, emitExpressionWithSourceMap); + function pipelineEmitWithNotification(emitContext: EmitContext, node: Node) { + emitNodeWithNotification(emitContext, node, pipelineEmitWithComments); } /** - * Emits an expression with source maps. + * Emits a node with comments. * - * NOTE: Do not call this method directly. It is part of the emitExpression pipeline - * and should only be called indirectly from emitExpressionWithComments. + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitWithNotification. */ - function emitExpressionWithSourceMap(node: Expression) { - emitNodeWithSourceMap(node, emitExpressionWorker); - } - - /** - * Emits a node with emit notification if available. - */ - function emitNodeWithNotification(node: Node, emitCallback: (node: Node) => void) { - if (node) { - if (isEmitNotificationEnabled(node)) { - onEmitNode(node, emitCallback); - } - else { - emitCallback(node); - } - } - } - - function emitNodeWithSourceMap(node: Node, emitCallback: (node: Node) => void) { - if (node) { - emitStart(/*range*/ node, /*contextNode*/ node, shouldSkipLeadingSourceMapForNode, shouldSkipSourceMapForChildren, getSourceMapRange); - emitCallback(node); - emitEnd(/*range*/ node, /*contextNode*/ node, shouldSkipTrailingSourceMapForNode, shouldSkipSourceMapForChildren, getSourceMapRange); - } - } - - function getSourceMapRange(node: Node) { - return node.sourceMapRange || node; - } - - /** - * Determines whether to skip leading comment emit for a node. - * - * We do not emit comments for NotEmittedStatement nodes or any node that has - * NodeEmitFlags.NoLeadingComments. - * - * @param node A Node. - */ - function shouldSkipLeadingCommentsForNode(node: Node) { - return isNotEmittedStatement(node) - || (node.emitFlags & NodeEmitFlags.NoLeadingComments) !== 0; - } - - /** - * Determines whether to skip source map emit for the start position of a node. - * - * We do not emit source maps for NotEmittedStatement nodes or any node that - * has NodeEmitFlags.NoLeadingSourceMap. - * - * @param node A Node. - */ - function shouldSkipLeadingSourceMapForNode(node: Node) { - return isNotEmittedStatement(node) - || (node.emitFlags & NodeEmitFlags.NoLeadingSourceMap) !== 0; - } - - - /** - * Determines whether to skip source map emit for the end position of a node. - * - * We do not emit source maps for NotEmittedStatement nodes or any node that - * has NodeEmitFlags.NoTrailingSourceMap. - * - * @param node A Node. - */ - function shouldSkipTrailingSourceMapForNode(node: Node) { - return isNotEmittedStatement(node) - || (node.emitFlags & NodeEmitFlags.NoTrailingSourceMap) !== 0; - } - - /** - * Determines whether to skip source map emit for a node and its children. - * - * We do not emit source maps for a node that has NodeEmitFlags.NoNestedSourceMaps. - */ - function shouldSkipSourceMapForChildren(node: Node) { - return (node.emitFlags & NodeEmitFlags.NoNestedSourceMaps) !== 0; - } - - function emitWorker(node: Node): void { - if (tryEmitSubstitute(node, emitWorker, /*isExpression*/ false)) { + function pipelineEmitWithComments(emitContext: EmitContext, node: Node) { + // Do not emit comments for SourceFile + if (emitContext === EmitContext.SourceFile) { + pipelineEmitWithSourceMap(emitContext, node); return; } + emitNodeWithComments(emitContext, node, pipelineEmitWithSourceMap); + } + + /** + * Emits a node with source maps. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitWithComments. + */ + function pipelineEmitWithSourceMap(emitContext: EmitContext, node: Node) { + // Do not emit source mappings for SourceFile or IdentifierName + if (emitContext === EmitContext.SourceFile + || emitContext === EmitContext.IdentifierName) { + pipelineEmitWithSubstitution(emitContext, node); + return; + } + + emitNodeWithSourceMap(emitContext, node, pipelineEmitWithSubstitution); + } + + /** + * Emits a node with possible substitution. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitWithSourceMap or + * pipelineEmitInUnspecifiedContext (when picking a more specific context). + */ + function pipelineEmitWithSubstitution(emitContext: EmitContext, node: Node) { + emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext); + } + + /** + * Emits a node. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitWithSubstitution. + */ + function pipelineEmitForContext(emitContext: EmitContext, node: Node): void { + switch (emitContext) { + case EmitContext.SourceFile: return pipelineEmitInSourceFileContext(node); + case EmitContext.IdentifierName: return pipelineEmitInIdentifierNameContext(node); + case EmitContext.Unspecified: return pipelineEmitInUnspecifiedContext(node); + case EmitContext.Expression: return pipelineEmitInExpressionContext(node); + } + } + + /** + * Emits a node in the SourceFile EmitContext. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitForContext. + */ + function pipelineEmitInSourceFileContext(node: Node): void { + const kind = node.kind; + switch (kind) { + // Top-level nodes + case SyntaxKind.SourceFile: + return emitSourceFile(node); + } + } + + /** + * Emits a node in the IdentifierName EmitContext. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitForContext. + */ + function pipelineEmitInIdentifierNameContext(node: Node): void { + const kind = node.kind; + switch (kind) { + // Identifiers + case SyntaxKind.Identifier: + return emitIdentifier(node); + } + } + + /** + * Emits a node in the Unspecified EmitContext. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitForContext. + */ + function pipelineEmitInUnspecifiedContext(node: Node): void { const kind = node.kind; switch (kind) { // Pseudo-literals @@ -541,7 +513,8 @@ const _super = (function (geti, seti) { case SyntaxKind.StringKeyword: case SyntaxKind.SymbolKeyword: case SyntaxKind.GlobalKeyword: - return writeTokenNode(node); + writeTokenText(kind); + return; // Parse tree nodes @@ -746,25 +719,24 @@ const _super = (function (geti, seti) { case SyntaxKind.EnumMember: return emitEnumMember(node); - // Top-level nodes - case SyntaxKind.SourceFile: - return emitSourceFile(node); - // JSDoc nodes (ignored) - // Transformation nodes (ignored) } + // If the node is an expression, try to emit it as an expression with + // substitution. if (isExpression(node)) { - return emitExpressionWorker(node); + return pipelineEmitWithSubstitution(EmitContext.Expression, node); } } - function emitExpressionWorker(node: Node) { - if (tryEmitSubstitute(node, emitExpressionWorker, /*isExpression*/ true)) { - return; - } - + /** + * Emits a node in the Expression EmitContext. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitForContext. + */ + function pipelineEmitInExpressionContext(node: Node): void { const kind = node.kind; switch (kind) { // Literals @@ -786,7 +758,8 @@ const _super = (function (geti, seti) { case SyntaxKind.SuperKeyword: case SyntaxKind.TrueKeyword: case SyntaxKind.ThisKeyword: - return writeTokenNode(node); + writeTokenText(kind); + return; // Expressions case SyntaxKind.ArrayLiteralExpression: @@ -888,7 +861,7 @@ const _super = (function (geti, seti) { // function emitIdentifier(node: Identifier) { - if (node.emitFlags & NodeEmitFlags.UMDDefine) { + if (getEmitFlags(node) & EmitFlags.UMDDefine) { writeLines(umdHelper); } else { @@ -1161,7 +1134,7 @@ const _super = (function (geti, seti) { write("{}"); } else { - const indentedFlag = node.emitFlags & NodeEmitFlags.Indented; + const indentedFlag = getEmitFlags(node) & EmitFlags.Indented; if (indentedFlag) { increaseIndent(); } @@ -1177,24 +1150,22 @@ const _super = (function (geti, seti) { } function emitPropertyAccessExpression(node: PropertyAccessExpression) { - if (tryEmitConstantValue(node)) { - return; - } - let indentBeforeDot = false; let indentAfterDot = false; - if (!(node.emitFlags & NodeEmitFlags.NoIndentation)) { + if (!(getEmitFlags(node) & EmitFlags.NoIndentation)) { const dotRangeStart = node.expression.end; const dotRangeEnd = skipTrivia(currentText, node.expression.end) + 1; const dotToken = { kind: SyntaxKind.DotToken, pos: dotRangeStart, end: dotRangeEnd }; indentBeforeDot = needsIndentation(node, node.expression, dotToken); indentAfterDot = needsIndentation(node, dotToken, node.name); } - const shouldEmitDotDot = !indentBeforeDot && needsDotDotForPropertyAccess(node.expression); emitExpression(node.expression); increaseIndentIf(indentBeforeDot); + + const shouldEmitDotDot = !indentBeforeDot && needsDotDotForPropertyAccess(node.expression); write(shouldEmitDotDot ? ".." : "."); + increaseIndentIf(indentAfterDot); emit(node.name); decreaseIndentIf(indentBeforeDot, indentAfterDot); @@ -1208,19 +1179,17 @@ const _super = (function (geti, seti) { const text = getLiteralTextOfNode(expression); return text.indexOf(tokenToString(SyntaxKind.DotToken)) < 0; } - else { + else if (isPropertyAccessExpression(expression) || isElementAccessExpression(expression)) { // check if constant enum value is integer - const constantValue = tryGetConstEnumValue(expression); + const constantValue = getConstantValue(expression); // isFinite handles cases when constantValue is undefined - return isFinite(constantValue) && Math.floor(constantValue) === constantValue; + return isFinite(constantValue) + && Math.floor(constantValue) === constantValue + && compilerOptions.removeComments; } } function emitElementAccessExpression(node: ElementAccessExpression) { - if (tryEmitConstantValue(node)) { - return; - } - emitExpression(node.expression); write("["); emitExpression(node.argumentExpression); @@ -1426,7 +1395,7 @@ const _super = (function (geti, seti) { } function emitBlockStatements(node: Block) { - if (node.emitFlags & NodeEmitFlags.SingleLine) { + if (getEmitFlags(node) & EmitFlags.SingleLine) { emitList(node, node.statements, ListFormat.SingleLineBlockStatements); } else { @@ -1630,12 +1599,12 @@ const _super = (function (geti, seti) { const body = node.body; if (body) { if (isBlock(body)) { - const indentedFlag = node.emitFlags & NodeEmitFlags.Indented; + const indentedFlag = getEmitFlags(node) & EmitFlags.Indented; if (indentedFlag) { increaseIndent(); } - if (node.emitFlags & NodeEmitFlags.ReuseTempVariableScope) { + if (getEmitFlags(node) & EmitFlags.ReuseTempVariableScope) { emitSignatureHead(node); emitBlockFunctionBody(node, body); } @@ -1679,7 +1648,7 @@ const _super = (function (geti, seti) { // * A non-synthesized body's start and end position are on different lines. // * Any statement in the body starts on a new line. - if (body.emitFlags & NodeEmitFlags.SingleLine) { + if (getEmitFlags(body) & EmitFlags.SingleLine) { return true; } @@ -1750,7 +1719,7 @@ const _super = (function (geti, seti) { write("class"); emitNodeWithPrefix(" ", node.name, emitIdentifierName); - const indentedFlag = node.emitFlags & NodeEmitFlags.Indented; + const indentedFlag = getEmitFlags(node) & EmitFlags.Indented; if (indentedFlag) { increaseIndent(); } @@ -2083,8 +2052,8 @@ const _super = (function (geti, seti) { // "comment1" is not considered to be leading comment for node.initializer // but rather a trailing comment on the previous node. const initializer = node.initializer; - if (!shouldSkipLeadingCommentsForNode(initializer)) { - const commentRange = initializer.commentRange || initializer; + if ((getEmitFlags(initializer) & EmitFlags.NoLeadingComments) === 0) { + const commentRange = getCommentRange(initializer); emitTrailingCommentsOfPosition(commentRange.pos); } @@ -2156,23 +2125,23 @@ const _super = (function (geti, seti) { } function emitHelpers(node: Node) { - const emitFlags = node.emitFlags; + const emitFlags = getEmitFlags(node); let helpersEmitted = false; - if (emitFlags & NodeEmitFlags.EmitEmitHelpers) { + if (emitFlags & EmitFlags.EmitEmitHelpers) { helpersEmitted = emitEmitHelpers(currentSourceFile); } - if (emitFlags & NodeEmitFlags.EmitExportStar) { + if (emitFlags & EmitFlags.EmitExportStar) { writeLines(exportStarHelper); helpersEmitted = true; } - if (emitFlags & NodeEmitFlags.EmitSuperHelper) { + if (emitFlags & EmitFlags.EmitSuperHelper) { writeLines(superHelper); helpersEmitted = true; } - if (emitFlags & NodeEmitFlags.EmitAdvancedSuperHelper) { + if (emitFlags & EmitFlags.EmitAdvancedSuperHelper) { writeLines(advancedSuperHelper); helpersEmitted = true; } @@ -2294,36 +2263,6 @@ const _super = (function (geti, seti) { } } - function tryEmitSubstitute(node: Node, emitNode: (node: Node) => void, isExpression: boolean) { - if (isSubstitutionEnabled(node) && (node.emitFlags & NodeEmitFlags.NoSubstitution) === 0) { - const substitute = onSubstituteNode(node, isExpression); - if (substitute !== node) { - substitute.emitFlags |= NodeEmitFlags.NoSubstitution; - emitNode(substitute); - return true; - } - } - - return false; - } - - function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean { - const constantValue = tryGetConstEnumValue(node); - if (constantValue !== undefined) { - write(String(constantValue)); - if (!compilerOptions.removeComments) { - const propertyName = isPropertyAccessExpression(node) - ? declarationNameToString(node.name) - : getTextOfNode(node.argumentExpression); - write(` /* ${propertyName} */`); - } - - return true; - } - - return false; - } - function emitEmbeddedStatement(node: Statement) { if (isBlock(node)) { write(" "); @@ -2447,7 +2386,7 @@ const _super = (function (geti, seti) { } if (shouldEmitInterveningComments) { - const commentRange = child.commentRange || child; + const commentRange = getCommentRange(child); emitTrailingCommentsOfPosition(commentRange.pos); } else { @@ -2503,31 +2442,13 @@ const _super = (function (geti, seti) { } function writeToken(token: SyntaxKind, pos: number, contextNode?: Node) { - const tokenStartPos = emitTokenStart(token, pos, contextNode, shouldSkipLeadingSourceMapForToken, getTokenSourceMapRange); - const tokenEndPos = writeTokenText(token, tokenStartPos); - return emitTokenEnd(token, tokenEndPos, contextNode, shouldSkipTrailingSourceMapForToken, getTokenSourceMapRange); - } - - function shouldSkipLeadingSourceMapForToken(contextNode: Node) { - return (contextNode.emitFlags & NodeEmitFlags.NoTokenLeadingSourceMaps) !== 0; - } - - function shouldSkipTrailingSourceMapForToken(contextNode: Node) { - return (contextNode.emitFlags & NodeEmitFlags.NoTokenTrailingSourceMaps) !== 0; + return emitTokenWithSourceMap(contextNode, token, pos, writeTokenText); } function writeTokenText(token: SyntaxKind, pos?: number) { const tokenString = tokenToString(token); write(tokenString); - return positionIsSynthesized(pos) ? -1 : pos + tokenString.length; - } - - function writeTokenNode(node: Node) { - if (node) { - emitStart(/*range*/ node, /*contextNode*/ node, shouldSkipLeadingSourceMapForNode, shouldSkipSourceMapForChildren, getSourceMapRange); - writeTokenText(node.kind); - emitEnd(/*range*/ node, /*contextNode*/ node, shouldSkipTrailingSourceMapForNode, shouldSkipSourceMapForChildren, getSourceMapRange); - } + return pos < 0 ? pos : pos + tokenString.length; } function increaseIndentIf(value: boolean, valueToWriteWhenNotIndenting?: string) { @@ -2692,16 +2613,6 @@ const _super = (function (geti, seti) { return getLiteralText(node, currentSourceFile, languageVersion); } - function tryGetConstEnumValue(node: Node): number { - if (compilerOptions.isolatedModules) { - return undefined; - } - - return isPropertyAccessExpression(node) || isElementAccessExpression(node) - ? resolver.getConstantValue(node) - : undefined; - } - function isSingleLineEmptyBlock(block: Block) { return !block.multiLine && block.statements.length === 0 diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 48296145dbc..d873c3ef877 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -76,7 +76,7 @@ namespace ts { // the original node. We also need to exclude specific properties and only include own- // properties (to skip members already defined on the shared prototype). const clone = createNode(node.kind, /*location*/ undefined, node.flags); - clone.original = node; + setOriginalNode(clone, node); for (const key in node) { if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { @@ -435,7 +435,7 @@ namespace ts { export function createPropertyAccess(expression: Expression, name: string | Identifier, location?: TextRange, flags?: NodeFlags) { const node = createNode(SyntaxKind.PropertyAccessExpression, location, flags); node.expression = parenthesizeForAccess(expression); - node.emitFlags = NodeEmitFlags.NoIndentation; + (node.emitNode || (node.emitNode = {})).flags |= EmitFlags.NoIndentation; node.name = typeof name === "string" ? createIdentifier(name) : name; return node; } @@ -444,7 +444,7 @@ namespace ts { if (node.expression !== expression || node.name !== name) { const propertyAccess = createPropertyAccess(expression, name, /*location*/ node, node.flags); // Because we are updating existed propertyAccess we want to inherit its emitFlags instead of using default from createPropertyAccess - propertyAccess.emitFlags = node.emitFlags; + (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node); return updateNode(propertyAccess, node); } return node; @@ -1551,7 +1551,7 @@ namespace ts { } else { const expression = isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location); - expression.emitFlags |= NodeEmitFlags.NoNestedSourceMaps; + (expression.emitNode || (expression.emitNode = {})).flags |= EmitFlags.NoNestedSourceMaps; return expression; } } @@ -1744,7 +1744,7 @@ namespace ts { ); // Mark this node as originally an async function - generatorFunc.emitFlags |= NodeEmitFlags.AsyncFunctionBody; + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= EmitFlags.AsyncFunctionBody; return createCall( createHelperName(externalHelpersModuleName, "__awaiter"), @@ -2222,7 +2222,7 @@ namespace ts { target.push(startOnNewLine(createStatement(createLiteral("use strict")))); foundUseStrict = true; } - if (statement.emitFlags & NodeEmitFlags.CustomPrologue) { + if (getEmitFlags(statement) & EmitFlags.CustomPrologue) { target.push(visitor ? visitNode(statement, visitor, isStatement) : statement); } else { @@ -2643,14 +2643,178 @@ namespace ts { export function setOriginalNode(node: T, original: Node): T { node.original = original; if (original) { - const { emitFlags, commentRange, sourceMapRange } = original; - if (emitFlags) node.emitFlags = emitFlags; - if (commentRange) node.commentRange = commentRange; - if (sourceMapRange) node.sourceMapRange = sourceMapRange; + const emitNode = original.emitNode; + if (emitNode) node.emitNode = mergeEmitNode(emitNode, node.emitNode); } return node; } + function mergeEmitNode(sourceEmitNode: EmitNode, destEmitNode: EmitNode) { + const { flags, commentRange, sourceMapRange, tokenSourceMapRanges } = sourceEmitNode; + if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges)) destEmitNode = {}; + if (flags) destEmitNode.flags = flags; + if (commentRange) destEmitNode.commentRange = commentRange; + if (sourceMapRange) destEmitNode.sourceMapRange = sourceMapRange; + if (tokenSourceMapRanges) destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + return destEmitNode; + } + + function mergeTokenSourceMapRanges(sourceRanges: Map, destRanges: Map) { + if (!destRanges) destRanges = createMap(); + copyProperties(sourceRanges, destRanges); + return destRanges; + } + + /** + * Clears any EmitNode entries from parse-tree nodes. + * @param sourceFile A source file. + */ + export function disposeEmitNodes(sourceFile: SourceFile) { + // During transformation we may need to annotate a parse tree node with transient + // transformation properties. As parse tree nodes live longer than transformation + // nodes, we need to make sure we reclaim any memory allocated for custom ranges + // from these nodes to ensure we do not hold onto entire subtrees just for position + // information. We also need to reset these nodes to a pre-transformation state + // for incremental parsing scenarios so that we do not impact later emit. + sourceFile = getSourceFileOfNode(getParseTreeNode(sourceFile)); + const emitNode = sourceFile && sourceFile.emitNode; + const annotatedNodes = emitNode && emitNode.annotatedNodes; + if (annotatedNodes) { + for (const node of annotatedNodes) { + node.emitNode = undefined; + } + } + } + + /** + * Associates a node with the current transformation, initializing + * various transient transformation properties. + * + * @param node The node. + */ + function getOrCreateEmitNode(node: Node) { + if (!node.emitNode) { + if (isParseTreeNode(node)) { + // To avoid holding onto transformation artifacts, we keep track of any + // parse tree node we are annotating. This allows us to clean them up after + // all transformations have completed. + if (node.kind === SyntaxKind.SourceFile) { + return node.emitNode = { annotatedNodes: [node] }; + } + + const sourceFile = getSourceFileOfNode(node); + getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); + } + + node.emitNode = {}; + } + + return node.emitNode; + } + + /** + * Gets flags that control emit behavior of a node. + * + * @param node The node. + */ + export function getEmitFlags(node: Node) { + const emitNode = node.emitNode; + return emitNode && emitNode.flags; + } + + /** + * Sets flags that control emit behavior of a node. + * + * @param node The node. + * @param emitFlags The NodeEmitFlags for the node. + */ + export function setEmitFlags(node: T, emitFlags: EmitFlags) { + getOrCreateEmitNode(node).flags = emitFlags; + return node; + } + + /** + * Sets a custom text range to use when emitting source maps. + * + * @param node The node. + * @param range The text range. + */ + export function setSourceMapRange(node: T, range: TextRange) { + getOrCreateEmitNode(node).sourceMapRange = range; + return node; + } + + /** + * Sets the TextRange to use for source maps for a token of a node. + * + * @param node The node. + * @param token The token. + * @param range The text range. + */ + export function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange) { + const emitNode = getOrCreateEmitNode(node); + const tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = createMap()); + tokenSourceMapRanges[token] = range; + return node; + } + + /** + * Sets a custom text range to use when emitting comments. + */ + export function setCommentRange(node: T, range: TextRange) { + getOrCreateEmitNode(node).commentRange = range; + return node; + } + + /** + * Gets a custom text range to use when emitting comments. + * + * @param node The node. + */ + export function getCommentRange(node: Node) { + const emitNode = node.emitNode; + return (emitNode && emitNode.commentRange) || node; + } + + /** + * Gets a custom text range to use when emitting source maps. + * + * @param node The node. + */ + export function getSourceMapRange(node: Node) { + const emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + + /** + * Gets the TextRange to use for source maps for a token of a node. + * + * @param node The node. + * @param token The token. + */ + export function getTokenSourceMapRange(node: Node, token: SyntaxKind) { + const emitNode = node.emitNode; + const tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + + /** + * Gets the constant value to emit for an expression. + */ + export function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression) { + const emitNode = node.emitNode; + return emitNode && emitNode.constantValue; + } + + /** + * Sets the constant value to emit for an expression. + */ + export function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: number) { + const emitNode = getOrCreateEmitNode(node); + emitNode.constantValue = value; + return node; + } + export function setTextRange(node: T, location: TextRange): T { if (location) { node.pos = location.pos; @@ -2692,7 +2856,7 @@ namespace ts { return undefined; } - /** + /** * Get the name of a target module from an import/export declaration as should be written in the emitted output. * The emitted output name can be different from the input if: * 1. The module has a /// diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index eb369be39d7..46db5188e33 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -18,11 +18,6 @@ namespace ts { */ reset(): void; - /** - * Gets test data for source maps. - */ - getSourceMapData(): SourceMapData; - /** * Set the current source file. * @@ -41,123 +36,23 @@ namespace ts { emitPos(pos: number): void; /** - * Emits a mapping for the start of a range. + * Emits a node with possible leading and trailing source maps. * - * If the range's start position is synthetic (undefined or a negative value), no mapping - * will be created. Any trivia at the start position in the original source will be - * skipped. - * - * @param range The range to emit. + * @param emitContext The current emit context + * @param node The node to emit. + * @param emitCallback The callback used to emit the node. */ - emitStart(range: TextRange): void; + emitNodeWithSourceMap(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; /** - * Emits a mapping for the start of a range. - * - * If the node's start position is synthetic (undefined or a negative value), no mapping - * will be created. Any trivia at the start position in the original source will be - * skipped. - * - * @param range The range to emit. - * @param contextNode The node for the current range. - * @param ignoreNodeCallback A callback used to determine whether to skip source map - * emit for the start position of this node. - * @param ignoreChildrenCallback A callback used to determine whether to skip source - * map emit for all children of this node. - * @param getTextRangeCallbackCallback A callback used to get a custom source map - * range for this node. - */ - emitStart(range: TextRange, contextNode: Node, ignoreNodeCallback: (node: Node) => boolean, ignoreChildrenCallback: (node: Node) => boolean, getTextRangeCallbackCallback: (node: Node) => TextRange): void; - - /** - * Emits a mapping for the end of a range. - * - * If the range's end position is synthetic (undefined or a negative value), no mapping - * will be created. - * - * @param range The range to emit. - */ - emitEnd(range: TextRange): void; - - /** - * Emits a mapping for the end of a range. - * - * If the node's end position is synthetic (undefined or a negative value), no mapping - * will be created. - * - * @param range The range to emit. - * @param contextNode The node for the current range. - * @param ignoreNodeCallback A callback used to determine whether to skip source map - * emit for the end position of this node. - * @param ignoreChildrenCallback A callback used to determine whether to skip source - * map emit for all children of this node. - * @param getTextRangeCallbackCallback A callback used to get a custom source map - * range for this node. - */ - emitEnd(range: TextRange, contextNode: Node, ignoreNodeCallback: (node: Node) => boolean, ignoreChildrenCallback: (node: Node) => boolean, getTextRangeCallbackCallback: (node: Node) => TextRange): void; - - /** - * Emits a mapping for the start position of a token. - * - * If the token's start position is synthetic (undefined or a negative value), no mapping - * will be created. Any trivia at the start position in the original source will be - * skipped. + * Emits a token of a node node with possible leading and trailing source maps. * + * @param node The node containing the token. * @param token The token to emit. - * @param tokenStartPos The start position of the token. - * @returns The start position of the token, following any trivia. + * @param tokenStartPos The start pos of the token. + * @param emitCallback The callback used to emit the token. */ - emitTokenStart(token: SyntaxKind, tokenStartPos: number): number; - - /** - * Emits a mapping for the start position of a token. - * - * If the token's start position is synthetic (undefined or a negative value), no mapping - * will be created. Any trivia at the start position in the original source will be - * skipped. - * - * @param token The token to emit. - * @param tokenStartPos The start position of the token. - * @param contextNode The node containing this token. - * @param ignoreTokenCallback A callback used to determine whether to skip source map - * emit for the start position of this token. - * @param getTokenTextRangeCallback A callback used to get a custom source - * map range for this node. - * @returns The start position of the token, following any trivia. - */ - emitTokenStart(token: SyntaxKind, tokenStartPos: number, contextNode: Node, ignoreTokenCallback: (node: Node, token: SyntaxKind) => boolean, getTokenTextRangeCallback: (node: Node, token: SyntaxKind) => TextRange): number; - - /** - * Emits a mapping for the end position of a token. - * - * If the token's end position is synthetic (undefined or a negative value), no mapping - * will be created. - * - * @param token The token to emit. - * @param tokenEndPos The end position of the token. - * @returns The end position of the token. - */ - emitTokenEnd(token: SyntaxKind, tokenEndPos: number): number; - - /** - * Emits a mapping for the end position of a token. - * - * If the token's end position is synthetic (undefined or a negative value), no mapping - * will be created. - * - * @param token The token to emit. - * @param tokenEndPos The end position of the token. - * @param contextNode The node containing this token. - * @param ignoreTokenCallback A callback used to determine whether to skip source map - * emit for the end position of this token. - * @param getTokenTextRangeCallback A callback used to get a custom source - * map range for this node. - * @returns The end position of the token. - */ - emitTokenEnd(token: SyntaxKind, tokenEndPos: number, contextNode: Node, ignoreTokenCallback: (node: Node, token: SyntaxKind) => boolean, getTokenTextRangeCallback: (node: Node, token: SyntaxKind) => TextRange): number; - - /*@deprecated*/ changeEmitSourcePos(): void; - /*@deprecated*/ stopOverridingSpan(): void; + emitTokenWithSourceMap(node: Node, token: SyntaxKind, tokenStartPos: number, emitCallback: (token: SyntaxKind, tokenStartPos: number) => number): number; /** * Gets the text for the source map. @@ -168,44 +63,11 @@ namespace ts { * Gets the SourceMappingURL for the source map. */ getSourceMappingURL(): string; - } - export function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter): SourceMapWriter { - const compilerOptions = host.getCompilerOptions(); - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - if (compilerOptions.extendedDiagnostics) { - return createSourceMapWriterWithExtendedDiagnostics(host, writer); - } - - return createSourceMapWriterWorker(host, writer); - } - else { - return getNullSourceMapWriter(); - } - } - - let nullSourceMapWriter: SourceMapWriter; - - export function getNullSourceMapWriter(): SourceMapWriter { - if (nullSourceMapWriter === undefined) { - nullSourceMapWriter = { - initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean): void { }, - reset(): void { }, - getSourceMapData(): SourceMapData { return undefined; }, - setSourceFile(sourceFile: SourceFile): void { }, - emitPos(pos: number): void { }, - emitStart(range: TextRange, contextNode?: Node, ignoreNodeCallback?: (node: Node) => boolean, ignoreChildrenCallback?: (node: Node) => boolean, getTextRangeCallback?: (node: Node) => TextRange): void { }, - emitEnd(range: TextRange, contextNode?: Node, ignoreNodeCallback?: (node: Node) => boolean, ignoreChildrenCallback?: (node: Node) => boolean, getTextRangeCallback?: (node: Node) => TextRange): void { }, - emitTokenStart(token: SyntaxKind, pos: number, contextNode?: Node, ignoreTokenCallback?: (node: Node) => boolean, getTokenTextRangeCallback?: (node: Node, token: SyntaxKind) => TextRange): number { return -1; }, - emitTokenEnd(token: SyntaxKind, end: number, contextNode?: Node, ignoreTokenCallback?: (node: Node) => boolean, getTokenTextRangeCallback?: (node: Node, token: SyntaxKind) => TextRange): number { return -1; }, - changeEmitSourcePos(): void { }, - stopOverridingSpan(): void { }, - getText(): string { return undefined; }, - getSourceMappingURL(): string { return undefined; } - }; - } - - return nullSourceMapWriter; + /** + * Gets test data for source maps. + */ + getSourceMapData(): SourceMapData; } // Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans @@ -217,14 +79,12 @@ namespace ts { sourceIndex: 0 }; - function createSourceMapWriterWorker(host: EmitHost, writer: EmitTextWriter): SourceMapWriter { + export function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter): SourceMapWriter { const compilerOptions = host.getCompilerOptions(); const extendedDiagnostics = compilerOptions.extendedDiagnostics; let currentSourceFile: SourceFile; let currentSourceText: string; let sourceMapDir: string; // The directory in which sourcemap will be - let stopOverridingSpan = false; - let modifyLastSourcePos = false; // Current source map file and its index in the sources list let sourceMapSourceIndex: number; @@ -236,13 +96,7 @@ namespace ts { // Source map data let sourceMapData: SourceMapData; - - // This keeps track of the number of times `disable` has been called without a - // corresponding call to `enable`. As long as this value is non-zero, mappings will not - // be recorded. - // This is primarily used to provide a better experience when debugging binding - // patterns and destructuring assignments for simple expressions. - let disableDepth: number; + let disabled: boolean = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap); return { initialize, @@ -250,12 +104,8 @@ namespace ts { getSourceMapData: () => sourceMapData, setSourceFile, emitPos, - emitStart, - emitEnd, - emitTokenStart, - emitTokenEnd, - changeEmitSourcePos, - stopOverridingSpan: () => stopOverridingSpan = true, + emitNodeWithSourceMap, + emitTokenWithSourceMap, getText, getSourceMappingURL, }; @@ -269,13 +119,16 @@ namespace ts { * @param isBundledEmit A value indicating whether the generated output file is a bundle. */ function initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean) { + if (disabled) { + return; + } + if (sourceMapData) { reset(); } currentSourceFile = undefined; currentSourceText = undefined; - disableDepth = 0; // Current source map file and its index in the sources list sourceMapSourceIndex = -1; @@ -338,6 +191,10 @@ namespace ts { * Reset the SourceMapWriter to an empty state. */ function reset() { + if (disabled) { + return; + } + currentSourceFile = undefined; sourceMapDir = undefined; sourceMapSourceIndex = undefined; @@ -345,64 +202,6 @@ namespace ts { lastEncodedSourceMapSpan = undefined; lastEncodedNameIndex = undefined; sourceMapData = undefined; - disableDepth = 0; - } - - /** - * Re-enables the recording of mappings. - */ - function enable() { - if (disableDepth > 0) { - disableDepth--; - } - } - - /** - * Disables the recording of mappings. - */ - function disable() { - disableDepth++; - } - - function updateLastEncodedAndRecordedSpans() { - if (modifyLastSourcePos) { - // Reset the source pos - modifyLastSourcePos = false; - - // Change Last recorded Map with last encoded emit line and character - lastRecordedSourceMapSpan.emittedLine = lastEncodedSourceMapSpan.emittedLine; - lastRecordedSourceMapSpan.emittedColumn = lastEncodedSourceMapSpan.emittedColumn; - - // Pop sourceMapDecodedMappings to remove last entry - sourceMapData.sourceMapDecodedMappings.pop(); - - // Point the lastEncodedSourceMapSpace to the previous encoded sourceMapSpan - // If the list is empty which indicates that we are at the beginning of the file, - // we have to reset it to default value (same value when we first initialize sourceMapWriter) - lastEncodedSourceMapSpan = sourceMapData.sourceMapDecodedMappings.length ? - sourceMapData.sourceMapDecodedMappings[sourceMapData.sourceMapDecodedMappings.length - 1] : - defaultLastEncodedSourceMapSpan; - - // TODO: Update lastEncodedNameIndex - // Since we dont support this any more, lets not worry about it right now. - // When we start supporting nameIndex, we will get back to this - - // Change the encoded source map - const sourceMapMappings = sourceMapData.sourceMapMappings; - let lenthToSet = sourceMapMappings.length - 1; - for (; lenthToSet >= 0; lenthToSet--) { - const currentChar = sourceMapMappings.charAt(lenthToSet); - if (currentChar === ",") { - // Separator for the entry found - break; - } - if (currentChar === ";" && lenthToSet !== 0 && sourceMapMappings.charAt(lenthToSet - 1) !== ";") { - // Last line separator found - break; - } - } - sourceMapData.sourceMapMappings = sourceMapMappings.substr(0, Math.max(0, lenthToSet)); - } } // Encoding for sourcemap span @@ -459,7 +258,7 @@ namespace ts { * @param pos The position. */ function emitPos(pos: number) { - if (positionIsSynthesized(pos) || disableDepth > 0) { + if (disabled || positionIsSynthesized(pos)) { return; } @@ -495,209 +294,89 @@ namespace ts { sourceColumn: sourceLinePos.character, sourceIndex: sourceMapSourceIndex }; - - stopOverridingSpan = false; } - else if (!stopOverridingSpan) { + else { // Take the new pos instead since there is no change in emittedLine and column since last location lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; } - updateLastEncodedAndRecordedSpans(); - if (extendedDiagnostics) { performance.mark("afterSourcemap"); performance.measure("Source Map", "beforeSourcemap", "afterSourcemap"); } } - function getStartPosPastDecorators(range: TextRange) { - const rangeHasDecorators = !!(range as Node).decorators; - return skipTrivia(currentSourceText, rangeHasDecorators ? (range as Node).decorators.end : range.pos); - } - /** - * Emits a mapping for the start of a range. + * Emits a node with possible leading and trailing source maps. * - * If the range's start position is synthetic (undefined or a negative value), no mapping - * will be created. Any trivia at the start position in the original source will be - * skipped. - * - * @param range The range to emit.0 + * @param node The node to emit. + * @param emitCallback The callback used to emit the node. */ - function emitStart(range: TextRange): void; - /** - * Emits a mapping for the start of a range. - * - * If the node's start position is synthetic (undefined or a negative value), no mapping - * will be created. Any trivia at the start position in the original source will be - * skipped. - * - * @param range The range to emit. - * @param contextNode The node for the current range. - * @param ignoreNodeCallback A callback used to determine whether to skip source map - * emit for the start position of this node. - * @param ignoreChildrenCallback A callback used to determine whether to skip source - * map emit for all children of this node. - * @param getTextRangeCallbackCallback A callback used to get a custom source map - * range for this node. - */ - function emitStart(range: TextRange, contextNode: Node, ignoreNodeCallback: (node: Node) => boolean, ignoreChildrenCallback: (node: Node) => boolean, getTextRangeCallback: (node: Node) => TextRange): void; - function emitStart(range: TextRange, contextNode?: Node, ignoreNodeCallback?: (node: Node) => boolean, ignoreChildrenCallback?: (node: Node) => boolean, getTextRangeCallback?: (node: Node) => TextRange) { - if (contextNode) { - if (!ignoreNodeCallback(contextNode)) { - range = getTextRangeCallback(contextNode) || range; - emitPos(getStartPosPastDecorators(range)); - } - - if (ignoreChildrenCallback(contextNode)) { - disable(); - } + function emitNodeWithSourceMap(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) { + if (disabled) { + return emitCallback(emitContext, node); } - else { - emitPos(getStartPosPastDecorators(range)); + + if (node) { + const emitNode = node.emitNode; + const emitFlags = emitNode && emitNode.flags; + const { pos, end } = emitNode && emitNode.sourceMapRange || node; + + if (node.kind !== SyntaxKind.NotEmittedStatement + && (emitFlags & EmitFlags.NoLeadingSourceMap) === 0 + && pos >= 0) { + emitPos(skipTrivia(currentSourceText, pos)); + } + + if (emitFlags & EmitFlags.NoNestedSourceMaps) { + disabled = true; + emitCallback(emitContext, node); + disabled = false; + } + else { + emitCallback(emitContext, node); + } + + if (node.kind !== SyntaxKind.NotEmittedStatement + && (emitFlags & EmitFlags.NoTrailingSourceMap) === 0 + && end >= 0) { + emitPos(end); + } } } /** - * Emits a mapping for the end of a range. - * - * If the range's end position is synthetic (undefined or a negative value), no mapping - * will be created. - * - * @param range The range to emit. - */ - function emitEnd(range: TextRange): void; - /** - * Emits a mapping for the end of a range. - * - * If the node's end position is synthetic (undefined or a negative value), no mapping - * will be created. - * - * @param range The range to emit. - * @param contextNode The node for the current range. - * @param ignoreNodeCallback A callback used to determine whether to skip source map - * emit for the end position of this node. - * @param ignoreChildrenCallback A callback used to determine whether to skip source - * map emit for all children of this node. - * @param getTextRangeCallbackCallback A callback used to get a custom source map - * range for this node. - */ - function emitEnd(range: TextRange, contextNode: Node, ignoreNodeCallback: (node: Node) => boolean, ignoreChildrenCallback: (node: Node) => boolean, getTextRangeCallback: (node: Node) => TextRange): void; - function emitEnd(range: TextRange, contextNode?: Node, ignoreNodeCallback?: (node: Node) => boolean, ignoreChildrenCallback?: (node: Node) => boolean, getTextRangeCallback?: (node: Node) => TextRange) { - if (contextNode) { - if (ignoreChildrenCallback(contextNode)) { - enable(); - } - - if (!ignoreNodeCallback(contextNode)) { - range = getTextRangeCallback(contextNode) || range; - emitPos(range.end); - } - } - else { - emitPos(range.end); - } - - stopOverridingSpan = false; - } - - /** - * Emits a mapping for the start position of a token. - * - * If the token's start position is synthetic (undefined or a negative value), no mapping - * will be created. Any trivia at the start position in the original source will be - * skipped. + * Emits a token of a node with possible leading and trailing source maps. * + * @param node The node containing the token. * @param token The token to emit. - * @param tokenStartPos The start position of the token. - * @returns The start position of the token, following any trivia. + * @param tokenStartPos The start pos of the token. + * @param emitCallback The callback used to emit the token. */ - function emitTokenStart(token: SyntaxKind, tokenStartPos: number): number; - /** - * Emits a mapping for the start position of a token. - * - * If the token's start position is synthetic (undefined or a negative value), no mapping - * will be created. Any trivia at the start position in the original source will be - * skipped. - * - * @param token The token to emit. - * @param tokenStartPos The start position of the token. - * @param contextNode The node containing this token. - * @param ignoreTokenCallback A callback used to determine whether to skip source map - * emit for the start position of this token. - * @param getTokenTextRangeCallback A callback used to get a custom source - * map range for this node. - * @returns The start position of the token, following any trivia. - */ - function emitTokenStart(token: SyntaxKind, tokenStartPos: number, contextNode: Node, ignoreTokenCallback: (node: Node, token: SyntaxKind) => boolean, getTokenTextRangeCallback: (node: Node, token: SyntaxKind) => TextRange): number; - function emitTokenStart(token: SyntaxKind, tokenStartPos: number, contextNode?: Node, ignoreTokenCallback?: (node: Node, token: SyntaxKind) => boolean, getTokenTextRangeCallback?: (node: Node, token: SyntaxKind) => TextRange): number { - if (contextNode) { - if (ignoreTokenCallback(contextNode, token)) { - return skipTrivia(currentSourceText, tokenStartPos); - } - - const range = getTokenTextRangeCallback(contextNode, token); - if (range) { - tokenStartPos = range.pos; - } + function emitTokenWithSourceMap(node: Node, token: SyntaxKind, tokenPos: number, emitCallback: (token: SyntaxKind, tokenStartPos: number) => number) { + if (disabled) { + return emitCallback(token, tokenPos); } - tokenStartPos = skipTrivia(currentSourceText, tokenStartPos); - emitPos(tokenStartPos); - return tokenStartPos; - } + const emitNode = node && node.emitNode; + const emitFlags = emitNode && emitNode.flags; + const range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token]; - /** - * Emits a mapping for the end position of a token. - * - * If the token's end position is synthetic (undefined or a negative value), no mapping - * will be created. - * - * @param token The token to emit. - * @param tokenEndPos The end position of the token. - * @returns The end position of the token. - */ - function emitTokenEnd(token: SyntaxKind, tokenEndPos: number): number; - /** - * Emits a mapping for the end position of a token. - * - * If the token's end position is synthetic (undefined or a negative value), no mapping - * will be created. - * - * @param token The token to emit. - * @param tokenEndPos The end position of the token. - * @param contextNode The node containing this token. - * @param ignoreTokenCallback A callback used to determine whether to skip source map - * emit for the end position of this token. - * @param getTokenTextRangeCallback A callback used to get a custom source - * map range for this node. - * @returns The end position of the token. - */ - function emitTokenEnd(token: SyntaxKind, tokenEndPos: number, contextNode: Node, ignoreTokenCallback: (node: Node, token: SyntaxKind) => boolean, getTokenTextRangeCallback: (node: Node, token: SyntaxKind) => TextRange): number; - function emitTokenEnd(token: SyntaxKind, tokenEndPos: number, contextNode?: Node, ignoreTokenCallback?: (node: Node, token: SyntaxKind) => boolean, getTokenTextRangeCallback?: (node: Node, token: SyntaxKind) => TextRange): number { - if (contextNode) { - if (ignoreTokenCallback(contextNode, token)) { - return tokenEndPos; - } - - const range = getTokenTextRangeCallback(contextNode, token); - if (range) { - tokenEndPos = range.end; - } + tokenPos = skipTrivia(currentSourceText, range ? range.pos : tokenPos); + if ((emitFlags & EmitFlags.NoTokenLeadingSourceMaps) === 0 && tokenPos >= 0) { + emitPos(tokenPos); } - emitPos(tokenEndPos); - return tokenEndPos; - } + tokenPos = emitCallback(token, tokenPos); + if (range) tokenPos = range.end; + if ((emitFlags & EmitFlags.NoTokenTrailingSourceMaps) === 0 && tokenPos >= 0) { + emitPos(tokenPos); + } - // @deprecated - function changeEmitSourcePos() { - Debug.assert(!modifyLastSourcePos); - modifyLastSourcePos = true; + return tokenPos; } /** @@ -706,6 +385,10 @@ namespace ts { * @param sourceFile The source file. */ function setSourceFile(sourceFile: SourceFile) { + if (disabled) { + return; + } + currentSourceFile = sourceFile; currentSourceText = currentSourceFile.text; @@ -738,6 +421,10 @@ namespace ts { * Gets the text for the source map. */ function getText() { + if (disabled) { + return; + } + encodeLastRecordedSourceMapSpan(); return stringify({ @@ -755,6 +442,10 @@ namespace ts { * Gets the SourceMappingURL for the source map. */ function getSourceMappingURL() { + if (disabled) { + return; + } + if (compilerOptions.inlineSourceMap) { // Encode the sourceMap into the sourceMap url const base64SourceMapText = convertToBase64(getText()); @@ -766,61 +457,6 @@ namespace ts { } } - function createSourceMapWriterWithExtendedDiagnostics(host: EmitHost, writer: EmitTextWriter): SourceMapWriter { - const { - initialize, - reset, - getSourceMapData, - setSourceFile, - emitPos, - emitStart, - emitEnd, - emitTokenStart, - emitTokenEnd, - changeEmitSourcePos, - stopOverridingSpan, - getText, - getSourceMappingURL, - } = createSourceMapWriterWorker(host, writer); - return { - initialize, - reset, - getSourceMapData, - setSourceFile, - emitPos(pos: number): void { - performance.mark("sourcemapStart"); - emitPos(pos); - performance.measure("sourceMapTime", "sourcemapStart"); - }, - emitStart(range: TextRange, contextNode?: Node, ignoreNodeCallback?: (node: Node) => boolean, ignoreChildrenCallback?: (node: Node) => boolean, getTextRangeCallback?: (node: Node) => TextRange): void { - performance.mark("emitSourcemap:emitStart"); - emitStart(range, contextNode, ignoreNodeCallback, ignoreChildrenCallback, getTextRangeCallback); - performance.measure("sourceMapTime", "emitSourcemap:emitStart"); - }, - emitEnd(range: TextRange, contextNode?: Node, ignoreNodeCallback?: (node: Node) => boolean, ignoreChildrenCallback?: (node: Node) => boolean, getTextRangeCallback?: (node: Node) => TextRange): void { - performance.mark("emitSourcemap:emitEnd"); - emitEnd(range, contextNode, ignoreNodeCallback, ignoreChildrenCallback, getTextRangeCallback); - performance.measure("sourceMapTime", "emitSourcemap:emitEnd"); - }, - emitTokenStart(token: SyntaxKind, tokenStartPos: number, contextNode?: Node, ignoreTokenCallback?: (node: Node) => boolean, getTokenTextRangeCallback?: (node: Node, token: SyntaxKind) => TextRange): number { - performance.mark("emitSourcemap:emitTokenStart"); - tokenStartPos = emitTokenStart(token, tokenStartPos, contextNode, ignoreTokenCallback, getTokenTextRangeCallback); - performance.measure("sourceMapTime", "emitSourcemap:emitTokenStart"); - return tokenStartPos; - }, - emitTokenEnd(token: SyntaxKind, tokenEndPos: number, contextNode?: Node, ignoreTokenCallback?: (node: Node) => boolean, getTokenTextRangeCallback?: (node: Node, token: SyntaxKind) => TextRange): number { - performance.mark("emitSourcemap:emitTokenEnd"); - tokenEndPos = emitTokenEnd(token, tokenEndPos, contextNode, ignoreTokenCallback, getTokenTextRangeCallback); - performance.measure("sourceMapTime", "emitSourcemap:emitTokenEnd"); - return tokenEndPos; - }, - changeEmitSourcePos, - stopOverridingSpan, - getText, - getSourceMappingURL, - }; - } - const base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; function base64FormatEncode(inValue: number) { diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 6242a2f2347..92407af2bb9 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -28,46 +28,25 @@ namespace ts { /** * Gets the transformed source files. */ - getSourceFiles(): SourceFile[]; + transformed: SourceFile[]; /** - * Gets the TextRange to use for source maps for a token of a node. - */ - getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange; - - /** - * Determines whether expression substitutions are enabled for the provided node. - */ - isSubstitutionEnabled(node: Node): boolean; - - /** - * Determines whether before/after emit notifications should be raised in the pretty - * printer when it emits a node. - */ - isEmitNotificationEnabled(node: Node): boolean; - - /** - * Hook used by transformers to substitute expressions just before they - * are emitted by the pretty printer. + * Emits the substitute for a node, if one is available; otherwise, emits the node. * + * @param emitContext The current emit context. * @param node The node to substitute. - * @param isExpression A value indicating whether the node is in an expression context. + * @param emitCallback A callback used to emit the node or its substitute. */ - onSubstituteNode(node: Node, isExpression: boolean): Node; + emitNodeWithSubstitution(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; /** - * Hook used to allow transformers to capture state before or after - * the printer emits a node. + * Emits a node with possible notification. * + * @param emitContext The current emit context. * @param node The node to emit. * @param emitCallback A callback used to emit the node. */ - onEmitNode(node: Node, emitCallback: (node: Node) => void): void; - - /** - * Reset transient transformation properties on parse tree nodes. - */ - dispose(): void; + emitNodeWithNotification(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; } export interface TransformationContext extends LexicalEnvironment { @@ -75,46 +54,6 @@ namespace ts { getEmitResolver(): EmitResolver; getEmitHost(): EmitHost; - /** - * Gets flags used to customize later transformations or emit. - */ - getNodeEmitFlags(node: Node): NodeEmitFlags; - - /** - * Sets flags used to customize later transformations or emit. - */ - setNodeEmitFlags(node: T, flags: NodeEmitFlags): T; - - /** - * Gets the TextRange to use for source maps for the node. - */ - getSourceMapRange(node: Node): TextRange; - - /** - * Sets the TextRange to use for source maps for the node. - */ - setSourceMapRange(node: T, range: TextRange): T; - - /** - * Gets the TextRange to use for source maps for a token of a node. - */ - getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange; - - /** - * Sets the TextRange to use for source maps for a token of a node. - */ - setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange): T; - - /** - * Gets the TextRange to use for comments for the node. - */ - getCommentRange(node: Node): TextRange; - - /** - * Sets the TextRange to use for comments for the node. - */ - setCommentRange(node: T, range: TextRange): T; - /** * Hoists a function declaration to the containing scope. */ @@ -139,7 +78,7 @@ namespace ts { * Hook used by transformers to substitute expressions just before they * are emitted by the pretty printer. */ - onSubstituteNode?: (node: Node, isExpression: boolean) => Node; + onSubstituteNode?: (emitContext: EmitContext, node: Node) => Node; /** * Enables before/after emit notifications in the pretty printer for the provided @@ -157,7 +96,7 @@ namespace ts { * Hook used to allow transformers to capture state before or after * the printer emits a node. */ - onEmitNode?: (node: Node, emit: (node: Node) => void) => void; + onEmitNode?: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void; } /* @internal */ @@ -186,14 +125,6 @@ namespace ts { return transformers; } - /** - * Tracks a monotonically increasing transformation id used to associate a node with a specific - * transformation. This ensures transient properties related to transformations can be safely - * stored on source tree nodes that may be reused across multiple transformations (such as - * with compile-on-save). - */ - let nextTransformId = 1; - /** * Transforms an array of SourceFiles by passing them through each transformer. * @@ -203,18 +134,10 @@ namespace ts { * @param transforms An array of Transformers. */ export function transformFiles(resolver: EmitResolver, host: EmitHost, sourceFiles: SourceFile[], transformers: Transformer[]): TransformationResult { - const transformId = nextTransformId; - nextTransformId++; - - const tokenSourceMapRanges = createMap(); const lexicalEnvironmentVariableDeclarationsStack: VariableDeclaration[][] = []; const lexicalEnvironmentFunctionDeclarationsStack: FunctionDeclaration[][] = []; const enabledSyntaxKindFeatures = new Array(SyntaxKind.Count); - const parseTreeNodesWithAnnotations: Node[] = []; - let lastTokenSourceMapRangeNode: Node; - let lastTokenSourceMapRangeToken: SyntaxKind; - let lastTokenSourceMapRange: TextRange; let lexicalEnvironmentStackOffset = 0; let hoistedVariableDeclarations: VariableDeclaration[]; let hoistedFunctionDeclarations: FunctionDeclaration[]; @@ -226,22 +149,14 @@ namespace ts { getCompilerOptions: () => host.getCompilerOptions(), getEmitResolver: () => resolver, getEmitHost: () => host, - getNodeEmitFlags, - setNodeEmitFlags, - getSourceMapRange, - setSourceMapRange, - getTokenSourceMapRange, - setTokenSourceMapRange, - getCommentRange, - setCommentRange, hoistVariableDeclaration, hoistFunctionDeclaration, startLexicalEnvironment, endLexicalEnvironment, - onSubstituteNode, + onSubstituteNode: (emitContext, node) => node, enableSubstitution, isSubstitutionEnabled, - onEmitNode, + onEmitNode: (node, emitContext, emitCallback) => emitCallback(node, emitContext), enableEmitNotification, isEmitNotificationEnabled }; @@ -256,30 +171,9 @@ namespace ts { lexicalEnvironmentDisabled = true; return { - getSourceFiles: () => transformed, - getTokenSourceMapRange, - isSubstitutionEnabled, - isEmitNotificationEnabled, - onSubstituteNode: context.onSubstituteNode, - onEmitNode: context.onEmitNode, - dispose() { - // During transformation we may need to annotate a parse tree node with transient - // transformation properties. As parse tree nodes live longer than transformation - // nodes, we need to make sure we reclaim any memory allocated for custom ranges - // from these nodes to ensure we do not hold onto entire subtrees just for position - // information. We also need to reset these nodes to a pre-transformation state - // for incremental parsing scenarios so that we do not impact later emit. - for (const node of parseTreeNodesWithAnnotations) { - if (node.transformId === transformId) { - node.transformId = 0; - node.emitFlags = 0; - node.commentRange = undefined; - node.sourceMapRange = undefined; - } - } - - parseTreeNodesWithAnnotations.length = 0; - } + transformed, + emitNodeWithSubstitution, + emitNodeWithNotification }; /** @@ -306,18 +200,29 @@ namespace ts { * Determines whether expression substitutions are enabled for the provided node. */ function isSubstitutionEnabled(node: Node) { - return (enabledSyntaxKindFeatures[node.kind] & SyntaxKindFeatureFlags.Substitution) !== 0; + return (enabledSyntaxKindFeatures[node.kind] & SyntaxKindFeatureFlags.Substitution) !== 0 + && (getEmitFlags(node) & EmitFlags.NoSubstitution) === 0; } /** - * Default hook for node substitutions. + * Emits a node with possible substitution. * - * @param node The node to substitute. - * @param isExpression A value indicating whether the node is to be used in an expression - * position. + * @param emitContext The current emit context. + * @param node The node to emit. + * @param emitCallback The callback used to emit the node or its substitute. */ - function onSubstituteNode(node: Node, isExpression: boolean) { - return node; + function emitNodeWithSubstitution(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) { + if (node) { + if (isSubstitutionEnabled(node)) { + const substitute = context.onSubstituteNode(emitContext, node); + if (substitute && substitute !== node) { + emitCallback(emitContext, substitute); + return; + } + } + + emitCallback(emitContext, node); + } } /** @@ -333,154 +238,25 @@ namespace ts { */ function isEmitNotificationEnabled(node: Node) { return (enabledSyntaxKindFeatures[node.kind] & SyntaxKindFeatureFlags.EmitNotifications) !== 0 - || (getNodeEmitFlags(node) & NodeEmitFlags.AdviseOnEmitNode) !== 0; + || (getEmitFlags(node) & EmitFlags.AdviseOnEmitNode) !== 0; } /** - * Default hook for node emit. + * Emits a node with possible emit notification. * + * @param emitContext The current emit context. * @param node The node to emit. - * @param emit A callback used to emit the node in the printer. + * @param emitCallback The callback used to emit the node. */ - function onEmitNode(node: Node, emit: (node: Node) => void) { - emit(node); - } - - /** - * Associates a node with the current transformation, initializing - * various transient transformation properties. - * - * @param node The node. - */ - function beforeSetAnnotation(node: Node) { - if ((node.flags & NodeFlags.Synthesized) === 0 && node.transformId !== transformId) { - // To avoid holding onto transformation artifacts, we keep track of any - // parse tree node we are annotating. This allows us to clean them up after - // all transformations have completed. - parseTreeNodesWithAnnotations.push(node); - node.transformId = transformId; - } - } - - /** - * Gets flags that control emit behavior of a node. - * - * If the node does not have its own NodeEmitFlags set, the node emit flags of its - * original pointer are used. - * - * @param node The node. - */ - function getNodeEmitFlags(node: Node) { - return node.emitFlags; - } - - /** - * Sets flags that control emit behavior of a node. - * - * @param node The node. - * @param emitFlags The NodeEmitFlags for the node. - */ - function setNodeEmitFlags(node: T, emitFlags: NodeEmitFlags) { - beforeSetAnnotation(node); - node.emitFlags = emitFlags; - return node; - } - - /** - * Gets a custom text range to use when emitting source maps. - * - * If a node does not have its own custom source map text range, the custom source map - * text range of its original pointer is used. - * - * @param node The node. - */ - function getSourceMapRange(node: Node) { - return node.sourceMapRange || node; - } - - /** - * Sets a custom text range to use when emitting source maps. - * - * @param node The node. - * @param range The text range. - */ - function setSourceMapRange(node: T, range: TextRange) { - beforeSetAnnotation(node); - node.sourceMapRange = range; - return node; - } - - /** - * Gets the TextRange to use for source maps for a token of a node. - * - * If a node does not have its own custom source map text range for a token, the custom - * source map text range for the token of its original pointer is used. - * - * @param node The node. - * @param token The token. - */ - function getTokenSourceMapRange(node: Node, token: SyntaxKind) { - // As a performance optimization, use the cached value of the most recent node. - // This helps for cases where this function is called repeatedly for the same node. - if (lastTokenSourceMapRangeNode === node && lastTokenSourceMapRangeToken === token) { - return lastTokenSourceMapRange; - } - - // Get the custom token source map range for a node or from one of its original nodes. - // Custom token ranges are not stored on the node to avoid the GC burden. - let range: TextRange; - let current = node; - while (current) { - range = current.id ? tokenSourceMapRanges[current.id + "-" + token] : undefined; - if (range !== undefined) { - break; + function emitNodeWithNotification(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) { + if (node) { + if (isEmitNotificationEnabled(node)) { + context.onEmitNode(emitContext, node, emitCallback); + } + else { + emitCallback(emitContext, node); } - - current = current.original; } - - // Cache the most recently requested value. - lastTokenSourceMapRangeNode = node; - lastTokenSourceMapRangeToken = token; - lastTokenSourceMapRange = range; - return range; - } - - /** - * Sets the TextRange to use for source maps for a token of a node. - * - * @param node The node. - * @param token The token. - * @param range The text range. - */ - function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange) { - // Cache the most recently requested value. - lastTokenSourceMapRangeNode = node; - lastTokenSourceMapRangeToken = token; - lastTokenSourceMapRange = range; - tokenSourceMapRanges[getNodeId(node) + "-" + token] = range; - return node; - } - - /** - * Gets a custom text range to use when emitting comments. - * - * If a node does not have its own custom source map text range, the custom source map - * text range of its original pointer is used. - * - * @param node The node. - */ - function getCommentRange(node: Node) { - return node.commentRange || node; - } - - /** - * Sets a custom text range to use when emitting comments. - */ - function setCommentRange(node: T, range: TextRange) { - beforeSetAnnotation(node); - node.commentRange = range; - return node; } /** @@ -563,70 +339,4 @@ namespace ts { return statements; } } - - /** - * High-order function, creates a function that executes a function composition. - * For example, `chain(a, b)` is the equivalent of `x => ((a', b') => y => b'(a'(y)))(a(x), b(x))` - * - * @param args The functions to chain. - */ - function chain(...args: ((t: T) => (u: U) => U)[]): (t: T) => (u: U) => U; - function chain(a: (t: T) => (u: U) => U, b: (t: T) => (u: U) => U, c: (t: T) => (u: U) => U, d: (t: T) => (u: U) => U, e: (t: T) => (u: U) => U): (t: T) => (u: U) => U { - if (e) { - const args: ((t: T) => (u: U) => U)[] = []; - for (let i = 0; i < arguments.length; i++) { - args[i] = arguments[i]; - } - - return t => compose(...map(args, f => f(t))); - } - else if (d) { - return t => compose(a(t), b(t), c(t), d(t)); - } - else if (c) { - return t => compose(a(t), b(t), c(t)); - } - else if (b) { - return t => compose(a(t), b(t)); - } - else if (a) { - return t => compose(a(t)); - } - else { - return t => u => u; - } - } - - /** - * High-order function, composes functions. Note that functions are composed inside-out; - * for example, `compose(a, b)` is the equivalent of `x => b(a(x))`. - * - * @param args The functions to compose. - */ - function compose(...args: ((t: T) => T)[]): (t: T) => T; - function compose(a: (t: T) => T, b: (t: T) => T, c: (t: T) => T, d: (t: T) => T, e: (t: T) => T): (t: T) => T { - if (e) { - const args: ((t: T) => T)[] = []; - for (let i = 0; i < arguments.length; i++) { - args[i] = arguments[i]; - } - - return t => reduceLeft<(t: T) => T, T>(args, (u, f) => f(u), t); - } - else if (d) { - return t => d(c(b(a(t)))); - } - else if (c) { - return t => c(b(a(t))); - } - else if (b) { - return t => b(a(t)); - } - else if (a) { - return t => a(t); - } - else { - return t => t; - } - } } \ No newline at end of file diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index a66f5e21d78..3bfa778cf9b 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -66,7 +66,7 @@ namespace ts { // NOTE: this completely disables source maps, but aligns with the behavior of // `emitAssignment` in the old emitter. - context.setNodeEmitFlags(expression, NodeEmitFlags.NoNestedSourceMaps); + setEmitFlags(expression, EmitFlags.NoNestedSourceMaps); aggregateTransformFlags(expression); expressions.push(expression); @@ -102,7 +102,7 @@ namespace ts { // NOTE: this completely disables source maps, but aligns with the behavior of // `emitAssignment` in the old emitter. - context.setNodeEmitFlags(declaration, NodeEmitFlags.NoNestedSourceMaps); + setEmitFlags(declaration, EmitFlags.NoNestedSourceMaps); aggregateTransformFlags(declaration); declarations.push(declaration); @@ -147,7 +147,7 @@ namespace ts { // NOTE: this completely disables source maps, but aligns with the behavior of // `emitAssignment` in the old emitter. - context.setNodeEmitFlags(declaration, NodeEmitFlags.NoNestedSourceMaps); + setEmitFlags(declaration, EmitFlags.NoNestedSourceMaps); declarations.push(declaration); aggregateTransformFlags(declaration); @@ -211,7 +211,7 @@ namespace ts { // NOTE: this completely disables source maps, but aligns with the behavior of // `emitAssignment` in the old emitter. - context.setNodeEmitFlags(expression, NodeEmitFlags.NoNestedSourceMaps); + setEmitFlags(expression, EmitFlags.NoNestedSourceMaps); pendingAssignments.push(expression); return expression; @@ -271,8 +271,8 @@ namespace ts { } else { const name = getMutableClone(target); - context.setSourceMapRange(name, target); - context.setCommentRange(name, target); + setSourceMapRange(name, target); + setCommentRange(name, target); emitAssignment(name, value, location, /*original*/ undefined); } } diff --git a/src/compiler/transformers/es6.ts b/src/compiler/transformers/es6.ts index e8ba800e190..4f2720c1507 100644 --- a/src/compiler/transformers/es6.ts +++ b/src/compiler/transformers/es6.ts @@ -139,18 +139,35 @@ namespace ts { loopOutParameters?: LoopOutParameter[]; } + const enum SuperCaptureResult { + /** + * A capture may have been added for calls to 'super', but + * the caller should emit subsequent statements normally. + */ + NoReplacement, + /** + * A call to 'super()' got replaced with a capturing statement like: + * + * var _this = _super.call(...) || this; + * + * Callers should skip the current statement. + */ + ReplaceSuperCapture, + /** + * A call to 'super()' got replaced with a capturing statement like: + * + * return _super.call(...) || this; + * + * Callers should skip the current statement and avoid any returns of '_this'. + */ + ReplaceWithReturn, + } + export function transformES6(context: TransformationContext) { const { startLexicalEnvironment, endLexicalEnvironment, hoistVariableDeclaration, - getNodeEmitFlags, - setNodeEmitFlags, - getCommentRange, - setCommentRange, - getSourceMapRange, - setSourceMapRange, - setTokenSourceMapRange, } = context; const resolver = context.getEmitResolver(); @@ -185,6 +202,10 @@ namespace ts { return transformSourceFile; function transformSourceFile(node: SourceFile) { + if (isDeclarationFile(node)) { + return node; + } + currentSourceFile = node; currentText = node.text; return visitNode(node, visitor, isSourceFile); @@ -200,7 +221,7 @@ namespace ts { : visitorWorker(node); } - function saveStateAndInvoke(node: Node, f: (node: Node) => T): T { + function saveStateAndInvoke(node: T, f: (node: T) => U): U { const savedEnclosingFunction = enclosingFunction; const savedEnclosingNonArrowFunction = enclosingNonArrowFunction; const savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; @@ -408,7 +429,7 @@ namespace ts { enclosingFunction = currentNode; if (currentNode.kind !== SyntaxKind.ArrowFunction) { enclosingNonArrowFunction = currentNode; - if (!(currentNode.emitFlags & NodeEmitFlags.AsyncFunctionBody)) { + if (!(getEmitFlags(currentNode) & EmitFlags.AsyncFunctionBody)) { enclosingNonAsyncFunctionBody = currentNode; } } @@ -671,19 +692,19 @@ namespace ts { // To preserve the behavior of the old emitter, we explicitly indent // the body of the function here if it was requested in an earlier // transformation. - if (getNodeEmitFlags(node) & NodeEmitFlags.Indented) { - setNodeEmitFlags(classFunction, NodeEmitFlags.Indented); + if (getEmitFlags(node) & EmitFlags.Indented) { + setEmitFlags(classFunction, EmitFlags.Indented); } // "inner" and "outer" below are added purely to preserve source map locations from // the old emitter const inner = createPartiallyEmittedExpression(classFunction); inner.end = node.end; - setNodeEmitFlags(inner, NodeEmitFlags.NoComments); + setEmitFlags(inner, EmitFlags.NoComments); const outer = createPartiallyEmittedExpression(inner); outer.end = skipTrivia(currentText, node.pos); - setNodeEmitFlags(outer, NodeEmitFlags.NoComments); + setEmitFlags(outer, EmitFlags.NoComments); return createParen( createCall( @@ -717,17 +738,17 @@ namespace ts { // emit with the original emitter. const outer = createPartiallyEmittedExpression(localName); outer.end = closingBraceLocation.end; - setNodeEmitFlags(outer, NodeEmitFlags.NoComments); + setEmitFlags(outer, EmitFlags.NoComments); const statement = createReturn(outer); statement.pos = closingBraceLocation.pos; - setNodeEmitFlags(statement, NodeEmitFlags.NoComments | NodeEmitFlags.NoTokenSourceMaps); + setEmitFlags(statement, EmitFlags.NoComments | EmitFlags.NoTokenSourceMaps); statements.push(statement); addRange(statements, endLexicalEnvironment()); const block = createBlock(createNodeArray(statements, /*location*/ node.members), /*location*/ undefined, /*multiLine*/ true); - setNodeEmitFlags(block, NodeEmitFlags.NoComments); + setEmitFlags(block, EmitFlags.NoComments); return block; } @@ -759,7 +780,8 @@ namespace ts { function addConstructor(statements: Statement[], node: ClassExpression | ClassDeclaration, extendsClauseElement: ExpressionWithTypeArguments): void { const constructor = getFirstConstructorWithBody(node); const hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); - statements.push( + + const constructorFunction = createFunctionDeclaration( /*decorators*/ undefined, /*modifiers*/ undefined, @@ -770,8 +792,12 @@ namespace ts { /*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), /*location*/ constructor || node - ) - ); + ); + + if (extendsClauseElement) { + setEmitFlags(constructorFunction, EmitFlags.CapturesThis); + } + statements.push(constructorFunction); } /** @@ -803,22 +829,53 @@ namespace ts { * @param hasSynthesizedSuper A value indicating whether the constructor starts with a * synthesized `super` call. */ - function transformConstructorBody(constructor: ConstructorDeclaration, node: ClassDeclaration | ClassExpression, extendsClauseElement: ExpressionWithTypeArguments, hasSynthesizedSuper: boolean) { + function transformConstructorBody(constructor: ConstructorDeclaration | undefined, node: ClassDeclaration | ClassExpression, extendsClauseElement: ExpressionWithTypeArguments, hasSynthesizedSuper: boolean) { const statements: Statement[] = []; startLexicalEnvironment(); - if (constructor) { - addCaptureThisForNodeIfNeeded(statements, constructor); - addDefaultValueAssignmentsIfNeeded(statements, constructor); - addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + + let statementOffset = -1; + if (hasSynthesizedSuper) { + // If a super call has already been synthesized, + // we're going to assume that we should just transform everything after that. + // The assumption is that no prior step in the pipeline has added any prologue directives. + statementOffset = 1; + } + else if (constructor) { + // Otherwise, try to emit all potential prologue directives first. + statementOffset = addPrologueDirectives(statements, constructor.body.statements, /*ensureUseStrict*/ false, visitor); } - addDefaultSuperCallIfNeeded(statements, constructor, extendsClauseElement, hasSynthesizedSuper); + if (constructor) { + addDefaultValueAssignmentsIfNeeded(statements, constructor); + addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); + + } + + const superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + + // The last statement expression was replaced. Skip it. + if (superCaptureStatus === SuperCaptureResult.ReplaceSuperCapture || superCaptureStatus === SuperCaptureResult.ReplaceWithReturn) { + statementOffset++; + } if (constructor) { - const body = saveStateAndInvoke(constructor, hasSynthesizedSuper ? transformConstructorBodyWithSynthesizedSuper : transformConstructorBodyWithoutSynthesizedSuper); + const body = saveStateAndInvoke(constructor, constructor => visitNodes(constructor.body.statements, visitor, isStatement, /*start*/ statementOffset)); addRange(statements, body); } + // Return `_this` unless we're sure enough that it would be pointless to add a return statement. + // If there's a constructor that we can tell returns in enough places, then we *do not* want to add a return. + if (extendsClauseElement + && superCaptureStatus !== SuperCaptureResult.ReplaceWithReturn + && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { + statements.push( + createReturn( + createIdentifier("_this") + ) + ); + } + addRange(statements, endLexicalEnvironment()); const block = createBlock( createNodeArray( @@ -830,47 +887,136 @@ namespace ts { ); if (!constructor) { - setNodeEmitFlags(block, NodeEmitFlags.NoComments); + setEmitFlags(block, EmitFlags.NoComments); } return block; } - function transformConstructorBodyWithSynthesizedSuper(node: ConstructorDeclaration) { - return visitNodes(node.body.statements, visitor, isStatement, 1); - } + /** + * We want to try to avoid emitting a return statement in certain cases if a user already returned something. + * It would generate obviously dead code, so we'll try to make things a little bit prettier + * by doing a minimal check on whether some common patterns always explicitly return. + */ + function isSufficientlyCoveredByReturnStatements(statement: Statement): boolean { + // A return statement is considered covered. + if (statement.kind === SyntaxKind.ReturnStatement) { + return true; + } + // An if-statement with two covered branches is covered. + else if (statement.kind === SyntaxKind.IfStatement) { + const ifStatement = statement as IfStatement; + if (ifStatement.elseStatement) { + return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && + isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); + } + } + // A block is covered if it has a last statement which is covered. + else if (statement.kind === SyntaxKind.Block) { + const lastStatement = lastOrUndefined((statement as Block).statements); + if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { + return true; + } + } - function transformConstructorBodyWithoutSynthesizedSuper(node: ConstructorDeclaration) { - return visitNodes(node.body.statements, visitor, isStatement, 0); + return false; } /** - * Adds a synthesized call to `_super` if it is needed. + * Declares a `_this` variable for derived classes and for when arrow functions capture `this`. * - * @param statements The statements for the new constructor body. - * @param constructor The constructor for the class. - * @param extendsClauseElement The expression for the class `extends` clause. - * @param hasSynthesizedSuper A value indicating whether the constructor starts with a - * synthesized `super` call. + * @returns The new statement offset into the `statements` array. */ - function addDefaultSuperCallIfNeeded(statements: Statement[], constructor: ConstructorDeclaration, extendsClauseElement: ExpressionWithTypeArguments, hasSynthesizedSuper: boolean) { - // If the TypeScript transformer needed to synthesize a constructor for property - // initializers, it would have also added a synthetic `...args` parameter and - // `super` call. - // If this is the case, or if the class has an `extends` clause but no - // constructor, we emit a synthesized call to `_super`. - if (constructor ? hasSynthesizedSuper : extendsClauseElement) { - statements.push( - createStatement( - createFunctionApply( - createIdentifier("_super"), - createThis(), - createIdentifier("arguments") - ), - /*location*/ extendsClauseElement - ) - ); + function declareOrCaptureOrReturnThisForConstructorIfNeeded( + statements: Statement[], + ctor: ConstructorDeclaration | undefined, + hasExtendsClause: boolean, + hasSynthesizedSuper: boolean, + statementOffset: number) { + // If this isn't a derived class, just capture 'this' for arrow functions if necessary. + if (!hasExtendsClause) { + if (ctor) { + addCaptureThisForNodeIfNeeded(statements, ctor); + } + return SuperCaptureResult.NoReplacement; } + + // We must be here because the user didn't write a constructor + // but we needed to call 'super(...args)' anyway as per 14.5.14 of the ES2016 spec. + // If that's the case we can just immediately return the result of a 'super()' call. + if (!ctor) { + statements.push(createReturn(createDefaultSuperCallOrThis())); + return SuperCaptureResult.ReplaceWithReturn; + } + + // The constructor exists, but it and the 'super()' call it contains were generated + // for something like property initializers. + // Create a captured '_this' variable and assume it will subsequently be used. + if (hasSynthesizedSuper) { + captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); + enableSubstitutionsForCapturedThis(); + return SuperCaptureResult.ReplaceSuperCapture; + } + + // Most of the time, a 'super' call will be the first real statement in a constructor body. + // In these cases, we'd like to transform these into a *single* statement instead of a declaration + // followed by an assignment statement for '_this'. For instance, if we emitted without an initializer, + // we'd get: + // + // var _this; + // _this = _super.call(...) || this; + // + // instead of + // + // var _this = _super.call(...) || this; + // + // Additionally, if the 'super()' call is the last statement, we should just avoid capturing + // entirely and immediately return the result like so: + // + // return _super.call(...) || this; + // + let firstStatement: Statement; + let superCallExpression: Expression; + + const ctorStatements = ctor.body.statements; + if (statementOffset < ctorStatements.length) { + firstStatement = ctorStatements[statementOffset]; + + if (firstStatement.kind === SyntaxKind.ExpressionStatement && isSuperCallExpression((firstStatement as ExpressionStatement).expression)) { + const superCall = (firstStatement as ExpressionStatement).expression as CallExpression; + superCallExpression = setOriginalNode( + saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), + superCall + ); + } + } + + // Return the result if we have an immediate super() call on the last statement. + if (superCallExpression && statementOffset === ctorStatements.length - 1) { + statements.push(createReturn(superCallExpression)); + return SuperCaptureResult.ReplaceWithReturn; + } + + // Perform the capture. + captureThisForNode(statements, ctor, superCallExpression, firstStatement); + + // If we're actually replacing the original statement, we need to signal this to the caller. + if (superCallExpression) { + return SuperCaptureResult.ReplaceSuperCapture; + } + + return SuperCaptureResult.NoReplacement; + } + + function createDefaultSuperCallOrThis() { + const actualThis = createThis(); + setEmitFlags(actualThis, EmitFlags.NoSubstitution); + const superCall = createFunctionApply( + createIdentifier("_super"), + actualThis, + createIdentifier("arguments"), + ); + return createLogicalOr(superCall, actualThis); } /** @@ -967,27 +1113,27 @@ namespace ts { // of an initializer, we must emit that expression to preserve side effects. if (name.elements.length > 0) { statements.push( - setNodeEmitFlags( + setEmitFlags( createVariableStatement( /*modifiers*/ undefined, createVariableDeclarationList( flattenParameterDestructuring(context, parameter, temp, visitor) ) ), - NodeEmitFlags.CustomPrologue + EmitFlags.CustomPrologue ) ); } else if (initializer) { statements.push( - setNodeEmitFlags( + setEmitFlags( createStatement( createAssignment( temp, visitNode(initializer, visitor, isExpression) ) ), - NodeEmitFlags.CustomPrologue + EmitFlags.CustomPrologue ) ); } @@ -1008,23 +1154,23 @@ namespace ts { getSynthesizedClone(name), createVoidZero() ), - setNodeEmitFlags( + setEmitFlags( createBlock([ createStatement( createAssignment( - setNodeEmitFlags(getMutableClone(name), NodeEmitFlags.NoSourceMap), - setNodeEmitFlags(initializer, NodeEmitFlags.NoSourceMap | getNodeEmitFlags(initializer)), + setEmitFlags(getMutableClone(name), EmitFlags.NoSourceMap), + setEmitFlags(initializer, EmitFlags.NoSourceMap | getEmitFlags(initializer)), /*location*/ parameter ) ) ], /*location*/ parameter), - NodeEmitFlags.SingleLine | NodeEmitFlags.NoTrailingSourceMap | NodeEmitFlags.NoTokenSourceMaps + EmitFlags.SingleLine | EmitFlags.NoTrailingSourceMap | EmitFlags.NoTokenSourceMaps ), /*elseStatement*/ undefined, /*location*/ parameter ); statement.startsOnNewLine = true; - setNodeEmitFlags(statement, NodeEmitFlags.NoTokenSourceMaps | NodeEmitFlags.NoTrailingSourceMap | NodeEmitFlags.CustomPrologue); + setEmitFlags(statement, EmitFlags.NoTokenSourceMaps | EmitFlags.NoTrailingSourceMap | EmitFlags.CustomPrologue); statements.push(statement); } @@ -1057,7 +1203,7 @@ namespace ts { // `declarationName` is the name of the local declaration for the parameter. const declarationName = getMutableClone(parameter.name); - setNodeEmitFlags(declarationName, NodeEmitFlags.NoSourceMap); + setEmitFlags(declarationName, EmitFlags.NoSourceMap); // `expressionName` is the name of the parameter used in expressions. const expressionName = getSynthesizedClone(parameter.name); @@ -1066,7 +1212,7 @@ namespace ts { // var param = []; statements.push( - setNodeEmitFlags( + setEmitFlags( createVariableStatement( /*modifiers*/ undefined, createVariableDeclarationList([ @@ -1078,7 +1224,7 @@ namespace ts { ]), /*location*/ parameter ), - NodeEmitFlags.CustomPrologue + EmitFlags.CustomPrologue ) ); @@ -1111,7 +1257,7 @@ namespace ts { ]) ); - setNodeEmitFlags(forStatement, NodeEmitFlags.CustomPrologue); + setEmitFlags(forStatement, EmitFlags.CustomPrologue); startOnNewLine(forStatement); statements.push(forStatement); } @@ -1124,24 +1270,29 @@ namespace ts { */ function addCaptureThisForNodeIfNeeded(statements: Statement[], node: Node): void { if (node.transformFlags & TransformFlags.ContainsCapturedLexicalThis && node.kind !== SyntaxKind.ArrowFunction) { - enableSubstitutionsForCapturedThis(); - const captureThisStatement = createVariableStatement( - /*modifiers*/ undefined, - createVariableDeclarationList([ - createVariableDeclaration( - "_this", - /*type*/ undefined, - createThis() - ) - ]) - ); - - setNodeEmitFlags(captureThisStatement, NodeEmitFlags.NoComments | NodeEmitFlags.CustomPrologue); - setSourceMapRange(captureThisStatement, node); - statements.push(captureThisStatement); + captureThisForNode(statements, node, createThis()); } } + function captureThisForNode(statements: Statement[], node: Node, initializer: Expression | undefined, originalStatement?: Statement): void { + enableSubstitutionsForCapturedThis(); + const captureThisStatement = createVariableStatement( + /*modifiers*/ undefined, + createVariableDeclarationList([ + createVariableDeclaration( + "_this", + /*type*/ undefined, + initializer + ) + ]), + originalStatement + ); + + setEmitFlags(captureThisStatement, EmitFlags.NoComments | EmitFlags.CustomPrologue); + setSourceMapRange(captureThisStatement, node); + statements.push(captureThisStatement); + } + /** * Adds statements to the class body function for a class to define the members of the * class. @@ -1200,7 +1351,7 @@ namespace ts { const sourceMapRange = getSourceMapRange(member); const func = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined); - setNodeEmitFlags(func, NodeEmitFlags.NoComments); + setEmitFlags(func, EmitFlags.NoComments); setSourceMapRange(func, sourceMapRange); const statement = createStatement( @@ -1221,7 +1372,7 @@ namespace ts { // The location for the statement is used to emit comments only. // No source map should be emitted for this statement to align with the // old emitter. - setNodeEmitFlags(statement, NodeEmitFlags.NoSourceMap); + setEmitFlags(statement, EmitFlags.NoSourceMap); return statement; } @@ -1240,7 +1391,7 @@ namespace ts { // The location for the statement is used to emit source maps only. // No comments should be emitted for this statement to align with the // old emitter. - setNodeEmitFlags(statement, NodeEmitFlags.NoComments); + setEmitFlags(statement, EmitFlags.NoComments); return statement; } @@ -1254,11 +1405,11 @@ namespace ts { // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. const target = getMutableClone(receiver); - setNodeEmitFlags(target, NodeEmitFlags.NoComments | NodeEmitFlags.NoTrailingSourceMap); + setEmitFlags(target, EmitFlags.NoComments | EmitFlags.NoTrailingSourceMap); setSourceMapRange(target, firstAccessor.name); const propertyName = createExpressionForPropertyName(visitNode(firstAccessor.name, visitor, isPropertyName)); - setNodeEmitFlags(propertyName, NodeEmitFlags.NoComments | NodeEmitFlags.NoLeadingSourceMap); + setEmitFlags(propertyName, EmitFlags.NoComments | EmitFlags.NoLeadingSourceMap); setSourceMapRange(propertyName, firstAccessor.name); const properties: ObjectLiteralElementLike[] = []; @@ -1309,7 +1460,7 @@ namespace ts { } const func = transformFunctionLikeToExpression(node, /*location*/ node, /*name*/ undefined); - setNodeEmitFlags(func, NodeEmitFlags.CapturesThis); + setEmitFlags(func, EmitFlags.CapturesThis); return func; } @@ -1434,7 +1585,7 @@ namespace ts { const expression = visitNode(body, visitor, isExpression); const returnStatement = createReturn(expression, /*location*/ body); - setNodeEmitFlags(returnStatement, NodeEmitFlags.NoTokenSourceMaps | NodeEmitFlags.NoTrailingSourceMap | NodeEmitFlags.NoTrailingComments); + setEmitFlags(returnStatement, EmitFlags.NoTokenSourceMaps | EmitFlags.NoTrailingSourceMap | EmitFlags.NoTrailingComments); statements.push(returnStatement); // To align with the source map emit for the old emitter, we set a custom @@ -1452,7 +1603,7 @@ namespace ts { const block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine); if (!multiLine && singleLine) { - setNodeEmitFlags(block, NodeEmitFlags.SingleLine); + setEmitFlags(block, EmitFlags.SingleLine); } if (closeBraceLocation) { @@ -1875,7 +2026,7 @@ namespace ts { } // The old emitter does not emit source maps for the expression - setNodeEmitFlags(expression, NodeEmitFlags.NoSourceMap | getNodeEmitFlags(expression)); + setEmitFlags(expression, EmitFlags.NoSourceMap | getEmitFlags(expression)); // The old emitter does not emit source maps for the block. // We add the location to preserve comments. @@ -1884,7 +2035,7 @@ namespace ts { /*location*/ bodyLocation ); - setNodeEmitFlags(body, NodeEmitFlags.NoSourceMap | NodeEmitFlags.NoTokenSourceMaps); + setEmitFlags(body, EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps); const forStatement = createFor( createVariableDeclarationList([ @@ -1902,7 +2053,7 @@ namespace ts { ); // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. - setNodeEmitFlags(forStatement, NodeEmitFlags.NoTokenTrailingSourceMaps); + setEmitFlags(forStatement, EmitFlags.NoTokenTrailingSourceMaps); return forStatement; } @@ -1938,13 +2089,13 @@ namespace ts { const expressions: Expression[] = []; const assignment = createAssignment( temp, - setNodeEmitFlags( + setEmitFlags( createObjectLiteral( visitNodes(properties, visitor, isObjectLiteralElementLike, 0, numInitialProperties), /*location*/ undefined, node.multiLine ), - NodeEmitFlags.Indented + EmitFlags.Indented ) ); if (node.multiLine) { @@ -2067,16 +2218,16 @@ namespace ts { const isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (enclosingNonArrowFunction.emitFlags & NodeEmitFlags.AsyncFunctionBody) !== 0 + && (getEmitFlags(enclosingNonArrowFunction) & EmitFlags.AsyncFunctionBody) !== 0 && (node.statement.transformFlags & TransformFlags.ContainsYield) !== 0; - let loopBodyFlags: NodeEmitFlags = 0; + let loopBodyFlags: EmitFlags = 0; if (currentState.containsLexicalThis) { - loopBodyFlags |= NodeEmitFlags.CapturesThis; + loopBodyFlags |= EmitFlags.CapturesThis; } if (isAsyncBlockContainingAwait) { - loopBodyFlags |= NodeEmitFlags.AsyncFunctionBody; + loopBodyFlags |= EmitFlags.AsyncFunctionBody; } const convertedLoopVariable = @@ -2087,7 +2238,7 @@ namespace ts { createVariableDeclaration( functionName, /*type*/ undefined, - setNodeEmitFlags( + setEmitFlags( createFunctionExpression( isAsyncBlockContainingAwait ? createToken(SyntaxKind.AsteriskToken) : undefined, /*name*/ undefined, @@ -2480,7 +2631,7 @@ namespace ts { // Methods with computed property names are handled in visitObjectLiteralExpression. Debug.assert(!isComputedPropertyName(node.name)); const functionExpression = transformFunctionLikeToExpression(node, /*location*/ moveRangePos(node, -1), /*name*/ undefined); - setNodeEmitFlags(functionExpression, NodeEmitFlags.NoLeadingComments | getNodeEmitFlags(functionExpression)); + setEmitFlags(functionExpression, EmitFlags.NoLeadingComments | getEmitFlags(functionExpression)); return createPropertyAssignment( node.name, functionExpression, @@ -2526,11 +2677,23 @@ namespace ts { * * @param node a CallExpression. */ - function visitCallExpression(node: CallExpression): LeftHandSideExpression { + function visitCallExpression(node: CallExpression) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + } + + function visitImmediateSuperCallInBody(node: CallExpression) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ false); + } + + function visitCallExpressionWithPotentialCapturedThisAssignment(node: CallExpression, assignToCapturedThis: boolean): CallExpression | BinaryExpression { // We are here either because SuperKeyword was used somewhere in the expression, or // because we contain a SpreadElementExpression. const { target, thisArg } = createCallBinding(node.expression, hoistVariableDeclaration); + if (node.expression.kind === SyntaxKind.SuperKeyword) { + setEmitFlags(thisArg, EmitFlags.NoSubstitution); + } + let resultingCall: CallExpression | BinaryExpression; if (node.transformFlags & TransformFlags.ContainsSpreadElementExpression) { // [source] // f(...a, b) @@ -2546,7 +2709,7 @@ namespace ts { // _super.m.apply(this, a.concat([b])) // _super.prototype.m.apply(this, a.concat([b])) - return createFunctionApply( + resultingCall = createFunctionApply( visitNode(target, visitor, isExpression), visitNode(thisArg, visitor, isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false) @@ -2563,13 +2726,27 @@ namespace ts { // _super.m.call(this, a) // _super.prototype.m.call(this, a) - return createFunctionCall( + resultingCall = createFunctionCall( visitNode(target, visitor, isExpression), visitNode(thisArg, visitor, isExpression), visitNodes(node.arguments, visitor, isExpression), /*location*/ node ); } + + if (node.expression.kind === SyntaxKind.SuperKeyword) { + const actualThis = createThis(); + setEmitFlags(actualThis, EmitFlags.NoSubstitution); + const initializer = + createLogicalOr( + resultingCall, + actualThis + ); + return assignToCapturedThis + ? createAssignment(createIdentifier("_this"), initializer) + : initializer; + } + return resultingCall; } /** @@ -2855,7 +3032,7 @@ namespace ts { * * @param node The node to be printed. */ - function onEmitNode(node: Node, emit: (node: Node) => void) { + function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) { const savedEnclosingFunction = enclosingFunction; if (enabledSubstitutions & ES6SubstitutionFlags.CapturedThis && isFunctionLike(node)) { @@ -2863,7 +3040,7 @@ namespace ts { enclosingFunction = node; } - previousOnEmitNode(node, emit); + previousOnEmitNode(emitContext, node, emitCallback); enclosingFunction = savedEnclosingFunction; } @@ -2904,10 +3081,10 @@ namespace ts { * @param isExpression A value indicating whether the node is to be used in an expression * position. */ - function onSubstituteNode(node: Node, isExpression: boolean) { - node = previousOnSubstituteNode(node, isExpression); + function onSubstituteNode(emitContext: EmitContext, node: Node) { + node = previousOnSubstituteNode(emitContext, node); - if (isExpression) { + if (emitContext === EmitContext.Expression) { return substituteExpression(node); } @@ -2995,7 +3172,7 @@ namespace ts { function substituteThisKeyword(node: PrimaryExpression): PrimaryExpression { if (enabledSubstitutions & ES6SubstitutionFlags.CapturedThis && enclosingFunction - && enclosingFunction.emitFlags & NodeEmitFlags.CapturesThis) { + && getEmitFlags(enclosingFunction) & EmitFlags.CapturesThis) { return createIdentifier("_this", /*location*/ node); } @@ -3013,7 +3190,7 @@ namespace ts { * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. */ function getLocalName(node: ClassDeclaration | ClassExpression | FunctionDeclaration, allowComments?: boolean, allowSourceMaps?: boolean) { - return getDeclarationName(node, allowComments, allowSourceMaps, NodeEmitFlags.LocalName); + return getDeclarationName(node, allowComments, allowSourceMaps, EmitFlags.LocalName); } /** @@ -3022,18 +3199,18 @@ namespace ts { * @param node The declaration. * @param allowComments Allow comments for the name. */ - function getDeclarationName(node: DeclarationStatement | ClassExpression, allowComments?: boolean, allowSourceMaps?: boolean, emitFlags?: NodeEmitFlags) { + function getDeclarationName(node: DeclarationStatement | ClassExpression, allowComments?: boolean, allowSourceMaps?: boolean, emitFlags?: EmitFlags) { if (node.name && !isGeneratedIdentifier(node.name)) { const name = getMutableClone(node.name); - emitFlags |= getNodeEmitFlags(node.name); + emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) { - emitFlags |= NodeEmitFlags.NoSourceMap; + emitFlags |= EmitFlags.NoSourceMap; } if (!allowComments) { - emitFlags |= NodeEmitFlags.NoComments; + emitFlags |= EmitFlags.NoComments; } if (emitFlags) { - setNodeEmitFlags(name, emitFlags); + setEmitFlags(name, emitFlags); } return name; } diff --git a/src/compiler/transformers/es7.ts b/src/compiler/transformers/es7.ts index 5d848bc608b..4d5e96134c4 100644 --- a/src/compiler/transformers/es7.ts +++ b/src/compiler/transformers/es7.ts @@ -9,6 +9,10 @@ namespace ts { return transformSourceFile; function transformSourceFile(node: SourceFile) { + if (isDeclarationFile(node)) { + return node; + } + return visitEachChild(node, visitor, context); } diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 5f142b6abe9..6fe3187bee1 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -231,9 +231,6 @@ namespace ts { endLexicalEnvironment, hoistFunctionDeclaration, hoistVariableDeclaration, - setSourceMapRange, - setCommentRange, - setNodeEmitFlags } = context; const compilerOptions = context.getCompilerOptions(); @@ -294,6 +291,10 @@ namespace ts { return transformSourceFile; function transformSourceFile(node: SourceFile) { + if (isDeclarationFile(node)) { + return node; + } + if (node.transformFlags & TransformFlags.ContainsGenerator) { currentSourceFile = node; node = visitEachChild(node, visitor, context); @@ -444,7 +445,7 @@ namespace ts { */ function visitFunctionDeclaration(node: FunctionDeclaration): Statement { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && node.emitFlags & NodeEmitFlags.AsyncFunctionBody) { + if (node.asteriskToken && getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { node = setOriginalNode( createFunctionDeclaration( /*decorators*/ undefined, @@ -492,7 +493,7 @@ namespace ts { */ function visitFunctionExpression(node: FunctionExpression): Expression { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && node.emitFlags & NodeEmitFlags.AsyncFunctionBody) { + if (node.asteriskToken && getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { node = setOriginalNode( createFunctionExpression( /*asteriskToken*/ undefined, @@ -616,7 +617,7 @@ namespace ts { } else { // Do not hoist custom prologues. - if (node.emitFlags & NodeEmitFlags.CustomPrologue) { + if (getEmitFlags(node) & EmitFlags.CustomPrologue) { return node; } @@ -1887,9 +1888,9 @@ namespace ts { return -1; } - function onSubstituteNode(node: Node, isExpression: boolean): Node { - node = previousOnSubstituteNode(node, isExpression); - if (isExpression) { + function onSubstituteNode(emitContext: EmitContext, node: Node): Node { + node = previousOnSubstituteNode(emitContext, node); + if (emitContext === EmitContext.Expression) { return substituteExpression(node); } return node; @@ -2585,7 +2586,7 @@ namespace ts { /*typeArguments*/ undefined, [ createThis(), - setNodeEmitFlags( + setEmitFlags( createFunctionExpression( /*asteriskToken*/ undefined, /*name*/ undefined, @@ -2598,7 +2599,7 @@ namespace ts { /*multiLine*/ buildResult.length > 0 ) ), - NodeEmitFlags.ReuseTempVariableScope + EmitFlags.ReuseTempVariableScope ) ] ); diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 9e6aa507cce..95a4016bb0a 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -16,6 +16,10 @@ namespace ts { * @param node A SourceFile node. */ function transformSourceFile(node: SourceFile) { + if (isDeclarationFile(node)) { + return node; + } + currentSourceFile = node; node = visitEachChild(node, visitor, context); currentSourceFile = undefined; diff --git a/src/compiler/transformers/module/es6.ts b/src/compiler/transformers/module/es6.ts index 2716165f2d3..09a2890727c 100644 --- a/src/compiler/transformers/module/es6.ts +++ b/src/compiler/transformers/module/es6.ts @@ -12,6 +12,10 @@ namespace ts { return transformSourceFile; function transformSourceFile(node: SourceFile) { + if (isDeclarationFile(node)) { + return node; + } + if (isExternalModule(node) || compilerOptions.isolatedModules) { currentSourceFile = node; return visitEachChild(node, visitor, context); diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 53004da2c17..c4e9b4c31c8 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -15,9 +15,6 @@ namespace ts { startLexicalEnvironment, endLexicalEnvironment, hoistVariableDeclaration, - setNodeEmitFlags, - getNodeEmitFlags, - setSourceMapRange, } = context; const compilerOptions = context.getCompilerOptions(); @@ -54,6 +51,10 @@ namespace ts { * @param node The SourceFile node. */ function transformSourceFile(node: SourceFile) { + if (isDeclarationFile(node)) { + return node; + } + if (isExternalModule(node) || compilerOptions.isolatedModules) { currentSourceFile = node; @@ -92,7 +93,7 @@ namespace ts { const updated = updateSourceFile(node, statements); if (hasExportStarsToExportValues) { - setNodeEmitFlags(updated, NodeEmitFlags.EmitExportStar | getNodeEmitFlags(node)); + setEmitFlags(updated, EmitFlags.EmitExportStar | getEmitFlags(node)); } return updated; @@ -116,7 +117,7 @@ namespace ts { */ function transformUMDModule(node: SourceFile) { const define = createIdentifier("define"); - setNodeEmitFlags(define, NodeEmitFlags.UMDDefine); + setEmitFlags(define, EmitFlags.UMDDefine); return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false); } @@ -220,7 +221,7 @@ namespace ts { if (hasExportStarsToExportValues) { // If we have any `export * from ...` declarations // we need to inform the emitter to add the __export helper. - setNodeEmitFlags(body, NodeEmitFlags.EmitExportStar); + setEmitFlags(body, EmitFlags.EmitExportStar); } return body; @@ -234,7 +235,7 @@ namespace ts { /*location*/ exportEquals ); - setNodeEmitFlags(statement, NodeEmitFlags.NoTokenSourceMaps | NodeEmitFlags.NoComments); + setEmitFlags(statement, EmitFlags.NoTokenSourceMaps | EmitFlags.NoComments); statements.push(statement); } else { @@ -249,7 +250,7 @@ namespace ts { /*location*/ exportEquals ); - setNodeEmitFlags(statement, NodeEmitFlags.NoComments); + setEmitFlags(statement, EmitFlags.NoComments); statements.push(statement); } } @@ -388,7 +389,7 @@ namespace ts { // Set emitFlags on the name of the importEqualsDeclaration // This is so the printer will not substitute the identifier - setNodeEmitFlags(node.name, NodeEmitFlags.NoSubstitution); + setEmitFlags(node.name, EmitFlags.NoSubstitution); const statements: Statement[] = []; if (moduleKind !== ModuleKind.AMD) { if (hasModifier(node, ModifierFlags.Export)) { @@ -598,7 +599,7 @@ namespace ts { } else { statements.push( - createExportStatement(node.name, setNodeEmitFlags(getSynthesizedClone(node.name), NodeEmitFlags.LocalName), /*location*/ node) + createExportStatement(node.name, setEmitFlags(getSynthesizedClone(node.name), EmitFlags.LocalName), /*location*/ node) ); } } @@ -813,7 +814,7 @@ namespace ts { )], /*location*/ node ); - setNodeEmitFlags(transformedStatement, NodeEmitFlags.NoComments); + setEmitFlags(transformedStatement, EmitFlags.NoComments); statements.push(transformedStatement); } @@ -821,14 +822,14 @@ namespace ts { return node.name ? getSynthesizedClone(node.name) : getGeneratedNameForNode(node); } - function onEmitNode(node: Node, emit: (node: Node) => void): void { + function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void { if (node.kind === SyntaxKind.SourceFile) { bindingNameExportSpecifiersMap = bindingNameExportSpecifiersForFileMap[getOriginalNodeId(node)]; - previousOnEmitNode(node, emit); + previousOnEmitNode(emitContext, node, emitCallback); bindingNameExportSpecifiersMap = undefined; } else { - previousOnEmitNode(node, emit); + previousOnEmitNode(emitContext, node, emitCallback); } } @@ -839,9 +840,9 @@ namespace ts { * @param isExpression A value indicating whether the node is to be used in an expression * position. */ - function onSubstituteNode(node: Node, isExpression: boolean) { - node = previousOnSubstituteNode(node, isExpression); - if (isExpression) { + function onSubstituteNode(emitContext: EmitContext, node: Node) { + node = previousOnSubstituteNode(emitContext, node); + if (emitContext === EmitContext.Expression) { return substituteExpression(node); } else if (isShorthandPropertyAssignment(node)) { @@ -890,7 +891,7 @@ namespace ts { // If the left-hand-side of the binaryExpression is an identifier and its is export through export Specifier if (isIdentifier(left) && isAssignmentOperator(node.operatorToken.kind)) { if (bindingNameExportSpecifiersMap && hasProperty(bindingNameExportSpecifiersMap, left.text)) { - setNodeEmitFlags(node, NodeEmitFlags.NoSubstitution); + setEmitFlags(node, EmitFlags.NoSubstitution); let nestedExportAssignment: BinaryExpression; for (const specifier of bindingNameExportSpecifiersMap[left.text]) { nestedExportAssignment = nestedExportAssignment ? @@ -910,7 +911,7 @@ namespace ts { const operand = node.operand; if (isIdentifier(operand) && bindingNameExportSpecifiersForFileMap) { if (bindingNameExportSpecifiersMap && hasProperty(bindingNameExportSpecifiersMap, operand.text)) { - setNodeEmitFlags(node, NodeEmitFlags.NoSubstitution); + setEmitFlags(node, EmitFlags.NoSubstitution); let transformedUnaryExpression: BinaryExpression; if (node.kind === SyntaxKind.PostfixUnaryExpression) { transformedUnaryExpression = createBinary( @@ -920,7 +921,7 @@ namespace ts { /*location*/ node ); // We have to set no substitution flag here to prevent visit the binary expression and substitute it again as we will preform all necessary substitution in here - setNodeEmitFlags(transformedUnaryExpression, NodeEmitFlags.NoSubstitution); + setEmitFlags(transformedUnaryExpression, EmitFlags.NoSubstitution); } let nestedExportAssignment: BinaryExpression; for (const specifier of bindingNameExportSpecifiersMap[operand.text]) { @@ -935,9 +936,9 @@ namespace ts { } function trySubstituteExportedName(node: Identifier) { - const emitFlags = getNodeEmitFlags(node); - if ((emitFlags & NodeEmitFlags.LocalName) === 0) { - const container = resolver.getReferencedExportContainer(node, (emitFlags & NodeEmitFlags.ExportName) !== 0); + const emitFlags = getEmitFlags(node); + if ((emitFlags & EmitFlags.LocalName) === 0) { + const container = resolver.getReferencedExportContainer(node, (emitFlags & EmitFlags.ExportName) !== 0); if (container) { if (container.kind === SyntaxKind.SourceFile) { return createPropertyAccess( @@ -953,7 +954,7 @@ namespace ts { } function trySubstituteImportedName(node: Identifier): Expression { - if ((getNodeEmitFlags(node) & NodeEmitFlags.LocalName) === 0) { + if ((getEmitFlags(node) & EmitFlags.LocalName) === 0) { const declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { if (isImportClause(declaration)) { @@ -1077,7 +1078,7 @@ namespace ts { if (includeNonAmdDependencies && importAliasName) { // Set emitFlags on the name of the classDeclaration // This is so that when printer will not substitute the identifier - setNodeEmitFlags(importAliasName, NodeEmitFlags.NoSubstitution); + setEmitFlags(importAliasName, EmitFlags.NoSubstitution); aliasedModuleNames.push(externalModuleName); importAliasNames.push(createParameter(importAliasName)); } diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index 5e3b0281227..4a137c89a93 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -10,8 +10,6 @@ namespace ts { } const { - getNodeEmitFlags, - setNodeEmitFlags, startLexicalEnvironment, endLexicalEnvironment, hoistVariableDeclaration, @@ -50,6 +48,10 @@ namespace ts { return transformSourceFile; function transformSourceFile(node: SourceFile) { + if (isDeclarationFile(node)) { + return node; + } + if (isExternalModule(node) || compilerOptions.isolatedModules) { currentSourceFile = node; currentNode = node; @@ -116,9 +118,9 @@ namespace ts { createParameter(contextObjectForFile) ], /*type*/ undefined, - setNodeEmitFlags( + setEmitFlags( createBlock(statements, /*location*/ undefined, /*multiLine*/ true), - NodeEmitFlags.EmitEmitHelpers + EmitFlags.EmitEmitHelpers ) ); @@ -135,7 +137,7 @@ namespace ts { : [dependencies, body] ) ) - ], /*nodeEmitFlags*/ ~NodeEmitFlags.EmitEmitHelpers & getNodeEmitFlags(node)); + ], /*nodeEmitFlags*/ ~EmitFlags.EmitEmitHelpers & getEmitFlags(node)); } /** @@ -984,14 +986,14 @@ namespace ts { // Substitutions // - function onEmitNode(node: Node, emit: (node: Node) => void): void { + function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void { if (node.kind === SyntaxKind.SourceFile) { exportFunctionForFile = exportFunctionForFileMap[getOriginalNodeId(node)]; - previousOnEmitNode(node, emit); + previousOnEmitNode(emitContext, node, emitCallback); exportFunctionForFile = undefined; } else { - previousOnEmitNode(node, emit); + previousOnEmitNode(emitContext, node, emitCallback); } } @@ -1002,9 +1004,9 @@ namespace ts { * @param isExpression A value indicating whether the node is to be used in an expression * position. */ - function onSubstituteNode(node: Node, isExpression: boolean) { - node = previousOnSubstituteNode(node, isExpression); - if (isExpression) { + function onSubstituteNode(emitContext: EmitContext, node: Node) { + node = previousOnSubstituteNode(emitContext, node); + if (emitContext === EmitContext.Expression) { return substituteExpression(node); } @@ -1053,7 +1055,7 @@ namespace ts { } function substituteAssignmentExpression(node: BinaryExpression): Expression { - setNodeEmitFlags(node, NodeEmitFlags.NoSubstitution); + setEmitFlags(node, EmitFlags.NoSubstitution); const left = node.left; switch (left.kind) { @@ -1176,7 +1178,7 @@ namespace ts { const exportDeclaration = resolver.getReferencedExportContainer(operand); if (exportDeclaration) { const expr = createPrefix(node.operator, operand, node); - setNodeEmitFlags(expr, NodeEmitFlags.NoSubstitution); + setEmitFlags(expr, EmitFlags.NoSubstitution); const call = createExportExpression(operand, expr); if (node.kind === SyntaxKind.PrefixUnaryExpression) { return call; @@ -1241,7 +1243,7 @@ namespace ts { ]), m, createBlock([ - setNodeEmitFlags( + setEmitFlags( createIf( condition, createStatement( @@ -1251,7 +1253,7 @@ namespace ts { ) ) ), - NodeEmitFlags.SingleLine + EmitFlags.SingleLine ) ]) ), @@ -1393,10 +1395,10 @@ namespace ts { hoistBindingElement(node, /*isExported*/ false); } - function updateSourceFile(node: SourceFile, statements: Statement[], nodeEmitFlags: NodeEmitFlags) { + function updateSourceFile(node: SourceFile, statements: Statement[], nodeEmitFlags: EmitFlags) { const updated = getMutableClone(node); updated.statements = createNodeArray(statements, node.statements); - setNodeEmitFlags(updated, nodeEmitFlags); + setEmitFlags(updated, nodeEmitFlags); return updated; } } diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 1d01e51f6d8..f6e8074cb07 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -24,10 +24,6 @@ namespace ts { export function transformTypeScript(context: TransformationContext) { const { - getNodeEmitFlags, - setNodeEmitFlags, - setCommentRange, - setSourceMapRange, startLexicalEnvironment, endLexicalEnvironment, hoistVariableDeclaration, @@ -46,11 +42,16 @@ namespace ts { context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; + // Enable substitution for property/element access to emit const enum values. + context.enableSubstitution(SyntaxKind.PropertyAccessExpression); + context.enableSubstitution(SyntaxKind.ElementAccessExpression); + // These variables contain state that changes as we descend into the tree. let currentSourceFile: SourceFile; let currentNamespace: ModuleDeclaration; let currentNamespaceContainerName: Identifier; let currentScope: SourceFile | Block | ModuleBlock | CaseBlock; + let currentScopeFirstDeclarationsOfName: Map; let currentSourceFileExternalHelpersModuleName: Identifier; /** @@ -85,6 +86,10 @@ namespace ts { * @param node A SourceFile node. */ function transformSourceFile(node: SourceFile) { + if (isDeclarationFile(node)) { + return node; + } + return visitNode(node, visitor, isSourceFile); } @@ -96,6 +101,7 @@ namespace ts { function saveStateAndInvoke(node: Node, f: (node: Node) => T): T { // Save state const savedCurrentScope = currentScope; + const savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; // Handle state changes before visiting a node. onBeforeVisitNode(node); @@ -103,8 +109,11 @@ namespace ts { const visited = f(node); // Restore state - currentScope = savedCurrentScope; + if (currentScope !== savedCurrentScope) { + currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; + } + currentScope = savedCurrentScope; return visited; } @@ -410,6 +419,16 @@ namespace ts { case SyntaxKind.ModuleBlock: case SyntaxKind.Block: currentScope = node; + currentScopeFirstDeclarationsOfName = undefined; + break; + + case SyntaxKind.ClassDeclaration: + case SyntaxKind.FunctionDeclaration: + if (hasModifier(node, ModifierFlags.Ambient)) { + break; + } + + recordEmittedDeclarationInScope(node); break; } } @@ -449,7 +468,7 @@ namespace ts { node = visitEachChild(node, visitor, context); } - setNodeEmitFlags(node, NodeEmitFlags.EmitEmitHelpers | node.emitFlags); + setEmitFlags(node, EmitFlags.EmitEmitHelpers | getEmitFlags(node)); return node; } @@ -521,7 +540,7 @@ namespace ts { // To better align with the old emitter, we should not emit a trailing source map // entry if the class has static properties. if (staticProperties.length > 0) { - setNodeEmitFlags(classDeclaration, NodeEmitFlags.NoTrailingSourceMap | getNodeEmitFlags(classDeclaration)); + setEmitFlags(classDeclaration, EmitFlags.NoTrailingSourceMap | getEmitFlags(classDeclaration)); } statements.push(classDeclaration); @@ -776,7 +795,7 @@ namespace ts { // To preserve the behavior of the old emitter, we explicitly indent // the body of a class with static initializers. - setNodeEmitFlags(classExpression, NodeEmitFlags.Indented | getNodeEmitFlags(classExpression)); + setEmitFlags(classExpression, EmitFlags.Indented | getEmitFlags(classExpression)); expressions.push(startOnNewLine(createAssignment(temp, classExpression))); addRange(expressions, generateInitializedPropertyExpressions(node, staticProperties, temp)); expressions.push(startOnNewLine(temp)); @@ -1009,10 +1028,10 @@ namespace ts { Debug.assert(isIdentifier(node.name)); const name = node.name as Identifier; const propertyName = getMutableClone(name); - setNodeEmitFlags(propertyName, NodeEmitFlags.NoComments | NodeEmitFlags.NoSourceMap); + setEmitFlags(propertyName, EmitFlags.NoComments | EmitFlags.NoSourceMap); const localName = getMutableClone(name); - setNodeEmitFlags(localName, NodeEmitFlags.NoComments); + setEmitFlags(localName, EmitFlags.NoComments); return startOnNewLine( createStatement( @@ -1418,7 +1437,7 @@ namespace ts { moveRangePastDecorators(member) ); - setNodeEmitFlags(helper, NodeEmitFlags.NoComments); + setEmitFlags(helper, EmitFlags.NoComments); return helper; } @@ -1467,7 +1486,7 @@ namespace ts { ); const result = createAssignment(getDeclarationName(node), expression, moveRangePastDecorators(node)); - setNodeEmitFlags(result, NodeEmitFlags.NoComments); + setEmitFlags(result, EmitFlags.NoComments); return result; } // Emit the call to __decorate. Given the class: @@ -1491,7 +1510,7 @@ namespace ts { moveRangePastDecorators(node) ); - setNodeEmitFlags(result, NodeEmitFlags.NoComments); + setEmitFlags(result, EmitFlags.NoComments); return result; } } @@ -1521,7 +1540,7 @@ namespace ts { transformDecorator(decorator), parameterOffset, /*location*/ decorator.expression); - setNodeEmitFlags(helper, NodeEmitFlags.NoComments); + setEmitFlags(helper, EmitFlags.NoComments); expressions.push(helper); } } @@ -2324,11 +2343,11 @@ namespace ts { if (languageVersion >= ScriptTarget.ES6) { if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuperBinding) { enableSubstitutionForAsyncMethodsWithSuper(); - setNodeEmitFlags(block, NodeEmitFlags.EmitAdvancedSuperHelper); + setEmitFlags(block, EmitFlags.EmitAdvancedSuperHelper); } else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuper) { enableSubstitutionForAsyncMethodsWithSuper(); - setNodeEmitFlags(block, NodeEmitFlags.EmitSuperHelper); + setEmitFlags(block, EmitFlags.EmitSuperHelper); } } @@ -2375,7 +2394,7 @@ namespace ts { setOriginalNode(parameter, node); setCommentRange(parameter, node); setSourceMapRange(parameter, moveRangePastModifiers(node)); - setNodeEmitFlags(parameter.name, NodeEmitFlags.NoTrailingSourceMap); + setEmitFlags(parameter.name, EmitFlags.NoTrailingSourceMap); return parameter; } @@ -2498,10 +2517,12 @@ namespace ts { } function shouldEmitVarForEnumDeclaration(node: EnumDeclaration | ModuleDeclaration) { - return !hasModifier(node, ModifierFlags.Export) - || (isES6ExportedDeclaration(node) && isFirstDeclarationOfKind(node, node.kind)); + return isFirstEmittedDeclarationInScope(node) + && (!hasModifier(node, ModifierFlags.Export) + || isES6ExportedDeclaration(node)); } + /* * Adds a trailing VariableStatement for an enum or module declaration. */ @@ -2534,17 +2555,18 @@ namespace ts { // We request to be advised when the printer is about to print this node. This allows // us to set up the correct state for later substitutions. - let emitFlags = NodeEmitFlags.AdviseOnEmitNode; + let emitFlags = EmitFlags.AdviseOnEmitNode; // If needed, we should emit a variable declaration for the enum. If we emit // a leading variable declaration, we should not emit leading comments for the // enum body. + recordEmittedDeclarationInScope(node); if (shouldEmitVarForEnumDeclaration(node)) { addVarForEnumOrModuleDeclaration(statements, node); // We should still emit the comments if we are emitting a system module. if (moduleKind !== ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= NodeEmitFlags.NoLeadingComments; + emitFlags |= EmitFlags.NoLeadingComments; } } @@ -2584,7 +2606,7 @@ namespace ts { ); setOriginalNode(enumStatement, node); - setNodeEmitFlags(enumStatement, emitFlags); + setEmitFlags(enumStatement, emitFlags); statements.push(enumStatement); if (isNamespaceExport(node)) { @@ -2675,20 +2697,48 @@ namespace ts { return isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); } - function isModuleMergedWithES6Class(node: ModuleDeclaration) { - return languageVersion === ScriptTarget.ES6 - && isMergedWithClass(node); - } - function isES6ExportedDeclaration(node: Node) { return isExternalModuleExport(node) && moduleKind === ModuleKind.ES6; } + /** + * Records that a declaration was emitted in the current scope, if it was the first + * declaration for the provided symbol. + * + * NOTE: if there is ever a transformation above this one, we may not be able to rely + * on symbol names. + */ + function recordEmittedDeclarationInScope(node: Node) { + const name = node.symbol && node.symbol.name; + if (name) { + if (!currentScopeFirstDeclarationsOfName) { + currentScopeFirstDeclarationsOfName = createMap(); + } + + if (!(name in currentScopeFirstDeclarationsOfName)) { + currentScopeFirstDeclarationsOfName[name] = node; + } + } + } + + /** + * Determines whether a declaration is the first declaration with the same name emitted + * in the current scope. + */ + function isFirstEmittedDeclarationInScope(node: Node) { + if (currentScopeFirstDeclarationsOfName) { + const name = node.symbol && node.symbol.name; + if (name) { + return currentScopeFirstDeclarationsOfName[name] === node; + } + } + + return false; + } + function shouldEmitVarForModuleDeclaration(node: ModuleDeclaration) { - return !isModuleMergedWithES6Class(node) - && (!isES6ExportedDeclaration(node) - || isFirstDeclarationOfKind(node, node.kind)); + return isFirstEmittedDeclarationInScope(node); } /** @@ -2736,7 +2786,7 @@ namespace ts { // })(m1 || (m1 = {})); // trailing comment module // setCommentRange(statement, node); - setNodeEmitFlags(statement, NodeEmitFlags.NoTrailingComments); + setEmitFlags(statement, EmitFlags.NoTrailingComments); statements.push(statement); } @@ -2759,16 +2809,17 @@ namespace ts { // We request to be advised when the printer is about to print this node. This allows // us to set up the correct state for later substitutions. - let emitFlags = NodeEmitFlags.AdviseOnEmitNode; + let emitFlags = EmitFlags.AdviseOnEmitNode; // If needed, we should emit a variable declaration for the module. If we emit // a leading variable declaration, we should not emit leading comments for the // module body. + recordEmittedDeclarationInScope(node); if (shouldEmitVarForModuleDeclaration(node)) { addVarForEnumOrModuleDeclaration(statements, node); // We should still emit the comments if we are emitting a system module. if (moduleKind !== ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= NodeEmitFlags.NoLeadingComments; + emitFlags |= EmitFlags.NoLeadingComments; } } @@ -2820,7 +2871,7 @@ namespace ts { ); setOriginalNode(moduleStatement, node); - setNodeEmitFlags(moduleStatement, emitFlags); + setEmitFlags(moduleStatement, emitFlags); statements.push(moduleStatement); return statements; } @@ -2833,8 +2884,10 @@ namespace ts { function transformModuleBody(node: ModuleDeclaration, namespaceLocalName: Identifier): Block { const savedCurrentNamespaceContainerName = currentNamespaceContainerName; const savedCurrentNamespace = currentNamespace; + const savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; currentNamespaceContainerName = namespaceLocalName; currentNamespace = node; + currentScopeFirstDeclarationsOfName = undefined; const statements: Statement[] = []; startLexicalEnvironment(); @@ -2861,10 +2914,12 @@ namespace ts { const moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; statementsLocation = moveRangePos(moduleBlock.statements, -1); } - addRange(statements, endLexicalEnvironment()); + addRange(statements, endLexicalEnvironment()); currentNamespaceContainerName = savedCurrentNamespaceContainerName; currentNamespace = savedCurrentNamespace; + currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; + const block = createBlock( createNodeArray( statements, @@ -2895,7 +2950,7 @@ namespace ts { // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. if (body.kind !== SyntaxKind.ModuleBlock) { - setNodeEmitFlags(block, block.emitFlags | NodeEmitFlags.NoComments); + setEmitFlags(block, getEmitFlags(block) | EmitFlags.NoComments); } return block; } @@ -2936,7 +2991,7 @@ namespace ts { } const moduleReference = createExpressionFromEntityName(node.moduleReference); - setNodeEmitFlags(moduleReference, NodeEmitFlags.NoComments | NodeEmitFlags.NoNestedComments); + setEmitFlags(moduleReference, EmitFlags.NoComments | EmitFlags.NoNestedComments); if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { // export var ${name} = ${moduleReference}; @@ -3048,15 +3103,15 @@ namespace ts { function getNamespaceMemberName(name: Identifier, allowComments?: boolean, allowSourceMaps?: boolean): Expression { const qualifiedName = createPropertyAccess(currentNamespaceContainerName, getSynthesizedClone(name), /*location*/ name); - let emitFlags: NodeEmitFlags; + let emitFlags: EmitFlags; if (!allowComments) { - emitFlags |= NodeEmitFlags.NoComments; + emitFlags |= EmitFlags.NoComments; } if (!allowSourceMaps) { - emitFlags |= NodeEmitFlags.NoSourceMap; + emitFlags |= EmitFlags.NoSourceMap; } if (emitFlags) { - setNodeEmitFlags(qualifiedName, emitFlags); + setEmitFlags(qualifiedName, emitFlags); } return qualifiedName; } @@ -3093,7 +3148,7 @@ namespace ts { * @param allowComments A value indicating whether comments may be emitted for the name. */ function getLocalName(node: DeclarationStatement | ClassExpression, noSourceMaps?: boolean, allowComments?: boolean) { - return getDeclarationName(node, allowComments, !noSourceMaps, NodeEmitFlags.LocalName); + return getDeclarationName(node, allowComments, !noSourceMaps, EmitFlags.LocalName); } /** @@ -3111,7 +3166,7 @@ namespace ts { return getNamespaceMemberName(getDeclarationName(node), allowComments, !noSourceMaps); } - return getDeclarationName(node, allowComments, !noSourceMaps, NodeEmitFlags.ExportName); + return getDeclarationName(node, allowComments, !noSourceMaps, EmitFlags.ExportName); } /** @@ -3122,20 +3177,20 @@ namespace ts { * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. * @param emitFlags Additional NodeEmitFlags to specify for the name. */ - function getDeclarationName(node: DeclarationStatement | ClassExpression, allowComments?: boolean, allowSourceMaps?: boolean, emitFlags?: NodeEmitFlags) { + function getDeclarationName(node: DeclarationStatement | ClassExpression, allowComments?: boolean, allowSourceMaps?: boolean, emitFlags?: EmitFlags) { if (node.name) { const name = getMutableClone(node.name); - emitFlags |= getNodeEmitFlags(node.name); + emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) { - emitFlags |= NodeEmitFlags.NoSourceMap; + emitFlags |= EmitFlags.NoSourceMap; } if (!allowComments) { - emitFlags |= NodeEmitFlags.NoComments; + emitFlags |= EmitFlags.NoComments; } if (emitFlags) { - setNodeEmitFlags(name, emitFlags); + setEmitFlags(name, emitFlags); } return name; @@ -3231,7 +3286,7 @@ namespace ts { * @param node The node to emit. * @param emit A callback used to emit the node in the printer. */ - function onEmitNode(node: Node, emit: (node: Node) => void): void { + function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void { const savedApplicableSubstitutions = applicableSubstitutions; const savedCurrentSuperContainer = currentSuperContainer; // If we need to support substitutions for `super` in an async method, @@ -3248,7 +3303,7 @@ namespace ts { applicableSubstitutions |= TypeScriptSubstitutionFlags.NonQualifiedEnumMembers; } - previousOnEmitNode(node, emit); + previousOnEmitNode(emitContext, node, emitCallback); applicableSubstitutions = savedApplicableSubstitutions; currentSuperContainer = savedCurrentSuperContainer; @@ -3261,9 +3316,9 @@ namespace ts { * @param isExpression A value indicating whether the node is to be used in an expression * position. */ - function onSubstituteNode(node: Node, isExpression: boolean) { - node = previousOnSubstituteNode(node, isExpression); - if (isExpression) { + function onSubstituteNode(emitContext: EmitContext, node: Node) { + node = previousOnSubstituteNode(emitContext, node); + if (emitContext === EmitContext.Expression) { return substituteExpression(node); } else if (isShorthandPropertyAssignment(node)) { @@ -3294,17 +3349,15 @@ namespace ts { switch (node.kind) { case SyntaxKind.Identifier: return substituteExpressionIdentifier(node); - } - - if (enabledSubstitutions & TypeScriptSubstitutionFlags.AsyncMethodsWithSuper) { - switch (node.kind) { - case SyntaxKind.CallExpression: + case SyntaxKind.PropertyAccessExpression: + return substitutePropertyAccessExpression(node); + case SyntaxKind.ElementAccessExpression: + return substituteElementAccessExpression(node); + case SyntaxKind.CallExpression: + if (enabledSubstitutions & TypeScriptSubstitutionFlags.AsyncMethodsWithSuper) { return substituteCallExpression(node); - case SyntaxKind.PropertyAccessExpression: - return substitutePropertyAccessExpression(node); - case SyntaxKind.ElementAccessExpression: - return substituteElementAccessExpression(node); - } + } + break; } return node; @@ -3342,7 +3395,7 @@ namespace ts { function trySubstituteNamespaceExportedName(node: Identifier): Expression { // If this is explicitly a local name, do not substitute. - if (enabledSubstitutions & applicableSubstitutions && (getNodeEmitFlags(node) & NodeEmitFlags.LocalName) === 0) { + if (enabledSubstitutions & applicableSubstitutions && (getEmitFlags(node) & EmitFlags.LocalName) === 0) { // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. const container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); @@ -3381,7 +3434,7 @@ namespace ts { } function substitutePropertyAccessExpression(node: PropertyAccessExpression) { - if (node.expression.kind === SyntaxKind.SuperKeyword) { + if (enabledSubstitutions & TypeScriptSubstitutionFlags.AsyncMethodsWithSuper && node.expression.kind === SyntaxKind.SuperKeyword) { const flags = getSuperContainerAsyncMethodFlags(); if (flags) { return createSuperAccessInAsyncMethod( @@ -3392,11 +3445,11 @@ namespace ts { } } - return node; + return substituteConstantValue(node); } function substituteElementAccessExpression(node: ElementAccessExpression) { - if (node.expression.kind === SyntaxKind.SuperKeyword) { + if (enabledSubstitutions & TypeScriptSubstitutionFlags.AsyncMethodsWithSuper && node.expression.kind === SyntaxKind.SuperKeyword) { const flags = getSuperContainerAsyncMethodFlags(); if (flags) { return createSuperAccessInAsyncMethod( @@ -3407,9 +3460,39 @@ namespace ts { } } + return substituteConstantValue(node); + } + + function substituteConstantValue(node: PropertyAccessExpression | ElementAccessExpression): LeftHandSideExpression { + const constantValue = tryGetConstEnumValue(node); + if (constantValue !== undefined) { + const substitute = createLiteral(constantValue); + setSourceMapRange(substitute, node); + setCommentRange(substitute, node); + if (!compilerOptions.removeComments) { + const propertyName = isPropertyAccessExpression(node) + ? declarationNameToString(node.name) + : getTextOfNode(node.argumentExpression); + substitute.trailingComment = ` ${propertyName} `; + } + + setConstantValue(node, constantValue); + return substitute; + } + return node; } + function tryGetConstEnumValue(node: Node): number { + if (compilerOptions.isolatedModules) { + return undefined; + } + + return isPropertyAccessExpression(node) || isElementAccessExpression(node) + ? resolver.getConstantValue(node) + : undefined; + } + function createSuperAccessInAsyncMethod(argumentExpression: Expression, flags: NodeCheckFlags, location: TextRange): LeftHandSideExpression { if (flags & NodeCheckFlags.AsyncMethodWithSuperBinding) { return createPropertyAccess( diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 7629f124231..f6d79176992 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -494,10 +494,7 @@ namespace ts { /* @internal */ nextContainer?: Node; // Next container in declaration order (initialized by binding) /* @internal */ localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes) /* @internal */ flowNode?: FlowNode; // Associated FlowNode (initialized by binding) - /* @internal */ transformId?: number; // Associates transient transformation properties with a specific transformation (initialized by transformation). - /* @internal */ emitFlags?: NodeEmitFlags; // Transient emit flags for a synthesized node (initialized by transformation). - /* @internal */ sourceMapRange?: TextRange; // Transient custom sourcemap range for a synthesized node (initialized by transformation). - /* @internal */ commentRange?: TextRange; // Transient custom comment range for a synthesized node (initialized by transformation). + /* @internal */ emitNode?: EmitNode; // Associated EmitNode (initialized by transforms) } export interface NodeArray extends Array, TextRange { @@ -3175,7 +3172,17 @@ namespace ts { } /* @internal */ - export const enum NodeEmitFlags { + export interface EmitNode { + flags?: EmitFlags; + commentRange?: TextRange; + sourceMapRange?: TextRange; + tokenSourceMapRanges?: Map; + annotatedNodes?: Node[]; // Tracks Parse-tree nodes with EmitNodes for eventual cleanup. + constantValue?: number; + } + + /* @internal */ + export const enum EmitFlags { EmitEmitHelpers = 1 << 0, // Any emit helpers should be written to this node. EmitExportStar = 1 << 1, // The export * helper should be written to this node. EmitSuperHelper = 1 << 2, // Emit the basic _super helper for async methods. @@ -3205,6 +3212,14 @@ namespace ts { CustomPrologue = 1 << 23, // Treat the statement as if it were a prologue directive (NOTE: Prologue directives are *not* transformed). } + /* @internal */ + export const enum EmitContext { + SourceFile, // Emitting a SourceFile + Expression, // Emitting an Expression + IdentifierName, // Emitting an IdentifierName + Unspecified, // Emitting an otherwise unspecified node + } + /** Additional context provided to `visitEachChild` */ /* @internal */ export interface LexicalEnvironment { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 130fe690c52..1a4d95feca5 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -982,11 +982,11 @@ namespace ts { } /** - * Given an super call\property node returns a closest node where either - * - super call\property is legal in the node and not legal in the parent node the node. + * Given an super call/property node, returns the closest node where + * - a super call/property access is legal in the node and not legal in the parent node the node. * i.e. super call is legal in constructor but not legal in the class body. - * - node is arrow function (so caller might need to call getSuperContainer in case it needs to climb higher) - * - super call\property is definitely illegal in the node (but might be legal in some subnode) + * - the container is an arrow function (so caller might need to call getSuperContainer again in case it needs to climb higher) + * - a super call/property is definitely illegal in the container (but might be legal in some subnode) * i.e. super property access is illegal in function declaration but can be legal in the statement list */ export function getSuperContainer(node: Node, stopOnFunctions: boolean): Node { diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index c459d2afac2..988e87284c3 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -2045,4 +2045,22 @@ namespace ts.projectSystem { assert.equal(snap.getLength(), expectedLength, "Incorrect snapshot size"); } }); + + describe("Language service", () => { + it("should work correctly on case-sensitive file systems", () => { + const lib = { + path: "/a/Lib/lib.d.ts", + content: "let x: number" + }; + const f = { + path: "/a/b/app.ts", + content: "let x = 1;" + }; + const host = createServerHost([lib, f], { executingFilePath: "/a/Lib/tsc.js", useCaseSensitiveFileNames: true }); + const projectService = createProjectService(host); + projectService.openClientFile(f.path); + projectService.checkNumberOfProjects({ inferredProjects: 1 }); + projectService.inferredProjects[0].getLanguageService().getProgram(); + }); + }); } \ No newline at end of file diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 707f286a9b5..2b28e66bf88 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1001,9 +1001,14 @@ namespace ts.server { } getScriptInfoForNormalizedPath(fileName: NormalizedPath) { - return this.filenameToScriptInfo.get(normalizedPathToPath(fileName, this.host.getCurrentDirectory(), this.toCanonicalFileName)); + return this.getScriptInfoForPath(normalizedPathToPath(fileName, this.host.getCurrentDirectory(), this.toCanonicalFileName)); } + getScriptInfoForPath(fileName: Path) { + return this.filenameToScriptInfo.get(fileName); + } + + setHostConfiguration(args: protocol.ConfigureRequestArguments) { if (args.file) { const info = this.getScriptInfoForNormalizedPath(toNormalizedPath(args.file)); diff --git a/src/server/project.ts b/src/server/project.ts index 01858b4cc68..b59efb03cfd 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -215,7 +215,13 @@ namespace ts.server { } getScriptInfos() { - return map(this.program.getSourceFiles(), sourceFile => this.getScriptInfoLSHost(sourceFile.path)); + return map(this.program.getSourceFiles(), sourceFile => { + const scriptInfo = this.projectService.getScriptInfoForPath(sourceFile.path); + if (!scriptInfo) { + Debug.assert(false, `scriptInfo for a file '${sourceFile.fileName}' is missing.`); + } + return scriptInfo; + }); } getFileEmitOutput(info: ScriptInfo, emitOnlyDtsFiles: boolean) { diff --git a/src/services/services.ts b/src/services/services.ts index eb103cebb11..b50e1d3313d 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -947,7 +947,7 @@ namespace ts { let lastTypesRootVersion = 0; - const useCaseSensitivefileNames = false; + const useCaseSensitivefileNames = host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(); const cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); const currentDirectory = host.getCurrentDirectory(); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js index bf9875efe30..09f7befae07 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js @@ -56,7 +56,6 @@ var clodule1 = (function () { } return clodule1; }()); -var clodule1; (function (clodule1) { function f(x) { } })(clodule1 || (clodule1 = {})); @@ -65,7 +64,6 @@ var clodule2 = (function () { } return clodule2; }()); -var clodule2; (function (clodule2) { var x; var D = (function () { @@ -79,7 +77,6 @@ var clodule3 = (function () { } return clodule3; }()); -var clodule3; (function (clodule3) { clodule3.y = { id: T }; })(clodule3 || (clodule3 = {})); @@ -88,7 +85,6 @@ var clodule4 = (function () { } return clodule4; }()); -var clodule4; (function (clodule4) { var D = (function () { function D() { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js index dc6c6f6ee8e..6e12244542e 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js @@ -22,7 +22,6 @@ var clodule = (function () { clodule.fn = function (id) { }; return clodule; }()); -var clodule; (function (clodule) { // error: duplicate identifier expected function fn(x, y) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js index 402e0e6ad09..6d04d636eb2 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js @@ -22,7 +22,6 @@ var clodule = (function () { clodule.fn = function (id) { }; return clodule; }()); -var clodule; (function (clodule) { // error: duplicate identifier expected function fn(x, y) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js index 0b6c868128e..d3ae3cb0bcf 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js @@ -22,7 +22,6 @@ var clodule = (function () { clodule.sfn = function (id) { return 42; }; return clodule; }()); -var clodule; (function (clodule) { // error: duplicate identifier expected function fn(x, y) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js index b8e332f1932..c6b463fa5fd 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js @@ -31,7 +31,6 @@ var Point = (function () { Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 return Point; }()); -var Point; (function (Point) { function Origin() { return null; } //expected duplicate identifier error Point.Origin = Origin; @@ -47,7 +46,6 @@ var A; return Point; }()); A.Point = Point; - var Point; (function (Point) { function Origin() { return ""; } //expected duplicate identifier error Point.Origin = Origin; diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js index 3fcbdefdf7e..7741290babc 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js @@ -31,7 +31,6 @@ var Point = (function () { Point.Origin = function () { return { x: 0, y: 0 }; }; return Point; }()); -var Point; (function (Point) { function Origin() { return ""; } // not an error, since not exported })(Point || (Point = {})); @@ -46,7 +45,6 @@ var A; return Point; }()); A.Point = Point; - var Point; (function (Point) { function Origin() { return ""; } // not an error since not exported })(Point = A.Point || (A.Point = {})); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js index 63d3739846b..cb2f7c6cb77 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js @@ -31,7 +31,6 @@ var Point = (function () { return Point; }()); Point.Origin = { x: 0, y: 0 }; -var Point; (function (Point) { Point.Origin = ""; //expected duplicate identifier error })(Point || (Point = {})); @@ -46,7 +45,6 @@ var A; }()); Point.Origin = { x: 0, y: 0 }; A.Point = Point; - var Point; (function (Point) { Point.Origin = ""; //expected duplicate identifier error })(Point = A.Point || (A.Point = {})); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js index 3921546a21c..ef77d6257fb 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js @@ -31,7 +31,6 @@ var Point = (function () { return Point; }()); Point.Origin = { x: 0, y: 0 }; -var Point; (function (Point) { var Origin = ""; // not an error, since not exported })(Point || (Point = {})); @@ -46,7 +45,6 @@ var A; }()); Point.Origin = { x: 0, y: 0 }; A.Point = Point; - var Point; (function (Point) { var Origin = ""; // not an error since not exported })(Point = A.Point || (A.Point = {})); diff --git a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js index 247dc4fe62d..b800ca2d24b 100644 --- a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js @@ -76,7 +76,6 @@ var A = (function () { } return A; }()); -var A; (function (A) { A.Instance = new A(); })(A || (A = {})); diff --git a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js index e6a0eb0584d..c0756a56e90 100644 --- a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js @@ -22,7 +22,6 @@ var enumdule; enumdule[enumdule["Red"] = 0] = "Red"; enumdule[enumdule["Blue"] = 1] = "Blue"; })(enumdule || (enumdule = {})); -var enumdule; (function (enumdule) { var Point = (function () { function Point(x, y) { diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index 7dcbfef1d72..ec0ed5494a4 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -38,7 +38,7 @@ var A; var Point3d = (function (_super) { __extends(Point3d, _super); function Point3d() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Point3d; }(Point)); diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js index 8f175621af4..bae9593fb98 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -41,7 +41,7 @@ var A; var Point3d = (function (_super) { __extends(Point3d, _super); function Point3d() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Point3d; }(Point)); diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js index 369a5b4dd52..daa56620014 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js @@ -72,7 +72,6 @@ var B; return { x: 0, y: 0 }; } B.Point = Point; - var Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = B.Point || (B.Point = {})); diff --git a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js index 6928e189a07..fa38dae1298 100644 --- a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js @@ -28,7 +28,6 @@ var enumdule; }()); enumdule.Point = Point; })(enumdule || (enumdule = {})); -var enumdule; (function (enumdule) { enumdule[enumdule["Red"] = 0] = "Red"; enumdule[enumdule["Blue"] = 1] = "Blue"; diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js index dd29b88421c..4c5ea297d27 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js @@ -50,7 +50,6 @@ var A; }()); A.Point = Point; })(A || (A = {})); -var A; (function (A) { var Point = (function () { function Point() { @@ -79,7 +78,6 @@ var X; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); -var X; (function (X) { var Y; (function (Y) { diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js index 2a75b92e2db..e98ed836f7b 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js @@ -42,7 +42,6 @@ var A; }()); A.Point = Point; })(A || (A = {})); -var A; (function (A) { // expected error var Point = (function () { @@ -67,7 +66,6 @@ var X; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); -var X; (function (X) { var Y; (function (Y) { diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js index 54ffef5a084..c8412b336dc 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js @@ -41,7 +41,6 @@ var A; (function (B) { })(B = A.B || (A.B = {})); })(A || (A = {})); -var A; (function (A) { var B; (function (B) { @@ -65,7 +64,6 @@ var X; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); -var X; (function (X) { var Y; (function (Y) { diff --git a/tests/baselines/reference/abstractClassInLocalScope.js b/tests/baselines/reference/abstractClassInLocalScope.js index a49da04c8a1..db5144be399 100644 --- a/tests/baselines/reference/abstractClassInLocalScope.js +++ b/tests/baselines/reference/abstractClassInLocalScope.js @@ -22,7 +22,7 @@ var __extends = (this && this.__extends) || function (d, b) { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js index 1f6c1dfdd7a..1b3e11cfa32 100644 --- a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js +++ b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js @@ -22,7 +22,7 @@ var __extends = (this && this.__extends) || function (d, b) { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/abstractProperty.js b/tests/baselines/reference/abstractProperty.js index 87b5475111b..fb7deaa09dd 100644 --- a/tests/baselines/reference/abstractProperty.js +++ b/tests/baselines/reference/abstractProperty.js @@ -35,9 +35,10 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); - this.raw = "edge"; - this.ro = "readonly please"; + var _this = _super.apply(this, arguments) || this; + _this.raw = "edge"; + _this.ro = "readonly please"; + return _this; } Object.defineProperty(C.prototype, "prop", { get: function () { return "foo"; }, diff --git a/tests/baselines/reference/abstractPropertyNegative.js b/tests/baselines/reference/abstractPropertyNegative.js index 5fc340c58d0..bebf9026a0e 100644 --- a/tests/baselines/reference/abstractPropertyNegative.js +++ b/tests/baselines/reference/abstractPropertyNegative.js @@ -57,8 +57,9 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); - this.ro = "readonly please"; + var _this = _super.apply(this, arguments) || this; + _this.ro = "readonly please"; + return _this; } Object.defineProperty(C.prototype, "concreteWithNoBody", { get: function () { }, @@ -77,8 +78,9 @@ var WrongTypeProperty = (function () { var WrongTypePropertyImpl = (function (_super) { __extends(WrongTypePropertyImpl, _super); function WrongTypePropertyImpl() { - _super.apply(this, arguments); - this.num = "nope, wrong"; + var _this = _super.apply(this, arguments) || this; + _this.num = "nope, wrong"; + return _this; } return WrongTypePropertyImpl; }(WrongTypeProperty)); @@ -90,7 +92,7 @@ var WrongTypeAccessor = (function () { var WrongTypeAccessorImpl = (function (_super) { __extends(WrongTypeAccessorImpl, _super); function WrongTypeAccessorImpl() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(WrongTypeAccessorImpl.prototype, "num", { get: function () { return "nope, wrong"; }, @@ -102,8 +104,9 @@ var WrongTypeAccessorImpl = (function (_super) { var WrongTypeAccessorImpl2 = (function (_super) { __extends(WrongTypeAccessorImpl2, _super); function WrongTypeAccessorImpl2() { - _super.apply(this, arguments); - this.num = "nope, wrong"; + var _this = _super.apply(this, arguments) || this; + _this.num = "nope, wrong"; + return _this; } return WrongTypeAccessorImpl2; }(WrongTypeAccessor)); diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.js b/tests/baselines/reference/accessOverriddenBaseClassMember1.js index c04532078e9..02d092dfd39 100644 --- a/tests/baselines/reference/accessOverriddenBaseClassMember1.js +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.js @@ -34,8 +34,9 @@ var Point = (function () { var ColoredPoint = (function (_super) { __extends(ColoredPoint, _super); function ColoredPoint(x, y, color) { - _super.call(this, x, y); - this.color = color; + var _this = _super.call(this, x, y) || this; + _this.color = color; + return _this; } ColoredPoint.prototype.toString = function () { return _super.prototype.toString.call(this) + " color=" + this.color; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index 7294aa1aff7..dbaeec1f688 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -38,7 +38,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js index 905ed9bce0e..8b60ed8e76d 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js @@ -46,7 +46,7 @@ var Backbone = require("./aliasUsage1_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index 2d9f7cfed6e..bf573aa9abb 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -40,7 +40,7 @@ var Backbone = require("./aliasUsageInArray_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.js b/tests/baselines/reference/aliasUsageInFunctionExpression.js index 21565dc99fc..49bdd493aac 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.js +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.js @@ -39,7 +39,7 @@ var Backbone = require("./aliasUsageInFunctionExpression_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.js b/tests/baselines/reference/aliasUsageInGenericFunction.js index af24b61cf33..dc3a8a88bab 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.js +++ b/tests/baselines/reference/aliasUsageInGenericFunction.js @@ -43,7 +43,7 @@ var Backbone = require("./aliasUsageInGenericFunction_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.js b/tests/baselines/reference/aliasUsageInIndexerOfClass.js index 3b21f15777c..cb7ad3027ca 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.js +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.js @@ -45,7 +45,7 @@ var Backbone = require("./aliasUsageInIndexerOfClass_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.js b/tests/baselines/reference/aliasUsageInObjectLiteral.js index b380104b461..81e3e621e85 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.js +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.js @@ -40,7 +40,7 @@ var Backbone = require("./aliasUsageInObjectLiteral_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInOrExpression.js b/tests/baselines/reference/aliasUsageInOrExpression.js index 1e9a5420345..4faa41dd034 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.js +++ b/tests/baselines/reference/aliasUsageInOrExpression.js @@ -43,7 +43,7 @@ var Backbone = require("./aliasUsageInOrExpression_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js index 76b90c01bf0..2cf4aefab6c 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js @@ -43,7 +43,7 @@ var Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); @@ -64,8 +64,9 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); - this.x = moduleA; + var _this = _super.apply(this, arguments) || this; + _this.x = moduleA; + return _this; } return D; }(C)); diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.js b/tests/baselines/reference/aliasUsageInVarAssignment.js index 7c73fac2d67..80bb2dca20e 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.js +++ b/tests/baselines/reference/aliasUsageInVarAssignment.js @@ -39,7 +39,7 @@ var Backbone = require("./aliasUsageInVarAssignment_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/ambiguousOverloadResolution.js b/tests/baselines/reference/ambiguousOverloadResolution.js index 275bbf67602..01002792921 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.js +++ b/tests/baselines/reference/ambiguousOverloadResolution.js @@ -22,7 +22,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/anyAssignabilityInInheritance.js b/tests/baselines/reference/anyAssignabilityInInheritance.js index f73228a464b..a156abe8ab2 100644 --- a/tests/baselines/reference/anyAssignabilityInInheritance.js +++ b/tests/baselines/reference/anyAssignabilityInInheritance.js @@ -119,7 +119,6 @@ var E; })(E || (E = {})); var r3 = foo3(a); // any function f() { } -var f; (function (f) { f.bar = 1; })(f || (f = {})); @@ -129,7 +128,6 @@ var CC = (function () { } return CC; }()); -var CC; (function (CC) { CC.bar = 1; })(CC || (CC = {})); diff --git a/tests/baselines/reference/anyAssignableToEveryType2.js b/tests/baselines/reference/anyAssignableToEveryType2.js index c5fefb60042..9a4534296a4 100644 --- a/tests/baselines/reference/anyAssignableToEveryType2.js +++ b/tests/baselines/reference/anyAssignableToEveryType2.js @@ -147,7 +147,6 @@ var E; E[E["A"] = 0] = "A"; })(E || (E = {})); function f() { } -var f; (function (f) { f.bar = 1; })(f || (f = {})); @@ -156,7 +155,6 @@ var c = (function () { } return c; }()); -var c; (function (c) { c.bar = 1; })(c || (c = {})); diff --git a/tests/baselines/reference/apparentTypeSubtyping.js b/tests/baselines/reference/apparentTypeSubtyping.js index 2d04b059a9a..6ca9d343a72 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.js +++ b/tests/baselines/reference/apparentTypeSubtyping.js @@ -38,7 +38,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -51,7 +51,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/apparentTypeSupertype.js b/tests/baselines/reference/apparentTypeSupertype.js index de1b1ba11bd..c6d3378872e 100644 --- a/tests/baselines/reference/apparentTypeSupertype.js +++ b/tests/baselines/reference/apparentTypeSupertype.js @@ -28,7 +28,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index e2ca36cbd1d..a887203cd5e 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -101,7 +101,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C2.prototype.C2M1 = function () { return null; }; return C2; diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index a15df1b14b7..d82dedff29d 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -75,7 +75,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C2.prototype.C2M1 = function () { return null; }; return C2; diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index f45f67a8765..b7ddaa5d6da 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -128,7 +128,7 @@ var EmptyTypes; var derived = (function (_super) { __extends(derived, _super); function derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return derived; }(base)); @@ -187,7 +187,7 @@ var NonEmptyTypes; var derived = (function (_super) { __extends(derived, _super); function derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return derived; }(base)); diff --git a/tests/baselines/reference/arrayLiteralTypeInference.js b/tests/baselines/reference/arrayLiteralTypeInference.js index f54dec83c9c..919d3a5e922 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.js +++ b/tests/baselines/reference/arrayLiteralTypeInference.js @@ -65,14 +65,14 @@ var Action = (function () { var ActionA = (function (_super) { __extends(ActionA, _super); function ActionA() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ActionA; }(Action)); var ActionB = (function (_super) { __extends(ActionB, _super); function ActionB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ActionB; }(Action)); diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index 4dbf88f8688..530cdedec73 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -70,7 +70,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived1; }(Base)); @@ -78,7 +78,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js index c15782a8e20..c0f320ac1e5 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js @@ -39,7 +39,7 @@ var List = (function () { var DerivedList = (function (_super) { __extends(DerivedList, _super); function DerivedList() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return DerivedList; }(List)); diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js index 255b52e16c9..d1d75e8041c 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js @@ -33,14 +33,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(Array)); diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index 73e3be15e11..64727398f72 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -116,8 +116,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this = this; - _super.call(this, function () { return _this; }); + return _super.call(this, function () { return _this; }) || this; } return Derived; }(Base)); @@ -158,8 +157,7 @@ var M2; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this = this; - _super.call(this, function () { return _this; }); + return _super.call(this, function () { return _this; }) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js index 24f95ec61ea..c5a1f415437 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js @@ -114,21 +114,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js index 43608565039..58faf663ea8 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js @@ -115,21 +115,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js index b3318dd53e8..87506cad08f 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js @@ -80,21 +80,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js index becbfea57a0..2c05d5960b2 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js @@ -57,21 +57,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js index d062a563a4d..76ad53e4e05 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js @@ -114,21 +114,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js index 5744424f878..f516df153c6 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js @@ -115,21 +115,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js index de42671c9f1..ef7de7f011b 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js @@ -80,21 +80,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js index 206ae7768ba..3d58ae707a5 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js @@ -57,21 +57,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js index 56b206786f1..37160506683 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js @@ -72,7 +72,7 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js index 53f92dd3b59..2e6ecd72741 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js @@ -59,7 +59,7 @@ b = a; // ok var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A)); diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js index 092de2ca707..2cc2510c8da 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js @@ -108,14 +108,14 @@ var OnlyDerived; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); @@ -167,14 +167,14 @@ var WithBase; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js index e876ba575be..997c5f7a0c9 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js @@ -157,7 +157,6 @@ var TargetIsPublic; e = d; // errror e = e; })(TargetIsPublic || (TargetIsPublic = {})); -var TargetIsPublic; (function (TargetIsPublic) { // targets var Base = (function () { diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js index 791ae494ab2..3b12701b3d9 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js @@ -103,14 +103,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js index d93ddf8b3a4..f965d18e2ce 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js @@ -105,14 +105,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.js b/tests/baselines/reference/assignmentCompatWithStringIndexer.js index ef6befe268e..8d081c90794 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.js @@ -82,7 +82,7 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -93,7 +93,7 @@ var Generics; var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A)); diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index 8a3b4b35d0b..ab3f80eff21 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -118,8 +118,9 @@ value; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.call(this); + var _this = _super.call(this) || this; _super.prototype. = value; + return _this; } Derived.prototype.foo = function () { _super.prototype. = value; }; Derived.sfoo = function () { _super. = value; }; diff --git a/tests/baselines/reference/assignmentToObjectAndFunction.js b/tests/baselines/reference/assignmentToObjectAndFunction.js index a3c4785b18b..d60e2de4a5a 100644 --- a/tests/baselines/reference/assignmentToObjectAndFunction.js +++ b/tests/baselines/reference/assignmentToObjectAndFunction.js @@ -38,20 +38,17 @@ var goodObj = { }; // Ok, because toString is a subtype of Object's toString var errFun = {}; // Error for no call signature function foo() { } -var foo; (function (foo) { foo.boom = 0; })(foo || (foo = {})); var goodFundule = foo; // ok function bar() { } -var bar; (function (bar) { function apply(thisArg, argArray) { } bar.apply = apply; })(bar || (bar = {})); var goodFundule2 = bar; // ok function bad() { } -var bad; (function (bad) { bad.apply = 0; })(bad || (bad = {})); diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5.js index 0e6e8d51501..76ffbc833aa 100644 --- a/tests/baselines/reference/asyncImportedPromise_es5.js +++ b/tests/baselines/reference/asyncImportedPromise_es5.js @@ -19,7 +19,7 @@ var __extends = (this && this.__extends) || function (d, b) { var Task = (function (_super) { __extends(Task, _super); function Task() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Task; }(Promise)); diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5.js b/tests/baselines/reference/asyncMethodWithSuper_es5.js index 21683eed637..9ceff6bab4e 100644 --- a/tests/baselines/reference/asyncMethodWithSuper_es5.js +++ b/tests/baselines/reference/asyncMethodWithSuper_es5.js @@ -61,7 +61,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } // async method with only call/get on 'super' does not require a binding B.prototype.simple = function () { diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5.js b/tests/baselines/reference/asyncQualifiedReturnType_es5.js index 19de38325e2..dd54f6ee833 100644 --- a/tests/baselines/reference/asyncQualifiedReturnType_es5.js +++ b/tests/baselines/reference/asyncQualifiedReturnType_es5.js @@ -13,7 +13,7 @@ var X; var MyPromise = (function (_super) { __extends(MyPromise, _super); function MyPromise() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyPromise; }(Promise)); diff --git a/tests/baselines/reference/augmentExportEquals3.js b/tests/baselines/reference/augmentExportEquals3.js index 82cfa5f2166..94cb0f8ce95 100644 --- a/tests/baselines/reference/augmentExportEquals3.js +++ b/tests/baselines/reference/augmentExportEquals3.js @@ -28,7 +28,6 @@ let b = x.b; define(["require", "exports"], function (require, exports) { "use strict"; function foo() { } - var foo; (function (foo) { foo.v = 1; })(foo || (foo = {})); diff --git a/tests/baselines/reference/augmentExportEquals4.js b/tests/baselines/reference/augmentExportEquals4.js index ee0fc1892c2..ff0cbd44e0b 100644 --- a/tests/baselines/reference/augmentExportEquals4.js +++ b/tests/baselines/reference/augmentExportEquals4.js @@ -32,7 +32,6 @@ define(["require", "exports"], function (require, exports) { } return foo; }()); - var foo; (function (foo) { foo.v = 1; })(foo || (foo = {})); diff --git a/tests/baselines/reference/augmentExportEquals6.js b/tests/baselines/reference/augmentExportEquals6.js index 94dfa389c6d..3f9cbbb0af8 100644 --- a/tests/baselines/reference/augmentExportEquals6.js +++ b/tests/baselines/reference/augmentExportEquals6.js @@ -36,7 +36,6 @@ define(["require", "exports"], function (require, exports) { } return foo; }()); - var foo; (function (foo) { var A = (function () { function A() { diff --git a/tests/baselines/reference/augmentedTypesClass.js b/tests/baselines/reference/augmentedTypesClass.js index 48cc4ef05de..b9c263971b3 100644 --- a/tests/baselines/reference/augmentedTypesClass.js +++ b/tests/baselines/reference/augmentedTypesClass.js @@ -23,7 +23,6 @@ var c4 = (function () { c4.prototype.foo = function () { }; return c4; }()); -var c4; (function (c4) { c4[c4["One"] = 0] = "One"; })(c4 || (c4 = {})); // error diff --git a/tests/baselines/reference/augmentedTypesClass2.js b/tests/baselines/reference/augmentedTypesClass2.js index ee87a2396ad..0896a03a925 100644 --- a/tests/baselines/reference/augmentedTypesClass2.js +++ b/tests/baselines/reference/augmentedTypesClass2.js @@ -51,7 +51,6 @@ var c33 = (function () { }; return c33; }()); -var c33; (function (c33) { c33[c33["One"] = 0] = "One"; })(c33 || (c33 = {})); diff --git a/tests/baselines/reference/augmentedTypesClass3.js b/tests/baselines/reference/augmentedTypesClass3.js index 216cd118ee6..3a4877707c6 100644 --- a/tests/baselines/reference/augmentedTypesClass3.js +++ b/tests/baselines/reference/augmentedTypesClass3.js @@ -27,7 +27,6 @@ var c5a = (function () { c5a.prototype.foo = function () { }; return c5a; }()); -var c5a; (function (c5a) { var y = 2; })(c5a || (c5a = {})); // should be ok @@ -37,7 +36,6 @@ var c5b = (function () { c5b.prototype.foo = function () { }; return c5b; }()); -var c5b; (function (c5b) { c5b.y = 2; })(c5b || (c5b = {})); // should be ok diff --git a/tests/baselines/reference/augmentedTypesEnum.js b/tests/baselines/reference/augmentedTypesEnum.js index 3d2bb0b7d25..406c1a3bf69 100644 --- a/tests/baselines/reference/augmentedTypesEnum.js +++ b/tests/baselines/reference/augmentedTypesEnum.js @@ -69,7 +69,6 @@ var e5; (function (e5) { e5[e5["One"] = 0] = "One"; })(e5 || (e5 = {})); -var e5; (function (e5) { e5[e5["Two"] = 0] = "Two"; })(e5 || (e5 = {})); // error @@ -77,7 +76,6 @@ var e5a; (function (e5a) { e5a[e5a["One"] = 0] = "One"; })(e5a || (e5a = {})); // error -var e5a; (function (e5a) { e5a[e5a["One"] = 0] = "One"; })(e5a || (e5a = {})); // error @@ -90,7 +88,6 @@ var e6a; (function (e6a) { e6a[e6a["One"] = 0] = "One"; })(e6a || (e6a = {})); -var e6a; (function (e6a) { var y = 2; })(e6a || (e6a = {})); // should be error @@ -98,7 +95,6 @@ var e6b; (function (e6b) { e6b[e6b["One"] = 0] = "One"; })(e6b || (e6b = {})); -var e6b; (function (e6b) { e6b.y = 2; })(e6b || (e6b = {})); // should be error diff --git a/tests/baselines/reference/augmentedTypesEnum3.js b/tests/baselines/reference/augmentedTypesEnum3.js index e0d8b51cf72..4df9dada530 100644 --- a/tests/baselines/reference/augmentedTypesEnum3.js +++ b/tests/baselines/reference/augmentedTypesEnum3.js @@ -25,13 +25,11 @@ var E; (function (E) { var t; })(E || (E = {})); -var E; (function (E) { })(E || (E = {})); var F; (function (F) { })(F || (F = {})); -var F; (function (F) { var t; })(F || (F = {})); @@ -39,15 +37,12 @@ var A; (function (A) { var o; })(A || (A = {})); -var A; (function (A) { A[A["b"] = 0] = "b"; })(A || (A = {})); -var A; (function (A) { A[A["c"] = 0] = "c"; })(A || (A = {})); -var A; (function (A) { var p; })(A || (A = {})); diff --git a/tests/baselines/reference/augmentedTypesFunction.js b/tests/baselines/reference/augmentedTypesFunction.js index 72f36aeeccc..95f91a938d7 100644 --- a/tests/baselines/reference/augmentedTypesFunction.js +++ b/tests/baselines/reference/augmentedTypesFunction.js @@ -63,19 +63,16 @@ var y3a = (function () { }()); // error // function then enum function y4() { } // error -var y4; (function (y4) { y4[y4["One"] = 0] = "One"; })(y4 || (y4 = {})); // error // function then internal module function y5() { } function y5a() { } -var y5a; (function (y5a) { var y = 2; })(y5a || (y5a = {})); // should be an error function y5b() { } -var y5b; (function (y5b) { y5b.y = 3; })(y5b || (y5b = {})); // should be an error diff --git a/tests/baselines/reference/augmentedTypesModules.js b/tests/baselines/reference/augmentedTypesModules.js index 39a4c17454b..61dd64174d9 100644 --- a/tests/baselines/reference/augmentedTypesModules.js +++ b/tests/baselines/reference/augmentedTypesModules.js @@ -138,7 +138,6 @@ function m2b() { } // should be errors to have function first function m2c() { } ; -var m2c; (function (m2c) { m2c.y = 2; })(m2c || (m2c = {})); @@ -146,7 +145,6 @@ function m2f() { } ; function m2g() { } ; -var m2g; (function (m2g) { var C = (function () { function C() { @@ -177,7 +175,6 @@ var m3b = (function () { m3b.prototype.foo = function () { }; return m3b; }()); -var m3b; (function (m3b) { var y = 2; })(m3b || (m3b = {})); @@ -187,7 +184,6 @@ var m3c = (function () { m3c.prototype.foo = function () { }; return m3c; }()); -var m3c; (function (m3c) { m3c.y = 2; })(m3c || (m3c = {})); @@ -216,7 +212,6 @@ var m4a; (function (m4a) { var y = 2; })(m4a || (m4a = {})); -var m4a; (function (m4a) { m4a[m4a["One"] = 0] = "One"; })(m4a || (m4a = {})); @@ -224,7 +219,6 @@ var m4b; (function (m4b) { m4b.y = 2; })(m4b || (m4b = {})); -var m4b; (function (m4b) { m4b[m4b["One"] = 0] = "One"; })(m4b || (m4b = {})); @@ -241,7 +235,6 @@ var m4d; return C; }()); })(m4d || (m4d = {})); -var m4d; (function (m4d) { m4d[m4d["One"] = 0] = "One"; })(m4d || (m4d = {})); diff --git a/tests/baselines/reference/augmentedTypesModules2.js b/tests/baselines/reference/augmentedTypesModules2.js index 82bba357bba..9f7d3613d57 100644 --- a/tests/baselines/reference/augmentedTypesModules2.js +++ b/tests/baselines/reference/augmentedTypesModules2.js @@ -45,7 +45,6 @@ function m2b() { } ; // error since the module is instantiated function m2c() { } ; -var m2c; (function (m2c) { m2c.y = 2; })(m2c || (m2c = {})); @@ -59,7 +58,6 @@ function m2f() { } ; function m2g() { } ; -var m2g; (function (m2g) { var C = (function () { function C() { diff --git a/tests/baselines/reference/augmentedTypesModules3b.js b/tests/baselines/reference/augmentedTypesModules3b.js index a422ad79973..02da7b41f2e 100644 --- a/tests/baselines/reference/augmentedTypesModules3b.js +++ b/tests/baselines/reference/augmentedTypesModules3b.js @@ -25,7 +25,6 @@ var m3b = (function () { m3b.prototype.foo = function () { }; return m3b; }()); -var m3b; (function (m3b) { var y = 2; })(m3b || (m3b = {})); @@ -35,7 +34,6 @@ var m3c = (function () { m3c.prototype.foo = function () { }; return m3c; }()); -var m3c; (function (m3c) { m3c.y = 2; })(m3c || (m3c = {})); diff --git a/tests/baselines/reference/augmentedTypesModules4.js b/tests/baselines/reference/augmentedTypesModules4.js index ed86c057462..5db6c42d707 100644 --- a/tests/baselines/reference/augmentedTypesModules4.js +++ b/tests/baselines/reference/augmentedTypesModules4.js @@ -30,7 +30,6 @@ var m4a; (function (m4a) { var y = 2; })(m4a || (m4a = {})); -var m4a; (function (m4a) { m4a[m4a["One"] = 0] = "One"; })(m4a || (m4a = {})); @@ -38,7 +37,6 @@ var m4b; (function (m4b) { m4b.y = 2; })(m4b || (m4b = {})); -var m4b; (function (m4b) { m4b[m4b["One"] = 0] = "One"; })(m4b || (m4b = {})); @@ -55,7 +53,6 @@ var m4d; return C; }()); })(m4d || (m4d = {})); -var m4d; (function (m4d) { m4d[m4d["One"] = 0] = "One"; })(m4d || (m4d = {})); diff --git a/tests/baselines/reference/autolift4.js b/tests/baselines/reference/autolift4.js index e6790021f63..1c29bfeeff7 100644 --- a/tests/baselines/reference/autolift4.js +++ b/tests/baselines/reference/autolift4.js @@ -43,8 +43,9 @@ Point.origin = new Point(0, 0); var Point3D = (function (_super) { __extends(Point3D, _super); function Point3D(x, y, z, m) { - _super.call(this, x, y); - this.z = z; + var _this = _super.call(this, x, y) || this; + _this.z = z; + return _this; } Point3D.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.m); diff --git a/tests/baselines/reference/autonumberingInEnums.js b/tests/baselines/reference/autonumberingInEnums.js index e6bf29bda8f..218b10ae44c 100644 --- a/tests/baselines/reference/autonumberingInEnums.js +++ b/tests/baselines/reference/autonumberingInEnums.js @@ -12,7 +12,6 @@ var Foo; (function (Foo) { Foo[Foo["a"] = 1] = "a"; })(Foo || (Foo = {})); -var Foo; (function (Foo) { Foo[Foo["b"] = 0] = "b"; // should work fine })(Foo || (Foo = {})); diff --git a/tests/baselines/reference/awaitClassExpression_es5.js b/tests/baselines/reference/awaitClassExpression_es5.js index 9123f5f2ea8..b207ba08f8d 100644 --- a/tests/baselines/reference/awaitClassExpression_es5.js +++ b/tests/baselines/reference/awaitClassExpression_es5.js @@ -17,7 +17,7 @@ function func() { _a = function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }; diff --git a/tests/baselines/reference/baseCheck.js b/tests/baselines/reference/baseCheck.js index c4210f3f6a5..870f811c09f 100644 --- a/tests/baselines/reference/baseCheck.js +++ b/tests/baselines/reference/baseCheck.js @@ -43,14 +43,14 @@ var C = (function () { var ELoc = (function (_super) { __extends(ELoc, _super); function ELoc(x) { - _super.call(this, 0, x); + return _super.call(this, 0, x) || this; } return ELoc; }(C)); var ELocVar = (function (_super) { __extends(ELocVar, _super); function ELocVar(x) { - _super.call(this, 0, loc); + return _super.call(this, 0, loc) || this; } ELocVar.prototype.m = function () { var loc = 10; @@ -60,24 +60,27 @@ var ELocVar = (function (_super) { var D = (function (_super) { __extends(D, _super); function D(z) { - _super.call(this, this.z); - this.z = z; + var _this = _super.call(this, _this.z) || this; + _this.z = z; + return _this; } return D; }(C)); // too few params var E = (function (_super) { __extends(E, _super); function E(z) { - _super.call(this, 0, this.z); - this.z = z; + var _this = _super.call(this, 0, _this.z) || this; + _this.z = z; + return _this; } return E; }(C)); var F = (function (_super) { __extends(F, _super); function F(z) { - _super.call(this, "hello", this.z); - this.z = z; + var _this = _super.call(this, "hello", _this.z) || this; + _this.z = z; + return _this; } return F; }(C)); // first param type diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js index 3f3fa3cc0b9..7e922cf83b2 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.js +++ b/tests/baselines/reference/baseIndexSignatureResolution.js @@ -38,7 +38,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/baseTypeOrderChecking.js b/tests/baselines/reference/baseTypeOrderChecking.js index 66d2135f01d..ec96b80a999 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.js +++ b/tests/baselines/reference/baseTypeOrderChecking.js @@ -51,7 +51,7 @@ var Class1 = (function () { var Class2 = (function (_super) { __extends(Class2, _super); function Class2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Class2; }(Class1)); @@ -63,7 +63,7 @@ var Class3 = (function () { var Class4 = (function (_super) { __extends(Class4, _super); function Class4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Class4; }(Class3)); diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js index dc52eeeaee6..5f8dcbd0e10 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -41,7 +41,7 @@ var CBaseBase = (function () { var CBase = (function (_super) { __extends(CBase, _super); function CBase() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return CBase; }(CBaseBase)); @@ -59,7 +59,7 @@ var Wrapper = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.works = function () { new CBaseBase(this); diff --git a/tests/baselines/reference/bases.js b/tests/baselines/reference/bases.js index f67f754d063..6b73eb9556b 100644 --- a/tests/baselines/reference/bases.js +++ b/tests/baselines/reference/bases.js @@ -36,8 +36,10 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - this.x; + var _this; + _this.x; any; + return _this; } return C; }(B)); diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js index 1c2fc896a6a..6d0f19dd37d 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js @@ -44,14 +44,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js index 21a69f517fc..2e2d0bcb1e2 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js @@ -40,14 +40,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js index e38ce2854bd..928909f4c38 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -46,7 +46,7 @@ var E = (function () { var F = (function (_super) { __extends(F, _super); function F() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return F; }(C)); @@ -59,8 +59,9 @@ var C1 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); - this.i = "bar"; + var _this = _super.apply(this, arguments) || this; + _this.i = "bar"; + return _this; } return D1; }(C1)); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js index 6b3bf8e125e..0ae7648c7f9 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js @@ -84,21 +84,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js index a823047fc0d..7a7791280ad 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js @@ -131,21 +131,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js index b60cf2014f1..19d66ce8d46 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js @@ -64,21 +64,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js index 434af36123e..1c53de5d26e 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js @@ -64,21 +64,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js index 9776d14612e..c42e36389ca 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js @@ -67,21 +67,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js index baa7f6c2c95..caba9d7ef6e 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js @@ -204,7 +204,6 @@ function foo12() { } var r12 = foo12(); function m1() { return 1; } -var m1; (function (m1) { m1.y = 2; })(m1 || (m1 = {})); @@ -217,7 +216,6 @@ var c1 = (function () { } return c1; }()); -var c1; (function (c1) { c1.x = 1; })(c1 || (c1 = {})); @@ -229,7 +227,6 @@ var e1; (function (e1) { e1[e1["A"] = 0] = "A"; })(e1 || (e1 = {})); -var e1; (function (e1) { e1.y = 1; })(e1 || (e1 = {})); diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index e89e9d9345b..161eb36dbcf 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -99,8 +99,9 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this, 1, 2); - _super.apply(this, [1, 2].concat(a)); + var _this = _super.call(this, 1, 2) || this; + _this = _super.apply(this, [1, 2].concat(a)) || this; + return _this; } D.prototype.foo = function () { _super.prototype.foo.call(this, 1, 2); diff --git a/tests/baselines/reference/captureThisInSuperCall.js b/tests/baselines/reference/captureThisInSuperCall.js index 791b6f4c979..2c4df5db961 100644 --- a/tests/baselines/reference/captureThisInSuperCall.js +++ b/tests/baselines/reference/captureThisInSuperCall.js @@ -22,8 +22,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - var _this = this; - _super.call(this, { test: function () { return _this.someMethod(); } }); + return _super.call(this, { test: function () { return _this.someMethod(); } }) || this; } B.prototype.someMethod = function () { }; return B; diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index bcff0938157..f0178dcbbf0 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -59,7 +59,7 @@ var D = (function () { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E; }(A)); @@ -67,7 +67,7 @@ var E = (function (_super) { var F = (function (_super) { __extends(F, _super); function F() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return F; }(A)); diff --git a/tests/baselines/reference/chainedAssignment3.js b/tests/baselines/reference/chainedAssignment3.js index b4b6330a7cf..3857867043c 100644 --- a/tests/baselines/reference/chainedAssignment3.js +++ b/tests/baselines/reference/chainedAssignment3.js @@ -36,7 +36,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js index c53910e00ac..26d341e1f6a 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js @@ -42,14 +42,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/checkForObjectTooStrict.js b/tests/baselines/reference/checkForObjectTooStrict.js index cdc19a5688d..ade99e9319b 100644 --- a/tests/baselines/reference/checkForObjectTooStrict.js +++ b/tests/baselines/reference/checkForObjectTooStrict.js @@ -49,14 +49,14 @@ var Foo; var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.call(this); + return _super.call(this) || this; } return Bar; }(Foo.Object)); var Baz = (function (_super) { __extends(Baz, _super); function Baz() { - _super.call(this); + return _super.call(this) || this; } return Baz; }(Object)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js index cfb5726dac1..8ced6fce500 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js @@ -24,10 +24,11 @@ var Based = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.call(this); - this; - this.x = 10; - var that = this; + var _this = _super.call(this) || this; + _this; + _this.x = 10; + var that = _this; + return _this; } return Derived; }(Based)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js index afbc15cf912..95b34f27b68 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js @@ -24,10 +24,12 @@ var Based = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - this.x = 100; - _super.call(this); - this.x = 10; - var that = this; + var _this; + _this.x = 100; + _this = _super.call(this) || this; + _this.x = 10; + var that = _this; + return _this; } return Derived; }(Based)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js index 7e9c23c1f83..0e882f71fdb 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js @@ -29,15 +29,17 @@ var Based = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { + var _this; var innver = (function () { function innver() { this.y = true; } return innver; }()); - _super.call(this); - this.x = 10; - var that = this; + _this = _super.call(this) || this; + _this.x = 10; + var that = _this; + return _this; } return Derived; }(Based)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js index 1257b446ccb..00f2ed22fbf 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js @@ -33,7 +33,7 @@ var Based = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this = this; + var _this; (function () { _this; // No error }); @@ -43,10 +43,11 @@ var Derived = (function (_super) { (function () { _this; // No error })(); - _super.call(this); - _super.call(this); - this.x = 10; - var that = this; + _this = _super.call(this) || this; + _this = _super.call(this) || this; + _this.x = 10; + var that = _this; + return _this; } return Derived; }(Based)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js index 1889ee998ca..8c7f18b77f6 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js @@ -25,7 +25,7 @@ var Based = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.call(this, this.x); + return _super.call(this, this.x) || this; } return Derived; }(Based)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js index 39db4dec174..cc8912230ab 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js @@ -28,9 +28,10 @@ var Base = (function () { var Super = (function (_super) { __extends(Super, _super); function Super() { - var _this = this; + var _this; (function () { return _this; }); // No Error - _super.call(this); + _this = _super.call(this) || this; + return _this; } return Super; }(Base)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js index d071c05db5d..ca12c16e047 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js @@ -23,8 +23,7 @@ var Base = (function () { var Super = (function (_super) { __extends(Super, _super); function Super() { - var _this = this; - _super.call(this, (function () { return _this; })); // No error + return _super.call(this, (function () { return _this; })) || this; } return Super; }(Base)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js index f334cc7f42b..25a480b9b57 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js @@ -28,8 +28,10 @@ var Base = (function () { var Super = (function (_super) { __extends(Super, _super); function Super() { - var that = this; - _super.call(this); + var _this; + var that = _this; + _this = _super.call(this) || this; + return _this; } return Super; }(Base)); diff --git a/tests/baselines/reference/circularImportAlias.js b/tests/baselines/reference/circularImportAlias.js index 19c156176bf..6fe5e604e57 100644 --- a/tests/baselines/reference/circularImportAlias.js +++ b/tests/baselines/reference/circularImportAlias.js @@ -32,7 +32,7 @@ var B; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(B.a.C)); diff --git a/tests/baselines/reference/circularTypeofWithFunctionModule.js b/tests/baselines/reference/circularTypeofWithFunctionModule.js index 6ce1dd62fc5..1c38b9625e3 100644 --- a/tests/baselines/reference/circularTypeofWithFunctionModule.js +++ b/tests/baselines/reference/circularTypeofWithFunctionModule.js @@ -27,12 +27,11 @@ var Foo = (function () { function maker(value) { return maker.Bar; } -var maker; (function (maker) { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar; }(Foo)); diff --git a/tests/baselines/reference/classAbstractConstructorAssignability.js b/tests/baselines/reference/classAbstractConstructorAssignability.js index 5695e6c79d3..35d9e75884f 100644 --- a/tests/baselines/reference/classAbstractConstructorAssignability.js +++ b/tests/baselines/reference/classAbstractConstructorAssignability.js @@ -28,14 +28,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/classAbstractCrashedOnce.js b/tests/baselines/reference/classAbstractCrashedOnce.js index 46f0a8938c4..fe23e60c94f 100644 --- a/tests/baselines/reference/classAbstractCrashedOnce.js +++ b/tests/baselines/reference/classAbstractCrashedOnce.js @@ -24,7 +24,7 @@ var foo = (function () { var bar = (function (_super) { __extends(bar, _super); function bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } bar.prototype.test = function () { this. diff --git a/tests/baselines/reference/classAbstractExtends.js b/tests/baselines/reference/classAbstractExtends.js index 8d7128cc03d..e899cb82d6d 100644 --- a/tests/baselines/reference/classAbstractExtends.js +++ b/tests/baselines/reference/classAbstractExtends.js @@ -31,28 +31,28 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B)); var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(B)); var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } E.prototype.bar = function () { }; return E; diff --git a/tests/baselines/reference/classAbstractFactoryFunction.js b/tests/baselines/reference/classAbstractFactoryFunction.js index d5b0417f995..50e232a9fca 100644 --- a/tests/baselines/reference/classAbstractFactoryFunction.js +++ b/tests/baselines/reference/classAbstractFactoryFunction.js @@ -31,7 +31,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/classAbstractGeneric.js b/tests/baselines/reference/classAbstractGeneric.js index c9409e97466..96df8f5f19e 100644 --- a/tests/baselines/reference/classAbstractGeneric.js +++ b/tests/baselines/reference/classAbstractGeneric.js @@ -39,28 +39,28 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); // error -- inherits abstract methods var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(A)); // error -- inherits abstract methods var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } E.prototype.foo = function () { return this.t; }; return E; @@ -68,7 +68,7 @@ var E = (function (_super) { var F = (function (_super) { __extends(F, _super); function F() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } F.prototype.bar = function (t) { }; return F; @@ -76,7 +76,7 @@ var F = (function (_super) { var G = (function (_super) { __extends(G, _super); function G() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } G.prototype.foo = function () { return this.t; }; G.prototype.bar = function (t) { }; diff --git a/tests/baselines/reference/classAbstractInAModule.js b/tests/baselines/reference/classAbstractInAModule.js index 17fbf568601..c6a9e206bcc 100644 --- a/tests/baselines/reference/classAbstractInAModule.js +++ b/tests/baselines/reference/classAbstractInAModule.js @@ -24,7 +24,7 @@ var M; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/classAbstractInheritance.js b/tests/baselines/reference/classAbstractInheritance.js index 4d5c804e557..297a80dd99c 100644 --- a/tests/baselines/reference/classAbstractInheritance.js +++ b/tests/baselines/reference/classAbstractInheritance.js @@ -35,14 +35,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); @@ -54,42 +54,42 @@ var AA = (function () { var BB = (function (_super) { __extends(BB, _super); function BB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return BB; }(AA)); var CC = (function (_super) { __extends(CC, _super); function CC() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return CC; }(AA)); var DD = (function (_super) { __extends(DD, _super); function DD() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return DD; }(BB)); var EE = (function (_super) { __extends(EE, _super); function EE() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return EE; }(BB)); var FF = (function (_super) { __extends(FF, _super); function FF() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return FF; }(CC)); var GG = (function (_super) { __extends(GG, _super); function GG() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return GG; }(CC)); diff --git a/tests/baselines/reference/classAbstractInstantiations1.js b/tests/baselines/reference/classAbstractInstantiations1.js index 0263e9e97b3..5abbb9c1baa 100644 --- a/tests/baselines/reference/classAbstractInstantiations1.js +++ b/tests/baselines/reference/classAbstractInstantiations1.js @@ -41,14 +41,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/classAbstractInstantiations2.js b/tests/baselines/reference/classAbstractInstantiations2.js index 379e0b18ccc..dea4c744ae0 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.js +++ b/tests/baselines/reference/classAbstractInstantiations2.js @@ -82,21 +82,21 @@ new x; // okay -- undefined behavior at runtime var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B)); // error -- not declared abstract var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(B)); // okay var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } E.prototype.bar = function () { return 1; }; return E; @@ -104,7 +104,7 @@ var E = (function (_super) { var F = (function (_super) { __extends(F, _super); function F() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } F.prototype.bar = function () { return 2; }; return F; diff --git a/tests/baselines/reference/classAbstractOverrideWithAbstract.js b/tests/baselines/reference/classAbstractOverrideWithAbstract.js index d613dd1fe31..4ecebdf7b32 100644 --- a/tests/baselines/reference/classAbstractOverrideWithAbstract.js +++ b/tests/baselines/reference/classAbstractOverrideWithAbstract.js @@ -38,7 +38,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -51,7 +51,7 @@ var AA = (function () { var BB = (function (_super) { __extends(BB, _super); function BB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } BB.prototype.bar = function () { }; return BB; @@ -59,14 +59,14 @@ var BB = (function (_super) { var CC = (function (_super) { __extends(CC, _super); function CC() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return CC; }(BB)); // error var DD = (function (_super) { __extends(DD, _super); function DD() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } DD.prototype.foo = function () { }; return DD; diff --git a/tests/baselines/reference/classAbstractSuperCalls.js b/tests/baselines/reference/classAbstractSuperCalls.js index 7ada903974c..0197f48a429 100644 --- a/tests/baselines/reference/classAbstractSuperCalls.js +++ b/tests/baselines/reference/classAbstractSuperCalls.js @@ -42,7 +42,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.bar = function () { _super.prototype.foo.call(this); }; B.prototype.baz = function () { return this.foo; }; @@ -51,7 +51,7 @@ var B = (function (_super) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.foo = function () { return 2; }; C.prototype.qux = function () { return _super.prototype.foo.call(this) || _super.prototype.foo; }; // 2 errors, foo is abstract @@ -68,7 +68,7 @@ var AA = (function () { var BB = (function (_super) { __extends(BB, _super); function BB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return BB; }(AA)); diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js index 457195f5449..74b5d62aaf5 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js @@ -31,7 +31,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.foo = function () { return 1; }; return B; @@ -39,7 +39,7 @@ var B = (function (_super) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js index dc025b11dde..25cf1a307c7 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js @@ -41,21 +41,21 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.foo = function () { }; return D; @@ -63,7 +63,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } E.prototype.foo = function () { }; return E; @@ -76,21 +76,21 @@ var AA = (function () { var BB = (function (_super) { __extends(BB, _super); function BB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return BB; }(AA)); var CC = (function (_super) { __extends(CC, _super); function CC() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return CC; }(AA)); var DD = (function (_super) { __extends(DD, _super); function DD() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } DD.prototype.foo = function () { }; return DD; diff --git a/tests/baselines/reference/classConstructorAccessibility2.js b/tests/baselines/reference/classConstructorAccessibility2.js index 03b7af3e716..ef637611e8d 100644 --- a/tests/baselines/reference/classConstructorAccessibility2.js +++ b/tests/baselines/reference/classConstructorAccessibility2.js @@ -77,8 +77,9 @@ var BaseC = (function () { var DerivedA = (function (_super) { __extends(DerivedA, _super); function DerivedA(x) { - _super.call(this, x); - this.x = x; + var _this = _super.call(this, x) || this; + _this.x = x; + return _this; } DerivedA.prototype.createInstance = function () { new DerivedA(5); }; DerivedA.prototype.createBaseInstance = function () { new BaseA(6); }; @@ -88,8 +89,9 @@ var DerivedA = (function (_super) { var DerivedB = (function (_super) { __extends(DerivedB, _super); function DerivedB(x) { - _super.call(this, x); - this.x = x; + var _this = _super.call(this, x) || this; + _this.x = x; + return _this; } DerivedB.prototype.createInstance = function () { new DerivedB(7); }; DerivedB.prototype.createBaseInstance = function () { new BaseB(8); }; // ok @@ -99,8 +101,9 @@ var DerivedB = (function (_super) { var DerivedC = (function (_super) { __extends(DerivedC, _super); function DerivedC(x) { - _super.call(this, x); - this.x = x; + var _this = _super.call(this, x) || this; + _this.x = x; + return _this; } DerivedC.prototype.createInstance = function () { new DerivedC(9); }; DerivedC.prototype.createBaseInstance = function () { new BaseC(10); }; // error diff --git a/tests/baselines/reference/classConstructorAccessibility4.js b/tests/baselines/reference/classConstructorAccessibility4.js index 6342facae21..4772ac68d11 100644 --- a/tests/baselines/reference/classConstructorAccessibility4.js +++ b/tests/baselines/reference/classConstructorAccessibility4.js @@ -51,7 +51,7 @@ var A = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); @@ -73,7 +73,7 @@ var D = (function () { var F = (function (_super) { __extends(F, _super); function F() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return F; }(D)); diff --git a/tests/baselines/reference/classConstructorAccessibility5.js b/tests/baselines/reference/classConstructorAccessibility5.js index ec9e9f83a8e..d658349c2a5 100644 --- a/tests/baselines/reference/classConstructorAccessibility5.js +++ b/tests/baselines/reference/classConstructorAccessibility5.js @@ -25,7 +25,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived.make = function () { new Base(); }; // ok return Derived; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility.js b/tests/baselines/reference/classConstructorParametersAccessibility.js index c31fd8bf9dd..e0e75bcfeeb 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility.js @@ -59,8 +59,9 @@ c3.p; // protected, error var Derived = (function (_super) { __extends(Derived, _super); function Derived(p) { - _super.call(this, p); - this.p; // OK + var _this = _super.call(this, p) || this; + _this.p; // OK + return _this; } return Derived; }(C3)); diff --git a/tests/baselines/reference/classConstructorParametersAccessibility2.js b/tests/baselines/reference/classConstructorParametersAccessibility2.js index 7f52a6a581f..84da66c3e3c 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility2.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility2.js @@ -59,8 +59,9 @@ c3.p; // protected, error var Derived = (function (_super) { __extends(Derived, _super); function Derived(p) { - _super.call(this, p); - this.p; // OK + var _this = _super.call(this, p) || this; + _this.p; // OK + return _this; } return Derived; }(C3)); diff --git a/tests/baselines/reference/classConstructorParametersAccessibility3.js b/tests/baselines/reference/classConstructorParametersAccessibility3.js index 0da9449a3a7..db9f94cf0fb 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility3.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility3.js @@ -28,9 +28,10 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived(p) { - _super.call(this, p); - this.p = p; - this.p; // OK + var _this = _super.call(this, p) || this; + _this.p = p; + _this.p; // OK + return _this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js index 7ab6cb2ceca..5a5440a92b5 100644 --- a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js +++ b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js @@ -25,17 +25,15 @@ var M; return N; }()); M.N = N; - var N; (function (N) { N.v = 0; })(N = M.N || (M.N = {})); })(M || (M = {})); -var M; (function (M) { var O = (function (_super) { __extends(O, _super); function O() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return O; }(M.N)); diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js index 5a455edc082..076412e164d 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js @@ -31,7 +31,7 @@ var StringTreeCollectionBase = (function () { var StringTreeCollection = (function (_super) { __extends(StringTreeCollection, _super); function StringTreeCollection() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return StringTreeCollection; }(StringTreeCollectionBase)); diff --git a/tests/baselines/reference/classExpression2.js b/tests/baselines/reference/classExpression2.js index ed9497c8729..59b62c60cfe 100644 --- a/tests/baselines/reference/classExpression2.js +++ b/tests/baselines/reference/classExpression2.js @@ -16,7 +16,7 @@ var D = (function () { var v = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(D)); diff --git a/tests/baselines/reference/classExpression3.js b/tests/baselines/reference/classExpression3.js index 508dc039387..c0376c54c27 100644 --- a/tests/baselines/reference/classExpression3.js +++ b/tests/baselines/reference/classExpression3.js @@ -15,15 +15,17 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(class_1, _super); function class_1() { - _super.apply(this, arguments); - this.c = 3; + var _this = _super.apply(this, arguments) || this; + _this.c = 3; + return _this; } return class_1; }((function (_super) { __extends(class_2, _super); function class_2() { - _super.apply(this, arguments); - this.b = 2; + var _this = _super.apply(this, arguments) || this; + _this.b = 2; + return _this; } return class_2; }((function () { diff --git a/tests/baselines/reference/classExpressionExtendingAbstractClass.js b/tests/baselines/reference/classExpressionExtendingAbstractClass.js index c4da02cb321..7312ab6567d 100644 --- a/tests/baselines/reference/classExpressionExtendingAbstractClass.js +++ b/tests/baselines/reference/classExpressionExtendingAbstractClass.js @@ -22,7 +22,7 @@ var A = (function () { var C = (function (_super) { __extends(class_1, _super); function class_1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class_1; }(A)); diff --git a/tests/baselines/reference/classExtendingBuiltinType.js b/tests/baselines/reference/classExtendingBuiltinType.js index ace4cf19fee..4c95e3008ea 100644 --- a/tests/baselines/reference/classExtendingBuiltinType.js +++ b/tests/baselines/reference/classExtendingBuiltinType.js @@ -20,70 +20,70 @@ var __extends = (this && this.__extends) || function (d, b) { var C1 = (function (_super) { __extends(C1, _super); function C1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C1; }(Object)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(Function)); var C3 = (function (_super) { __extends(C3, _super); function C3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C3; }(String)); var C4 = (function (_super) { __extends(C4, _super); function C4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C4; }(Boolean)); var C5 = (function (_super) { __extends(C5, _super); function C5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C5; }(Number)); var C6 = (function (_super) { __extends(C6, _super); function C6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C6; }(Date)); var C7 = (function (_super) { __extends(C7, _super); function C7() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C7; }(RegExp)); var C8 = (function (_super) { __extends(C8, _super); function C8() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C8; }(Error)); var C9 = (function (_super) { __extends(C9, _super); function C9() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C9; }(Array)); var C10 = (function (_super) { __extends(C10, _super); function C10() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C10; }(Array)); diff --git a/tests/baselines/reference/classExtendingClass.js b/tests/baselines/reference/classExtendingClass.js index 8073271b5ea..91e3752980c 100644 --- a/tests/baselines/reference/classExtendingClass.js +++ b/tests/baselines/reference/classExtendingClass.js @@ -47,7 +47,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); @@ -66,7 +66,7 @@ var C2 = (function () { var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(C2)); diff --git a/tests/baselines/reference/classExtendingClassLikeType.js b/tests/baselines/reference/classExtendingClassLikeType.js index a41bb14451a..bfc10c23563 100644 --- a/tests/baselines/reference/classExtendingClassLikeType.js +++ b/tests/baselines/reference/classExtendingClassLikeType.js @@ -68,35 +68,38 @@ var __extends = (this && this.__extends) || function (d, b) { var D0 = (function (_super) { __extends(D0, _super); function D0() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D0; }(Base)); var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.call(this, "abc", "def"); - this.x = "x"; - this.y = "y"; + var _this = _super.call(this, "abc", "def") || this; + _this.x = "x"; + _this.y = "y"; + return _this; } return D1; }(getBase())); var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.call(this, 10); - _super.call(this, 10, 20); - this.x = 1; - this.y = 2; + var _this = _super.call(this, 10) || this; + _this = _super.call(this, 10, 20) || this; + _this.x = 1; + _this.y = 2; + return _this; } return D2; }(getBase())); var D3 = (function (_super) { __extends(D3, _super); function D3() { - _super.call(this, "abc", 42); - this.x = "x"; - this.y = 2; + var _this = _super.call(this, "abc", 42) || this; + _this.x = "x"; + _this.y = 2; + return _this; } return D3; }(getBase())); @@ -104,7 +107,7 @@ var D3 = (function (_super) { var D4 = (function (_super) { __extends(D4, _super); function D4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D4; }(getBase())); @@ -112,7 +115,7 @@ var D4 = (function (_super) { var D5 = (function (_super) { __extends(D5, _super); function D5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D5; }(getBadBase())); diff --git a/tests/baselines/reference/classExtendingNonConstructor.js b/tests/baselines/reference/classExtendingNonConstructor.js index c46e3c5ddbe..574d5004486 100644 --- a/tests/baselines/reference/classExtendingNonConstructor.js +++ b/tests/baselines/reference/classExtendingNonConstructor.js @@ -27,49 +27,49 @@ function foo() { var C1 = (function (_super) { __extends(C1, _super); function C1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C1; }(undefined)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(true)); var C3 = (function (_super) { __extends(C3, _super); function C3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C3; }(false)); var C4 = (function (_super) { __extends(C4, _super); function C4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C4; }(42)); var C5 = (function (_super) { __extends(C5, _super); function C5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C5; }("hello")); var C6 = (function (_super) { __extends(C6, _super); function C6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C6; }(x)); var C7 = (function (_super) { __extends(C7, _super); function C7() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C7; }(foo)); diff --git a/tests/baselines/reference/classExtendingNull.js b/tests/baselines/reference/classExtendingNull.js index fa6f0357b0d..8d5d73329aa 100644 --- a/tests/baselines/reference/classExtendingNull.js +++ b/tests/baselines/reference/classExtendingNull.js @@ -12,14 +12,14 @@ var __extends = (this && this.__extends) || function (d, b) { var C1 = (function (_super) { __extends(C1, _super); function C1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C1; }(null)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }((null))); diff --git a/tests/baselines/reference/classExtendingPrimitive.js b/tests/baselines/reference/classExtendingPrimitive.js index 8ecad9c24a5..53cb45c2081 100644 --- a/tests/baselines/reference/classExtendingPrimitive.js +++ b/tests/baselines/reference/classExtendingPrimitive.js @@ -24,28 +24,28 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(number)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(string)); var C3 = (function (_super) { __extends(C3, _super); function C3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C3; }(boolean)); var C4 = (function (_super) { __extends(C4, _super); function C4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C4; }(Void)); @@ -58,28 +58,28 @@ void {}; var C5 = (function (_super) { __extends(C5, _super); function C5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C5; }(Null)); var C5a = (function (_super) { __extends(C5a, _super); function C5a() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C5a; }(null)); var C6 = (function (_super) { __extends(C6, _super); function C6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C6; }(undefined)); var C7 = (function (_super) { __extends(C7, _super); function C7() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C7; }(Undefined)); @@ -90,7 +90,7 @@ var E; var C8 = (function (_super) { __extends(C8, _super); function C8() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C8; }(E)); diff --git a/tests/baselines/reference/classExtendingPrimitive2.js b/tests/baselines/reference/classExtendingPrimitive2.js index af766977967..b32dc31a5b4 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.js +++ b/tests/baselines/reference/classExtendingPrimitive2.js @@ -20,7 +20,7 @@ void {}; var C5a = (function (_super) { __extends(C5a, _super); function C5a() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C5a; }(null)); diff --git a/tests/baselines/reference/classExtendingQualifiedName.js b/tests/baselines/reference/classExtendingQualifiedName.js index 17d888834ec..fced8c2a373 100644 --- a/tests/baselines/reference/classExtendingQualifiedName.js +++ b/tests/baselines/reference/classExtendingQualifiedName.js @@ -23,7 +23,7 @@ var M; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(M.C)); diff --git a/tests/baselines/reference/classExtendingQualifiedName2.js b/tests/baselines/reference/classExtendingQualifiedName2.js index 4f1d872e753..c133ceb87dc 100644 --- a/tests/baselines/reference/classExtendingQualifiedName2.js +++ b/tests/baselines/reference/classExtendingQualifiedName2.js @@ -24,7 +24,7 @@ var M; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(M.C)); diff --git a/tests/baselines/reference/classExtendsAcrossFiles.js b/tests/baselines/reference/classExtendsAcrossFiles.js index 0805389f268..5be0ab8f9c0 100644 --- a/tests/baselines/reference/classExtendsAcrossFiles.js +++ b/tests/baselines/reference/classExtendsAcrossFiles.js @@ -37,7 +37,7 @@ exports.b = { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -62,7 +62,7 @@ exports.a = { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js index 80b4b7c175d..91f96450d87 100644 --- a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js @@ -24,7 +24,6 @@ var A = (function () { } return A; }()); -var A; (function (A) { })(A || (A = {})); var Foo; @@ -33,7 +32,7 @@ var Foo; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js index 4c593761f00..6c3dc789445 100644 --- a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js @@ -23,7 +23,7 @@ var Foo; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/classExtendsEveryObjectType.js b/tests/baselines/reference/classExtendsEveryObjectType.js index 8b4663ad2cb..a19f5d5cdd6 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.js +++ b/tests/baselines/reference/classExtendsEveryObjectType.js @@ -25,14 +25,14 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(I)); // error var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }({ foo: string })); // error @@ -40,7 +40,7 @@ var x; var C3 = (function (_super) { __extends(C3, _super); function C3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C3; }(x)); // error @@ -51,7 +51,7 @@ var M; var C4 = (function (_super) { __extends(C4, _super); function C4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C4; }(M)); // error @@ -59,14 +59,14 @@ function foo() { } var C5 = (function (_super) { __extends(C5, _super); function C5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C5; }(foo)); // error var C6 = (function (_super) { __extends(C6, _super); function C6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C6; }([])); // error diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.js b/tests/baselines/reference/classExtendsEveryObjectType2.js index 6aceb0ffebf..fbc364ca5da 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.js +++ b/tests/baselines/reference/classExtendsEveryObjectType2.js @@ -12,14 +12,14 @@ var __extends = (this && this.__extends) || function (d, b) { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }({ foo: string })); // error var C6 = (function (_super) { __extends(C6, _super); function C6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C6; }([])); // error diff --git a/tests/baselines/reference/classExtendsInterface.js b/tests/baselines/reference/classExtendsInterface.js index b324f7382d8..b5946224317 100644 --- a/tests/baselines/reference/classExtendsInterface.js +++ b/tests/baselines/reference/classExtendsInterface.js @@ -17,7 +17,7 @@ var __extends = (this && this.__extends) || function (d, b) { var A = (function (_super) { __extends(A, _super); function A() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return A; }(Comparable)); @@ -29,7 +29,7 @@ var B = (function () { var A2 = (function (_super) { __extends(A2, _super); function A2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return A2; }(Comparable2)); diff --git a/tests/baselines/reference/classExtendsInterfaceInExpression.js b/tests/baselines/reference/classExtendsInterfaceInExpression.js index 69e63f92570..9dcd8dd7279 100644 --- a/tests/baselines/reference/classExtendsInterfaceInExpression.js +++ b/tests/baselines/reference/classExtendsInterfaceInExpression.js @@ -20,7 +20,7 @@ function factory(a) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(factory(A))); diff --git a/tests/baselines/reference/classExtendsInterfaceInModule.js b/tests/baselines/reference/classExtendsInterfaceInModule.js index 45415488700..9da8831a138 100644 --- a/tests/baselines/reference/classExtendsInterfaceInModule.js +++ b/tests/baselines/reference/classExtendsInterfaceInModule.js @@ -24,21 +24,21 @@ var __extends = (this && this.__extends) || function (d, b) { var C1 = (function (_super) { __extends(C1, _super); function C1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C1; }(M.I1)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(M.I2)); var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(Mod.Nested.I)); diff --git a/tests/baselines/reference/classExtendsItself.js b/tests/baselines/reference/classExtendsItself.js index 279d0ad6899..36f2263d671 100644 --- a/tests/baselines/reference/classExtendsItself.js +++ b/tests/baselines/reference/classExtendsItself.js @@ -14,21 +14,21 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(C)); // error var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(D)); // error var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E; }(E)); // error diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.js b/tests/baselines/reference/classExtendsItselfIndirectly.js index f8ea40ee69c..0f3f48d2f2c 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly.js @@ -20,42 +20,42 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(E)); // error var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E; }(D)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(E2)); // error var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(C2)); var E2 = (function (_super) { __extends(E2, _super); function E2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E2; }(D2)); diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.js b/tests/baselines/reference/classExtendsItselfIndirectly2.js index 269edb851e9..e215a07c357 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.js @@ -31,7 +31,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(N.E)); // error @@ -40,7 +40,7 @@ var M; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); @@ -51,7 +51,7 @@ var N; var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E; }(M.D)); @@ -62,7 +62,7 @@ var O; var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(Q.E2)); // error @@ -71,7 +71,7 @@ var O; var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(C2)); @@ -82,7 +82,7 @@ var O; var E2 = (function (_super) { __extends(E2, _super); function E2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E2; }(P.D2)); diff --git a/tests/baselines/reference/classExtendsItselfIndirectly3.js b/tests/baselines/reference/classExtendsItselfIndirectly3.js index 2d2cf938156..f8366d77e13 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly3.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly3.js @@ -27,7 +27,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(E)); // error @@ -40,7 +40,7 @@ var __extends = (this && this.__extends) || function (d, b) { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); @@ -53,7 +53,7 @@ var __extends = (this && this.__extends) || function (d, b) { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E; }(D)); @@ -66,7 +66,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(E2)); // error @@ -79,7 +79,7 @@ var __extends = (this && this.__extends) || function (d, b) { var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(C2)); @@ -92,7 +92,7 @@ var __extends = (this && this.__extends) || function (d, b) { var E2 = (function (_super) { __extends(E2, _super); function E2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E2; }(D2)); diff --git a/tests/baselines/reference/classExtendsMultipleBaseClasses.js b/tests/baselines/reference/classExtendsMultipleBaseClasses.js index 61db0a41a5c..cd9c28ad283 100644 --- a/tests/baselines/reference/classExtendsMultipleBaseClasses.js +++ b/tests/baselines/reference/classExtendsMultipleBaseClasses.js @@ -22,7 +22,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/classExtendsNull.js b/tests/baselines/reference/classExtendsNull.js index afb2be21c68..1eeb5172cad 100644 --- a/tests/baselines/reference/classExtendsNull.js +++ b/tests/baselines/reference/classExtendsNull.js @@ -21,7 +21,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.call(this); + var _this = _super.call(this) || this; return Object.create(null); } return C; @@ -29,6 +29,7 @@ var C = (function (_super) { var D = (function (_super) { __extends(D, _super); function D() { + var _this; return Object.create(null); } return D; diff --git a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js index ae2f73cadc1..ddaadc2dc62 100644 --- a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js +++ b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js @@ -25,7 +25,7 @@ var M; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/classExtendsValidConstructorFunction.js b/tests/baselines/reference/classExtendsValidConstructorFunction.js index 00cd35693f1..31bff6e430c 100644 --- a/tests/baselines/reference/classExtendsValidConstructorFunction.js +++ b/tests/baselines/reference/classExtendsValidConstructorFunction.js @@ -16,7 +16,7 @@ var x = new foo(); // can be used as a constructor function var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(foo)); // error, cannot extend it though diff --git a/tests/baselines/reference/classHeritageWithTrailingSeparator.js b/tests/baselines/reference/classHeritageWithTrailingSeparator.js index 7f85e4e25d7..12265f569bd 100644 --- a/tests/baselines/reference/classHeritageWithTrailingSeparator.js +++ b/tests/baselines/reference/classHeritageWithTrailingSeparator.js @@ -17,7 +17,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index 09cdd5c779b..5e3eae46543 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -33,7 +33,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C2.prototype.foo = function () { return 1; diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index b47514b1286..5fd003e93b9 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -37,7 +37,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(A)); diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index 32ae1ef3e88..477288972df 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -40,7 +40,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(A)); diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index 923ac9c9829..0ec258ab77b 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -42,7 +42,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(A)); diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index a807590749e..0771c56415c 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -47,7 +47,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(A)); diff --git a/tests/baselines/reference/classIndexer3.js b/tests/baselines/reference/classIndexer3.js index 39fb844613e..2e55c894645 100644 --- a/tests/baselines/reference/classIndexer3.js +++ b/tests/baselines/reference/classIndexer3.js @@ -24,7 +24,7 @@ var C123 = (function () { var D123 = (function (_super) { __extends(D123, _super); function D123() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D123; }(C123)); diff --git a/tests/baselines/reference/classInheritence.js b/tests/baselines/reference/classInheritence.js index e6e7a1eaf42..f68d76fad47 100644 --- a/tests/baselines/reference/classInheritence.js +++ b/tests/baselines/reference/classInheritence.js @@ -11,14 +11,14 @@ var __extends = (this && this.__extends) || function (d, b) { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var A = (function (_super) { __extends(A, _super); function A() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return A; }(A)); diff --git a/tests/baselines/reference/classIsSubtypeOfBaseType.js b/tests/baselines/reference/classIsSubtypeOfBaseType.js index b51488dbe1e..52300987d8e 100644 --- a/tests/baselines/reference/classIsSubtypeOfBaseType.js +++ b/tests/baselines/reference/classIsSubtypeOfBaseType.js @@ -29,14 +29,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index ec49320b4be..63490fa29b1 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -28,7 +28,7 @@ var __extends = (this && this.__extends) || function (d, b) { var A = (function (_super) { __extends(A, _super); function A() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } A.prototype.foo = function () { this.bar(); }; return A; diff --git a/tests/baselines/reference/classOrderBug.js b/tests/baselines/reference/classOrderBug.js index d937197fad5..e21a5ed64cf 100644 --- a/tests/baselines/reference/classOrderBug.js +++ b/tests/baselines/reference/classOrderBug.js @@ -35,7 +35,7 @@ var baz = (function () { var foo = (function (_super) { __extends(foo, _super); function foo() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return foo; }(baz)); diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index 0e3897a4f46..9443509032c 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -33,7 +33,7 @@ var A = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(A)); diff --git a/tests/baselines/reference/classSideInheritance2.js b/tests/baselines/reference/classSideInheritance2.js index 72fd4af1eed..67ee666749b 100644 --- a/tests/baselines/reference/classSideInheritance2.js +++ b/tests/baselines/reference/classSideInheritance2.js @@ -29,7 +29,7 @@ var __extends = (this && this.__extends) || function (d, b) { var SubText = (function (_super) { __extends(SubText, _super); function SubText(text, span) { - _super.call(this); + return _super.call(this) || this; } return SubText; }(TextBase)); diff --git a/tests/baselines/reference/classSideInheritance3.js b/tests/baselines/reference/classSideInheritance3.js index b708489c518..589dd81c5c6 100644 --- a/tests/baselines/reference/classSideInheritance3.js +++ b/tests/baselines/reference/classSideInheritance3.js @@ -33,15 +33,16 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B(x, data) { - _super.call(this, x); - this.data = data; + var _this = _super.call(this, x) || this; + _this.data = data; + return _this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C(x) { - _super.call(this, x); + return _super.call(this, x) || this; } return C; }(A)); diff --git a/tests/baselines/reference/classUpdateTests.js b/tests/baselines/reference/classUpdateTests.js index 581575d0d46..53ef71d0e4b 100644 --- a/tests/baselines/reference/classUpdateTests.js +++ b/tests/baselines/reference/classUpdateTests.js @@ -157,69 +157,79 @@ var D = (function () { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); - this.p1 = 0; + var _this = _super.apply(this, arguments) || this; + _this.p1 = 0; + return _this; } return E; }(D)); var F = (function (_super) { __extends(F, _super); function F() { + var _this; + return _this; } // ERROR - super call required return F; }(E)); var G = (function (_super) { __extends(G, _super); function G() { - _super.call(this); - this.p1 = 0; + var _this = _super.call(this) || this; + _this.p1 = 0; + return _this; } // NO ERROR return G; }(D)); var H = (function () { function H() { - _super.call(this); + _this = _super.call(this) || this; } // ERROR - no super call allowed return H; }()); var I = (function (_super) { __extends(I, _super); function I() { - _super.call(this); + return _super.call(this) || this; } // ERROR - no super call allowed return I; }(Object)); var J = (function (_super) { __extends(J, _super); function J(p1) { - _super.call(this); // NO ERROR - this.p1 = p1; + var _this = _super.call(this) || this; + _this.p1 = p1; + return _this; } return J; }(G)); var K = (function (_super) { __extends(K, _super); function K(p1) { - this.p1 = p1; + var _this; + _this.p1 = p1; var i = 0; - _super.call(this); + _this = _super.call(this) || this; + return _this; } return K; }(G)); var L = (function (_super) { __extends(L, _super); function L(p1) { - _super.call(this); // NO ERROR - this.p1 = p1; + var _this = _super.call(this) || this; + _this.p1 = p1; + return _this; } return L; }(G)); var M = (function (_super) { __extends(M, _super); function M(p1) { - this.p1 = p1; + var _this; + _this.p1 = p1; var i = 0; - _super.call(this); + _this = _super.call(this) || this; + return _this; } return M; }(G)); diff --git a/tests/baselines/reference/classWithBaseClassButNoConstructor.js b/tests/baselines/reference/classWithBaseClassButNoConstructor.js index e94a4700506..c25687d3c74 100644 --- a/tests/baselines/reference/classWithBaseClassButNoConstructor.js +++ b/tests/baselines/reference/classWithBaseClassButNoConstructor.js @@ -54,7 +54,7 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(Base)); @@ -69,7 +69,7 @@ var Base2 = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(Base2)); @@ -80,7 +80,7 @@ var d2 = new D(1); // ok var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(Base2)); @@ -90,7 +90,7 @@ var d4 = new D(1); // ok var D3 = (function (_super) { __extends(D3, _super); function D3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D3; }(Base2)); diff --git a/tests/baselines/reference/classWithConstructors.js b/tests/baselines/reference/classWithConstructors.js index 04dcfa2325c..f445d22d18f 100644 --- a/tests/baselines/reference/classWithConstructors.js +++ b/tests/baselines/reference/classWithConstructors.js @@ -75,7 +75,7 @@ var NonGeneric; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C2)); @@ -103,7 +103,7 @@ var Generics; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C2)); diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index 2b2e01e59df..2cb8a4e0a50 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -48,7 +48,7 @@ C.g = function () { return ''; }; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.method = function () { // No errors diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index 327adead6b8..9e79780d5cc 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -45,7 +45,7 @@ var r3 = r.foo; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/classdecl.js b/tests/baselines/reference/classdecl.js index a8a440fa17d..a3059757d2f 100644 --- a/tests/baselines/reference/classdecl.js +++ b/tests/baselines/reference/classdecl.js @@ -136,7 +136,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return b; }(a)); @@ -161,7 +161,7 @@ var m2; var c = (function (_super) { __extends(c, _super); function c() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return c; }(b)); @@ -177,7 +177,7 @@ var m2; var c = (function (_super) { __extends(c, _super); function c() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return c; }(m1.b)); diff --git a/tests/baselines/reference/cloduleAcrossModuleDefinitions.js b/tests/baselines/reference/cloduleAcrossModuleDefinitions.js index f0f31325aed..ac3ff22852f 100644 --- a/tests/baselines/reference/cloduleAcrossModuleDefinitions.js +++ b/tests/baselines/reference/cloduleAcrossModuleDefinitions.js @@ -27,7 +27,6 @@ var A; }()); A.B = B; })(A || (A = {})); -var A; (function (A) { var B; (function (B) { diff --git a/tests/baselines/reference/cloduleAndTypeParameters.js b/tests/baselines/reference/cloduleAndTypeParameters.js index 2d47ce1ef75..c37ec8d584f 100644 --- a/tests/baselines/reference/cloduleAndTypeParameters.js +++ b/tests/baselines/reference/cloduleAndTypeParameters.js @@ -19,7 +19,6 @@ var Foo = (function () { } return Foo; }()); -var Foo; (function (Foo) { var Baz = (function () { function Baz() { diff --git a/tests/baselines/reference/cloduleStaticMembers.js b/tests/baselines/reference/cloduleStaticMembers.js index 868b9305bdf..b696a842f3b 100644 --- a/tests/baselines/reference/cloduleStaticMembers.js +++ b/tests/baselines/reference/cloduleStaticMembers.js @@ -20,7 +20,6 @@ var Clod = (function () { }()); Clod.x = 10; Clod.y = 10; -var Clod; (function (Clod) { var p = Clod.x; var q = x; diff --git a/tests/baselines/reference/cloduleWithDuplicateMember1.js b/tests/baselines/reference/cloduleWithDuplicateMember1.js index 6f4a2809b8e..d364af3a751 100644 --- a/tests/baselines/reference/cloduleWithDuplicateMember1.js +++ b/tests/baselines/reference/cloduleWithDuplicateMember1.js @@ -34,11 +34,9 @@ var C = (function () { C.foo = function () { }; return C; }()); -var C; (function (C) { C.x = 1; })(C || (C = {})); -var C; (function (C) { function foo() { } C.foo = foo; diff --git a/tests/baselines/reference/cloduleWithDuplicateMember2.js b/tests/baselines/reference/cloduleWithDuplicateMember2.js index f0e8af0e3d2..927ec4356b5 100644 --- a/tests/baselines/reference/cloduleWithDuplicateMember2.js +++ b/tests/baselines/reference/cloduleWithDuplicateMember2.js @@ -27,11 +27,9 @@ var C = (function () { }); return C; }()); -var C; (function (C) { C.x = 1; })(C || (C = {})); -var C; (function (C) { function x() { } C.x = x; diff --git a/tests/baselines/reference/cloduleWithPriorInstantiatedModule.js b/tests/baselines/reference/cloduleWithPriorInstantiatedModule.js index 00040923627..e6bb334a424 100644 --- a/tests/baselines/reference/cloduleWithPriorInstantiatedModule.js +++ b/tests/baselines/reference/cloduleWithPriorInstantiatedModule.js @@ -28,7 +28,6 @@ var Moclodule = (function () { return Moclodule; }()); // Instantiated module. -var Moclodule; (function (Moclodule) { var Manager = (function () { function Manager() { diff --git a/tests/baselines/reference/cloduleWithPriorUninstantiatedModule.js b/tests/baselines/reference/cloduleWithPriorUninstantiatedModule.js index ba29858c5dd..552f9a57656 100644 --- a/tests/baselines/reference/cloduleWithPriorUninstantiatedModule.js +++ b/tests/baselines/reference/cloduleWithPriorUninstantiatedModule.js @@ -22,7 +22,6 @@ var Moclodule = (function () { return Moclodule; }()); // Instantiated module. -var Moclodule; (function (Moclodule) { var Manager = (function () { function Manager() { diff --git a/tests/baselines/reference/cloduleWithRecursiveReference.js b/tests/baselines/reference/cloduleWithRecursiveReference.js index d07af909cc7..6da2de4c07e 100644 --- a/tests/baselines/reference/cloduleWithRecursiveReference.js +++ b/tests/baselines/reference/cloduleWithRecursiveReference.js @@ -16,7 +16,6 @@ var M; return C; }()); M.C = C; - var C; (function (C_1) { C_1.C = M.C; })(C = M.C || (M.C = {})); diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index 7e6f26ad591..ea4bfcf301f 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -33,7 +33,6 @@ var Shape = (function () { } return Shape; }()); -var Shape; (function (Shape) { var Utils; (function (Utils) { @@ -44,11 +43,10 @@ var Shape; var Path = (function (_super) { __extends(Path, _super); function Path() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Path; }(Shape)); -var Path; (function (Path) { var Utils; (function (Utils) { diff --git a/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js index fd502b32ccf..977d0c4bf49 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js @@ -62,7 +62,6 @@ var M; return c; }()); })(M || (M = {})); -var M; (function (M_2) { var d = (function () { function d() { @@ -78,7 +77,6 @@ var M; return d; }()); })(M || (M = {})); -var M; (function (M) { var e = (function () { function e() { @@ -93,7 +91,6 @@ var M; return e; }()); })(M || (M = {})); -var M; (function (M_3) { var f = (function () { function f() { @@ -109,7 +106,6 @@ var M; return f; }()); })(M || (M = {})); -var M; (function (M) { var e = (function () { function e() { diff --git a/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.js index 24332a84797..5dd1fb96e1d 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.js @@ -34,7 +34,6 @@ var M; return c; }()); })(M || (M = {})); -var M; (function (M_2) { var d = (function () { function d(M, p) { @@ -44,7 +43,6 @@ var M; return d; }()); })(M || (M = {})); -var M; (function (M_3) { var d2 = (function () { function d2() { diff --git a/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js index 252ad2c63dc..afe3cb43f28 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js @@ -27,14 +27,12 @@ var M; if (p === void 0) { p = M_1.x; } } })(M || (M = {})); -var M; (function (M_2) { function fn2() { var M; var p = M_2.x; } })(M || (M = {})); -var M; (function (M_3) { function fn3() { function M() { diff --git a/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js index a42b6502483..4ff4cb22668 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js @@ -45,7 +45,6 @@ var M; return c; }()); })(M || (M = {})); -var M; (function (M_2) { var d = (function () { function d() { @@ -57,7 +56,6 @@ var M; return d; }()); })(M || (M = {})); -var M; (function (M_3) { var e = (function () { function e() { @@ -70,7 +68,6 @@ var M; return e; }()); })(M || (M = {})); -var M; (function (M) { var f = (function () { function f() { diff --git a/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js index 6726d32d77d..a4486c48de3 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js @@ -52,7 +52,6 @@ var M; var p = M_1.x; })(m1 || (m1 = {})); })(M || (M = {})); -var M; (function (M_2) { var m2; (function (m2) { @@ -65,7 +64,6 @@ var M; var p2 = new M(); })(m2 || (m2 = {})); })(M || (M = {})); -var M; (function (M_3) { var m3; (function (m3) { @@ -75,7 +73,6 @@ var M; var p2 = M(); })(m3 || (m3 = {})); })(M || (M = {})); -var M; (function (M) { var m3; (function (m3) { @@ -83,7 +80,6 @@ var M; var p2; })(m3 || (m3 = {})); })(M || (M = {})); -var M; (function (M_4) { var m4; (function (m4) { diff --git a/tests/baselines/reference/collisionCodeGenModuleWithModuleReopening.js b/tests/baselines/reference/collisionCodeGenModuleWithModuleReopening.js index eed1095cdc3..def2c8c2bb0 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithModuleReopening.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithModuleReopening.js @@ -40,7 +40,6 @@ var m1; m1_1.m1 = m1; })(m1 || (m1 = {})); var foo = new m1.m1(); -var m1; (function (m1) { var c1 = (function () { function c1() { @@ -64,7 +63,6 @@ var m2; var x = new c1(); })(m2 || (m2 = {})); var foo3 = new m2.c1(); -var m2; (function (m2_1) { var m2 = (function () { function m2() { diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js index fc64a8012ee..85c0e398fbd 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js @@ -68,7 +68,7 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(b.prototype, "prop2", { get: function () { @@ -88,7 +88,7 @@ var b = (function (_super) { var c = (function (_super) { __extends(c, _super); function c() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(c.prototype, "prop2", { get: function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js index b6e7cb121d6..d4a22b731f2 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js @@ -42,20 +42,22 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.call(this); + var _this = _super.call(this) || this; function _super() { } + return _this; } return b; }(Foo)); var c = (function (_super) { __extends(c, _super); function c() { - _super.call(this); + var _this = _super.call(this) || this; var x = function () { function _super() { } }; + return _this; } return c; }(Foo)); diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js index 14b8bf46697..81c069da169 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js @@ -50,7 +50,7 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.prototype.foo = function () { function _super() { @@ -63,7 +63,7 @@ var b = (function (_super) { var c = (function (_super) { __extends(c, _super); function c() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } c.prototype.foo = function () { var x = function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js index 2af7a6a870e..67b7f0e3991 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js @@ -40,13 +40,14 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); - this.prop2 = { + var _this = _super.apply(this, arguments) || this; + _this.prop2 = { doStuff: function () { function _super() { } } }; + return _this; } return b; }(Foo)); diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js index 6887a22ae20..26f782c0d17 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js @@ -58,7 +58,7 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(b.prototype, "prop2", { get: function () { @@ -76,7 +76,7 @@ var b = (function (_super) { var c = (function (_super) { __extends(c, _super); function c() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(c.prototype, "prop2", { get: function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js index d3b5e7a2030..e3069352c08 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js @@ -36,18 +36,20 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.call(this); + var _this = _super.call(this) || this; var _super = 10; // Should be error + return _this; } return b; }(Foo)); var c = (function (_super) { __extends(c, _super); function c() { - _super.call(this); + var _this = _super.call(this) || this; var x = function () { var _super = 10; // Should be error }; + return _this; } return c; }(Foo)); diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js index 4553608756d..0524d993ba1 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js @@ -36,7 +36,7 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.prototype.foo = function () { var _super = 10; // Should be error @@ -46,7 +46,7 @@ var b = (function (_super) { var c = (function (_super) { __extends(c, _super); function c() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } c.prototype.foo = function () { var x = function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js index df5d812cf54..d793e022c6b 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js @@ -38,13 +38,14 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); - this.prop2 = { + var _this = _super.apply(this, arguments) || this; + _this.prop2 = { doStuff: function () { var _super = 10; // Should be error } }; - this._super = 10; // No error + _this._super = 10; // No error + return _this; } return b; }(Foo)); diff --git a/tests/baselines/reference/collisionSuperAndNameResolution.js b/tests/baselines/reference/collisionSuperAndNameResolution.js index 2db90d8b026..cb5636ec904 100644 --- a/tests/baselines/reference/collisionSuperAndNameResolution.js +++ b/tests/baselines/reference/collisionSuperAndNameResolution.js @@ -27,7 +27,7 @@ var base = (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Foo.prototype.x = function () { console.log(_super); // Error as this doesnt not resolve to user defined _super diff --git a/tests/baselines/reference/collisionSuperAndParameter.js b/tests/baselines/reference/collisionSuperAndParameter.js index 29b5ad3b496..f5765043c55 100644 --- a/tests/baselines/reference/collisionSuperAndParameter.js +++ b/tests/baselines/reference/collisionSuperAndParameter.js @@ -94,11 +94,12 @@ var Foo = (function () { var Foo2 = (function (_super) { __extends(Foo2, _super); function Foo2(_super) { - _super.call(this); - this.prop4 = { + var _this = _super.call(this) || this; + _this.prop4 = { doStuff: function (_super) { } }; + return _this; } Foo2.prototype.x = function () { var _this = this; @@ -123,7 +124,7 @@ var Foo2 = (function (_super) { var Foo4 = (function (_super) { __extends(Foo4, _super); function Foo4(_super) { - _super.call(this); + return _super.call(this) || this; } Foo4.prototype.y = function (_super) { var _this = this; diff --git a/tests/baselines/reference/collisionSuperAndParameter1.js b/tests/baselines/reference/collisionSuperAndParameter1.js index 517c126ab44..ed19500f9d4 100644 --- a/tests/baselines/reference/collisionSuperAndParameter1.js +++ b/tests/baselines/reference/collisionSuperAndParameter1.js @@ -23,7 +23,7 @@ var Foo = (function () { var Foo2 = (function (_super) { __extends(Foo2, _super); function Foo2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Foo2.prototype.x = function () { var lambda = function (_super) { diff --git a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js index f94a9fde5f2..5fa7fe29091 100644 --- a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js +++ b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js @@ -44,30 +44,32 @@ var a = (function () { var b1 = (function (_super) { __extends(b1, _super); function b1(_super) { - _super.call(this); + return _super.call(this) || this; } return b1; }(a)); var b2 = (function (_super) { __extends(b2, _super); function b2(_super) { - _super.call(this); - this._super = _super; + var _this = _super.call(this) || this; + _this._super = _super; + return _this; } return b2; }(a)); var b3 = (function (_super) { __extends(b3, _super); function b3(_super) { - _super.call(this); + return _super.call(this) || this; } return b3; }(a)); var b4 = (function (_super) { __extends(b4, _super); function b4(_super) { - _super.call(this); - this._super = _super; + var _this = _super.call(this) || this; + _this._super = _super; + return _this; } return b4; }(a)); diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js index c71b0dcf1dd..9e8132c6883 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js @@ -34,7 +34,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.prototype.foo = function () { var _this = this; @@ -46,7 +46,7 @@ var b = (function (_super) { var b2 = (function (_super) { __extends(b2, _super); function b2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b2.prototype.foo = function () { var _this = this; diff --git a/tests/baselines/reference/commentsInheritance.js b/tests/baselines/reference/commentsInheritance.js index 42df3cca389..3527f5d23bb 100644 --- a/tests/baselines/reference/commentsInheritance.js +++ b/tests/baselines/reference/commentsInheritance.js @@ -227,7 +227,7 @@ var c2 = (function () { var c3 = (function (_super) { __extends(c3, _super); function c3() { - _super.call(this, 10); + return _super.call(this, 10) || this; } /** c3 f1*/ c3.prototype.f1 = function () { @@ -258,7 +258,7 @@ c2_i = c3_i; var c4 = (function (_super) { __extends(c4, _super); function c4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return c4; }(c2)); diff --git a/tests/baselines/reference/commentsMultiModuleMultiFile.js b/tests/baselines/reference/commentsMultiModuleMultiFile.js index 5b30279def5..67794577226 100644 --- a/tests/baselines/reference/commentsMultiModuleMultiFile.js +++ b/tests/baselines/reference/commentsMultiModuleMultiFile.js @@ -51,7 +51,6 @@ define(["require", "exports"], function (require, exports) { multiM.b = b; })(multiM = exports.multiM || (exports.multiM = {})); /** thi is multi module 2*/ - var multiM; (function (multiM) { /** class c comment*/ var c = (function () { diff --git a/tests/baselines/reference/commentsMultiModuleSingleFile.js b/tests/baselines/reference/commentsMultiModuleSingleFile.js index 63b6c67888b..0e00a3eaff6 100644 --- a/tests/baselines/reference/commentsMultiModuleSingleFile.js +++ b/tests/baselines/reference/commentsMultiModuleSingleFile.js @@ -44,7 +44,6 @@ var multiM; multiM.d = d; })(multiM || (multiM = {})); /// this is multi module 2 -var multiM; (function (multiM) { /** class c comment*/ var c = (function () { diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js index 0de25c15013..a263a30e382 100644 --- a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js @@ -227,14 +227,14 @@ var Base = (function () { var A2 = (function (_super) { __extends(A2, _super); function A2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return A2; }(Base)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js index 4185af60dbc..b8584522b7b 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js @@ -182,7 +182,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js index 90c67439773..93e1e876a7f 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js @@ -182,7 +182,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js index 736b57e08ba..a8973bf2c10 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js @@ -125,7 +125,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js index ca7eea70ad6..4539538782d 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js @@ -163,7 +163,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js index c64e33827c5..5e8412bc361 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js @@ -163,7 +163,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js index dc7a12eecdc..d30c3586b12 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js @@ -273,7 +273,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js index d4be6df98dd..4235c1352d4 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js @@ -235,7 +235,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js index ee5ad2fbd07..9a6fecd668d 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js @@ -121,7 +121,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js index 79e4bfd0bbf..5721a452486 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js @@ -178,7 +178,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js index 31c0dd3c7c5..b6bf8a16e61 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js @@ -178,7 +178,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js index 5decd7a21fb..690214fc00f 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js @@ -92,7 +92,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -114,7 +114,7 @@ var A2 = (function () { var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A2)); diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index 46974055171..4f48e5fc2c5 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -57,7 +57,7 @@ var __extends = (this && this.__extends) || function (d, b) { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived.createEmpty = function () { var item = new Derived(); diff --git a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js index 3d885d3eef1..326c0830c4f 100644 --- a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js +++ b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js @@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || function (d, b) { var S18 = (function (_super) { __extends(S18, _super); function S18() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return S18; }(S18)); diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.js b/tests/baselines/reference/compoundAssignmentLHSIsValue.js index a55c068d4a4..bfea11911bf 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.js @@ -197,9 +197,10 @@ value; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.call(this); + var _this = _super.call(this) || this; _super.prototype. *= value; _super.prototype. += value; + return _this; } Derived.prototype.foo = function () { _super.prototype. *= value; diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js index 16500b823b8..c8fb8c6a222 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js @@ -139,9 +139,10 @@ _a = Math.pow(['', ''], value), '' = _a[0], '' = _a[1]; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.call(this); + var _this = _super.call(this) || this; (_a = _super.prototype). = Math.pow(_a., value); var _a; + return _this; } Derived.prototype.foo = function () { (_a = _super.prototype). = Math.pow(_a., value); diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.js b/tests/baselines/reference/computedPropertyNames24_ES5.js index 24cfe77d93c..ff9112755bd 100644 --- a/tests/baselines/reference/computedPropertyNames24_ES5.js +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -25,7 +25,7 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype[_super.bar.call(this)] = function () { }; return C; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index b03dd285ced..dad9c5c291a 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -30,7 +30,7 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.foo = function () { var obj = (_a = {}, diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index 41a20ac6477..5db7768270a 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -27,7 +27,7 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype[(_a = {}, _a[_super.bar.call(this)] = 1, _a)[0]] = function () { }; return C; diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.js b/tests/baselines/reference/computedPropertyNames27_ES5.js index bdef47165b1..381805659e2 100644 --- a/tests/baselines/reference/computedPropertyNames27_ES5.js +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -19,8 +19,8 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } - C.prototype[(_super.call(this), "prop")] = function () { }; + C.prototype[(_this = _super.call(this) || this, "prop")] = function () { }; return C; }(Base)); diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index ed15bbf0145..ab765c56dd7 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -24,10 +24,11 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.call(this); + var _this = _super.call(this) || this; var obj = (_a = {}, - _a[(_super.call(this), "prop")] = function () { }, + _a[(_this = _super.call(this) || this, "prop")] = function () { }, _a); + return _this; var _a; } return C; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index a900fd44c67..c2c7cddd971 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -29,16 +29,17 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.call(this); + var _this = _super.call(this) || this; (function () { var obj = (_a = {}, // Ideally, we would capture this. But the reference is // illegal, and not capturing this is consistent with //treatment of other similar violations. - _a[(_super.call(this), "prop")] = function () { }, + _a[(_this = _super.call(this) || this, "prop")] = function () { }, _a); var _a; }); + return _this; } return C; }(Base)); diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index 2e38e2a131f..00cc765f4cc 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -32,7 +32,7 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.foo = function () { var _this = this; diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js index c79a4d8d6d1..b1bb0fec72c 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -36,7 +36,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(D.prototype, "get1", { // Computed properties diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.js b/tests/baselines/reference/computedPropertyNames44_ES5.js index 78e20a7d6a3..bf940f15014 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES5.js +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -40,7 +40,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(D.prototype, "set1", { set: function (p) { }, diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.js b/tests/baselines/reference/computedPropertyNames45_ES5.js index 9c7482a4713..5b5d64f9bf0 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.js +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -41,7 +41,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(D.prototype, "set1", { set: function (p) { }, diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js index 3514965f1ce..408571af42a 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js @@ -63,7 +63,7 @@ var X = (function () { var A = (function (_super) { __extends(A, _super); function A() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return A; }(X)); @@ -71,7 +71,7 @@ var A = (function (_super) { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(X)); diff --git a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js index 8780c92fc1e..0ac935a582a 100644 --- a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js @@ -39,7 +39,7 @@ var X = (function () { var A = (function (_super) { __extends(A, _super); function A() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return A; }(X)); @@ -47,7 +47,7 @@ var A = (function (_super) { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(X)); diff --git a/tests/baselines/reference/constEnumToStringWithComments.js b/tests/baselines/reference/constEnumToStringWithComments.js index c01e75cb923..f0fbc866385 100644 --- a/tests/baselines/reference/constEnumToStringWithComments.js +++ b/tests/baselines/reference/constEnumToStringWithComments.js @@ -23,15 +23,15 @@ let c1 = Foo["C"].toString(); //// [constEnumToStringWithComments.js] -var x0 = 100 /* X */..toString(); -var x1 = 100 /* "X" */..toString(); +var x0 = 100 /* X */.toString(); +var x1 = 100 /* "X" */.toString(); var y0 = 0.5 /* Y */.toString(); var y1 = 0.5 /* "Y" */.toString(); -var z0 = 2 /* Z */..toString(); -var z1 = 2 /* "Z" */..toString(); -var a0 = -1 /* A */..toString(); -var a1 = -1 /* "A" */..toString(); +var z0 = 2 /* Z */.toString(); +var z1 = 2 /* "Z" */.toString(); +var a0 = -1 /* A */.toString(); +var a1 = -1 /* "A" */.toString(); var b0 = -1.5 /* B */.toString(); var b1 = -1.5 /* "B" */.toString(); -var c0 = -1 /* C */..toString(); -var c1 = -1 /* "C" */..toString(); +var c0 = -1 /* C */.toString(); +var c1 = -1 /* "C" */.toString(); diff --git a/tests/baselines/reference/constantOverloadFunction.js b/tests/baselines/reference/constantOverloadFunction.js index 09ff39f582e..160191c5ca0 100644 --- a/tests/baselines/reference/constantOverloadFunction.js +++ b/tests/baselines/reference/constantOverloadFunction.js @@ -28,7 +28,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; @@ -36,7 +36,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived2.prototype.baz = function () { }; return Derived2; @@ -44,7 +44,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived3.prototype.biz = function () { }; return Derived3; diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js index 37c1b1737cd..509f9ba70e6 100644 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js @@ -29,7 +29,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; @@ -37,7 +37,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived2.prototype.baz = function () { }; return Derived2; @@ -45,7 +45,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived3.prototype.biz = function () { }; return Derived3; diff --git a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js index 4fd63cf60d0..7908d36a56a 100644 --- a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js +++ b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js @@ -40,7 +40,7 @@ var GenericBase = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(GenericBase)); diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js index 88f35f53b17..6b308d88896 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js @@ -84,21 +84,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js index 96318a0d616..09abd6e0868 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js @@ -129,21 +129,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js index 171c4bc6210..4e9a8c59bf9 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js @@ -74,21 +74,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js index 26757c43def..91ec3b313bb 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js @@ -64,21 +64,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js index ae1d0d90445..edafb009916 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js @@ -67,21 +67,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/constructSignaturesWithOverloads2.js b/tests/baselines/reference/constructSignaturesWithOverloads2.js index eae1b358dcc..b82c6d00a4b 100644 --- a/tests/baselines/reference/constructSignaturesWithOverloads2.js +++ b/tests/baselines/reference/constructSignaturesWithOverloads2.js @@ -47,7 +47,6 @@ var C = (function () { } return C; }()); -var C; (function (C) { C.x = 1; })(C || (C = {})); @@ -57,7 +56,6 @@ var C2 = (function () { } return C2; }()); -var C2; (function (C2) { C2.x = 1; })(C2 || (C2 = {})); diff --git a/tests/baselines/reference/constructorArgs.js b/tests/baselines/reference/constructorArgs.js index 1d533506e15..6bbea0fddf7 100644 --- a/tests/baselines/reference/constructorArgs.js +++ b/tests/baselines/reference/constructorArgs.js @@ -29,8 +29,9 @@ var Super = (function () { var Sub = (function (_super) { __extends(Sub, _super); function Sub(options) { - _super.call(this, options.value); - this.options = options; + var _this = _super.call(this, options.value) || this; + _this.options = options; + return _this; } return Sub; }(Super)); diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js index d06faa80f20..45ed976e191 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js @@ -33,14 +33,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js index 1c3d6bf16d0..c5e27748f52 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js @@ -47,7 +47,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived(x) { - _super.call(this, x); + return _super.call(this, x) || this; } return Derived; }(Base)); @@ -55,7 +55,7 @@ var Derived2 = (function (_super) { __extends(Derived2, _super); // ok, not enforcing assignability relation on this function Derived2(x) { - _super.call(this, x); + var _this = _super.call(this, x) || this; return 1; } return Derived2; diff --git a/tests/baselines/reference/constructorHasPrototypeProperty.js b/tests/baselines/reference/constructorHasPrototypeProperty.js index 960b76f52c4..a16694cdbf5 100644 --- a/tests/baselines/reference/constructorHasPrototypeProperty.js +++ b/tests/baselines/reference/constructorHasPrototypeProperty.js @@ -47,7 +47,7 @@ var NonGeneric; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); @@ -66,7 +66,7 @@ var Generic; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/constructorOverloads2.js b/tests/baselines/reference/constructorOverloads2.js index 76481ec1bc6..2d26194f2e7 100644 --- a/tests/baselines/reference/constructorOverloads2.js +++ b/tests/baselines/reference/constructorOverloads2.js @@ -40,7 +40,7 @@ var FooBase = (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo(x, y) { - _super.call(this, x); + return _super.call(this, x) || this; } Foo.prototype.bar1 = function () { }; return Foo; diff --git a/tests/baselines/reference/constructorOverloads3.js b/tests/baselines/reference/constructorOverloads3.js index 61f0d50db03..c0ae9b452f9 100644 --- a/tests/baselines/reference/constructorOverloads3.js +++ b/tests/baselines/reference/constructorOverloads3.js @@ -31,6 +31,8 @@ var __extends = (this && this.__extends) || function (d, b) { var Foo = (function (_super) { __extends(Foo, _super); function Foo(x, y) { + var _this; + return _this; } Foo.prototype.bar1 = function () { }; return Foo; diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index 905c12e07e3..2e3190c15c8 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -525,7 +525,7 @@ method2(); var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.method2 = function () { return this.method1(2); diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.js b/tests/baselines/reference/contextualTypingArrayOfLambdas.js index 5775e0f064d..caf7ed445e5 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.js +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.js @@ -28,14 +28,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression.js b/tests/baselines/reference/contextualTypingOfConditionalExpression.js index 29bb48e7970..a6ce98f61e2 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression.js @@ -29,14 +29,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js index 1d84d74e590..e3bd1643cfb 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js @@ -26,14 +26,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js index c385eff83d5..89979da4812 100644 --- a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js +++ b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js @@ -25,7 +25,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/declFileClassExtendsNull.js b/tests/baselines/reference/declFileClassExtendsNull.js index e9081acab55..30ddc3f08bf 100644 --- a/tests/baselines/reference/declFileClassExtendsNull.js +++ b/tests/baselines/reference/declFileClassExtendsNull.js @@ -12,7 +12,7 @@ var __extends = (this && this.__extends) || function (d, b) { var ExtendsNull = (function (_super) { __extends(ExtendsNull, _super); function ExtendsNull() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ExtendsNull; }(null)); diff --git a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js index 4b9535cd2c3..442007d9b9a 100644 --- a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js +++ b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js @@ -23,7 +23,7 @@ var X = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(X)); diff --git a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js index 117bb6a7bd5..47593dc9d68 100644 --- a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js +++ b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js @@ -26,7 +26,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index 0974f9d7b36..b2e99a73ad7 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -91,7 +91,7 @@ exports.g = C.F5(); var h = (function (_super) { __extends(h, _super); function h() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return h; }(C.A)); diff --git a/tests/baselines/reference/declFileGenericType2.js b/tests/baselines/reference/declFileGenericType2.js index a4636d82993..720be79b28d 100644 --- a/tests/baselines/reference/declFileGenericType2.js +++ b/tests/baselines/reference/declFileGenericType2.js @@ -58,7 +58,7 @@ var templa; var AbstractElementController = (function (_super) { __extends(AbstractElementController, _super); function AbstractElementController() { - _super.call(this); + return _super.call(this) || this; } return AbstractElementController; }(templa.mvc.AbstractController)); @@ -67,7 +67,6 @@ var templa; })(dom = templa.dom || (templa.dom = {})); })(templa || (templa = {})); // Module -var templa; (function (templa) { var dom; (function (dom) { @@ -78,8 +77,9 @@ var templa; var AbstractCompositeElementController = (function (_super) { __extends(AbstractCompositeElementController, _super); function AbstractCompositeElementController() { - _super.call(this); - this._controllers = []; + var _this = _super.call(this) || this; + _this._controllers = []; + return _this; } return AbstractCompositeElementController; }(templa.dom.mvc.AbstractElementController)); diff --git a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js index f7672149308..171625efe1a 100644 --- a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js +++ b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js @@ -50,7 +50,6 @@ var M; m.c = c; })(m = M.m || (M.m = {})); })(M || (M = {})); -var M; (function (M) { var N; (function (N) { diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js index 4ac08f97a52..17d885788dd 100644 --- a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js @@ -35,7 +35,7 @@ var X; var W = (function (_super) { __extends(W, _super); function W() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return W; }(A.B.Base.W)); @@ -43,7 +43,6 @@ var X; })(base = Y.base || (Y.base = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); -var X; (function (X) { var Y; (function (Y) { @@ -54,7 +53,7 @@ var X; var W = (function (_super) { __extends(W, _super); function W() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return W; }(X.Y.base.W)); diff --git a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js index 6dfce6e8e63..70d0cd5a3dd 100644 --- a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js +++ b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js @@ -36,7 +36,6 @@ var A; B.EventManager = EventManager; })(B = A.B || (A.B = {})); })(A || (A = {})); -var A; (function (A) { var B; (function (B) { @@ -45,7 +44,7 @@ var A; var ContextMenu = (function (_super) { __extends(ContextMenu, _super); function ContextMenu() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ContextMenu; }(B.EventManager)); diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends.js b/tests/baselines/reference/declarationEmitExpressionInExtends.js index a7b2a6c7873..726c7b22446 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends.js @@ -29,7 +29,7 @@ var Q = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(x)); diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends2.js b/tests/baselines/reference/declarationEmitExpressionInExtends2.js index 09298fbd92d..4081de6d3ed 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends2.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends2.js @@ -29,7 +29,7 @@ function getClass(c) { var MyClass = (function (_super) { __extends(MyClass, _super); function MyClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyClass; }(getClass(2))); diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends3.js b/tests/baselines/reference/declarationEmitExpressionInExtends3.js index c21074fc3b7..f36a7e250a2 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends3.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends3.js @@ -70,7 +70,7 @@ function getExportedClass(c) { var MyClass = (function (_super) { __extends(MyClass, _super); function MyClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyClass; }(getLocalClass(undefined))); @@ -78,7 +78,7 @@ exports.MyClass = MyClass; var MyClass2 = (function (_super) { __extends(MyClass2, _super); function MyClass2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyClass2; }(getExportedClass(undefined))); @@ -86,7 +86,7 @@ exports.MyClass2 = MyClass2; var MyClass3 = (function (_super) { __extends(MyClass3, _super); function MyClass3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyClass3; }(getExportedClass(undefined))); @@ -94,7 +94,7 @@ exports.MyClass3 = MyClass3; var MyClass4 = (function (_super) { __extends(MyClass4, _super); function MyClass4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyClass4; }(getExportedClass(undefined))); diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends4.js b/tests/baselines/reference/declarationEmitExpressionInExtends4.js index e5e822a784d..b90c1275197 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends4.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends4.js @@ -33,21 +33,21 @@ function getSomething() { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(getSomething())); var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(SomeUndefinedFunction())); var C3 = (function (_super) { __extends(C3, _super); function C3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C3; }(SomeUndefinedFunction)); diff --git a/tests/baselines/reference/declarationEmitNameConflicts.js b/tests/baselines/reference/declarationEmitNameConflicts.js index 2ce92501409..6d848b42869 100644 --- a/tests/baselines/reference/declarationEmitNameConflicts.js +++ b/tests/baselines/reference/declarationEmitNameConflicts.js @@ -85,7 +85,6 @@ var M; M.c = N; M.d = im; })(M = exports.M || (exports.M = {})); -var M; (function (M) { var P; (function (P) { @@ -111,7 +110,6 @@ var M; P.d = M.d; // emitted incorrectly as typeof im })(P = M.P || (M.P = {})); })(M = exports.M || (exports.M = {})); -var M; (function (M) { var Q; (function (Q) { diff --git a/tests/baselines/reference/declarationEmitNameConflicts2.js b/tests/baselines/reference/declarationEmitNameConflicts2.js index b7b345979d7..41dcec4690f 100644 --- a/tests/baselines/reference/declarationEmitNameConflicts2.js +++ b/tests/baselines/reference/declarationEmitNameConflicts2.js @@ -39,7 +39,6 @@ var X; })(base = Y.base || (Y.base = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); -var X; (function (X) { var Y; (function (Y) { diff --git a/tests/baselines/reference/declarationEmitNameConflicts3.js b/tests/baselines/reference/declarationEmitNameConflicts3.js index e9d5ea3b98e..b0a87e64483 100644 --- a/tests/baselines/reference/declarationEmitNameConflicts3.js +++ b/tests/baselines/reference/declarationEmitNameConflicts3.js @@ -50,7 +50,6 @@ var M; E.f = f; })(E = M.E || (M.E = {})); })(M || (M = {})); -var M; (function (M) { var P; (function (P) { @@ -64,7 +63,7 @@ var M; var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E; }(C)); diff --git a/tests/baselines/reference/declarationEmitProtectedMembers.js b/tests/baselines/reference/declarationEmitProtectedMembers.js index f391e143d72..9ae8e8a2437 100644 --- a/tests/baselines/reference/declarationEmitProtectedMembers.js +++ b/tests/baselines/reference/declarationEmitProtectedMembers.js @@ -88,7 +88,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C2.prototype.f = function () { return _super.prototype.f.call(this) + this.x; @@ -102,7 +102,7 @@ var C2 = (function (_super) { var C3 = (function (_super) { __extends(C3, _super); function C3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C3.prototype.f = function () { return _super.prototype.f.call(this); diff --git a/tests/baselines/reference/declarationEmitThisPredicates01.js b/tests/baselines/reference/declarationEmitThisPredicates01.js index d05b5c46dad..ad9b7a70373 100644 --- a/tests/baselines/reference/declarationEmitThisPredicates01.js +++ b/tests/baselines/reference/declarationEmitThisPredicates01.js @@ -28,7 +28,7 @@ exports.C = C; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js index e34dcc9810f..fe7995462ef 100644 --- a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js +++ b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js @@ -28,7 +28,7 @@ exports.C = C; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/declareDottedExtend.js b/tests/baselines/reference/declareDottedExtend.js index f1e9ea0b4de..3c7588d2b6c 100644 --- a/tests/baselines/reference/declareDottedExtend.js +++ b/tests/baselines/reference/declareDottedExtend.js @@ -21,14 +21,14 @@ var ab = A.B; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(ab.C)); var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E; }(A.B.C)); diff --git a/tests/baselines/reference/decoratorOnClassConstructor2.js b/tests/baselines/reference/decoratorOnClassConstructor2.js index 5fc5501c329..ce323e8ed1e 100644 --- a/tests/baselines/reference/decoratorOnClassConstructor2.js +++ b/tests/baselines/reference/decoratorOnClassConstructor2.js @@ -45,7 +45,7 @@ var _0_ts_2 = require("./0.ts"); var C = (function (_super) { __extends(C, _super); function C(prop) { - _super.call(this); + return _super.call(this) || this; } return C; }(_0_ts_1.base)); diff --git a/tests/baselines/reference/decoratorOnClassConstructor3.js b/tests/baselines/reference/decoratorOnClassConstructor3.js index 66946fab8bd..f06bf80b21d 100644 --- a/tests/baselines/reference/decoratorOnClassConstructor3.js +++ b/tests/baselines/reference/decoratorOnClassConstructor3.js @@ -48,7 +48,7 @@ var _0_2 = require("./0"); var C = (function (_super) { __extends(C, _super); function C(prop) { - _super.call(this); + return _super.call(this) || this; } return C; }(_0_1.base)); diff --git a/tests/baselines/reference/decoratorOnClassMethod12.js b/tests/baselines/reference/decoratorOnClassMethod12.js index 6e9b9763a3a..7dd5f698182 100644 --- a/tests/baselines/reference/decoratorOnClassMethod12.js +++ b/tests/baselines/reference/decoratorOnClassMethod12.js @@ -32,7 +32,7 @@ var M; var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.method = function () { }; return C; diff --git a/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.js b/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.js new file mode 100644 index 00000000000..4ab447d8e32 --- /dev/null +++ b/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.js @@ -0,0 +1,75 @@ +//// [derivedClassConstructorWithExplicitReturns01.ts] + +class C { + cProp = 10; + + foo() { return "this never gets used."; } + + constructor(value: number) { + return { + cProp: value, + foo() { + return "well this looks kinda C-ish."; + } + } + } +} + +class D extends C { + dProp = () => this; + + constructor(a = 100) { + super(a); + + if (Math.random() < 0.5) { + "You win!" + return { + cProp: 1, + dProp: () => this, + foo() { return "You win!!!!!" } + }; + } + else + return null; + } +} + +//// [derivedClassConstructorWithExplicitReturns01.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var C = (function () { + function C(value) { + this.cProp = 10; + return { + cProp: value, + foo: function () { + return "well this looks kinda C-ish."; + } + }; + } + C.prototype.foo = function () { return "this never gets used."; }; + return C; +}()); +var D = (function (_super) { + __extends(D, _super); + function D(a) { + if (a === void 0) { a = 100; } + var _this = _super.call(this, a) || this; + _this.dProp = function () { return _this; }; + if (Math.random() < 0.5) { + "You win!"; + return { + cProp: 1, + dProp: function () { return _this; }, + foo: function () { return "You win!!!!!"; } + }; + } + else + return null; + } + return D; +}(C)); +//# sourceMappingURL=derivedClassConstructorWithExplicitReturns01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.js.map b/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.js.map new file mode 100644 index 00000000000..8b9037e40c9 --- /dev/null +++ b/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.js.map @@ -0,0 +1,2 @@ +//// [derivedClassConstructorWithExplicitReturns01.js.map] +{"version":3,"file":"derivedClassConstructorWithExplicitReturns01.js","sourceRoot":"","sources":["derivedClassConstructorWithExplicitReturns01.ts"],"names":[],"mappings":";;;;;AACA;IAKI,WAAY,KAAa;QAJzB,UAAK,GAAG,EAAE,CAAC;QAKP,MAAM,CAAC;YACH,KAAK,EAAE,KAAK;YACZ,GAAG;gBACC,MAAM,CAAC,8BAA8B,CAAC;YAC1C,CAAC;SACJ,CAAA;IACL,CAAC;IATD,eAAG,GAAH,cAAQ,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAU7C,QAAC;AAAD,CAAC,AAbD,IAaC;AAED;IAAgB,qBAAC;IAGb,WAAY,CAAO;QAAP,kBAAA,EAAA,OAAO;QAAnB,YACI,kBAAM,CAAC,CAAC,SAYX;QAfD,WAAK,GAAG,cAAM,OAAA,KAAI,EAAJ,CAAI,CAAC;QAKf,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;YACtB,UAAU,CAAA;YACV,MAAM,CAAC;gBACH,KAAK,EAAE,CAAC;gBACR,KAAK,EAAE,cAAM,OAAA,KAAI,EAAJ,CAAI;gBACjB,GAAG,gBAAK,MAAM,CAAC,cAAc,CAAA,CAAC,CAAC;aAClC,CAAC;QACN,CAAC;QACD,IAAI;YACA,MAAM,CAAC,IAAI,CAAC;IACpB,CAAC;IACL,QAAC;AAAD,CAAC,AAjBD,CAAgB,CAAC,GAiBhB"} \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.sourcemap.txt b/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.sourcemap.txt new file mode 100644 index 00000000000..d452115ceb7 --- /dev/null +++ b/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.sourcemap.txt @@ -0,0 +1,582 @@ +=================================================================== +JsFile: derivedClassConstructorWithExplicitReturns01.js +mapUrl: derivedClassConstructorWithExplicitReturns01.js.map +sourceRoot: +sources: derivedClassConstructorWithExplicitReturns01.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/derivedClassConstructorWithExplicitReturns01.js +sourceFile:derivedClassConstructorWithExplicitReturns01.ts +------------------------------------------------------------------- +>>>var __extends = (this && this.__extends) || function (d, b) { +>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>>}; +>>>var C = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(6, 1) Source(2, 1) + SourceIndex(0) +--- +>>> function C(value) { +1->^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^ +4 > ^^^^^-> +1->class C { + > cProp = 10; + > + > foo() { return "this never gets used."; } + > + > +2 > constructor( +3 > value: number +1->Emitted(7, 5) Source(7, 5) + SourceIndex(0) +2 >Emitted(7, 16) Source(7, 17) + SourceIndex(0) +3 >Emitted(7, 21) Source(7, 30) + SourceIndex(0) +--- +>>> this.cProp = 10; +1->^^^^^^^^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +1-> +2 > cProp +3 > = +4 > 10 +5 > ; +1->Emitted(8, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(8, 19) Source(3, 10) + SourceIndex(0) +3 >Emitted(8, 22) Source(3, 13) + SourceIndex(0) +4 >Emitted(8, 24) Source(3, 15) + SourceIndex(0) +5 >Emitted(8, 25) Source(3, 16) + SourceIndex(0) +--- +>>> return { +1 >^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^-> +1 > + > + > foo() { return "this never gets used."; } + > + > constructor(value: number) { + > +2 > return +3 > +1 >Emitted(9, 9) Source(8, 9) + SourceIndex(0) +2 >Emitted(9, 15) Source(8, 15) + SourceIndex(0) +3 >Emitted(9, 16) Source(8, 16) + SourceIndex(0) +--- +>>> cProp: value, +1->^^^^^^^^^^^^ +2 > ^^^^^ +3 > ^^ +4 > ^^^^^ +5 > ^^^^^^^-> +1->{ + > +2 > cProp +3 > : +4 > value +1->Emitted(10, 13) Source(9, 13) + SourceIndex(0) +2 >Emitted(10, 18) Source(9, 18) + SourceIndex(0) +3 >Emitted(10, 20) Source(9, 20) + SourceIndex(0) +4 >Emitted(10, 25) Source(9, 25) + SourceIndex(0) +--- +>>> foo: function () { +1->^^^^^^^^^^^^ +2 > ^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->, + > +2 > foo +1->Emitted(11, 13) Source(10, 13) + SourceIndex(0) +2 >Emitted(11, 16) Source(10, 16) + SourceIndex(0) +--- +>>> return "well this looks kinda C-ish."; +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +1->() { + > +2 > return +3 > +4 > "well this looks kinda C-ish." +5 > ; +1->Emitted(12, 17) Source(11, 17) + SourceIndex(0) +2 >Emitted(12, 23) Source(11, 23) + SourceIndex(0) +3 >Emitted(12, 24) Source(11, 24) + SourceIndex(0) +4 >Emitted(12, 54) Source(11, 54) + SourceIndex(0) +5 >Emitted(12, 55) Source(11, 55) + SourceIndex(0) +--- +>>> } +1 >^^^^^^^^^^^^ +2 > ^ +1 > + > +2 > } +1 >Emitted(13, 13) Source(12, 13) + SourceIndex(0) +2 >Emitted(13, 14) Source(12, 14) + SourceIndex(0) +--- +>>> }; +1 >^^^^^^^^^ +2 > ^ +1 > + > } +2 > +1 >Emitted(14, 10) Source(13, 10) + SourceIndex(0) +2 >Emitted(14, 11) Source(13, 10) + SourceIndex(0) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(15, 5) Source(14, 5) + SourceIndex(0) +2 >Emitted(15, 6) Source(14, 6) + SourceIndex(0) +--- +>>> C.prototype.foo = function () { return "this never gets used."; }; +1->^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^ +9 > ^ +10> ^ +1-> +2 > foo +3 > +4 > foo() { +5 > return +6 > +7 > "this never gets used." +8 > ; +9 > +10> } +1->Emitted(16, 5) Source(5, 5) + SourceIndex(0) +2 >Emitted(16, 20) Source(5, 8) + SourceIndex(0) +3 >Emitted(16, 23) Source(5, 5) + SourceIndex(0) +4 >Emitted(16, 37) Source(5, 13) + SourceIndex(0) +5 >Emitted(16, 43) Source(5, 19) + SourceIndex(0) +6 >Emitted(16, 44) Source(5, 20) + SourceIndex(0) +7 >Emitted(16, 67) Source(5, 43) + SourceIndex(0) +8 >Emitted(16, 68) Source(5, 44) + SourceIndex(0) +9 >Emitted(16, 69) Source(5, 45) + SourceIndex(0) +10>Emitted(16, 70) Source(5, 46) + SourceIndex(0) +--- +>>> return C; +1 >^^^^ +2 > ^^^^^^^^ +1 > + > + > constructor(value: number) { + > return { + > cProp: value, + > foo() { + > return "well this looks kinda C-ish."; + > } + > } + > } + > +2 > } +1 >Emitted(17, 5) Source(15, 1) + SourceIndex(0) +2 >Emitted(17, 13) Source(15, 2) + SourceIndex(0) +--- +>>>}()); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > cProp = 10; + > + > foo() { return "this never gets used."; } + > + > constructor(value: number) { + > return { + > cProp: value, + > foo() { + > return "well this looks kinda C-ish."; + > } + > } + > } + > } +1 >Emitted(18, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(18, 2) Source(15, 2) + SourceIndex(0) +3 >Emitted(18, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(18, 6) Source(15, 2) + SourceIndex(0) +--- +>>>var D = (function (_super) { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +1->Emitted(19, 1) Source(17, 1) + SourceIndex(0) +--- +>>> __extends(D, _super); +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^ +1->class D extends +2 > C +1->Emitted(20, 5) Source(17, 17) + SourceIndex(0) +2 >Emitted(20, 26) Source(17, 18) + SourceIndex(0) +--- +>>> function D(a) { +1 >^^^^ +2 > ^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 > { + > dProp = () => this; + > + > +2 > constructor( +3 > a = 100 +1 >Emitted(21, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(21, 16) Source(20, 17) + SourceIndex(0) +3 >Emitted(21, 17) Source(20, 24) + SourceIndex(0) +--- +>>> if (a === void 0) { a = 100; } +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^ +5 > ^^^^^^^^^^^^^^^-> +1-> +2 > +3 > +4 > a = 100 +1->Emitted(22, 9) Source(20, 17) + SourceIndex(0) +2 >Emitted(22, 27) Source(20, 17) + SourceIndex(0) +3 >Emitted(22, 29) Source(20, 17) + SourceIndex(0) +4 >Emitted(22, 36) Source(20, 24) + SourceIndex(0) +--- +>>> var _this = _super.call(this, a) || this; +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^^^^-> +1-> +2 > constructor(a = 100) { + > +3 > super( +4 > a +5 > ) +6 > ; + > + > if (Math.random() < 0.5) { + > "You win!" + > return { + > cProp: 1, + > dProp: () => this, + > foo() { return "You win!!!!!" } + > }; + > } + > else + > return null; + > } +1->Emitted(23, 9) Source(20, 5) + SourceIndex(0) +2 >Emitted(23, 21) Source(21, 9) + SourceIndex(0) +3 >Emitted(23, 39) Source(21, 15) + SourceIndex(0) +4 >Emitted(23, 40) Source(21, 16) + SourceIndex(0) +5 >Emitted(23, 41) Source(21, 17) + SourceIndex(0) +6 >Emitted(23, 50) Source(33, 6) + SourceIndex(0) +--- +>>> _this.dProp = function () { return _this; }; +1->^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^^ +6 > ^^^^^ +7 > ^^ +8 > ^ +9 > ^ +1-> +2 > dProp +3 > = +4 > () => +5 > +6 > this +7 > +8 > this +9 > ; +1->Emitted(24, 9) Source(18, 5) + SourceIndex(0) +2 >Emitted(24, 20) Source(18, 10) + SourceIndex(0) +3 >Emitted(24, 23) Source(18, 13) + SourceIndex(0) +4 >Emitted(24, 37) Source(18, 19) + SourceIndex(0) +5 >Emitted(24, 44) Source(18, 19) + SourceIndex(0) +6 >Emitted(24, 49) Source(18, 23) + SourceIndex(0) +7 >Emitted(24, 51) Source(18, 19) + SourceIndex(0) +8 >Emitted(24, 52) Source(18, 23) + SourceIndex(0) +9 >Emitted(24, 53) Source(18, 24) + SourceIndex(0) +--- +>>> if (Math.random() < 0.5) { +1 >^^^^^^^^ +2 > ^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^ +7 > ^^^^^^ +8 > ^^ +9 > ^^^ +10> ^^^ +11> ^ +12> ^ +13> ^ +1 > + > + > constructor(a = 100) { + > super(a); + > + > +2 > if +3 > +4 > ( +5 > Math +6 > . +7 > random +8 > () +9 > < +10> 0.5 +11> ) +12> +13> { +1 >Emitted(25, 9) Source(23, 9) + SourceIndex(0) +2 >Emitted(25, 11) Source(23, 11) + SourceIndex(0) +3 >Emitted(25, 12) Source(23, 12) + SourceIndex(0) +4 >Emitted(25, 13) Source(23, 13) + SourceIndex(0) +5 >Emitted(25, 17) Source(23, 17) + SourceIndex(0) +6 >Emitted(25, 18) Source(23, 18) + SourceIndex(0) +7 >Emitted(25, 24) Source(23, 24) + SourceIndex(0) +8 >Emitted(25, 26) Source(23, 26) + SourceIndex(0) +9 >Emitted(25, 29) Source(23, 29) + SourceIndex(0) +10>Emitted(25, 32) Source(23, 32) + SourceIndex(0) +11>Emitted(25, 33) Source(23, 33) + SourceIndex(0) +12>Emitted(25, 34) Source(23, 34) + SourceIndex(0) +13>Emitted(25, 35) Source(23, 35) + SourceIndex(0) +--- +>>> "You win!"; +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^ +3 > ^ +1 > + > +2 > "You win!" +3 > +1 >Emitted(26, 13) Source(24, 13) + SourceIndex(0) +2 >Emitted(26, 23) Source(24, 23) + SourceIndex(0) +3 >Emitted(26, 24) Source(24, 23) + SourceIndex(0) +--- +>>> return { +1 >^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^-> +1 > + > +2 > return +3 > +1 >Emitted(27, 13) Source(25, 13) + SourceIndex(0) +2 >Emitted(27, 19) Source(25, 19) + SourceIndex(0) +3 >Emitted(27, 20) Source(25, 20) + SourceIndex(0) +--- +>>> cProp: 1, +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->{ + > +2 > cProp +3 > : +4 > 1 +1->Emitted(28, 17) Source(26, 17) + SourceIndex(0) +2 >Emitted(28, 22) Source(26, 22) + SourceIndex(0) +3 >Emitted(28, 24) Source(26, 24) + SourceIndex(0) +4 >Emitted(28, 25) Source(26, 25) + SourceIndex(0) +--- +>>> dProp: function () { return _this; }, +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^^ +6 > ^^^^^ +7 > ^^ +8 > ^ +9 > ^^^^^^^^-> +1->, + > +2 > dProp +3 > : +4 > () => +5 > +6 > this +7 > +8 > this +1->Emitted(29, 17) Source(27, 17) + SourceIndex(0) +2 >Emitted(29, 22) Source(27, 22) + SourceIndex(0) +3 >Emitted(29, 24) Source(27, 24) + SourceIndex(0) +4 >Emitted(29, 38) Source(27, 30) + SourceIndex(0) +5 >Emitted(29, 45) Source(27, 30) + SourceIndex(0) +6 >Emitted(29, 50) Source(27, 34) + SourceIndex(0) +7 >Emitted(29, 52) Source(27, 30) + SourceIndex(0) +8 >Emitted(29, 53) Source(27, 34) + SourceIndex(0) +--- +>>> foo: function () { return "You win!!!!!"; } +1->^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^^^^^^^^^^^^^^^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +9 > ^ +1->, + > +2 > foo +3 > () { +4 > return +5 > +6 > "You win!!!!!" +7 > +8 > +9 > } +1->Emitted(30, 17) Source(28, 17) + SourceIndex(0) +2 >Emitted(30, 20) Source(28, 20) + SourceIndex(0) +3 >Emitted(30, 36) Source(28, 25) + SourceIndex(0) +4 >Emitted(30, 42) Source(28, 31) + SourceIndex(0) +5 >Emitted(30, 43) Source(28, 32) + SourceIndex(0) +6 >Emitted(30, 57) Source(28, 46) + SourceIndex(0) +7 >Emitted(30, 58) Source(28, 46) + SourceIndex(0) +8 >Emitted(30, 59) Source(28, 47) + SourceIndex(0) +9 >Emitted(30, 60) Source(28, 48) + SourceIndex(0) +--- +>>> }; +1 >^^^^^^^^^^^^^ +2 > ^ +1 > + > } +2 > ; +1 >Emitted(31, 14) Source(29, 14) + SourceIndex(0) +2 >Emitted(31, 15) Source(29, 15) + SourceIndex(0) +--- +>>> } +1 >^^^^^^^^ +2 > ^ +3 > ^^^^-> +1 > + > +2 > } +1 >Emitted(32, 9) Source(30, 9) + SourceIndex(0) +2 >Emitted(32, 10) Source(30, 10) + SourceIndex(0) +--- +>>> else +1->^^^^^^^^ +2 > ^^^^ +3 > ^^^^^^^^^^^^^-> +1-> + > +2 > else +1->Emitted(33, 9) Source(31, 9) + SourceIndex(0) +2 >Emitted(33, 13) Source(31, 13) + SourceIndex(0) +--- +>>> return null; +1->^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^ +5 > ^ +1-> + > +2 > return +3 > +4 > null +5 > ; +1->Emitted(34, 13) Source(32, 13) + SourceIndex(0) +2 >Emitted(34, 19) Source(32, 19) + SourceIndex(0) +3 >Emitted(34, 20) Source(32, 20) + SourceIndex(0) +4 >Emitted(34, 24) Source(32, 24) + SourceIndex(0) +5 >Emitted(34, 25) Source(32, 25) + SourceIndex(0) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(35, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(35, 6) Source(33, 6) + SourceIndex(0) +--- +>>> return D; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(36, 5) Source(34, 1) + SourceIndex(0) +2 >Emitted(36, 13) Source(34, 2) + SourceIndex(0) +--- +>>>}(C)); +1 > +2 >^ +3 > +4 > ^ +5 > ^ +6 > ^^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class D extends +5 > C +6 > { + > dProp = () => this; + > + > constructor(a = 100) { + > super(a); + > + > if (Math.random() < 0.5) { + > "You win!" + > return { + > cProp: 1, + > dProp: () => this, + > foo() { return "You win!!!!!" } + > }; + > } + > else + > return null; + > } + > } +1 >Emitted(37, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(37, 2) Source(34, 2) + SourceIndex(0) +3 >Emitted(37, 2) Source(17, 1) + SourceIndex(0) +4 >Emitted(37, 3) Source(17, 17) + SourceIndex(0) +5 >Emitted(37, 4) Source(17, 18) + SourceIndex(0) +6 >Emitted(37, 7) Source(34, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=derivedClassConstructorWithExplicitReturns01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.symbols b/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.symbols new file mode 100644 index 00000000000..ee043fcfe71 --- /dev/null +++ b/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.symbols @@ -0,0 +1,66 @@ +=== tests/cases/compiler/derivedClassConstructorWithExplicitReturns01.ts === + +class C { +>C : Symbol(C, Decl(derivedClassConstructorWithExplicitReturns01.ts, 0, 0)) + + cProp = 10; +>cProp : Symbol(C.cProp, Decl(derivedClassConstructorWithExplicitReturns01.ts, 1, 9)) + + foo() { return "this never gets used."; } +>foo : Symbol(C.foo, Decl(derivedClassConstructorWithExplicitReturns01.ts, 2, 15)) + + constructor(value: number) { +>value : Symbol(value, Decl(derivedClassConstructorWithExplicitReturns01.ts, 6, 16)) + + return { + cProp: value, +>cProp : Symbol(cProp, Decl(derivedClassConstructorWithExplicitReturns01.ts, 7, 16)) +>value : Symbol(value, Decl(derivedClassConstructorWithExplicitReturns01.ts, 6, 16)) + + foo() { +>foo : Symbol(foo, Decl(derivedClassConstructorWithExplicitReturns01.ts, 8, 25)) + + return "well this looks kinda C-ish."; + } + } + } +} + +class D extends C { +>D : Symbol(D, Decl(derivedClassConstructorWithExplicitReturns01.ts, 14, 1)) +>C : Symbol(C, Decl(derivedClassConstructorWithExplicitReturns01.ts, 0, 0)) + + dProp = () => this; +>dProp : Symbol(D.dProp, Decl(derivedClassConstructorWithExplicitReturns01.ts, 16, 19)) +>this : Symbol(D, Decl(derivedClassConstructorWithExplicitReturns01.ts, 14, 1)) + + constructor(a = 100) { +>a : Symbol(a, Decl(derivedClassConstructorWithExplicitReturns01.ts, 19, 16)) + + super(a); +>super : Symbol(C, Decl(derivedClassConstructorWithExplicitReturns01.ts, 0, 0)) +>a : Symbol(a, Decl(derivedClassConstructorWithExplicitReturns01.ts, 19, 16)) + + if (Math.random() < 0.5) { +>Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.d.ts, --, --)) + + "You win!" + return { + cProp: 1, +>cProp : Symbol(cProp, Decl(derivedClassConstructorWithExplicitReturns01.ts, 24, 20)) + + dProp: () => this, +>dProp : Symbol(dProp, Decl(derivedClassConstructorWithExplicitReturns01.ts, 25, 25)) +>this : Symbol(D, Decl(derivedClassConstructorWithExplicitReturns01.ts, 14, 1)) + + foo() { return "You win!!!!!" } +>foo : Symbol(foo, Decl(derivedClassConstructorWithExplicitReturns01.ts, 26, 34)) + + }; + } + else + return null; + } +} diff --git a/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.types b/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.types new file mode 100644 index 00000000000..d361e783ef0 --- /dev/null +++ b/tests/baselines/reference/derivedClassConstructorWithExplicitReturns01.types @@ -0,0 +1,85 @@ +=== tests/cases/compiler/derivedClassConstructorWithExplicitReturns01.ts === + +class C { +>C : C + + cProp = 10; +>cProp : number +>10 : 10 + + foo() { return "this never gets used."; } +>foo : () => string +>"this never gets used." : "this never gets used." + + constructor(value: number) { +>value : number + + return { +>{ cProp: value, foo() { return "well this looks kinda C-ish."; } } : { cProp: number; foo(): string; } + + cProp: value, +>cProp : number +>value : number + + foo() { +>foo : () => string + + return "well this looks kinda C-ish."; +>"well this looks kinda C-ish." : "well this looks kinda C-ish." + } + } + } +} + +class D extends C { +>D : D +>C : C + + dProp = () => this; +>dProp : () => this +>() => this : () => this +>this : this + + constructor(a = 100) { +>a : number +>100 : 100 + + super(a); +>super(a) : void +>super : typeof C +>a : number + + if (Math.random() < 0.5) { +>Math.random() < 0.5 : boolean +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number +>0.5 : 0.5 + + "You win!" +>"You win!" : "You win!" + + return { +>{ cProp: 1, dProp: () => this, foo() { return "You win!!!!!" } } : { cProp: number; dProp: () => this; foo(): string; } + + cProp: 1, +>cProp : number +>1 : 1 + + dProp: () => this, +>dProp : () => this +>() => this : () => this +>this : this + + foo() { return "You win!!!!!" } +>foo : () => string +>"You win!!!!!" : "You win!!!!!" + + }; + } + else + return null; +>null : null + } +} diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index 2e6ac2c7934..e76f3445c8e 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -47,6 +47,8 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { + var _this; + return _this; } return Derived; }(Base)); @@ -58,21 +60,27 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - var r2 = function () { return _super.call(this); }; // error for misplaced super call (nested function) + var _this; + var r2 = function () { return _this = _super.call(this) || this; }; // error for misplaced super call (nested function) + return _this; } return Derived2; }(Base2)); var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - var r = function () { _super.call(this); }; // error + var _this; + var r = function () { _this = _super.call(this) || this; }; // error + return _this; } return Derived3; }(Base2)); var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4() { - var r = _super.call(this); // ok + var _this; + var r = _this = _super.call(this) || this; // ok + return _this; } return Derived4; }(Base2)); diff --git a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js index 7dbb901362f..7f6b83593ca 100644 --- a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js +++ b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js @@ -38,7 +38,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived.prototype.x = function () { return 1; diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index 0c7a21232e6..8224473cb54 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -68,7 +68,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -89,7 +89,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js index a44d4340b8f..4753e395390 100644 --- a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js +++ b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js @@ -32,7 +32,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -45,7 +45,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js index c81c6f048f5..981c072d47c 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js +++ b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js @@ -32,7 +32,7 @@ var BaseClass = (function () { var DerivedClass = (function (_super) { __extends(DerivedClass, _super); function DerivedClass() { - _super.call(this); + return _super.call(this) || this; } DerivedClass.prototype._init = function () { }; diff --git a/tests/baselines/reference/derivedClassOverridesPrivates.js b/tests/baselines/reference/derivedClassOverridesPrivates.js index cd486152c1c..1a58c038fea 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivates.js +++ b/tests/baselines/reference/derivedClassOverridesPrivates.js @@ -29,7 +29,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -41,7 +41,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js index 5b8af9e85bf..b8997769eb7 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -66,7 +66,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived(a) { - _super.call(this, x); + return _super.call(this, x) || this; } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index 5c7d73d5dfd..6797eef0e77 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -94,7 +94,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived(a) { - _super.call(this, a); + return _super.call(this, a) || this; } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { @@ -131,7 +131,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js index ebb675a26db..d0d9d8fa0f5 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -103,14 +103,14 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1(a) { - _super.call(this, a); + return _super.call(this, a) || this; } return Derived1; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2(a) { - _super.call(this, a); + return _super.call(this, a) || this; } Derived2.prototype.b = function (a) { }; return Derived2; @@ -118,7 +118,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3(a) { - _super.call(this, a); + return _super.call(this, a) || this; } Object.defineProperty(Derived3.prototype, "c", { get: function () { return x; }, @@ -130,7 +130,7 @@ var Derived3 = (function (_super) { var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4(a) { - _super.call(this, a); + return _super.call(this, a) || this; } Object.defineProperty(Derived4.prototype, "c", { set: function (v) { }, @@ -142,21 +142,21 @@ var Derived4 = (function (_super) { var Derived5 = (function (_super) { __extends(Derived5, _super); function Derived5(a) { - _super.call(this, a); + return _super.call(this, a) || this; } return Derived5; }(Base)); var Derived6 = (function (_super) { __extends(Derived6, _super); function Derived6(a) { - _super.call(this, a); + return _super.call(this, a) || this; } return Derived6; }(Base)); var Derived7 = (function (_super) { __extends(Derived7, _super); function Derived7(a) { - _super.call(this, a); + return _super.call(this, a) || this; } Derived7.s = function (a) { }; return Derived7; @@ -164,7 +164,7 @@ var Derived7 = (function (_super) { var Derived8 = (function (_super) { __extends(Derived8, _super); function Derived8(a) { - _super.call(this, a); + return _super.call(this, a) || this; } Object.defineProperty(Derived8, "t", { get: function () { return x; }, @@ -176,7 +176,7 @@ var Derived8 = (function (_super) { var Derived9 = (function (_super) { __extends(Derived9, _super); function Derived9(a) { - _super.call(this, a); + return _super.call(this, a) || this; } Object.defineProperty(Derived9, "t", { set: function (v) { }, @@ -188,7 +188,7 @@ var Derived9 = (function (_super) { var Derived10 = (function (_super) { __extends(Derived10, _super); function Derived10(a) { - _super.call(this, a); + return _super.call(this, a) || this; } return Derived10; }(Base)); diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js index b8a15ee8b6c..06f80997600 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js @@ -30,14 +30,14 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived1; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived1)); diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index b62f0d8f7d3..7943d904dea 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -92,7 +92,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived(a) { - _super.call(this, x); + return _super.call(this, x) || this; } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { @@ -129,7 +129,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js index 147e6edbbb4..e42ff9c9e1d 100644 --- a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js +++ b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js @@ -37,7 +37,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -49,7 +49,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassParameterProperties.js b/tests/baselines/reference/derivedClassParameterProperties.js index 8e5fa82cf0f..27dcc4b7d5d 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.js +++ b/tests/baselines/reference/derivedClassParameterProperties.js @@ -109,73 +109,86 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived(y) { + var _this; var a = 1; - _super.call(this); // ok + _this = _super.call(this) || this; // ok + return _this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2(y) { - this.y = y; + var _this; + _this.y = y; var a = 1; - _super.call(this); // error + _this = _super.call(this) || this; // error + return _this; } return Derived2; }(Base)); var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3(y) { - _super.call(this); // ok - this.y = y; + var _this = _super.call(this) || this; + _this.y = y; var a = 1; + return _this; } return Derived3; }(Base)); var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4(y) { - this.a = 1; + var _this; + _this.a = 1; var b = 2; - _super.call(this); // error + _this = _super.call(this) || this; // error + return _this; } return Derived4; }(Base)); var Derived5 = (function (_super) { __extends(Derived5, _super); function Derived5(y) { - _super.call(this); // ok - this.a = 1; + var _this = _super.call(this) || this; + _this.a = 1; var b = 2; + return _this; } return Derived5; }(Base)); var Derived6 = (function (_super) { __extends(Derived6, _super); function Derived6(y) { - this.a = 1; + var _this; + _this.a = 1; var b = 2; - _super.call(this); // error: "super" has to be called before "this" accessing + _this = _super.call(this) || this; // error: "super" has to be called before "this" accessing + return _this; } return Derived6; }(Base)); var Derived7 = (function (_super) { __extends(Derived7, _super); function Derived7(y) { - this.a = 1; - this.a = 3; - this.b = 3; - _super.call(this); // error + var _this; + _this.a = 1; + _this.a = 3; + _this.b = 3; + _this = _super.call(this) || this; // error + return _this; } return Derived7; }(Base)); var Derived8 = (function (_super) { __extends(Derived8, _super); function Derived8(y) { - _super.call(this); // ok - this.a = 1; - this.a = 3; - this.b = 3; + var _this = _super.call(this) || this; + _this.a = 1; + _this.a = 3; + _this.b = 3; + return _this; } return Derived8; }(Base)); @@ -188,20 +201,23 @@ var Base2 = (function () { var Derived9 = (function (_super) { __extends(Derived9, _super); function Derived9(y) { - this.a = 1; - this.a = 3; - this.b = 3; - _super.call(this); // error + var _this; + _this.a = 1; + _this.a = 3; + _this.b = 3; + _this = _super.call(this) || this; // error + return _this; } return Derived9; }(Base2)); var Derived10 = (function (_super) { __extends(Derived10, _super); function Derived10(y) { - _super.call(this); // ok - this.a = 1; - this.a = 3; - this.b = 3; + var _this = _super.call(this) || this; + _this.a = 1; + _this.a = 3; + _this.b = 3; + return _this; } return Derived10; }(Base2)); diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js index 50408d3bee7..b778d7bbca2 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js @@ -46,37 +46,38 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); - this.a = _super.call(this); + var _this = _super.apply(this, arguments) || this; + _this.a = _this = _super.call(this) || this; + return _this; } Derived.prototype.b = function () { - _super.call(this); + _this = _super.call(this) || this; }; Object.defineProperty(Derived.prototype, "C", { get: function () { - _super.call(this); + _this = _super.call(this) || this; return 1; }, set: function (v) { - _super.call(this); + _this = _super.call(this) || this; }, enumerable: true, configurable: true }); Derived.b = function () { - _super.call(this); + _this = _super.call(this) || this; }; Object.defineProperty(Derived, "C", { get: function () { - _super.call(this); + _this = _super.call(this) || this; return 1; }, set: function (v) { - _super.call(this); + _this = _super.call(this) || this; }, enumerable: true, configurable: true }); return Derived; }(Base)); -Derived.a = _super.call(this); +Derived.a = _this = _super.call(this) || this; diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index 1c88306bf3a..504d414a608 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -42,32 +42,34 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.call(this, this); // ok + return _super.call(this, _this) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2(a) { - _super.call(this, this); // error - this.a = a; + var _this = _super.call(this, _this) || this; + _this.a = a; + return _this; } return Derived2; }(Base)); var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3(a) { - var _this = this; - _super.call(this, function () { return _this; }); // error - this.a = a; + var _this = _super.call(this, function () { return _this; }) || this; + _this.a = a; + return _this; } return Derived3; }(Base)); var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4(a) { - _super.call(this, function () { return this; }); // ok - this.a = a; + var _this = _super.call(this, function () { return this; }) || this; + _this.a = a; + return _this; } return Derived4; }(Base)); diff --git a/tests/baselines/reference/derivedClassTransitivity.js b/tests/baselines/reference/derivedClassTransitivity.js index 38c465492e6..a76ac8101a0 100644 --- a/tests/baselines/reference/derivedClassTransitivity.js +++ b/tests/baselines/reference/derivedClassTransitivity.js @@ -36,7 +36,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.foo = function () { }; // ok to drop parameters return D; @@ -44,7 +44,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } E.prototype.foo = function (x) { }; // ok to add optional parameters return E; diff --git a/tests/baselines/reference/derivedClassTransitivity2.js b/tests/baselines/reference/derivedClassTransitivity2.js index 5d08905a605..a3894863696 100644 --- a/tests/baselines/reference/derivedClassTransitivity2.js +++ b/tests/baselines/reference/derivedClassTransitivity2.js @@ -36,7 +36,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.foo = function (x) { }; // ok to drop parameters return D; @@ -44,7 +44,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } E.prototype.foo = function (x, y) { }; // ok to add optional parameters return E; diff --git a/tests/baselines/reference/derivedClassTransitivity3.js b/tests/baselines/reference/derivedClassTransitivity3.js index be7e97a8fc5..71dfecb346f 100644 --- a/tests/baselines/reference/derivedClassTransitivity3.js +++ b/tests/baselines/reference/derivedClassTransitivity3.js @@ -36,7 +36,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.foo = function (x) { }; // ok to drop parameters return D; @@ -44,7 +44,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } E.prototype.foo = function (x, y) { }; // ok to add optional parameters return E; diff --git a/tests/baselines/reference/derivedClassTransitivity4.js b/tests/baselines/reference/derivedClassTransitivity4.js index 0c70f03218e..0030ce702d8 100644 --- a/tests/baselines/reference/derivedClassTransitivity4.js +++ b/tests/baselines/reference/derivedClassTransitivity4.js @@ -36,7 +36,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.foo = function () { }; // ok to drop parameters return D; @@ -44,7 +44,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } E.prototype.foo = function (x) { }; // ok to add optional parameters return E; diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index 34af167011d..2a199e55861 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -91,7 +91,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(D.prototype, "X", { get: function () { @@ -119,7 +119,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(E.prototype, "X", { get: function () { return ''; }, diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index 2c0775efc19..0542815c4e4 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -46,7 +46,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived.prototype.fn = function () { return ''; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index 540be97d165..41869cad416 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -56,7 +56,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived.prototype.fn = function () { return ''; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 93d5b49fcd0..10ae3cb35c8 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -45,7 +45,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived.fn = function () { return ''; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index b58acc01082..3f2c2a3b811 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -58,7 +58,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived.fn = function () { return ''; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js index 479beebbbfe..7a6a7ecbb63 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js @@ -41,9 +41,10 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); - this.x = 1; - this.y = 'hello'; + var _this = _super.apply(this, arguments) || this; + _this.x = 1; + _this.y = 'hello'; + return _this; } return Derived; }(Base)); @@ -58,9 +59,10 @@ var Base2 = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); - this.x = 2; - this.y = null; + var _this = _super.apply(this, arguments) || this; + _this.x = 2; + _this.y = null; + return _this; } return D; }(Base2)); diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js index 4dc35c5e006..62beb4bf28f 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js @@ -49,9 +49,10 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); - this.x = 1; - this.y = 'hello'; + var _this = _super.apply(this, arguments) || this; + _this.x = 1; + _this.y = 'hello'; + return _this; } return Derived; }(Base)); @@ -68,9 +69,10 @@ var Base2 = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); - this.x = 2; - this.y = null; + var _this = _super.apply(this, arguments) || this; + _this.x = 2; + _this.y = null; + return _this; } return D; }(Base2)); diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js index 3b0a673d378..c96d0c96723 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js @@ -63,18 +63,20 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived(y, z) { - _super.call(this, 2); - this.b = ''; - this.b = y; + var _this = _super.call(this, 2) || this; + _this.b = ''; + _this.b = y; + return _this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); - this.x = 1; - this.y = 'hello'; + var _this = _super.apply(this, arguments) || this; + _this.x = 1; + _this.y = 'hello'; + return _this; } return Derived2; }(Derived)); @@ -90,18 +92,20 @@ var Base2 = (function () { var D = (function (_super) { __extends(D, _super); function D(y, z) { - _super.call(this, 2); - this.b = null; - this.b = y; + var _this = _super.call(this, 2) || this; + _this.b = null; + _this.b = y; + return _this; } return D; }(Base)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); - this.x = 2; - this.y = null; + var _this = _super.apply(this, arguments) || this; + _this.x = 2; + _this.y = null; + return _this; } return D2; }(D)); diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index b6103940b33..3e097a9b139 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -39,7 +39,7 @@ var __extends = (this && this.__extends) || function (d, b) { var Red = (function (_super) { __extends(Red, _super); function Red() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Red.prototype.shade = function () { var _this = this; @@ -58,7 +58,7 @@ var Color = (function () { var Blue = (function (_super) { __extends(Blue, _super); function Blue() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Blue.prototype.shade = function () { var _this = this; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index 56daf4b7310..1822f3fcc47 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -64,7 +64,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(D.prototype, "X", { get: function () { @@ -92,7 +92,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(E.prototype, "X", { get: function () { return ''; } // error diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js index 2e0a561e846..c17922e05ee 100644 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js +++ b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js @@ -34,7 +34,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived.prototype.foo = function (x) { return null; diff --git a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js index cfbe44166c9..6fe690fd692 100644 --- a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js +++ b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js @@ -39,7 +39,7 @@ var Derived = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/destructuringParameterDeclaration5.js b/tests/baselines/reference/destructuringParameterDeclaration5.js index 2df6ce46b2c..7ba178823df 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration5.js +++ b/tests/baselines/reference/destructuringParameterDeclaration5.js @@ -65,7 +65,7 @@ var Class = (function () { var SubClass = (function (_super) { __extends(SubClass, _super); function SubClass() { - _super.call(this); + return _super.call(this) || this; } return SubClass; }(Class)); @@ -77,7 +77,7 @@ var D = (function () { var SubD = (function (_super) { __extends(SubD, _super); function SubD() { - _super.call(this); + return _super.call(this) || this; } return SubD; }(D)); diff --git a/tests/baselines/reference/dottedModuleName.js b/tests/baselines/reference/dottedModuleName.js index 6a8f33ca7bb..32d98676d6c 100644 --- a/tests/baselines/reference/dottedModuleName.js +++ b/tests/baselines/reference/dottedModuleName.js @@ -37,7 +37,6 @@ var M; })(X = N.X || (N.X = {})); })(N = M.N || (M.N = {})); })(M || (M = {})); -var M; (function (M) { var N; (function (N) { diff --git a/tests/baselines/reference/dottedModuleName2.js b/tests/baselines/reference/dottedModuleName2.js index 4cbffa0e12f..33c3f459f74 100644 --- a/tests/baselines/reference/dottedModuleName2.js +++ b/tests/baselines/reference/dottedModuleName2.js @@ -60,7 +60,6 @@ var AA; })(AA || (AA = {})); var tmpOK = AA.B.x; var tmpError = A.B.x; -var A; (function (A) { var B; (function (B) { diff --git a/tests/baselines/reference/duplicateAnonymousInners1.js b/tests/baselines/reference/duplicateAnonymousInners1.js index 24f79566d56..8cf1dc89a45 100644 --- a/tests/baselines/reference/duplicateAnonymousInners1.js +++ b/tests/baselines/reference/duplicateAnonymousInners1.js @@ -41,7 +41,6 @@ var Foo; // Inner should show up in intellisense Foo.Outer = 0; })(Foo || (Foo = {})); -var Foo; (function (Foo) { // Should not be an error var Helper = (function () { diff --git a/tests/baselines/reference/duplicateAnonymousModuleClasses.js b/tests/baselines/reference/duplicateAnonymousModuleClasses.js index 74f80a65d40..e27d6987e80 100644 --- a/tests/baselines/reference/duplicateAnonymousModuleClasses.js +++ b/tests/baselines/reference/duplicateAnonymousModuleClasses.js @@ -65,7 +65,6 @@ var F; return Helper; }()); })(F || (F = {})); -var F; (function (F) { // Should not be an error var Helper = (function () { @@ -82,7 +81,6 @@ var Foo; return Helper; }()); })(Foo || (Foo = {})); -var Foo; (function (Foo) { // Should not be an error var Helper = (function () { @@ -101,7 +99,6 @@ var Gar; return Helper; }()); })(Foo || (Foo = {})); - var Foo; (function (Foo) { // Should not be an error var Helper = (function () { diff --git a/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js b/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js index eae9e9e4de1..37fb4fcb633 100644 --- a/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js +++ b/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js @@ -62,12 +62,10 @@ var M; }()); M.I = I; })(M || (M = {})); -var M; (function (M) { function f() { } M.f = f; })(M || (M = {})); -var M; (function (M) { var f = (function () { function f() { @@ -76,11 +74,9 @@ var M; }()); // error M.f = f; })(M || (M = {})); -var M; (function (M) { function g() { } })(M || (M = {})); -var M; (function (M) { var g = (function () { function g() { @@ -89,7 +85,6 @@ var M; }()); // no error M.g = g; })(M || (M = {})); -var M; (function (M) { var C = (function () { function C() { @@ -98,15 +93,12 @@ var M; }()); M.C = C; })(M || (M = {})); -var M; (function (M) { function C() { } // no error })(M || (M = {})); -var M; (function (M) { M.v = 3; })(M || (M = {})); -var M; (function (M) { M.v = 3; // error for redeclaring var in a different parent })(M || (M = {})); @@ -115,7 +107,6 @@ var Foo = (function () { } return Foo; }()); -var Foo; (function (Foo) { })(Foo || (Foo = {})); var N; diff --git a/tests/baselines/reference/duplicateSymbolsExportMatching.js b/tests/baselines/reference/duplicateSymbolsExportMatching.js index bb04e3c72a4..9f977f5fd58 100644 --- a/tests/baselines/reference/duplicateSymbolsExportMatching.js +++ b/tests/baselines/reference/duplicateSymbolsExportMatching.js @@ -75,7 +75,6 @@ define(["require", "exports"], function (require, exports) { (function (inst) { var t; })(inst || (inst = {})); - var inst; (function (inst) { var t; })(inst = M.inst || (M.inst = {})); @@ -86,7 +85,6 @@ define(["require", "exports"], function (require, exports) { var v; var w; })(M2 || (M2 = {})); - var M; (function (M) { var F; (function (F) { @@ -95,14 +93,12 @@ define(["require", "exports"], function (require, exports) { function F() { } // Only one error for duplicate identifier (don't consider visibility) M.F = F; })(M || (M = {})); - var M; (function (M) { var C = (function () { function C() { } return C; }()); - var C; (function (C) { var t; })(C = M.C || (M.C = {})); diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js index 88ce3f1418b..05b061116d3 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js @@ -30,8 +30,9 @@ var B = (function (_super) { function B(x) { "use strict"; 'someStringForEgngInject'; - _super.call(this); - this.x = x; + var _this = _super.call(this) || this; + _this.x = x; + return _this; } return B; }(A)); diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js index 920ad1f7bda..2cf2cb02073 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js @@ -32,8 +32,9 @@ var B = (function (_super) { function B() { "use strict"; 'someStringForEgngInject'; - _super.call(this); - this.blub = 12; + var _this = _super.call(this) || this; + _this.blub = 12; + return _this; } return B; }(A)); diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js index 3fa18140034..eaa52e39285 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js @@ -30,9 +30,10 @@ var B = (function (_super) { function B(x) { "use strict"; 'someStringForEgngInject'; - _super.call(this); - this.x = x; - this.blah = 2; + var _this = _super.call(this) || this; + _this.x = x; + _this.blah = 2; + return _this; } return B; }(A)); diff --git a/tests/baselines/reference/emitThisInSuperMethodCall.js b/tests/baselines/reference/emitThisInSuperMethodCall.js index 1350ed9d4c8..1f7ed8bfa94 100644 --- a/tests/baselines/reference/emitThisInSuperMethodCall.js +++ b/tests/baselines/reference/emitThisInSuperMethodCall.js @@ -43,7 +43,7 @@ var User = (function () { var RegisteredUser = (function (_super) { __extends(RegisteredUser, _super); function RegisteredUser() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } RegisteredUser.prototype.f = function () { (function () { diff --git a/tests/baselines/reference/emptyModuleName.js b/tests/baselines/reference/emptyModuleName.js index 5c85d39e1ec..3ed21cf217a 100644 --- a/tests/baselines/reference/emptyModuleName.js +++ b/tests/baselines/reference/emptyModuleName.js @@ -14,7 +14,7 @@ var A = require(""); var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/enumAssignabilityInInheritance.js b/tests/baselines/reference/enumAssignabilityInInheritance.js index dc5237108f5..c5ff19cf239 100644 --- a/tests/baselines/reference/enumAssignabilityInInheritance.js +++ b/tests/baselines/reference/enumAssignabilityInInheritance.js @@ -145,7 +145,6 @@ var E2; })(E2 || (E2 = {})); var r4 = foo13(E.A); function f() { } -var f; (function (f) { f.bar = 1; })(f || (f = {})); @@ -155,7 +154,6 @@ var CC = (function () { } return CC; }()); -var CC; (function (CC) { CC.bar = 1; })(CC || (CC = {})); diff --git a/tests/baselines/reference/enumAssignmentCompat.js b/tests/baselines/reference/enumAssignmentCompat.js index b4762d182d4..9cdac291b99 100644 --- a/tests/baselines/reference/enumAssignmentCompat.js +++ b/tests/baselines/reference/enumAssignmentCompat.js @@ -48,7 +48,6 @@ var W; }()); W.D = D; })(W || (W = {})); -var W; (function (W) { W[W["a"] = 0] = "a"; W[W["b"] = 1] = "b"; diff --git a/tests/baselines/reference/enumAssignmentCompat2.js b/tests/baselines/reference/enumAssignmentCompat2.js index 0cc3b6befbf..5675bc86fe0 100644 --- a/tests/baselines/reference/enumAssignmentCompat2.js +++ b/tests/baselines/reference/enumAssignmentCompat2.js @@ -44,7 +44,6 @@ var W; W[W["b"] = 1] = "b"; W[W["c"] = 2] = "c"; })(W || (W = {})); -var W; (function (W) { var D = (function () { function D() { diff --git a/tests/baselines/reference/enumAssignmentCompat3.js b/tests/baselines/reference/enumAssignmentCompat3.js index 74f74ab1652..62f05c18b5f 100644 --- a/tests/baselines/reference/enumAssignmentCompat3.js +++ b/tests/baselines/reference/enumAssignmentCompat3.js @@ -164,7 +164,6 @@ var Merged2; E[E["c"] = 2] = "c"; })(Merged2.E || (Merged2.E = {})); var E = Merged2.E; - var E; (function (E) { E.d = 5; })(E = Merged2.E || (Merged2.E = {})); diff --git a/tests/baselines/reference/enumBasics1.js b/tests/baselines/reference/enumBasics1.js index e5c9c6d29d4..76e60cde355 100644 --- a/tests/baselines/reference/enumBasics1.js +++ b/tests/baselines/reference/enumBasics1.js @@ -69,7 +69,6 @@ var E2; E2[E2["A"] = 0] = "A"; E2[E2["B"] = 1] = "B"; })(E2 || (E2 = {})); -var E2; (function (E2) { E2[E2["C"] = 0] = "C"; E2[E2["D"] = 1] = "D"; diff --git a/tests/baselines/reference/enumGenericTypeClash.js b/tests/baselines/reference/enumGenericTypeClash.js index 931df9f9d98..31c41be85c2 100644 --- a/tests/baselines/reference/enumGenericTypeClash.js +++ b/tests/baselines/reference/enumGenericTypeClash.js @@ -9,7 +9,6 @@ var X = (function () { } return X; }()); -var X; (function (X) { X[X["MyVal"] = 0] = "MyVal"; })(X || (X = {})); diff --git a/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.js b/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.js index 56f40eef6e0..9cb6169b2af 100644 --- a/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.js +++ b/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.js @@ -151,7 +151,6 @@ var E2; E2[E2["A"] = 0] = "A"; })(E2 || (E2 = {})); function f() { } -var f; (function (f) { f.bar = 1; })(f || (f = {})); @@ -160,7 +159,6 @@ var c = (function () { } return c; }()); -var c; (function (c) { c.bar = 1; })(c || (c = {})); diff --git a/tests/baselines/reference/enumMerging.js b/tests/baselines/reference/enumMerging.js index 5dc5a475b40..d830b03cac9 100644 --- a/tests/baselines/reference/enumMerging.js +++ b/tests/baselines/reference/enumMerging.js @@ -77,7 +77,6 @@ var M1; EImpl1[EImpl1["B"] = 1] = "B"; EImpl1[EImpl1["C"] = 2] = "C"; })(EImpl1 || (EImpl1 = {})); - var EImpl1; (function (EImpl1) { EImpl1[EImpl1["D"] = 1] = "D"; EImpl1[EImpl1["E"] = 2] = "E"; @@ -122,7 +121,6 @@ var M3; EInit[EInit["A"] = 0] = "A"; EInit[EInit["B"] = 1] = "B"; })(EInit || (EInit = {})); - var EInit; (function (EInit) { EInit[EInit["C"] = 1] = "C"; EInit[EInit["D"] = 2] = "D"; @@ -160,7 +158,6 @@ var M6; var Color = A.Color; })(A = M6.A || (M6.A = {})); })(M6 || (M6 = {})); -var M6; (function (M6) { var A; (function (A) { diff --git a/tests/baselines/reference/enumMergingErrors.js b/tests/baselines/reference/enumMergingErrors.js index 46855093816..c9b4aaef754 100644 --- a/tests/baselines/reference/enumMergingErrors.js +++ b/tests/baselines/reference/enumMergingErrors.js @@ -59,7 +59,6 @@ var M; })(M.E3 || (M.E3 = {})); var E3 = M.E3; })(M || (M = {})); -var M; (function (M) { (function (E1) { E1[E1["B"] = 'foo'.length] = "B"; @@ -74,7 +73,6 @@ var M; })(M.E3 || (M.E3 = {})); var E3 = M.E3; })(M || (M = {})); -var M; (function (M) { (function (E1) { E1[E1["C"] = 0] = "C"; @@ -97,14 +95,12 @@ var M1; })(M1.E1 || (M1.E1 = {})); var E1 = M1.E1; })(M1 || (M1 = {})); -var M1; (function (M1) { (function (E1) { E1[E1["B"] = 0] = "B"; })(M1.E1 || (M1.E1 = {})); var E1 = M1.E1; })(M1 || (M1 = {})); -var M1; (function (M1) { (function (E1) { E1[E1["C"] = 0] = "C"; @@ -119,14 +115,12 @@ var M2; })(M2.E1 || (M2.E1 = {})); var E1 = M2.E1; })(M2 || (M2 = {})); -var M2; (function (M2) { (function (E1) { E1[E1["B"] = 0] = "B"; })(M2.E1 || (M2.E1 = {})); var E1 = M2.E1; })(M2 || (M2 = {})); -var M2; (function (M2) { (function (E1) { E1[E1["C"] = 0] = "C"; diff --git a/tests/baselines/reference/enumsWithMultipleDeclarations1.js b/tests/baselines/reference/enumsWithMultipleDeclarations1.js index 35da126205d..67bca48db53 100644 --- a/tests/baselines/reference/enumsWithMultipleDeclarations1.js +++ b/tests/baselines/reference/enumsWithMultipleDeclarations1.js @@ -16,11 +16,9 @@ var E; (function (E) { E[E["A"] = 0] = "A"; })(E || (E = {})); -var E; (function (E) { E[E["B"] = 0] = "B"; })(E || (E = {})); -var E; (function (E) { E[E["C"] = 0] = "C"; })(E || (E = {})); diff --git a/tests/baselines/reference/enumsWithMultipleDeclarations2.js b/tests/baselines/reference/enumsWithMultipleDeclarations2.js index 53d0d717711..55cab82bbc5 100644 --- a/tests/baselines/reference/enumsWithMultipleDeclarations2.js +++ b/tests/baselines/reference/enumsWithMultipleDeclarations2.js @@ -16,11 +16,9 @@ var E; (function (E) { E[E["A"] = 0] = "A"; })(E || (E = {})); -var E; (function (E) { E[E["B"] = 1] = "B"; })(E || (E = {})); -var E; (function (E) { E[E["C"] = 0] = "C"; })(E || (E = {})); diff --git a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js index 96f6c65b85c..ed2e1aa7f06 100644 --- a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js +++ b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js @@ -30,7 +30,7 @@ var base = (function () { var derived = (function (_super) { __extends(derived, _super); function derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return derived; }(base)); diff --git a/tests/baselines/reference/errorSuperCalls.js b/tests/baselines/reference/errorSuperCalls.js index 3e778535bb7..720894e50c0 100644 --- a/tests/baselines/reference/errorSuperCalls.js +++ b/tests/baselines/reference/errorSuperCalls.js @@ -83,38 +83,38 @@ var __extends = (this && this.__extends) || function (d, b) { //super call in class constructor with no base type var NoBase = (function () { function NoBase() { - _super.call(this); + _this = _super.call(this) || this; //super call in class member initializer with no base type - this.p = _super.call(this); + this.p = _this = _super.call(this) || this; } //super call in class member function with no base type NoBase.prototype.fn = function () { - _super.call(this); + _this = _super.call(this) || this; }; Object.defineProperty(NoBase.prototype, "foo", { //super call in class accessor (get and set) with no base type get: function () { - _super.call(this); + _this = _super.call(this) || this; return null; }, set: function (v) { - _super.call(this); + _this = _super.call(this) || this; }, enumerable: true, configurable: true }); //super call in static class member function with no base type NoBase.fn = function () { - _super.call(this); + _this = _super.call(this) || this; }; Object.defineProperty(NoBase, "q", { //super call in static class accessor (get and set) with no base type get: function () { - _super.call(this); + _this = _super.call(this) || this; return null; }, set: function (n) { - _super.call(this); + _this = _super.call(this) || this; }, enumerable: true, configurable: true @@ -122,7 +122,7 @@ var NoBase = (function () { return NoBase; }()); //super call in static class member initializer with no base type -NoBase.k = _super.call(this); +NoBase.k = _this = _super.call(this) || this; var Base = (function () { function Base() { } @@ -132,8 +132,10 @@ var Derived = (function (_super) { __extends(Derived, _super); //super call with type arguments function Derived() { - _super.prototype..call(this); - _super.call(this); + var _this; + _super.prototype..call(_this); + _this = _super.call(this) || this; + return _this; } return Derived; }(Base)); @@ -145,22 +147,23 @@ var OtherBase = (function () { var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + var _this = _super.apply(this, arguments) || this; //super call in class member initializer of derived type - this.t = _super.call(this); + _this.t = _this = _super.call(this) || this; + return _this; } OtherDerived.prototype.fn = function () { //super call in class member function of derived type - _super.call(this); + _this = _super.call(this) || this; }; Object.defineProperty(OtherDerived.prototype, "foo", { //super call in class accessor (get and set) of derived type get: function () { - _super.call(this); + _this = _super.call(this) || this; return null; }, set: function (n) { - _super.call(this); + _this = _super.call(this) || this; }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index dbfbdb46940..e12a758b053 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -186,8 +186,9 @@ SomeBase.publicStaticMember = 0; var SomeDerived1 = (function (_super) { __extends(SomeDerived1, _super); function SomeDerived1() { - _super.call(this); + var _this = _super.call(this) || this; _super.prototype.publicMember = 1; + return _this; } SomeDerived1.prototype.fn = function () { var x = _super.prototype.publicMember; @@ -219,8 +220,9 @@ var SomeDerived1 = (function (_super) { var SomeDerived2 = (function (_super) { __extends(SomeDerived2, _super); function SomeDerived2() { - _super.call(this); + var _this = _super.call(this) || this; _super.prototype.privateMember = 1; + return _this; } SomeDerived2.prototype.fn = function () { var x = _super.prototype.privateMember; @@ -245,7 +247,7 @@ var SomeDerived2 = (function (_super) { var SomeDerived3 = (function (_super) { __extends(SomeDerived3, _super); function SomeDerived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } SomeDerived3.fn = function () { _super.publicStaticMember = 3; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index a7898810e10..6dd9f62edcb 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -135,7 +135,7 @@ var testClass6 = (function () { var testClass7 = (function (_super) { __extends(testClass7, _super); function testClass7() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return testClass7; }(Foo)); // error: could not find symbol V diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.js b/tests/baselines/reference/es6ClassSuperCodegenBug.js index c32865478e3..2eec250211e 100644 --- a/tests/baselines/reference/es6ClassSuperCodegenBug.js +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.js @@ -28,12 +28,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { + var _this; if (true) { - _super.call(this, 'a1', 'b1'); + _this = _super.call(this, 'a1', 'b1') || this; } else { - _super.call(this, 'a2', 'b2'); + _this = _super.call(this, 'a2', 'b2') || this; } + return _this; } return B; }(A)); diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index a722cce1670..067e57c2581 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -103,13 +103,14 @@ var Foo = (function (_super) { __extends(Foo, _super); function Foo(x, y, z) { if (z === void 0) { z = 0; } - _super.call(this, x); - this.y = y; - this.z = z; - this.gar = 0; - this.zoo = "zoo"; - this.x = x; - this.gar = 5; + var _this = _super.call(this, x) || this; + _this.y = y; + _this.z = z; + _this.gar = 0; + _this.zoo = "zoo"; + _this.x = x; + _this.gar = 5; + return _this; } Foo.prototype.bar = function () { return 0; }; Foo.prototype.boo = function (x) { return x; }; diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index 1881e6b8c87..de5657b087e 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -267,7 +267,7 @@ var SuperParent = (function () { var SuperChild = (function (_super) { __extends(SuperChild, _super); function SuperChild() { - _super.call(this, 1); + return _super.call(this, 1) || this; } SuperChild.prototype.b = function () { _super.prototype.b.call(this, 'str'); @@ -314,7 +314,7 @@ var BaseClassWithConstructor = (function () { var ChildClassWithoutConstructor = (function (_super) { __extends(ChildClassWithoutConstructor, _super); function ChildClassWithoutConstructor() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ChildClassWithoutConstructor; }(BaseClassWithConstructor)); diff --git a/tests/baselines/reference/es6ClassTest7.js b/tests/baselines/reference/es6ClassTest7.js index 14662410a14..f786fce4461 100644 --- a/tests/baselines/reference/es6ClassTest7.js +++ b/tests/baselines/reference/es6ClassTest7.js @@ -17,7 +17,7 @@ var __extends = (this && this.__extends) || function (d, b) { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar; }(M.Foo)); diff --git a/tests/baselines/reference/es6modulekindWithES5Target12.js b/tests/baselines/reference/es6modulekindWithES5Target12.js new file mode 100644 index 00000000000..316718e6f80 --- /dev/null +++ b/tests/baselines/reference/es6modulekindWithES5Target12.js @@ -0,0 +1,70 @@ +//// [es6modulekindWithES5Target12.ts] + +export class C { +} + +export namespace C { + export const x = 1; +} + +export enum E { + w = 1 +} + +export enum E { + x = 2 +} + +export namespace E { + export const y = 1; +} + +export namespace E { + export const z = 1; +} + +export namespace N { +} + +export namespace N { + export const x = 1; +} + +export function F() { +} + +export namespace F { + export const x = 1; +} + +//// [es6modulekindWithES5Target12.js] +export var C = (function () { + function C() { + } + return C; +}()); +(function (C) { + C.x = 1; +})(C || (C = {})); +export var E; +(function (E) { + E[E["w"] = 1] = "w"; +})(E || (E = {})); +(function (E) { + E[E["x"] = 2] = "x"; +})(E || (E = {})); +(function (E) { + E.y = 1; +})(E || (E = {})); +(function (E) { + E.z = 1; +})(E || (E = {})); +export var N; +(function (N) { + N.x = 1; +})(N || (N = {})); +export function F() { +} +(function (F) { + F.x = 1; +})(F || (F = {})); diff --git a/tests/baselines/reference/es6modulekindWithES5Target12.symbols b/tests/baselines/reference/es6modulekindWithES5Target12.symbols new file mode 100644 index 00000000000..e6469a6300a --- /dev/null +++ b/tests/baselines/reference/es6modulekindWithES5Target12.symbols @@ -0,0 +1,62 @@ +=== tests/cases/compiler/es6modulekindWithES5Target12.ts === + +export class C { +>C : Symbol(C, Decl(es6modulekindWithES5Target12.ts, 0, 0), Decl(es6modulekindWithES5Target12.ts, 2, 1)) +} + +export namespace C { +>C : Symbol(C, Decl(es6modulekindWithES5Target12.ts, 0, 0), Decl(es6modulekindWithES5Target12.ts, 2, 1)) + + export const x = 1; +>x : Symbol(x, Decl(es6modulekindWithES5Target12.ts, 5, 16)) +} + +export enum E { +>E : Symbol(E, Decl(es6modulekindWithES5Target12.ts, 6, 1), Decl(es6modulekindWithES5Target12.ts, 10, 1), Decl(es6modulekindWithES5Target12.ts, 14, 1), Decl(es6modulekindWithES5Target12.ts, 18, 1)) + + w = 1 +>w : Symbol(E.w, Decl(es6modulekindWithES5Target12.ts, 8, 15)) +} + +export enum E { +>E : Symbol(E, Decl(es6modulekindWithES5Target12.ts, 6, 1), Decl(es6modulekindWithES5Target12.ts, 10, 1), Decl(es6modulekindWithES5Target12.ts, 14, 1), Decl(es6modulekindWithES5Target12.ts, 18, 1)) + + x = 2 +>x : Symbol(E.x, Decl(es6modulekindWithES5Target12.ts, 12, 15)) +} + +export namespace E { +>E : Symbol(E, Decl(es6modulekindWithES5Target12.ts, 6, 1), Decl(es6modulekindWithES5Target12.ts, 10, 1), Decl(es6modulekindWithES5Target12.ts, 14, 1), Decl(es6modulekindWithES5Target12.ts, 18, 1)) + + export const y = 1; +>y : Symbol(y, Decl(es6modulekindWithES5Target12.ts, 17, 16)) +} + +export namespace E { +>E : Symbol(E, Decl(es6modulekindWithES5Target12.ts, 6, 1), Decl(es6modulekindWithES5Target12.ts, 10, 1), Decl(es6modulekindWithES5Target12.ts, 14, 1), Decl(es6modulekindWithES5Target12.ts, 18, 1)) + + export const z = 1; +>z : Symbol(z, Decl(es6modulekindWithES5Target12.ts, 21, 16)) +} + +export namespace N { +>N : Symbol(N, Decl(es6modulekindWithES5Target12.ts, 22, 1), Decl(es6modulekindWithES5Target12.ts, 25, 1)) +} + +export namespace N { +>N : Symbol(N, Decl(es6modulekindWithES5Target12.ts, 22, 1), Decl(es6modulekindWithES5Target12.ts, 25, 1)) + + export const x = 1; +>x : Symbol(x, Decl(es6modulekindWithES5Target12.ts, 28, 16)) +} + +export function F() { +>F : Symbol(F, Decl(es6modulekindWithES5Target12.ts, 29, 1), Decl(es6modulekindWithES5Target12.ts, 32, 1)) +} + +export namespace F { +>F : Symbol(F, Decl(es6modulekindWithES5Target12.ts, 29, 1), Decl(es6modulekindWithES5Target12.ts, 32, 1)) + + export const x = 1; +>x : Symbol(x, Decl(es6modulekindWithES5Target12.ts, 35, 16)) +} diff --git a/tests/baselines/reference/es6modulekindWithES5Target12.types b/tests/baselines/reference/es6modulekindWithES5Target12.types new file mode 100644 index 00000000000..5bc42cae68a --- /dev/null +++ b/tests/baselines/reference/es6modulekindWithES5Target12.types @@ -0,0 +1,69 @@ +=== tests/cases/compiler/es6modulekindWithES5Target12.ts === + +export class C { +>C : C +} + +export namespace C { +>C : typeof C + + export const x = 1; +>x : 1 +>1 : 1 +} + +export enum E { +>E : E + + w = 1 +>w : E.w +>1 : 1 +} + +export enum E { +>E : E + + x = 2 +>x : E.x +>2 : 2 +} + +export namespace E { +>E : typeof E + + export const y = 1; +>y : 1 +>1 : 1 +} + +export namespace E { +>E : typeof E + + export const z = 1; +>z : 1 +>1 : 1 +} + +export namespace N { +>N : typeof N +} + +export namespace N { +>N : typeof N + + export const x = 1; +>x : 1 +>1 : 1 +} + +export function F() { +>F : typeof F +} + +export namespace F { +>F : typeof F + + export const x = 1; +>x : 1 +>1 : 1 +} diff --git a/tests/baselines/reference/exportAssignmentMergedModule.js b/tests/baselines/reference/exportAssignmentMergedModule.js index 8d78799a05b..aa2a7082f76 100644 --- a/tests/baselines/reference/exportAssignmentMergedModule.js +++ b/tests/baselines/reference/exportAssignmentMergedModule.js @@ -34,7 +34,6 @@ var Foo; Foo.a = a; Foo.b = true; })(Foo || (Foo = {})); -var Foo; (function (Foo) { function c(a) { return a; diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.js b/tests/baselines/reference/exportAssignmentOfGenericType1.js index 0504bad39c7..7c1831ecac4 100644 --- a/tests/baselines/reference/exportAssignmentOfGenericType1.js +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.js @@ -34,7 +34,7 @@ define(["require", "exports", "exportAssignmentOfGenericType1_0"], function (req var M = (function (_super) { __extends(M, _super); function M() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return M; }(q)); diff --git a/tests/baselines/reference/exportAssignmentTopLevelClodule.js b/tests/baselines/reference/exportAssignmentTopLevelClodule.js index 08220cc8de3..9e073462aac 100644 --- a/tests/baselines/reference/exportAssignmentTopLevelClodule.js +++ b/tests/baselines/reference/exportAssignmentTopLevelClodule.js @@ -25,7 +25,6 @@ define(["require", "exports"], function (require, exports) { } return Foo; }()); - var Foo; (function (Foo) { Foo.answer = 42; })(Foo || (Foo = {})); diff --git a/tests/baselines/reference/exportAssignmentTopLevelEnumdule.js b/tests/baselines/reference/exportAssignmentTopLevelEnumdule.js index 2516b1b0e28..5043a684326 100644 --- a/tests/baselines/reference/exportAssignmentTopLevelEnumdule.js +++ b/tests/baselines/reference/exportAssignmentTopLevelEnumdule.js @@ -26,7 +26,6 @@ define(["require", "exports"], function (require, exports) { foo[foo["green"] = 1] = "green"; foo[foo["blue"] = 2] = "blue"; })(foo || (foo = {})); - var foo; (function (foo) { foo.answer = 42; })(foo || (foo = {})); diff --git a/tests/baselines/reference/exportAssignmentTopLevelFundule.js b/tests/baselines/reference/exportAssignmentTopLevelFundule.js index d151a61d539..0549700e464 100644 --- a/tests/baselines/reference/exportAssignmentTopLevelFundule.js +++ b/tests/baselines/reference/exportAssignmentTopLevelFundule.js @@ -22,7 +22,6 @@ define(["require", "exports"], function (require, exports) { function foo() { return "test"; } - var foo; (function (foo) { foo.answer = 42; })(foo || (foo = {})); diff --git a/tests/baselines/reference/exportDeclarationInInternalModule.js b/tests/baselines/reference/exportDeclarationInInternalModule.js index a9ea4bf5eda..b6d6d982a32 100644 --- a/tests/baselines/reference/exportDeclarationInInternalModule.js +++ b/tests/baselines/reference/exportDeclarationInInternalModule.js @@ -32,11 +32,10 @@ var Bbb = (function () { var Aaa = (function (_super) { __extends(Aaa, _super); function Aaa() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Aaa; }(Bbb)); -var Aaa; (function (Aaa) { var SomeType = (function () { function SomeType() { @@ -45,7 +44,6 @@ var Aaa; }()); Aaa.SomeType = SomeType; })(Aaa || (Aaa = {})); -var Bbb; (function (Bbb) { var SomeType = (function () { function SomeType() { diff --git a/tests/baselines/reference/exportDefaultProperty.js b/tests/baselines/reference/exportDefaultProperty.js index 10ba6d6419a..2dcef41d761 100644 --- a/tests/baselines/reference/exportDefaultProperty.js +++ b/tests/baselines/reference/exportDefaultProperty.js @@ -51,7 +51,6 @@ var A; return B; }()); A.B = B; - var B; (function (B) { B.b = 0; })(B = A.B || (A.B = {})); diff --git a/tests/baselines/reference/exportEqualsProperty.js b/tests/baselines/reference/exportEqualsProperty.js index 2fd8a8c8511..9acb1ee49b7 100644 --- a/tests/baselines/reference/exportEqualsProperty.js +++ b/tests/baselines/reference/exportEqualsProperty.js @@ -50,7 +50,6 @@ var A; return B; }()); A.B = B; - var B; (function (B) { B.b = 0; })(B = A.B || (A.B = {})); diff --git a/tests/baselines/reference/exportImportAlias.js b/tests/baselines/reference/exportImportAlias.js index be77f755368..3f9bc18f45b 100644 --- a/tests/baselines/reference/exportImportAlias.js +++ b/tests/baselines/reference/exportImportAlias.js @@ -96,7 +96,6 @@ var X; return 42; } X.Y = Y; - var Y; (function (Y) { var Point = (function () { function Point(x, y) { @@ -124,7 +123,6 @@ var K; return L; }()); K.L = L; - var L; (function (L) { L.y = 12; })(L = K.L || (K.L = {})); diff --git a/tests/baselines/reference/exportImportAndClodule.js b/tests/baselines/reference/exportImportAndClodule.js index e519d555792..842b97c0871 100644 --- a/tests/baselines/reference/exportImportAndClodule.js +++ b/tests/baselines/reference/exportImportAndClodule.js @@ -29,7 +29,6 @@ var K; return L; }()); K.L = L; - var L; (function (L) { L.y = 12; })(L = K.L || (K.L = {})); diff --git a/tests/baselines/reference/exportInFunction.errors.txt b/tests/baselines/reference/exportInFunction.errors.txt new file mode 100644 index 00000000000..cfd005952f9 --- /dev/null +++ b/tests/baselines/reference/exportInFunction.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/exportInFunction.ts(3,1): error TS1005: '}' expected. + + +==== tests/cases/compiler/exportInFunction.ts (1 errors) ==== + function f() { + export = 0; + + +!!! error TS1005: '}' expected. \ No newline at end of file diff --git a/tests/baselines/reference/exportInFunction.js b/tests/baselines/reference/exportInFunction.js new file mode 100644 index 00000000000..9e1db163d81 --- /dev/null +++ b/tests/baselines/reference/exportInFunction.js @@ -0,0 +1,9 @@ +//// [exportInFunction.ts] +function f() { + export = 0; + + +//// [exportInFunction.js] +function f() { + export = 0; +} diff --git a/tests/baselines/reference/extBaseClass1.js b/tests/baselines/reference/extBaseClass1.js index 446c6df9c94..91dfba7a9bf 100644 --- a/tests/baselines/reference/extBaseClass1.js +++ b/tests/baselines/reference/extBaseClass1.js @@ -37,18 +37,17 @@ var M; var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B)); M.C = C; })(M || (M = {})); -var M; (function (M) { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(M.B)); @@ -59,7 +58,7 @@ var N; var C3 = (function (_super) { __extends(C3, _super); function C3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C3; }(M.B)); diff --git a/tests/baselines/reference/extBaseClass2.js b/tests/baselines/reference/extBaseClass2.js index f7bd85d685c..3ab217eb019 100644 --- a/tests/baselines/reference/extBaseClass2.js +++ b/tests/baselines/reference/extBaseClass2.js @@ -21,7 +21,7 @@ var N; var C4 = (function (_super) { __extends(C4, _super); function C4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C4; }(M.B)); @@ -32,7 +32,7 @@ var M; var C5 = (function (_super) { __extends(C5, _super); function C5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C5; }(B)); diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType.js b/tests/baselines/reference/extendAndImplementTheSameBaseType.js index e52e5b497ac..74bbf3a27ac 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType.js @@ -28,7 +28,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.baz = function () { }; return D; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js index 1f4f62a42ee..fa7963487d5 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js @@ -33,7 +33,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.baz = function () { }; return D; diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js index d598389d0fa..596ab319b2c 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js @@ -12,7 +12,7 @@ var __extends = (this && this.__extends) || function (d, b) { var derived = (function (_super) { __extends(derived, _super); function derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return derived; }(base)); diff --git a/tests/baselines/reference/extendClassExpressionFromModule.js b/tests/baselines/reference/extendClassExpressionFromModule.js index 6532603b73c..895cdedfaff 100644 --- a/tests/baselines/reference/extendClassExpressionFromModule.js +++ b/tests/baselines/reference/extendClassExpressionFromModule.js @@ -31,7 +31,7 @@ var x = foo1; var y = (function (_super) { __extends(y, _super); function y() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return y; }(x)); diff --git a/tests/baselines/reference/extendConstructSignatureInInterface.js b/tests/baselines/reference/extendConstructSignatureInInterface.js index 20f43a948b8..4bf92dd0315 100644 --- a/tests/baselines/reference/extendConstructSignatureInInterface.js +++ b/tests/baselines/reference/extendConstructSignatureInInterface.js @@ -20,7 +20,7 @@ var CStatic; var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E; }(CStatic)); diff --git a/tests/baselines/reference/extendNonClassSymbol1.js b/tests/baselines/reference/extendNonClassSymbol1.js index 558e6d6ba57..b23b601bc29 100644 --- a/tests/baselines/reference/extendNonClassSymbol1.js +++ b/tests/baselines/reference/extendNonClassSymbol1.js @@ -19,7 +19,7 @@ var x = A; var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(x)); // error, could not find symbol xs diff --git a/tests/baselines/reference/extendNonClassSymbol2.js b/tests/baselines/reference/extendNonClassSymbol2.js index 3785c7c5846..78dfaa91827 100644 --- a/tests/baselines/reference/extendNonClassSymbol2.js +++ b/tests/baselines/reference/extendNonClassSymbol2.js @@ -18,7 +18,7 @@ var x = new Foo(); // legal, considered a constructor function var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(Foo)); // error, could not find symbol Foo diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js index 6542492e200..da081154d8a 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js @@ -51,7 +51,7 @@ var Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); @@ -67,7 +67,7 @@ var Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/extendsClauseAlreadySeen.js b/tests/baselines/reference/extendsClauseAlreadySeen.js index fb9a3f12378..267cd86eed0 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen.js @@ -20,7 +20,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.baz = function () { }; return D; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen2.js b/tests/baselines/reference/extendsClauseAlreadySeen2.js index 9423789dd35..76fbc3365af 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen2.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen2.js @@ -20,7 +20,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.baz = function () { }; return D; diff --git a/tests/baselines/reference/fluentClasses.js b/tests/baselines/reference/fluentClasses.js index 3d5efcc1b1a..ac44416e133 100644 --- a/tests/baselines/reference/fluentClasses.js +++ b/tests/baselines/reference/fluentClasses.js @@ -35,7 +35,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.bar = function () { return this; @@ -45,7 +45,7 @@ var B = (function (_super) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.baz = function () { return this; diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index 5c097a68ccc..4f52b5e1456 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -126,7 +126,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.boz = function () { for (var x in this.biz()) { } diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index caec9bd1987..d1181760a36 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -107,7 +107,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.boz = function () { for (var x in this.biz()) { } diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index aff01bc8565..3666ad930a6 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -68,7 +68,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(C)); diff --git a/tests/baselines/reference/forwardRefInEnum.js b/tests/baselines/reference/forwardRefInEnum.js index 76e2575ec8d..555454dccaa 100644 --- a/tests/baselines/reference/forwardRefInEnum.js +++ b/tests/baselines/reference/forwardRefInEnum.js @@ -25,7 +25,6 @@ var E1; E1[E1["Y"] = E1.Z] = "Y"; E1[E1["Y1"] = E1["Z"]] = "Y1"; })(E1 || (E1 = {})); -var E1; (function (E1) { E1[E1["Z"] = 4] = "Z"; })(E1 || (E1 = {})); diff --git a/tests/baselines/reference/funClodule.js b/tests/baselines/reference/funClodule.js index 8ea98ad7487..b2c18bf3786 100644 --- a/tests/baselines/reference/funClodule.js +++ b/tests/baselines/reference/funClodule.js @@ -21,7 +21,6 @@ class foo3 { } // Should error //// [funClodule.js] function foo3() { } -var foo3; (function (foo3) { function x() { } foo3.x = x; diff --git a/tests/baselines/reference/functionImplementationErrors.js b/tests/baselines/reference/functionImplementationErrors.js index 2dc6c8a1bc4..433418af41d 100644 --- a/tests/baselines/reference/functionImplementationErrors.js +++ b/tests/baselines/reference/functionImplementationErrors.js @@ -134,14 +134,14 @@ var AnotherClass = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived1; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/functionImplementations.js b/tests/baselines/reference/functionImplementations.js index 6e37f929efe..86636b84a87 100644 --- a/tests/baselines/reference/functionImplementations.js +++ b/tests/baselines/reference/functionImplementations.js @@ -236,7 +236,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -287,7 +287,7 @@ function f6() { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/functionMergedWithModule.js b/tests/baselines/reference/functionMergedWithModule.js index d83c1cd4e37..9265ee9bc1f 100644 --- a/tests/baselines/reference/functionMergedWithModule.js +++ b/tests/baselines/reference/functionMergedWithModule.js @@ -18,7 +18,6 @@ module foo.Baz { function foo(title) { var x = 10; } -var foo; (function (foo) { var Bar; (function (Bar) { @@ -27,7 +26,6 @@ var foo; Bar.f = f; })(Bar = foo.Bar || (foo.Bar = {})); })(foo || (foo = {})); -var foo; (function (foo) { var Baz; (function (Baz) { diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs.js b/tests/baselines/reference/functionSubtypingOfVarArgs.js index 7485abe1927..55917962184 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs.js @@ -32,7 +32,7 @@ var EventBase = (function () { var StringEvent = (function (_super) { __extends(StringEvent, _super); function StringEvent() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } StringEvent.prototype.add = function (listener) { _super.prototype.add.call(this, listener); diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.js b/tests/baselines/reference/functionSubtypingOfVarArgs2.js index 33d0e8c7e03..a676316459f 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs2.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.js @@ -32,7 +32,7 @@ var EventBase = (function () { var StringEvent = (function (_super) { __extends(StringEvent, _super); function StringEvent() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } StringEvent.prototype.add = function (listener) { _super.prototype.add.call(this, listener); diff --git a/tests/baselines/reference/funduleOfFunctionWithoutReturnTypeAnnotation.js b/tests/baselines/reference/funduleOfFunctionWithoutReturnTypeAnnotation.js index 36356b1f6ed..868a755bf7e 100644 --- a/tests/baselines/reference/funduleOfFunctionWithoutReturnTypeAnnotation.js +++ b/tests/baselines/reference/funduleOfFunctionWithoutReturnTypeAnnotation.js @@ -11,7 +11,6 @@ module fn { function fn() { return fn.n; } -var fn; (function (fn) { fn.n = 1; })(fn || (fn = {})); diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index e5488121d34..2a6911d9cf5 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -369,14 +369,14 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived1; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty.js b/tests/baselines/reference/genericBaseClassLiteralProperty.js index 5aa43d78826..a075eff9550 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty.js @@ -26,7 +26,7 @@ var BaseClass = (function () { var SubClass = (function (_super) { __extends(SubClass, _super); function SubClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } SubClass.prototype.Error = function () { var x = this._getValue1(); diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.js b/tests/baselines/reference/genericBaseClassLiteralProperty2.js index 3226f1cd659..2b562742bf7 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.js @@ -35,7 +35,7 @@ var BaseCollection2 = (function () { var DataView2 = (function (_super) { __extends(DataView2, _super); function DataView2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } DataView2.prototype.fillItems = function (item) { this._itemsByKey['dummy'] = item; diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js index 04d5bd2d997..afef6224ba1 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js @@ -122,14 +122,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js index 509dd9a1136..7b621b3ffd9 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js @@ -46,14 +46,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js index d3f18e0bfcb..892cda0ee2d 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js @@ -54,7 +54,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js index acab51690d3..addfbc756a8 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js @@ -52,14 +52,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js index 31b4cd181b9..c2ad2ba29a3 100644 --- a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js +++ b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js @@ -46,7 +46,7 @@ var M; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(C1)); diff --git a/tests/baselines/reference/genericClassExpressionInFunction.js b/tests/baselines/reference/genericClassExpressionInFunction.js index f334da52625..dc574dedb00 100644 --- a/tests/baselines/reference/genericClassExpressionInFunction.js +++ b/tests/baselines/reference/genericClassExpressionInFunction.js @@ -47,7 +47,7 @@ function B1() { return (function (_super) { __extends(class_1, _super); function class_1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class_1; }(A)); @@ -57,7 +57,7 @@ var B2 = (function () { this.anon = (function (_super) { __extends(class_2, _super); function class_2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class_2; }(A)); @@ -68,7 +68,7 @@ function B3() { return (function (_super) { __extends(Inner, _super); function Inner() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Inner; }(A)); @@ -77,14 +77,14 @@ function B3() { var K = (function (_super) { __extends(K, _super); function K() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return K; }(B1())); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }((new B2().anon))); @@ -92,7 +92,7 @@ var b3Number = B3(); var S = (function (_super) { __extends(S, _super); function S() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return S; }(b3Number)); diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js index 9f71ace88a9..1f3a6e17f14 100644 --- a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js @@ -14,14 +14,14 @@ var __extends = (this && this.__extends) || function (d, b) { var A = (function (_super) { __extends(A, _super); function A() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return A; }(B)); var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(C)); diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js index 8f90c2fb6e4..28eaf464968 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js @@ -109,7 +109,7 @@ var PortalFx; var Validator = (function (_super) { __extends(Validator, _super); function Validator(message) { - _super.call(this, message); + return _super.call(this, message) || this; } return Validator; }(Portal.Controls.Validators.Validator)); diff --git a/tests/baselines/reference/genericClassStaticMethod.js b/tests/baselines/reference/genericClassStaticMethod.js index 394e6650e0a..4609e3bc9db 100644 --- a/tests/baselines/reference/genericClassStaticMethod.js +++ b/tests/baselines/reference/genericClassStaticMethod.js @@ -26,7 +26,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Bar.getFoo = function () { }; diff --git a/tests/baselines/reference/genericClasses3.js b/tests/baselines/reference/genericClasses3.js index 2bd33efb3dc..5371e2479aa 100644 --- a/tests/baselines/reference/genericClasses3.js +++ b/tests/baselines/reference/genericClasses3.js @@ -31,7 +31,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/genericCloduleInModule.js b/tests/baselines/reference/genericCloduleInModule.js index e3f926e1f91..6164bfc0904 100644 --- a/tests/baselines/reference/genericCloduleInModule.js +++ b/tests/baselines/reference/genericCloduleInModule.js @@ -23,7 +23,6 @@ var A; return B; }()); A.B = B; - var B; (function (B) { B.x = 1; })(B = A.B || (A.B = {})); diff --git a/tests/baselines/reference/genericCloduleInModule2.js b/tests/baselines/reference/genericCloduleInModule2.js index 433a165db92..55a5507eed2 100644 --- a/tests/baselines/reference/genericCloduleInModule2.js +++ b/tests/baselines/reference/genericCloduleInModule2.js @@ -27,7 +27,6 @@ var A; }()); A.B = B; })(A || (A = {})); -var A; (function (A) { var B; (function (B) { diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js index d2bf12667fc..d990f76d2c3 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js @@ -45,14 +45,13 @@ var EndGate; Tweening.Tween = Tween; })(Tweening = EndGate.Tweening || (EndGate.Tweening = {})); })(EndGate || (EndGate = {})); -var EndGate; (function (EndGate) { var Tweening; (function (Tweening) { var NumberTween = (function (_super) { __extends(NumberTween, _super); function NumberTween(from) { - _super.call(this, from); + return _super.call(this, from) || this; } return NumberTween; }(Tweening.Tween)); diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js index f61f57cb615..4291b315933 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js @@ -44,14 +44,13 @@ var EndGate; Tweening.Tween = Tween; })(Tweening = EndGate.Tweening || (EndGate.Tweening = {})); })(EndGate || (EndGate = {})); -var EndGate; (function (EndGate) { var Tweening; (function (Tweening) { var NumberTween = (function (_super) { __extends(NumberTween, _super); function NumberTween(from) { - _super.call(this, from); + return _super.call(this, from) || this; } return NumberTween; }(Tweening.Tween)); diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js index 906145850f1..1b455073196 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js @@ -26,7 +26,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js index 1c73075acc4..0abd655e1da 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js @@ -26,7 +26,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/genericFunduleInModule.js b/tests/baselines/reference/genericFunduleInModule.js index 95700edecab..9bd1e47b420 100644 --- a/tests/baselines/reference/genericFunduleInModule.js +++ b/tests/baselines/reference/genericFunduleInModule.js @@ -14,7 +14,6 @@ var A; (function (A) { function B(x) { return x; } A.B = B; - var B; (function (B) { B.x = 1; })(B = A.B || (A.B = {})); diff --git a/tests/baselines/reference/genericFunduleInModule2.js b/tests/baselines/reference/genericFunduleInModule2.js index 956e9129ec7..2523b4fe126 100644 --- a/tests/baselines/reference/genericFunduleInModule2.js +++ b/tests/baselines/reference/genericFunduleInModule2.js @@ -18,7 +18,6 @@ var A; function B(x) { return x; } A.B = B; })(A || (A = {})); -var A; (function (A) { var B; (function (B) { diff --git a/tests/baselines/reference/genericInheritedDefaultConstructors.js b/tests/baselines/reference/genericInheritedDefaultConstructors.js index 170ef89abb2..059a3213b7a 100644 --- a/tests/baselines/reference/genericInheritedDefaultConstructors.js +++ b/tests/baselines/reference/genericInheritedDefaultConstructors.js @@ -24,7 +24,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js index 6dd456ab703..56a64e8934f 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js @@ -8,7 +8,6 @@ module foo { //// [genericMergedDeclarationUsingTypeParameter.js] function foo(y, z) { return y; } -var foo; (function (foo) { var y = 1; })(foo || (foo = {})); diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js index ac51424deea..11a9c0891ae 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js @@ -12,7 +12,6 @@ var foo = (function () { } return foo; }()); -var foo; (function (foo) { var y = 1; })(foo || (foo = {})); diff --git a/tests/baselines/reference/genericOfACloduleType1.js b/tests/baselines/reference/genericOfACloduleType1.js index 3e4b9d3a9d4..1c9657ec8f1 100644 --- a/tests/baselines/reference/genericOfACloduleType1.js +++ b/tests/baselines/reference/genericOfACloduleType1.js @@ -28,7 +28,6 @@ var M; return C; }()); M.C = C; - var C; (function (C) { var X = (function () { function X() { diff --git a/tests/baselines/reference/genericOfACloduleType2.js b/tests/baselines/reference/genericOfACloduleType2.js index f1e3f2a8a00..c96e3f4fa6d 100644 --- a/tests/baselines/reference/genericOfACloduleType2.js +++ b/tests/baselines/reference/genericOfACloduleType2.js @@ -31,7 +31,6 @@ var M; return C; }()); M.C = C; - var C; (function (C) { var X = (function () { function X() { diff --git a/tests/baselines/reference/genericPrototypeProperty2.js b/tests/baselines/reference/genericPrototypeProperty2.js index 3f1b6e21adc..eac025cce9b 100644 --- a/tests/baselines/reference/genericPrototypeProperty2.js +++ b/tests/baselines/reference/genericPrototypeProperty2.js @@ -29,7 +29,7 @@ var BaseEvent = (function () { var MyEvent = (function (_super) { __extends(MyEvent, _super); function MyEvent() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyEvent; }(BaseEvent)); @@ -41,7 +41,7 @@ var BaseEventWrapper = (function () { var MyEventWrapper = (function (_super) { __extends(MyEventWrapper, _super); function MyEventWrapper() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyEventWrapper; }(BaseEventWrapper)); diff --git a/tests/baselines/reference/genericPrototypeProperty3.js b/tests/baselines/reference/genericPrototypeProperty3.js index b7cca85561c..9e3ede0019d 100644 --- a/tests/baselines/reference/genericPrototypeProperty3.js +++ b/tests/baselines/reference/genericPrototypeProperty3.js @@ -28,7 +28,7 @@ var BaseEvent = (function () { var MyEvent = (function (_super) { __extends(MyEvent, _super); function MyEvent() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyEvent; }(BaseEvent)); @@ -40,7 +40,7 @@ var BaseEventWrapper = (function () { var MyEventWrapper = (function (_super) { __extends(MyEventWrapper, _super); function MyEventWrapper() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyEventWrapper; }(BaseEventWrapper)); diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js index 73012f714e8..6d65ee5531b 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js @@ -57,7 +57,7 @@ var TypeScript2; var PullTypeSymbol = (function (_super) { __extends(PullTypeSymbol, _super); function PullTypeSymbol() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PullTypeSymbol; }(PullSymbol)); diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js index 61cb758c48e..c7643d4a9a2 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js @@ -47,7 +47,6 @@ var TypeScript; }()); TypeScript.MemberName = MemberName; })(TypeScript || (TypeScript = {})); -var TypeScript; (function (TypeScript) { var PullSymbol = (function () { function PullSymbol() { @@ -59,8 +58,9 @@ var TypeScript; var PullTypeSymbol = (function (_super) { __extends(PullTypeSymbol, _super); function PullTypeSymbol() { - _super.apply(this, arguments); - this._elementType = null; + var _this = _super.apply(this, arguments) || this; + _this._elementType = null; + return _this; } PullTypeSymbol.prototype.toString = function (scopeSymbol, useConstraintInName) { var s = this.getScopedNameEx(scopeSymbol, useConstraintInName).toString(); diff --git a/tests/baselines/reference/genericTypeAssertions2.js b/tests/baselines/reference/genericTypeAssertions2.js index 02a51aed35d..687d593f01e 100644 --- a/tests/baselines/reference/genericTypeAssertions2.js +++ b/tests/baselines/reference/genericTypeAssertions2.js @@ -28,7 +28,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.bar = function () { return null; diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index 2c5bbf51d7f..50dbe5debbd 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -40,7 +40,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.bar = function () { return 1; }; return B; @@ -48,7 +48,7 @@ var B = (function (_super) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.baz = function () { return 1; }; return C; diff --git a/tests/baselines/reference/genericTypeAssertions6.js b/tests/baselines/reference/genericTypeAssertions6.js index 5bc7a943163..7bbd7351f1d 100644 --- a/tests/baselines/reference/genericTypeAssertions6.js +++ b/tests/baselines/reference/genericTypeAssertions6.js @@ -44,7 +44,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.g = function (x) { var a = x; diff --git a/tests/baselines/reference/genericTypeConstraints.js b/tests/baselines/reference/genericTypeConstraints.js index 5f4bb41a83f..67303166aa3 100644 --- a/tests/baselines/reference/genericTypeConstraints.js +++ b/tests/baselines/reference/genericTypeConstraints.js @@ -38,7 +38,7 @@ var Bar = (function () { var BarExtended = (function (_super) { __extends(BarExtended, _super); function BarExtended() { - _super.call(this); + return _super.call(this) || this; } return BarExtended; }(Bar)); diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index 7fe6c49d65e..cf19feede34 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -60,7 +60,7 @@ var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); @@ -76,7 +76,7 @@ var M; var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(M.E)); diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index 12be456a8a8..973ee231762 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -55,14 +55,14 @@ var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(I)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(M.C)); diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js index 1f016b401ed..d6fb98b67ca 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js @@ -31,7 +31,7 @@ define(["require", "exports"], function (require, exports) { var List = (function (_super) { __extends(List, _super); function List() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } List.prototype.Bar = function () { }; return List; @@ -46,7 +46,7 @@ define(["require", "exports"], function (require, exports) { var ListItem = (function (_super) { __extends(ListItem, _super); function ListItem() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ListItem; }(CollectionItem)); diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.js b/tests/baselines/reference/heterogeneousArrayLiterals.js index e482f0d33d3..9b15cf743f0 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.js +++ b/tests/baselines/reference/heterogeneousArrayLiterals.js @@ -160,21 +160,20 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); var base; var derived; var derived2; -var Derived; (function (Derived) { var h = [{ foo: base, basear: derived }, { foo: base }]; // {foo: Base}[] var i = [{ foo: base, basear: derived }, { foo: derived }]; // {foo: Derived}[] diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index 75762ffbb54..483370bee5c 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -177,7 +177,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(C)); diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index 88671ce1cee..868d53daad5 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -34,18 +34,20 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var r2 = function () { return _super.call(this); }; - var r3 = function () { _super.call(this); }; - var r4 = function () { _super.call(this); }; + var _this; + var r2 = function () { return _this = _super.call(this) || this; }; + var r3 = function () { _this = _super.call(this) || this; }; + var r4 = function () { _this = _super.call(this) || this; }; var r5 = { get foo() { - _super.call(this); + _this = _super.call(this) || this; return 1; }, set foo(v) { - _super.call(this); + _this = _super.call(this) || this; } }; + return _this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/implementClausePrecedingExtends.js b/tests/baselines/reference/implementClausePrecedingExtends.js index ba3583c3051..df725cde43a 100644 --- a/tests/baselines/reference/implementClausePrecedingExtends.js +++ b/tests/baselines/reference/implementClausePrecedingExtends.js @@ -16,7 +16,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js index 8fec5dc27da..a5a5e02c156 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js @@ -99,21 +99,21 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar; }(Foo)); var Bar2 = (function (_super) { __extends(Bar2, _super); function Bar2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar2; }(Foo)); var Bar3 = (function (_super) { __extends(Bar3, _super); function Bar3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar3; }(Foo)); @@ -128,28 +128,28 @@ var M; var Baz = (function (_super) { __extends(Baz, _super); function Baz() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Baz; }(Foo)); var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar; }(Foo)); var Bar2 = (function (_super) { __extends(Bar2, _super); function Bar2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar2; }(Foo)); var Bar3 = (function (_super) { __extends(Bar3, _super); function Bar3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar3; }(Foo)); @@ -165,14 +165,14 @@ var M2; var Baz = (function (_super) { __extends(Baz, _super); function Baz() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Baz; }(Foo)); var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar; }(Foo)); @@ -183,14 +183,14 @@ var M2; var Bar2 = (function (_super) { __extends(Bar2, _super); function Bar2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar2; }(Foo)); var Bar3 = (function (_super) { __extends(Bar3, _super); function Bar3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar3; }(Foo)); diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js index 915e652056c..d0f74847141 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js @@ -75,28 +75,28 @@ var Bar4 = (function () { var Bar5 = (function (_super) { __extends(Bar5, _super); function Bar5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar5; }(Foo)); var Bar6 = (function (_super) { __extends(Bar6, _super); function Bar6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar6; }(Foo)); var Bar7 = (function (_super) { __extends(Bar7, _super); function Bar7() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar7; }(Foo)); var Bar8 = (function (_super) { __extends(Bar8, _super); function Bar8() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar8; }(Foo)); diff --git a/tests/baselines/reference/importAliasIdentifiers.js b/tests/baselines/reference/importAliasIdentifiers.js index 084b6694e9c..278c5a2e8a0 100644 --- a/tests/baselines/reference/importAliasIdentifiers.js +++ b/tests/baselines/reference/importAliasIdentifiers.js @@ -67,7 +67,6 @@ var clodule = (function () { } return clodule; }()); -var clodule; (function (clodule) { var Point = { x: 0, y: 0 }; })(clodule || (clodule = {})); @@ -78,7 +77,6 @@ var p; function fundule() { return { x: 0, y: 0 }; } -var fundule; (function (fundule) { var Point = { x: 0, y: 0 }; })(fundule || (fundule = {})); diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index 60e142dd5f7..b4f45cac806 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -30,7 +30,7 @@ var Greeter = require("./importAsBaseClass_0"); var Hello = (function (_super) { __extends(Hello, _super); function Hello() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Hello; }(Greeter)); diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js index f850b5cf177..ae4d3127010 100644 --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -45,7 +45,7 @@ exports.A = A; var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -93,7 +93,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/importHelpersAmd.js b/tests/baselines/reference/importHelpersAmd.js index bb02cbf0417..fea93840fa9 100644 --- a/tests/baselines/reference/importHelpersAmd.js +++ b/tests/baselines/reference/importHelpersAmd.js @@ -32,7 +32,7 @@ define(["require", "exports", "tslib", "./a"], function (require, exports, tslib var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(a_1.A)); diff --git a/tests/baselines/reference/importHelpersInIsolatedModules.js b/tests/baselines/reference/importHelpersInIsolatedModules.js index a5929bc152c..28c00f97554 100644 --- a/tests/baselines/reference/importHelpersInIsolatedModules.js +++ b/tests/baselines/reference/importHelpersInIsolatedModules.js @@ -45,7 +45,7 @@ exports.A = A; var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -78,7 +78,7 @@ var A = (function () { var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/importHelpersNoHelpers.js b/tests/baselines/reference/importHelpersNoHelpers.js index 8c5afc99ece..e22d1f4353d 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.js +++ b/tests/baselines/reference/importHelpersNoHelpers.js @@ -39,7 +39,7 @@ exports.A = A; var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -87,7 +87,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/importHelpersNoModule.js b/tests/baselines/reference/importHelpersNoModule.js index 36bc0c5f76b..41df9710f33 100644 --- a/tests/baselines/reference/importHelpersNoModule.js +++ b/tests/baselines/reference/importHelpersNoModule.js @@ -37,7 +37,7 @@ exports.A = A; var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -85,7 +85,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/importHelpersOutFile.js b/tests/baselines/reference/importHelpersOutFile.js index cb50330c20c..a45f6285782 100644 --- a/tests/baselines/reference/importHelpersOutFile.js +++ b/tests/baselines/reference/importHelpersOutFile.js @@ -35,7 +35,7 @@ define("b", ["require", "exports", "tslib", "a"], function (require, exports, ts var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(a_1.A)); @@ -46,7 +46,7 @@ define("c", ["require", "exports", "tslib", "a"], function (require, exports, ts var C = (function (_super) { tslib_2.__extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(a_2.A)); diff --git a/tests/baselines/reference/importHelpersSystem.js b/tests/baselines/reference/importHelpersSystem.js index 3c1ee19ec48..20f2d299c52 100644 --- a/tests/baselines/reference/importHelpersSystem.js +++ b/tests/baselines/reference/importHelpersSystem.js @@ -51,7 +51,7 @@ System.register(["tslib", "./a"], function (exports_1, context_1) { B = (function (_super) { tslib_1.__extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(a_1.A)); diff --git a/tests/baselines/reference/importShadowsGlobalName.js b/tests/baselines/reference/importShadowsGlobalName.js index 316a94d9069..34cc0604e7a 100644 --- a/tests/baselines/reference/importShadowsGlobalName.js +++ b/tests/baselines/reference/importShadowsGlobalName.js @@ -31,7 +31,7 @@ define(["require", "exports", "Foo"], function (require, exports, Error) { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar; }(Error)); diff --git a/tests/baselines/reference/importUsedInExtendsList1.js b/tests/baselines/reference/importUsedInExtendsList1.js index b9827d5bc93..a40c3a51a78 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.js +++ b/tests/baselines/reference/importUsedInExtendsList1.js @@ -31,7 +31,7 @@ var foo = require("./importUsedInExtendsList1_require"); var Sub = (function (_super) { __extends(Sub, _super); function Sub() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Sub; }(foo.Super)); diff --git a/tests/baselines/reference/indexerConstraints2.js b/tests/baselines/reference/indexerConstraints2.js index dd143da97e6..d7357f021d0 100644 --- a/tests/baselines/reference/indexerConstraints2.js +++ b/tests/baselines/reference/indexerConstraints2.js @@ -42,7 +42,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -55,7 +55,7 @@ var F = (function () { var G = (function (_super) { __extends(G, _super); function G() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return G; }(F)); @@ -68,7 +68,7 @@ var H = (function () { var I = (function (_super) { __extends(I, _super); function I() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return I; }(H)); @@ -81,7 +81,7 @@ var J = (function () { var K = (function (_super) { __extends(K, _super); function K() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return K; }(J)); diff --git a/tests/baselines/reference/indirectSelfReference.js b/tests/baselines/reference/indirectSelfReference.js index 66d23a45b72..2f4f37b9b53 100644 --- a/tests/baselines/reference/indirectSelfReference.js +++ b/tests/baselines/reference/indirectSelfReference.js @@ -11,14 +11,14 @@ var __extends = (this && this.__extends) || function (d, b) { var a = (function (_super) { __extends(a, _super); function a() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return a; }(b)); var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.js b/tests/baselines/reference/indirectSelfReferenceGeneric.js index 99ab918e631..9171bb0eeb6 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.js +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.js @@ -11,14 +11,14 @@ var __extends = (this && this.__extends) || function (d, b) { var a = (function (_super) { __extends(a, _super); function a() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return a; }(b)); var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js index 6321f77d31f..ad1a063bfb0 100644 --- a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js +++ b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js @@ -43,7 +43,7 @@ var Base = (function () { var A = (function (_super) { __extends(A, _super); function A() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return A; }(Base)); diff --git a/tests/baselines/reference/inheritFromGenericTypeParameter.js b/tests/baselines/reference/inheritFromGenericTypeParameter.js index f5bc099cb8d..40e6abd3e53 100644 --- a/tests/baselines/reference/inheritFromGenericTypeParameter.js +++ b/tests/baselines/reference/inheritFromGenericTypeParameter.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(T)); diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js index 9462df7a3c3..a0874eb1c72 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js @@ -24,14 +24,14 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(B)); diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index 52fbfaffdde..cbfef2d3382 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -53,14 +53,14 @@ var B2 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1; }(B1)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(B2)); @@ -72,7 +72,7 @@ var N = (function () { var ND = (function (_super) { __extends(ND, _super); function ND() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ND; }(N)); @@ -86,7 +86,7 @@ var Good = (function () { var Baad = (function (_super) { __extends(Baad, _super); function Baad() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Baad.prototype.f = function () { return 0; }; Baad.prototype.g = function (n) { return 0; }; diff --git a/tests/baselines/reference/inheritance1.js b/tests/baselines/reference/inheritance1.js index c65155ee55c..86de0b76350 100644 --- a/tests/baselines/reference/inheritance1.js +++ b/tests/baselines/reference/inheritance1.js @@ -75,7 +75,7 @@ var Control = (function () { var Button = (function (_super) { __extends(Button, _super); function Button() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Button.prototype.select = function () { }; return Button; @@ -83,7 +83,7 @@ var Button = (function (_super) { var TextBox = (function (_super) { __extends(TextBox, _super); function TextBox() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } TextBox.prototype.select = function () { }; return TextBox; @@ -91,14 +91,14 @@ var TextBox = (function (_super) { var ImageBase = (function (_super) { __extends(ImageBase, _super); function ImageBase() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ImageBase; }(Control)); var Image1 = (function (_super) { __extends(Image1, _super); function Image1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Image1; }(Control)); diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js index b416cf3fb93..57a9c897583 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js @@ -25,14 +25,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.myMethod = function () { }; return C; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js index 25a977531ca..83c5aa3e4cd 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js @@ -25,14 +25,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.myMethod = function () { }; return C; diff --git a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js index dfd05556925..b11b6e318a7 100644 --- a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js @@ -25,14 +25,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.myMethod = function () { }; return C; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js index b4efaa89621..09ea08899d9 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js @@ -40,7 +40,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(b.prototype, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js index 5044a8e03ac..59d2abdaab2 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js @@ -31,7 +31,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(b.prototype, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js index 6ebdc336a64..98a95747a8e 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js @@ -26,7 +26,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(b.prototype, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js index 3ddff027c1a..0d54e5d42fa 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js @@ -37,7 +37,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.prototype.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js index a6c3beea4ef..9af25c6fdb8 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js @@ -28,7 +28,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.prototype.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js index 94b602d29d9..5c77ce08101 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js @@ -23,7 +23,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.prototype.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js index a8fc4d5a3dd..82c7a94d17c 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js @@ -37,7 +37,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js index 7d5cdb43e96..e6929218e63 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js @@ -26,7 +26,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js index 648f1d1622e..85764cddc52 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js @@ -21,7 +21,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js index 59675c56e5f..28fe8144509 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js @@ -21,7 +21,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js index 97464233027..0cc71e168f4 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js @@ -40,7 +40,7 @@ var N; var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1; }(M.C1)); @@ -48,7 +48,7 @@ var N; var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(M.C2)); diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js index 49145b010d4..bb91ee5f9ea 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js @@ -40,7 +40,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(b, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js index 4a202b76497..363852a84bf 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js @@ -31,7 +31,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(b, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js index a0dd1177cfb..ba8df7a5f0b 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js @@ -26,7 +26,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(b, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js index 06f907371ea..e464029fba5 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js @@ -37,7 +37,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js index ea36c40480f..cc825cfa9b5 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js @@ -32,7 +32,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js index ae523d53d9b..466c65fa7d5 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js @@ -28,7 +28,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js index 93890bd8294..dfc0ce2c13f 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js @@ -23,7 +23,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js index 4d0f2438459..da7850f2071 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js @@ -23,7 +23,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js index f2dfda4e48f..d5916a9d452 100644 --- a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js +++ b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js @@ -23,7 +23,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } b.x = function () { return new b().x; diff --git a/tests/baselines/reference/inheritanceStaticMembersCompatible.js b/tests/baselines/reference/inheritanceStaticMembersCompatible.js index 0dc736a375d..b4cae99b64b 100644 --- a/tests/baselines/reference/inheritanceStaticMembersCompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersCompatible.js @@ -21,7 +21,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js index 51c474430ad..38c637dd8d1 100644 --- a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js @@ -21,7 +21,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js index d138ac3eba8..49dc86fc500 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js @@ -36,7 +36,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js index 3d3f550713e..bcd63537540 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js @@ -26,7 +26,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js index e23917e40a4..c1bdd9b66a2 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js @@ -21,7 +21,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams.js b/tests/baselines/reference/inheritedConstructorWithRestParams.js index 2d312d9859d..c9db1756676 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams.js @@ -32,7 +32,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams2.js b/tests/baselines/reference/inheritedConstructorWithRestParams2.js index 0ad25b302f0..9a1b13a8434 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams2.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams2.js @@ -53,14 +53,14 @@ var BaseBase2 = (function () { var Base = (function (_super) { __extends(Base, _super); function Base() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Base; }(BaseBase)); var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/inheritedModuleMembersForClodule.js b/tests/baselines/reference/inheritedModuleMembersForClodule.js index 95b71069584..cd49009fed9 100644 --- a/tests/baselines/reference/inheritedModuleMembersForClodule.js +++ b/tests/baselines/reference/inheritedModuleMembersForClodule.js @@ -38,11 +38,10 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); -var D; (function (D) { function foo() { return 0; @@ -53,7 +52,7 @@ var D; var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } E.bar = function () { return this.foo(); diff --git a/tests/baselines/reference/instanceOfAssignability.js b/tests/baselines/reference/instanceOfAssignability.js index 775afe86946..b8f39c5b0e2 100644 --- a/tests/baselines/reference/instanceOfAssignability.js +++ b/tests/baselines/reference/instanceOfAssignability.js @@ -115,14 +115,14 @@ var Animal = (function () { var Mammal = (function (_super) { __extends(Mammal, _super); function Mammal() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Mammal; }(Animal)); var Giraffe = (function (_super) { __extends(Giraffe, _super); function Giraffe() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Giraffe; }(Mammal)); diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index a507a19a456..8dc5227685f 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -69,7 +69,7 @@ var NonGeneric; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); @@ -101,7 +101,7 @@ var Generic; var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/instanceSubtypeCheck2.js b/tests/baselines/reference/instanceSubtypeCheck2.js index d72f29e93bf..914f3796001 100644 --- a/tests/baselines/reference/instanceSubtypeCheck2.js +++ b/tests/baselines/reference/instanceSubtypeCheck2.js @@ -21,7 +21,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(C1)); diff --git a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js index 97be2137722..54a574238e5 100644 --- a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js +++ b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js @@ -128,7 +128,7 @@ var A = (function () { var A1 = (function (_super) { __extends(A1, _super); function A1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return A1; }(A)); @@ -140,7 +140,7 @@ var A2 = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/instantiatedReturnTypeContravariance.js b/tests/baselines/reference/instantiatedReturnTypeContravariance.js index 4d5e4376308..bc496a63632 100644 --- a/tests/baselines/reference/instantiatedReturnTypeContravariance.js +++ b/tests/baselines/reference/instantiatedReturnTypeContravariance.js @@ -47,7 +47,7 @@ var c = (function () { var d = (function (_super) { __extends(d, _super); function d() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } d.prototype.foo = function () { return null; diff --git a/tests/baselines/reference/interfaceClassMerging.js b/tests/baselines/reference/interfaceClassMerging.js index 8138e7888b3..6542376a19b 100644 --- a/tests/baselines/reference/interfaceClassMerging.js +++ b/tests/baselines/reference/interfaceClassMerging.js @@ -57,7 +57,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Bar.prototype.method = function (a) { return this.optionalProperty; diff --git a/tests/baselines/reference/interfaceClassMerging2.js b/tests/baselines/reference/interfaceClassMerging2.js index 99f5b07696d..70a62da4131 100644 --- a/tests/baselines/reference/interfaceClassMerging2.js +++ b/tests/baselines/reference/interfaceClassMerging2.js @@ -53,7 +53,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Bar.prototype.classBarMethod = function () { return this; diff --git a/tests/baselines/reference/interfaceExtendsClass1.js b/tests/baselines/reference/interfaceExtendsClass1.js index 43c7c6f6fa4..8324a001f91 100644 --- a/tests/baselines/reference/interfaceExtendsClass1.js +++ b/tests/baselines/reference/interfaceExtendsClass1.js @@ -32,7 +32,7 @@ var Control = (function () { var Button = (function (_super) { __extends(Button, _super); function Button() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Button.prototype.select = function () { }; return Button; @@ -40,7 +40,7 @@ var Button = (function (_super) { var TextBox = (function (_super) { __extends(TextBox, _super); function TextBox() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } TextBox.prototype.select = function () { }; return TextBox; @@ -48,7 +48,7 @@ var TextBox = (function (_super) { var Image = (function (_super) { __extends(Image, _super); function Image() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Image; }(Control)); diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index e1bdbff85dd..1179ff101df 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -43,7 +43,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.foo = function (x) { return x; }; D.prototype.other = function (x) { return x; }; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index 1592b1a723b..49b5efbd012 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -39,9 +39,10 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); - this.x = 2; - this.y = 3; + var _this = _super.apply(this, arguments) || this; + _this.x = 2; + _this.y = 3; + return _this; } D.prototype.foo = function (x) { return x; }; D.prototype.other = function (x) { return x; }; @@ -51,8 +52,9 @@ var D = (function (_super) { var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); - this.x = ""; + var _this = _super.apply(this, arguments) || this; + _this.x = ""; + return _this; } D2.prototype.foo = function (x) { return x; }; D2.prototype.other = function (x) { return x; }; diff --git a/tests/baselines/reference/interfaceImplementation8.js b/tests/baselines/reference/interfaceImplementation8.js index edfb33bfe1b..afb5a795264 100644 --- a/tests/baselines/reference/interfaceImplementation8.js +++ b/tests/baselines/reference/interfaceImplementation8.js @@ -64,21 +64,21 @@ var C3 = (function () { var C4 = (function (_super) { __extends(C4, _super); function C4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C4; }(C1)); var C5 = (function (_super) { __extends(C5, _super); function C5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C5; }(C2)); var C6 = (function (_super) { __extends(C6, _super); function C6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C6; }(C3)); @@ -90,7 +90,7 @@ var C7 = (function () { var C8 = (function (_super) { __extends(C8, _super); function C8() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C8; }(C7)); diff --git a/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.js b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.js index 8feecb53f98..a0c0e0b34fe 100644 --- a/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.js +++ b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.js @@ -19,7 +19,6 @@ var A = (function () { } return A; }()); -var A; (function (A) { A.a = 10; })(A || (A = {})); diff --git a/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.js b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.js index 27101bba5f9..5fc852cca40 100644 --- a/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.js +++ b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstanceNoConflict.js @@ -18,7 +18,6 @@ var A = (function () { } return A; }()); -var A; (function (A) { A.a = 10; })(A || (A = {})); diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js index cb3c22b52eb..6e9b09c906f 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js @@ -95,7 +95,7 @@ var Y; var BB = (function (_super) { __extends(BB, _super); function BB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return BB; }(A)); @@ -110,7 +110,7 @@ var Y2; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(AA)); @@ -144,7 +144,7 @@ var YY; var BB = (function (_super) { __extends(BB, _super); function BB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return BB; }(A)); @@ -159,7 +159,7 @@ var YY2; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(AA)); @@ -193,7 +193,7 @@ var YYY; var BB = (function (_super) { __extends(BB, _super); function BB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return BB; }(A)); @@ -208,7 +208,7 @@ var YYY2; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(AA)); diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index 0c90c6d0025..340429cc398 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -67,7 +67,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(C)); diff --git a/tests/baselines/reference/invalidNestedModules.js b/tests/baselines/reference/invalidNestedModules.js index 8b532ddd757..676817139f9 100644 --- a/tests/baselines/reference/invalidNestedModules.js +++ b/tests/baselines/reference/invalidNestedModules.js @@ -45,7 +45,6 @@ var A; })(C = B.C || (B.C = {})); })(B = A.B || (A.B = {})); })(A || (A = {})); -var A; (function (A) { var B; (function (B) { @@ -69,7 +68,6 @@ var M2; X.Point = Point; })(X = M2.X || (M2.X = {})); })(M2 || (M2 = {})); -var M2; (function (M2) { var X; (function (X) { diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index 0f5b0d3e08d..a6b07b7d7bd 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -41,7 +41,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/isDeclarationVisibleNodeKinds.js b/tests/baselines/reference/isDeclarationVisibleNodeKinds.js index e24032eb858..07bc9994742 100644 --- a/tests/baselines/reference/isDeclarationVisibleNodeKinds.js +++ b/tests/baselines/reference/isDeclarationVisibleNodeKinds.js @@ -79,7 +79,6 @@ var schema; schema_1.createValidator1 = createValidator1; })(schema || (schema = {})); // Constructor types -var schema; (function (schema_2) { function createValidator2(schema) { return undefined; @@ -87,7 +86,6 @@ var schema; schema_2.createValidator2 = createValidator2; })(schema || (schema = {})); // union types -var schema; (function (schema_3) { function createValidator3(schema) { return undefined; @@ -95,7 +93,6 @@ var schema; schema_3.createValidator3 = createValidator3; })(schema || (schema = {})); // Array types -var schema; (function (schema_4) { function createValidator4(schema) { return undefined; @@ -103,7 +100,6 @@ var schema; schema_4.createValidator4 = createValidator4; })(schema || (schema = {})); // TypeLiterals -var schema; (function (schema_5) { function createValidator5(schema) { return undefined; @@ -111,7 +107,6 @@ var schema; schema_5.createValidator5 = createValidator5; })(schema || (schema = {})); // Tuple types -var schema; (function (schema_6) { function createValidator6(schema) { return undefined; @@ -119,7 +114,6 @@ var schema; schema_6.createValidator6 = createValidator6; })(schema || (schema = {})); // Paren Types -var schema; (function (schema_7) { function createValidator7(schema) { return undefined; @@ -127,14 +121,12 @@ var schema; schema_7.createValidator7 = createValidator7; })(schema || (schema = {})); // Type reference -var schema; (function (schema_8) { function createValidator8(schema) { return undefined; } schema_8.createValidator8 = createValidator8; })(schema || (schema = {})); -var schema; (function (schema) { var T = (function () { function T() { diff --git a/tests/baselines/reference/isolatedModulesImportExportElision.js b/tests/baselines/reference/isolatedModulesImportExportElision.js index 2d391a64fe7..6f1d38dcbb5 100644 --- a/tests/baselines/reference/isolatedModulesImportExportElision.js +++ b/tests/baselines/reference/isolatedModulesImportExportElision.js @@ -26,7 +26,7 @@ var ns = require("module"); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(module_2.c2.C)); diff --git a/tests/baselines/reference/jsxViaImport.js b/tests/baselines/reference/jsxViaImport.js index 63c84090c9c..604787af744 100644 --- a/tests/baselines/reference/jsxViaImport.js +++ b/tests/baselines/reference/jsxViaImport.js @@ -35,7 +35,7 @@ var BaseComponent = require("BaseComponent"); var TestComponent = (function (_super) { __extends(TestComponent, _super); function TestComponent() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } TestComponent.prototype.render = function () { return ; diff --git a/tests/baselines/reference/lambdaArgCrash.js b/tests/baselines/reference/lambdaArgCrash.js index 822aa71efd0..47db7f3ce64 100644 --- a/tests/baselines/reference/lambdaArgCrash.js +++ b/tests/baselines/reference/lambdaArgCrash.js @@ -56,7 +56,7 @@ var Event = (function () { var ItemSetEvent = (function (_super) { __extends(ItemSetEvent, _super); function ItemSetEvent() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ItemSetEvent.prototype.add = function (listener) { _super.prototype.add.call(this, listener); diff --git a/tests/baselines/reference/lift.js b/tests/baselines/reference/lift.js index 568379948bc..364d52d9385 100644 --- a/tests/baselines/reference/lift.js +++ b/tests/baselines/reference/lift.js @@ -32,9 +32,10 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C(y, z, w) { - _super.call(this, y); + var _this = _super.call(this, y) || this; var x = 10 + w; var ll = x * w; + return _this; } C.prototype.liftxyz = function () { return x + z + this.y; }; C.prototype.liftxylocllz = function () { return x + z + this.y + this.ll; }; diff --git a/tests/baselines/reference/localTypes1.js b/tests/baselines/reference/localTypes1.js index a4f835c8669..100452b7a96 100644 --- a/tests/baselines/reference/localTypes1.js +++ b/tests/baselines/reference/localTypes1.js @@ -300,7 +300,7 @@ function f6() { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -308,7 +308,7 @@ function f6() { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/m7Bugs.js b/tests/baselines/reference/m7Bugs.js index 6292356faf5..e5a4d11f00c 100644 --- a/tests/baselines/reference/m7Bugs.js +++ b/tests/baselines/reference/m7Bugs.js @@ -42,7 +42,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(C1)); diff --git a/tests/baselines/reference/mergeThreeInterfaces2.js b/tests/baselines/reference/mergeThreeInterfaces2.js index f853dad3a28..ef504a5f6ec 100644 --- a/tests/baselines/reference/mergeThreeInterfaces2.js +++ b/tests/baselines/reference/mergeThreeInterfaces2.js @@ -76,7 +76,6 @@ var M2; var r1 = a.foo; var r2 = a.bar; })(M2 || (M2 = {})); -var M2; (function (M2) { var a; var r1 = a.foo; @@ -84,7 +83,6 @@ var M2; var r3 = a.baz; })(M2 || (M2 = {})); // same as above but with an additional level of nesting and third module declaration -var M2; (function (M2) { var M3; (function (M3) { @@ -93,7 +91,6 @@ var M2; var r2 = a.bar; })(M3 = M2.M3 || (M2.M3 = {})); })(M2 || (M2 = {})); -var M2; (function (M2) { var M3; (function (M3) { @@ -103,7 +100,6 @@ var M2; var r3 = a.baz; })(M3 = M2.M3 || (M2.M3 = {})); })(M2 || (M2 = {})); -var M2; (function (M2) { var M3; (function (M3) { diff --git a/tests/baselines/reference/mergeTwoInterfaces2.js b/tests/baselines/reference/mergeTwoInterfaces2.js index 4f45c8f821e..3ab21df428c 100644 --- a/tests/baselines/reference/mergeTwoInterfaces2.js +++ b/tests/baselines/reference/mergeTwoInterfaces2.js @@ -56,14 +56,12 @@ var M2; var r1 = a.foo; var r2 = a.bar; })(M2 || (M2 = {})); -var M2; (function (M2) { var a; var r1 = a.foo; var r2 = a.bar; })(M2 || (M2 = {})); // same as above but with an additional level of nesting -var M2; (function (M2) { var M3; (function (M3) { @@ -72,7 +70,6 @@ var M2; var r2 = a.bar; })(M3 = M2.M3 || (M2.M3 = {})); })(M2 || (M2 = {})); -var M2; (function (M2) { var M3; (function (M3) { diff --git a/tests/baselines/reference/mergedDeclarations1.js b/tests/baselines/reference/mergedDeclarations1.js index 641ff031ded..f8663d12549 100644 --- a/tests/baselines/reference/mergedDeclarations1.js +++ b/tests/baselines/reference/mergedDeclarations1.js @@ -20,7 +20,6 @@ var b = point.equals(p1, p2); function point(x, y) { return { x: x, y: y }; } -var point; (function (point) { point.origin = point(0, 0); function equals(p1, p2) { diff --git a/tests/baselines/reference/mergedDeclarations2.js b/tests/baselines/reference/mergedDeclarations2.js index 962346541cc..b35ec48f7a8 100644 --- a/tests/baselines/reference/mergedDeclarations2.js +++ b/tests/baselines/reference/mergedDeclarations2.js @@ -15,11 +15,9 @@ var Foo; (function (Foo) { Foo[Foo["b"] = 0] = "b"; })(Foo || (Foo = {})); -var Foo; (function (Foo) { Foo[Foo["a"] = 0] = "a"; })(Foo || (Foo = {})); -var Foo; (function (Foo) { Foo.x = b; })(Foo || (Foo = {})); diff --git a/tests/baselines/reference/mergedDeclarations3.js b/tests/baselines/reference/mergedDeclarations3.js index 272946b5075..ddf94b46e81 100644 --- a/tests/baselines/reference/mergedDeclarations3.js +++ b/tests/baselines/reference/mergedDeclarations3.js @@ -48,7 +48,6 @@ var M; })(M.Color || (M.Color = {})); var Color = M.Color; })(M || (M = {})); -var M; (function (M) { var Color; (function (Color) { @@ -56,27 +55,23 @@ var M; })(Color = M.Color || (M.Color = {})); })(M || (M = {})); var p = M.Color.Blue; // ok -var M; (function (M) { function foo() { } M.foo = foo; })(M || (M = {})); -var M; (function (M) { var foo; (function (foo) { foo.x = 1; })(foo || (foo = {})); })(M || (M = {})); -var M; (function (M) { var foo; (function (foo) { foo.y = 2; })(foo = M.foo || (M.foo = {})); })(M || (M = {})); -var M; (function (M) { var foo; (function (foo) { diff --git a/tests/baselines/reference/mergedDeclarations4.js b/tests/baselines/reference/mergedDeclarations4.js index 64fad6bd598..c47632b0a69 100644 --- a/tests/baselines/reference/mergedDeclarations4.js +++ b/tests/baselines/reference/mergedDeclarations4.js @@ -27,7 +27,6 @@ var M; M.f(); var r = f.hello; })(M || (M = {})); -var M; (function (M) { var f; (function (f) { diff --git a/tests/baselines/reference/mergedDeclarations5.js b/tests/baselines/reference/mergedDeclarations5.js index ce4b929c7f9..b24e86eca58 100644 --- a/tests/baselines/reference/mergedDeclarations5.js +++ b/tests/baselines/reference/mergedDeclarations5.js @@ -27,7 +27,7 @@ var __extends = (this && this.__extends) || function (d, b) { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.foo = function () { }; return B; diff --git a/tests/baselines/reference/mergedDeclarations6.js b/tests/baselines/reference/mergedDeclarations6.js index 2ff9d3e6604..d610e4ab46f 100644 --- a/tests/baselines/reference/mergedDeclarations6.js +++ b/tests/baselines/reference/mergedDeclarations6.js @@ -47,7 +47,7 @@ define(["require", "exports", "./a"], function (require, exports, a_1) { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.setProtected = function () { }; diff --git a/tests/baselines/reference/mergedEnumDeclarationCodeGen.js b/tests/baselines/reference/mergedEnumDeclarationCodeGen.js index 57b6e8051f8..ecf2474430e 100644 --- a/tests/baselines/reference/mergedEnumDeclarationCodeGen.js +++ b/tests/baselines/reference/mergedEnumDeclarationCodeGen.js @@ -13,7 +13,6 @@ var E; E[E["a"] = 0] = "a"; E[E["b"] = 0] = "b"; })(E || (E = {})); -var E; (function (E) { E[E["c"] = 0] = "c"; })(E || (E = {})); diff --git a/tests/baselines/reference/mergedInheritedClassInterface.js b/tests/baselines/reference/mergedInheritedClassInterface.js index 72ac1c8a928..0f598f2cf78 100644 --- a/tests/baselines/reference/mergedInheritedClassInterface.js +++ b/tests/baselines/reference/mergedInheritedClassInterface.js @@ -61,7 +61,7 @@ var BaseClass = (function () { var Child = (function (_super) { __extends(Child, _super); function Child() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Child.prototype.method = function () { }; return Child; @@ -75,7 +75,7 @@ var ChildNoBaseClass = (function () { var Grandchild = (function (_super) { __extends(Grandchild, _super); function Grandchild() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Grandchild; }(ChildNoBaseClass)); diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js index a7e341c31ce..6dccf1dfdd9 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js @@ -50,14 +50,14 @@ var C2 = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E; }(C2)); diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js index 3d9c4e1175e..a3ca796575c 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js @@ -57,7 +57,7 @@ var C2 = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen.js b/tests/baselines/reference/mergedModuleDeclarationCodeGen.js index f71702386ec..573701d407b 100644 --- a/tests/baselines/reference/mergedModuleDeclarationCodeGen.js +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen.js @@ -29,7 +29,6 @@ var X; }()); })(Y = X.Y || (X.Y = {})); })(X = exports.X || (exports.X = {})); -var X; (function (X) { var Y; (function (Y) { diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen2.js b/tests/baselines/reference/mergedModuleDeclarationCodeGen2.js index bb7c34e4ac5..224042ac571 100644 --- a/tests/baselines/reference/mergedModuleDeclarationCodeGen2.js +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen2.js @@ -20,7 +20,6 @@ var my; })(foo = data.foo || (data.foo = {})); })(data = my.data || (my.data = {})); })(my || (my = {})); -var my; (function (my_1) { var data; (function (data_1) { diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen3.js b/tests/baselines/reference/mergedModuleDeclarationCodeGen3.js index 4a002e88f3d..5b16fe16dd2 100644 --- a/tests/baselines/reference/mergedModuleDeclarationCodeGen3.js +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen3.js @@ -17,7 +17,6 @@ var my; data.buz = buz; })(data = my.data || (my.data = {})); })(my || (my = {})); -var my; (function (my_1) { var data; (function (data_1) { diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen4.js b/tests/baselines/reference/mergedModuleDeclarationCodeGen4.js index 3e4a2dcd308..9a351c5c55e 100644 --- a/tests/baselines/reference/mergedModuleDeclarationCodeGen4.js +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen4.js @@ -32,7 +32,6 @@ var superContain; })(data = buz.data || (buz.data = {})); })(buz = my.buz || (my.buz = {})); })(my = contain_1.my || (contain_1.my = {})); - var my; (function (my_1) { var buz; (function (buz_1) { diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen5.js b/tests/baselines/reference/mergedModuleDeclarationCodeGen5.js index a5bc2e8e56e..11a4773d63a 100644 --- a/tests/baselines/reference/mergedModuleDeclarationCodeGen5.js +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen5.js @@ -32,7 +32,6 @@ var M; })(plop = buz.plop || (buz.plop = {})); })(buz = M_1.buz || (M_1.buz = {})); })(M || (M = {})); -var M; (function (M) { var buz; (function (buz_1) { diff --git a/tests/baselines/reference/mergedModuleDeclarationWithSharedExportedVar.js b/tests/baselines/reference/mergedModuleDeclarationWithSharedExportedVar.js index f2f45c621d0..df8c0f8470c 100644 --- a/tests/baselines/reference/mergedModuleDeclarationWithSharedExportedVar.js +++ b/tests/baselines/reference/mergedModuleDeclarationWithSharedExportedVar.js @@ -13,7 +13,6 @@ var M; M.v = 10; M.v; })(M || (M = {})); -var M; (function (M) { M.v; })(M || (M = {})); diff --git a/tests/baselines/reference/missingFunctionImplementation.js b/tests/baselines/reference/missingFunctionImplementation.js index a452c8080b7..d9ab942cfc8 100644 --- a/tests/baselines/reference/missingFunctionImplementation.js +++ b/tests/baselines/reference/missingFunctionImplementation.js @@ -131,7 +131,6 @@ var C8 = (function () { } return C8; }()); -var C8; (function (C8) { function m(a, b) { } C8.m = m; @@ -143,14 +142,12 @@ var C9 = (function () { C9.m = function (a) { }; return C9; }()); -var C9; (function (C9) { })(C9 || (C9 = {})); // merged namespaces var N10; (function (N10) { })(N10 || (N10 = {})); -var N10; (function (N10) { function m(a) { } N10.m = m; @@ -161,7 +158,6 @@ var N12; function m(a) { } N12.m = m; })(N12 || (N12 = {})); -var N12; (function (N12) { function m(a) { } N12.m = m; diff --git a/tests/baselines/reference/missingPropertiesOfClassExpression.js b/tests/baselines/reference/missingPropertiesOfClassExpression.js index 54834397b64..c7b30882b14 100644 --- a/tests/baselines/reference/missingPropertiesOfClassExpression.js +++ b/tests/baselines/reference/missingPropertiesOfClassExpression.js @@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || function (d, b) { var George = (function (_super) { __extends(George, _super); function George() { - _super.call(this); + return _super.call(this) || this; } return George; }((function () { diff --git a/tests/baselines/reference/moduleAsBaseType.js b/tests/baselines/reference/moduleAsBaseType.js index 71f16846363..fc0533a2470 100644 --- a/tests/baselines/reference/moduleAsBaseType.js +++ b/tests/baselines/reference/moduleAsBaseType.js @@ -13,7 +13,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(M)); diff --git a/tests/baselines/reference/moduleDuplicateIdentifiers.js b/tests/baselines/reference/moduleDuplicateIdentifiers.js index 1da296d7d12..097192ac73c 100644 --- a/tests/baselines/reference/moduleDuplicateIdentifiers.js +++ b/tests/baselines/reference/moduleDuplicateIdentifiers.js @@ -48,7 +48,6 @@ var FooBar; (function (FooBar) { FooBar.member1 = 2; })(FooBar = exports.FooBar || (exports.FooBar = {})); -var FooBar; (function (FooBar) { FooBar.member2 = 42; })(FooBar = exports.FooBar || (exports.FooBar = {})); diff --git a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js index cd2df2633ae..51d9eb89b1d 100644 --- a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js +++ b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js @@ -31,7 +31,7 @@ define(["require", "exports"], function (require, exports) { var Test1 = (function (_super) { __extends(Test1, _super); function Test1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Test1; }(C1)); diff --git a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.js b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.js index 090d6502d5b..e0e95b3c72b 100644 --- a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.js +++ b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.js @@ -61,7 +61,6 @@ var TypeScript; }()); })(Parser = TypeScript.Parser || (TypeScript.Parser = {})); })(TypeScript || (TypeScript = {})); -var TypeScript; (function (TypeScript) { ; ; @@ -81,7 +80,6 @@ var TypeScript; }()); TypeScript.PositionedToken = PositionedToken; })(TypeScript || (TypeScript = {})); -var TypeScript; (function (TypeScript) { var SyntaxNode = (function () { function SyntaxNode() { @@ -98,7 +96,6 @@ var TypeScript; }()); TypeScript.SyntaxNode = SyntaxNode; })(TypeScript || (TypeScript = {})); -var TypeScript; (function (TypeScript) { var Syntax; (function (Syntax) { diff --git a/tests/baselines/reference/moduleMerge.js b/tests/baselines/reference/moduleMerge.js index 04f2f511b8d..4e5aac120fc 100644 --- a/tests/baselines/reference/moduleMerge.js +++ b/tests/baselines/reference/moduleMerge.js @@ -36,7 +36,6 @@ var A; return B; }()); })(A || (A = {})); -var A; (function (A) { var B = (function () { function B() { diff --git a/tests/baselines/reference/moduleReopenedTypeOtherBlock.js b/tests/baselines/reference/moduleReopenedTypeOtherBlock.js index 3380cd0ec7d..007090a0c11 100644 --- a/tests/baselines/reference/moduleReopenedTypeOtherBlock.js +++ b/tests/baselines/reference/moduleReopenedTypeOtherBlock.js @@ -18,7 +18,6 @@ var M; }()); M.C1 = C1; })(M || (M = {})); -var M; (function (M) { var C2 = (function () { function C2() { diff --git a/tests/baselines/reference/moduleReopenedTypeSameBlock.js b/tests/baselines/reference/moduleReopenedTypeSameBlock.js index b9624e75b75..07b5e8e657e 100644 --- a/tests/baselines/reference/moduleReopenedTypeSameBlock.js +++ b/tests/baselines/reference/moduleReopenedTypeSameBlock.js @@ -16,7 +16,6 @@ var M; }()); M.C1 = C1; })(M || (M = {})); -var M; (function (M) { var C2 = (function () { function C2() { diff --git a/tests/baselines/reference/moduleVariables.js b/tests/baselines/reference/moduleVariables.js index e127fec768f..3f5047c6266 100644 --- a/tests/baselines/reference/moduleVariables.js +++ b/tests/baselines/reference/moduleVariables.js @@ -24,11 +24,9 @@ var M; M.x = 2; console.log(M.x); // 2 })(M || (M = {})); -var M; (function (M) { console.log(M.x); // 2 })(M || (M = {})); -var M; (function (M) { var x = 3; console.log(x); // 3 diff --git a/tests/baselines/reference/moduleVisibilityTest1.js b/tests/baselines/reference/moduleVisibilityTest1.js index 3278613409d..52afcf169d9 100644 --- a/tests/baselines/reference/moduleVisibilityTest1.js +++ b/tests/baselines/reference/moduleVisibilityTest1.js @@ -116,7 +116,6 @@ var M; var someModuleVar = 4; function someModuleFunction() { return 5; } })(M || (M = {})); -var M; (function (M) { M.c = M.x; M.meb = M.E.B; diff --git a/tests/baselines/reference/moduleVisibilityTest2.js b/tests/baselines/reference/moduleVisibilityTest2.js index 51f3b00255b..62b12b87808 100644 --- a/tests/baselines/reference/moduleVisibilityTest2.js +++ b/tests/baselines/reference/moduleVisibilityTest2.js @@ -117,7 +117,6 @@ var M; var someModuleVar = 4; function someModuleFunction() { return 5; } })(M || (M = {})); -var M; (function (M) { M.c = x; M.meb = M.E.B; diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js index ec434286f43..1558ef742ab 100644 --- a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js @@ -79,14 +79,14 @@ var A; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(AA)); var BB = (function (_super) { __extends(BB, _super); function BB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return BB; }(A)); @@ -130,7 +130,7 @@ var Y; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(AA)); @@ -138,7 +138,7 @@ var Y; var BB = (function (_super) { __extends(BB, _super); function BB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return BB; }(A)); diff --git a/tests/baselines/reference/moduledecl.js b/tests/baselines/reference/moduledecl.js index f4efbadbf3e..437907017fc 100644 --- a/tests/baselines/reference/moduledecl.js +++ b/tests/baselines/reference/moduledecl.js @@ -278,7 +278,6 @@ var m; (function (m3) { })(m3 = m.m3 || (m.m3 = {})); })(m || (m = {})); -var m; (function (m) { var m25; (function (m25) { diff --git a/tests/baselines/reference/multiModuleClodule1.js b/tests/baselines/reference/multiModuleClodule1.js index b5b11058368..eac6bfa8d51 100644 --- a/tests/baselines/reference/multiModuleClodule1.js +++ b/tests/baselines/reference/multiModuleClodule1.js @@ -27,12 +27,10 @@ var C = (function () { C.boo = function () { }; return C; }()); -var C; (function (C) { C.x = 1; var y = 2; })(C || (C = {})); -var C; (function (C) { function foo() { } C.foo = foo; diff --git a/tests/baselines/reference/multiModuleFundule1.js b/tests/baselines/reference/multiModuleFundule1.js index 6aa9cb959ba..43bfe0b35fa 100644 --- a/tests/baselines/reference/multiModuleFundule1.js +++ b/tests/baselines/reference/multiModuleFundule1.js @@ -14,11 +14,9 @@ var r3 = C.foo(); //// [multiModuleFundule1.js] function C(x) { } -var C; (function (C) { C.x = 1; })(C || (C = {})); -var C; (function (C) { function foo() { } C.foo = foo; diff --git a/tests/baselines/reference/multipleExports.js b/tests/baselines/reference/multipleExports.js index c70a5005aab..fd6ac67e82a 100644 --- a/tests/baselines/reference/multipleExports.js +++ b/tests/baselines/reference/multipleExports.js @@ -19,7 +19,6 @@ var M; M.v = 0; })(M = exports.M || (exports.M = {})); var x = 0; -var M; (function (M) { M.v; })(M = exports.M || (exports.M = {})); diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index 26372bfb718..9c0e865cdb7 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -57,28 +57,28 @@ var B2 = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B1)); var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1; }(B1)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(B2)); var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E; }(D1)); @@ -90,7 +90,7 @@ var N = (function () { var ND = (function (_super) { __extends(ND, _super); function ND() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ND; }(N)); @@ -104,7 +104,7 @@ var Good = (function () { var Baad = (function (_super) { __extends(Baad, _super); function Baad() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Baad.prototype.f = function () { return 0; }; Baad.prototype.g = function (n) { return 0; }; diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index c8cca671327..8b59564d465 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -25,7 +25,7 @@ var foo = (function () { var foo2 = (function (_super) { __extends(foo2, _super); function foo2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return foo2; }(foo)); diff --git a/tests/baselines/reference/nameCollision.js b/tests/baselines/reference/nameCollision.js index 4f41bf4a086..e51bd5e7c69 100644 --- a/tests/baselines/reference/nameCollision.js +++ b/tests/baselines/reference/nameCollision.js @@ -58,7 +58,6 @@ var B; (function (B) { var A = 12; })(B || (B = {})); -var B; (function (B_1) { // re-opened module with colliding name // this should add an underscore. diff --git a/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.js b/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.js index 6a7041a6733..a13c38cf737 100644 --- a/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.js +++ b/tests/baselines/reference/nameCollisionWithBlockScopedVariable1.js @@ -16,7 +16,6 @@ var M; } M.C = C; })(M || (M = {})); -var M; (function (M_1) { { let M = 0; diff --git a/tests/baselines/reference/noEmitHelpers.js b/tests/baselines/reference/noEmitHelpers.js index b2c26c6af75..fdb7cbab7d4 100644 --- a/tests/baselines/reference/noEmitHelpers.js +++ b/tests/baselines/reference/noEmitHelpers.js @@ -13,7 +13,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js index 69d98d4b0c6..cc4c9422373 100644 --- a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js @@ -26,7 +26,7 @@ var Parent = (function () { var Child = (function (_super) { __extends(Child, _super); function Child() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(Child.prototype, "message", { set: function (str) { diff --git a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js index 7ad703fd3b7..1323955c05e 100644 --- a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js @@ -25,7 +25,7 @@ var Parent = (function () { var Child = (function (_super) { __extends(Child, _super); function Child() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(Child.prototype, "message", { get: function () { diff --git a/tests/baselines/reference/nonExportedElementsOfMergedModules.js b/tests/baselines/reference/nonExportedElementsOfMergedModules.js index e46bf62c05f..623d8b0036e 100644 --- a/tests/baselines/reference/nonExportedElementsOfMergedModules.js +++ b/tests/baselines/reference/nonExportedElementsOfMergedModules.js @@ -27,7 +27,6 @@ var One; (function (B) { })(B || (B = {})); })(One || (One = {})); -var One; (function (One) { var A; (function (A) { diff --git a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js index b9927ebf193..b0a3365193d 100644 --- a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js +++ b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js @@ -19,7 +19,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar; }(Foo)); // Valid diff --git a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js index d285818aaa9..905ea763d56 100644 --- a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js +++ b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js @@ -142,7 +142,6 @@ var r13 = true ? null : E; var r14 = true ? E.A : null; var r14 = true ? null : E.A; function f() { } -var f; (function (f) { f.bar = 1; })(f || (f = {})); @@ -154,7 +153,6 @@ var c = (function () { } return c; }()); -var c; (function (c) { c.bar = 1; })(c || (c = {})); diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index cef2759e1d5..92c8b380e00 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -61,7 +61,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.bar = function () { return ''; }; return B; diff --git a/tests/baselines/reference/numericIndexerConstraint3.js b/tests/baselines/reference/numericIndexerConstraint3.js index 9f7a61fe30d..29cb75b4234 100644 --- a/tests/baselines/reference/numericIndexerConstraint3.js +++ b/tests/baselines/reference/numericIndexerConstraint3.js @@ -26,7 +26,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/numericIndexerConstraint4.js b/tests/baselines/reference/numericIndexerConstraint4.js index a9eace23833..135e169c4a9 100644 --- a/tests/baselines/reference/numericIndexerConstraint4.js +++ b/tests/baselines/reference/numericIndexerConstraint4.js @@ -26,7 +26,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/numericIndexerTyping2.js b/tests/baselines/reference/numericIndexerTyping2.js index 47fb46794f0..5b9e797bdec 100644 --- a/tests/baselines/reference/numericIndexerTyping2.js +++ b/tests/baselines/reference/numericIndexerTyping2.js @@ -26,7 +26,7 @@ var I = (function () { var I2 = (function (_super) { __extends(I2, _super); function I2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return I2; }(I)); diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.js b/tests/baselines/reference/objectCreationOfElementAccessExpression.js index dce09972c83..a1739ce0d8e 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.js +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.js @@ -81,50 +81,56 @@ var Food = (function () { var MonsterFood = (function (_super) { __extends(MonsterFood, _super); function MonsterFood(name, flavor) { - _super.call(this, name); - this.flavor = flavor; + var _this = _super.call(this, name) || this; + _this.flavor = flavor; + return _this; } return MonsterFood; }(Food)); var IceCream = (function (_super) { __extends(IceCream, _super); function IceCream(flavor) { - _super.call(this, "Ice Cream", flavor); - this.flavor = flavor; + var _this = _super.call(this, "Ice Cream", flavor) || this; + _this.flavor = flavor; + return _this; } return IceCream; }(MonsterFood)); var Cookie = (function (_super) { __extends(Cookie, _super); function Cookie(flavor, isGlutenFree) { - _super.call(this, "Cookie", flavor); - this.flavor = flavor; - this.isGlutenFree = isGlutenFree; + var _this = _super.call(this, "Cookie", flavor) || this; + _this.flavor = flavor; + _this.isGlutenFree = isGlutenFree; + return _this; } return Cookie; }(MonsterFood)); var PetFood = (function (_super) { __extends(PetFood, _super); function PetFood(name, whereToBuy) { - _super.call(this, name); - this.whereToBuy = whereToBuy; + var _this = _super.call(this, name) || this; + _this.whereToBuy = whereToBuy; + return _this; } return PetFood; }(Food)); var ExpensiveOrganicDogFood = (function (_super) { __extends(ExpensiveOrganicDogFood, _super); function ExpensiveOrganicDogFood(whereToBuy) { - _super.call(this, "Origen", whereToBuy); - this.whereToBuy = whereToBuy; + var _this = _super.call(this, "Origen", whereToBuy) || this; + _this.whereToBuy = whereToBuy; + return _this; } return ExpensiveOrganicDogFood; }(PetFood)); var ExpensiveOrganicCatFood = (function (_super) { __extends(ExpensiveOrganicCatFood, _super); function ExpensiveOrganicCatFood(whereToBuy, containsFish) { - _super.call(this, "Nature's Logic", whereToBuy); - this.whereToBuy = whereToBuy; - this.containsFish = containsFish; + var _this = _super.call(this, "Nature's Logic", whereToBuy) || this; + _this.whereToBuy = whereToBuy; + _this.containsFish = containsFish; + return _this; } return ExpensiveOrganicCatFood; }(PetFood)); diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js index 83dd0210a4c..69395b0df49 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js @@ -19,7 +19,6 @@ module m { var m; (function (m) { })(m || (m = {})); -var m; (function (m) { var z = m.x; var y = { diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js index 7a5aaa34242..c9d7edf8140 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js @@ -17,7 +17,6 @@ module m { var m; (function (m) { })(m || (m = {})); -var m; (function (m) { var z = m.x; var y = { diff --git a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js index 9c5bcfb8e2d..17045d65af0 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js @@ -68,7 +68,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js index 29781229b5a..e82cef9bdd6 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js @@ -147,14 +147,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js index 7ecb597a2d9..abcea113670 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js @@ -140,7 +140,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -162,14 +162,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js index 9710afe700d..f5aeb177472 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js @@ -147,14 +147,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates.js b/tests/baselines/reference/objectTypesIdentityWithPrivates.js index 7d6be5eaf8f..3946027063f 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates.js @@ -145,14 +145,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js index cb9c677f024..9cae6960a2e 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js @@ -53,7 +53,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js index 241fbcaf27e..68754a583aa 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js @@ -39,7 +39,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(C1)); @@ -53,7 +53,7 @@ var C3 = (function () { var C4 = (function (_super) { __extends(C4, _super); function C4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C4; }(C3)); diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js index c0578c2fba1..b0211bbbba7 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js @@ -147,14 +147,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js index 0670d45a5a5..00d7d1e81d8 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js @@ -140,7 +140,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -162,14 +162,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/optionalConstructorArgInSuper.js b/tests/baselines/reference/optionalConstructorArgInSuper.js index 3e6a47b4de2..e460ab3fb15 100644 --- a/tests/baselines/reference/optionalConstructorArgInSuper.js +++ b/tests/baselines/reference/optionalConstructorArgInSuper.js @@ -25,7 +25,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/optionalMethods.js b/tests/baselines/reference/optionalMethods.js index 98629f5718b..28ed0bcd76e 100644 --- a/tests/baselines/reference/optionalMethods.js +++ b/tests/baselines/reference/optionalMethods.js @@ -109,8 +109,9 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); - this.a = 1; + var _this = _super.apply(this, arguments) || this; + _this.a = 1; + return _this; } Derived.prototype.f = function () { return 1; }; return Derived; diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 6d42c38f907..1b603898aa6 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -162,7 +162,7 @@ var C2 = (function (_super) { __extends(C2, _super); function C2(v2) { if (v2 === void 0) { v2 = 6; } - _super.call(this, v2); + return _super.call(this, v2) || this; } return C2; }(C1)); diff --git a/tests/baselines/reference/optionalParamInOverride.js b/tests/baselines/reference/optionalParamInOverride.js index f6ccdbe3fab..1312a89502a 100644 --- a/tests/baselines/reference/optionalParamInOverride.js +++ b/tests/baselines/reference/optionalParamInOverride.js @@ -22,7 +22,7 @@ var Z = (function () { var Y = (function (_super) { __extends(Y, _super); function Y() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Y.prototype.func = function (value) { }; return Y; diff --git a/tests/baselines/reference/optionalParameterProperty.js b/tests/baselines/reference/optionalParameterProperty.js index 48cefeef22c..f9b9ecaf990 100644 --- a/tests/baselines/reference/optionalParameterProperty.js +++ b/tests/baselines/reference/optionalParameterProperty.js @@ -25,8 +25,9 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D(p) { - _super.call(this); - this.p = p; + var _this = _super.call(this) || this; + _this.p = p; + return _this; } return D; }(C)); diff --git a/tests/baselines/reference/outModuleConcatAmd.js b/tests/baselines/reference/outModuleConcatAmd.js index 8a478e675c6..5054c2a3c33 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js +++ b/tests/baselines/reference/outModuleConcatAmd.js @@ -28,7 +28,7 @@ define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(a_1.A)); diff --git a/tests/baselines/reference/outModuleConcatAmd.js.map b/tests/baselines/reference/outModuleConcatAmd.js.map index 7f9893b2346..e987d5deb8a 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js.map +++ b/tests/baselines/reference/outModuleConcatAmd.js.map @@ -1,2 +1,2 @@ //// [all.js.map] -{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;IACA;QAAA;QAAiB,CAAC;QAAD,QAAC;IAAD,CAAC,AAAlB,IAAkB;IAAlB,cAAkB;;;;ICAlB;QAAuB,qBAAC;QAAxB;YAAuB,8BAAC;QAAG,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAA5B,cAA4B"} \ No newline at end of file +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;IACA;QAAA;QAAiB,CAAC;QAAD,QAAC;IAAD,CAAC,AAAlB,IAAkB;IAAlB,cAAkB;;;;ICAlB;QAAuB,qBAAC;QAAxB;;QAA2B,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAA5B,cAA4B"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt index ba7f1d93245..1bfda049776 100644 --- a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt @@ -92,25 +92,18 @@ sourceFile:tests/cases/compiler/b.ts --- >>> function B() { 1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 1 >Emitted(19, 9) Source(2, 1) + SourceIndex(1) --- ->>> _super.apply(this, arguments); -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(20, 13) Source(2, 24) + SourceIndex(1) -2 >Emitted(20, 43) Source(2, 25) + SourceIndex(1) ---- +>>> return _super.apply(this, arguments) || this; >>> } -1 >^^^^^^^^ +1->^^^^^^^^ 2 > ^ 3 > ^^^^^^^^^-> -1 > { +1->export class B extends A { 2 > } -1 >Emitted(21, 9) Source(2, 28) + SourceIndex(1) +1->Emitted(21, 9) Source(2, 28) + SourceIndex(1) 2 >Emitted(21, 10) Source(2, 29) + SourceIndex(1) --- >>> return B; diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js index b23b73caf83..a615090f33a 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -44,7 +44,7 @@ System.register("b", ["ref/a"], function (exports_2, context_2) { B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(a_1.A)); diff --git a/tests/baselines/reference/outModuleConcatSystem.js.map b/tests/baselines/reference/outModuleConcatSystem.js.map index 59ab70de531..ac8fb23d87c 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js.map +++ b/tests/baselines/reference/outModuleConcatSystem.js.map @@ -1,2 +1,2 @@ //// [all.js.map] -{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;;;YACA;gBAAA;gBAAiB,CAAC;gBAAD,QAAC;YAAD,CAAC,AAAlB,IAAkB;;QAClB,CAAC;;;;;;;;;;;;;;YCDD;gBAAuB,qBAAC;gBAAxB;oBAAuB,8BAAC;gBAAG,CAAC;gBAAD,QAAC;YAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;;QAAA,CAAC"} \ No newline at end of file +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;;;YACA;gBAAA;gBAAiB,CAAC;gBAAD,QAAC;YAAD,CAAC,AAAlB,IAAkB;;QAClB,CAAC;;;;;;;;;;;;;;YCDD;gBAAuB,qBAAC;gBAAxB;;gBAA2B,CAAC;gBAAD,QAAC;YAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;;QAAA,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt index 86573493e20..732214237fa 100644 --- a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt @@ -109,25 +109,18 @@ sourceFile:tests/cases/compiler/b.ts --- >>> function B() { 1 >^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 1 >Emitted(35, 17) Source(2, 1) + SourceIndex(1) --- ->>> _super.apply(this, arguments); -1->^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(36, 21) Source(2, 24) + SourceIndex(1) -2 >Emitted(36, 51) Source(2, 25) + SourceIndex(1) ---- +>>> return _super.apply(this, arguments) || this; >>> } -1 >^^^^^^^^^^^^^^^^ +1->^^^^^^^^^^^^^^^^ 2 > ^ 3 > ^^^^^^^^^-> -1 > { +1->export class B extends A { 2 > } -1 >Emitted(37, 17) Source(2, 28) + SourceIndex(1) +1->Emitted(37, 17) Source(2, 28) + SourceIndex(1) 2 >Emitted(37, 18) Source(2, 29) + SourceIndex(1) --- >>> return B; diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js b/tests/baselines/reference/outModuleTripleSlashRefs.js index 90f8feab7bc..b9ff7c15b61 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js @@ -57,7 +57,7 @@ define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(a_1.A)); diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js.map b/tests/baselines/reference/outModuleTripleSlashRefs.js.map index c6e1aab6bc8..45d57990450 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js.map +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js.map @@ -1,2 +1,2 @@ //// [all.js.map] -{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/b.ts","tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;AAAA,iCAAiC;AACjC;IAAA;IAEA,CAAC;IAAD,UAAC;AAAD,CAAC,AAFD,IAEC;;;ICFD,+BAA+B;IAC/B;QAAA;QAEA,CAAC;QAAD,QAAC;IAAD,CAAC,AAFD,IAEC;IAFD,cAEC;;;;ICHD;QAAuB,qBAAC;QAAxB;YAAuB,8BAAC;QAAG,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAA5B,cAA4B"} \ No newline at end of file +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/b.ts","tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;AAAA,iCAAiC;AACjC;IAAA;IAEA,CAAC;IAAD,UAAC;AAAD,CAAC,AAFD,IAEC;;;ICFD,+BAA+B;IAC/B;QAAA;QAEA,CAAC;QAAD,QAAC;IAAD,CAAC,AAFD,IAEC;IAFD,cAEC;;;;ICHD;QAAuB,qBAAC;QAAxB;;QAA2B,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAA5B,cAA4B"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt index 8be43826419..482c898e0cb 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt +++ b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt @@ -168,25 +168,18 @@ sourceFile:tests/cases/compiler/b.ts --- >>> function B() { 1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 1 >Emitted(26, 9) Source(2, 1) + SourceIndex(2) --- ->>> _super.apply(this, arguments); -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->export class B extends -2 > A -1->Emitted(27, 13) Source(2, 24) + SourceIndex(2) -2 >Emitted(27, 43) Source(2, 25) + SourceIndex(2) ---- +>>> return _super.apply(this, arguments) || this; >>> } -1 >^^^^^^^^ +1->^^^^^^^^ 2 > ^ 3 > ^^^^^^^^^-> -1 > { +1->export class B extends A { 2 > } -1 >Emitted(28, 9) Source(2, 28) + SourceIndex(2) +1->Emitted(28, 9) Source(2, 28) + SourceIndex(2) 2 >Emitted(28, 10) Source(2, 29) + SourceIndex(2) --- >>> return B; diff --git a/tests/baselines/reference/overload1.js b/tests/baselines/reference/overload1.js index fd05873c647..41aafdfb29c 100644 --- a/tests/baselines/reference/overload1.js +++ b/tests/baselines/reference/overload1.js @@ -56,7 +56,7 @@ var O; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -64,7 +64,7 @@ var O; var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.js b/tests/baselines/reference/overloadOnConstConstraintChecks1.js index a3b7a329861..f9d1c81b06b 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks1.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.js @@ -37,7 +37,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; @@ -45,7 +45,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived2.prototype.baz = function () { }; return Derived2; @@ -53,7 +53,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived3.prototype.biz = function () { }; return Derived3; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.js b/tests/baselines/reference/overloadOnConstConstraintChecks2.js index efb57153b13..a680a62ddfe 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks2.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.js @@ -25,14 +25,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.foo = function () { }; return C; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.js b/tests/baselines/reference/overloadOnConstConstraintChecks3.js index 181f9d8129c..025e449fd6f 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks3.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.js @@ -27,14 +27,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.foo = function () { }; return C; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.js b/tests/baselines/reference/overloadOnConstConstraintChecks4.js index d73c59863ad..0f436a5f0b2 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.js @@ -27,22 +27,23 @@ var Z = (function () { var A = (function (_super) { __extends(A, _super); function A() { - _super.apply(this, arguments); - this.x = 1; + var _this = _super.apply(this, arguments) || this; + _this.x = 1; + return _this; } return A; }(Z)); var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.foo = function () { }; return C; diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js index c98075c04a1..e3f58c0f7d0 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js @@ -26,7 +26,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; @@ -34,7 +34,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived2.prototype.baz = function () { }; return Derived2; @@ -42,7 +42,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived3.prototype.biz = function () { }; return Derived3; diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index 0d25322fdfc..e5cc35c39c4 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -108,21 +108,21 @@ var SomeBase = (function () { var SomeDerived1 = (function (_super) { __extends(SomeDerived1, _super); function SomeDerived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return SomeDerived1; }(SomeBase)); var SomeDerived2 = (function (_super) { __extends(SomeDerived2, _super); function SomeDerived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return SomeDerived2; }(SomeBase)); var SomeDerived3 = (function (_super) { __extends(SomeDerived3, _super); function SomeDerived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return SomeDerived3; }(SomeBase)); diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.js b/tests/baselines/reference/overloadResolutionClassConstructors.js index 9fa55fe1e95..7c8b2e2ccb6 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.js +++ b/tests/baselines/reference/overloadResolutionClassConstructors.js @@ -115,21 +115,21 @@ var SomeBase = (function () { var SomeDerived1 = (function (_super) { __extends(SomeDerived1, _super); function SomeDerived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return SomeDerived1; }(SomeBase)); var SomeDerived2 = (function (_super) { __extends(SomeDerived2, _super); function SomeDerived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return SomeDerived2; }(SomeBase)); var SomeDerived3 = (function (_super) { __extends(SomeDerived3, _super); function SomeDerived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return SomeDerived3; }(SomeBase)); diff --git a/tests/baselines/reference/overloadResolutionConstructors.js b/tests/baselines/reference/overloadResolutionConstructors.js index 12d8480eefb..44bbfbcec2b 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.js +++ b/tests/baselines/reference/overloadResolutionConstructors.js @@ -116,21 +116,21 @@ var SomeBase = (function () { var SomeDerived1 = (function (_super) { __extends(SomeDerived1, _super); function SomeDerived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return SomeDerived1; }(SomeBase)); var SomeDerived2 = (function (_super) { __extends(SomeDerived2, _super); function SomeDerived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return SomeDerived2; }(SomeBase)); var SomeDerived3 = (function (_super) { __extends(SomeDerived3, _super); function SomeDerived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return SomeDerived3; }(SomeBase)); diff --git a/tests/baselines/reference/overloadingOnConstants1.js b/tests/baselines/reference/overloadingOnConstants1.js index b261201be40..96f4f7baf24 100644 --- a/tests/baselines/reference/overloadingOnConstants1.js +++ b/tests/baselines/reference/overloadingOnConstants1.js @@ -40,7 +40,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; @@ -48,7 +48,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived2.prototype.baz = function () { }; return Derived2; @@ -56,7 +56,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived3.prototype.biz = function () { }; return Derived3; diff --git a/tests/baselines/reference/overloadingOnConstants2.js b/tests/baselines/reference/overloadingOnConstants2.js index 977ae7ec5b9..0c34d0f4b76 100644 --- a/tests/baselines/reference/overloadingOnConstants2.js +++ b/tests/baselines/reference/overloadingOnConstants2.js @@ -42,7 +42,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/overridingPrivateStaticMembers.js b/tests/baselines/reference/overridingPrivateStaticMembers.js index ddd9fae6429..ca5616450ba 100644 --- a/tests/baselines/reference/overridingPrivateStaticMembers.js +++ b/tests/baselines/reference/overridingPrivateStaticMembers.js @@ -21,7 +21,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/parseErrorInHeritageClause1.js b/tests/baselines/reference/parseErrorInHeritageClause1.js index e2f66bfadd7..a9ca0a6db73 100644 --- a/tests/baselines/reference/parseErrorInHeritageClause1.js +++ b/tests/baselines/reference/parseErrorInHeritageClause1.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parser509630.js b/tests/baselines/reference/parser509630.js index 4d94ea619ec..d3648dc5b64 100644 --- a/tests/baselines/reference/parser509630.js +++ b/tests/baselines/reference/parser509630.js @@ -21,7 +21,7 @@ var Type = (function () { var Any = (function (_super) { __extends(Any, _super); function Any() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Any; }(Type)); diff --git a/tests/baselines/reference/parserAstSpans1.js b/tests/baselines/reference/parserAstSpans1.js index 41f07380e97..6b86353b959 100644 --- a/tests/baselines/reference/parserAstSpans1.js +++ b/tests/baselines/reference/parserAstSpans1.js @@ -318,8 +318,9 @@ var c2 = (function () { var c3 = (function (_super) { __extends(c3, _super); function c3() { - _super.call(this, 10); - this.p1 = _super.prototype.c2_p1; + var _this = _super.call(this, 10) || this; + _this.p1 = _super.prototype.c2_p1; + return _this; } /** c3 f1*/ c3.prototype.f1 = function () { @@ -362,7 +363,7 @@ c2_i.nc_f1(); var c4 = (function (_super) { __extends(c4, _super); function c4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return c4; }(c2)); @@ -404,8 +405,9 @@ var c5 = (function () { var c6 = (function (_super) { __extends(c6, _super); function c6() { - _super.call(this); - this.d = _super.prototype.b; + var _this = _super.call(this) || this; + _this.d = _super.prototype.b; + return _this; } return c6; }(c5)); diff --git a/tests/baselines/reference/parserClassDeclaration1.js b/tests/baselines/reference/parserClassDeclaration1.js index 41ecc9135c0..a61b492b7a9 100644 --- a/tests/baselines/reference/parserClassDeclaration1.js +++ b/tests/baselines/reference/parserClassDeclaration1.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserClassDeclaration3.js b/tests/baselines/reference/parserClassDeclaration3.js index c375b4b5a21..f58f0ab00cb 100644 --- a/tests/baselines/reference/parserClassDeclaration3.js +++ b/tests/baselines/reference/parserClassDeclaration3.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/parserClassDeclaration4.js b/tests/baselines/reference/parserClassDeclaration4.js index f19ac06c35c..912aa8c6581 100644 --- a/tests/baselines/reference/parserClassDeclaration4.js +++ b/tests/baselines/reference/parserClassDeclaration4.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserClassDeclaration5.js b/tests/baselines/reference/parserClassDeclaration5.js index 272edc89fb6..054aaf0eb7a 100644 --- a/tests/baselines/reference/parserClassDeclaration5.js +++ b/tests/baselines/reference/parserClassDeclaration5.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserClassDeclaration6.js b/tests/baselines/reference/parserClassDeclaration6.js index 88d8481d52a..1423edfe037 100644 --- a/tests/baselines/reference/parserClassDeclaration6.js +++ b/tests/baselines/reference/parserClassDeclaration6.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserEnumDeclaration4.js b/tests/baselines/reference/parserEnumDeclaration4.js index 47450d419e1..d5b1e696a3d 100644 --- a/tests/baselines/reference/parserEnumDeclaration4.js +++ b/tests/baselines/reference/parserEnumDeclaration4.js @@ -3,7 +3,6 @@ enum void { } //// [parserEnumDeclaration4.js] -var ; (function () { })( || ( = {})); void {}; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js index b53c41fb45c..aa0679bb8f5 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js index 500f6d38c6d..1308c7c194b 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js index 8c02a996ea5..b1471628fbd 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserGenericsInTypeContexts1.js b/tests/baselines/reference/parserGenericsInTypeContexts1.js index f6f4f39393f..641d296dc43 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts1.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts1.js @@ -26,7 +26,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserGenericsInTypeContexts2.js b/tests/baselines/reference/parserGenericsInTypeContexts2.js index 99e19586c52..b0f14a090ae 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts2.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts2.js @@ -26,7 +26,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js index 255cad3ca21..253f856a990 100644 --- a/tests/baselines/reference/parserRealSource10.js +++ b/tests/baselines/reference/parserRealSource10.js @@ -826,9 +826,10 @@ var TypeScript; var NumberLiteralToken = (function (_super) { __extends(NumberLiteralToken, _super); function NumberLiteralToken(value, hasEmptyFraction) { - _super.call(this, TokenID.NumberLiteral); - this.value = value; - this.hasEmptyFraction = hasEmptyFraction; + var _this = _super.call(this, TokenID.NumberLiteral) || this; + _this.value = value; + _this.hasEmptyFraction = hasEmptyFraction; + return _this; } NumberLiteralToken.prototype.getText = function () { return this.hasEmptyFraction ? this.value.toString() + ".0" : this.value.toString(); @@ -842,8 +843,9 @@ var TypeScript; var StringLiteralToken = (function (_super) { __extends(StringLiteralToken, _super); function StringLiteralToken(value) { - _super.call(this, TokenID.StringLiteral); - this.value = value; + var _this = _super.call(this, TokenID.StringLiteral) || this; + _this.value = value; + return _this; } StringLiteralToken.prototype.getText = function () { return this.value; @@ -857,9 +859,10 @@ var TypeScript; var IdentifierToken = (function (_super) { __extends(IdentifierToken, _super); function IdentifierToken(value, hasEscapeSequence) { - _super.call(this, TokenID.Identifier); - this.value = value; - this.hasEscapeSequence = hasEscapeSequence; + var _this = _super.call(this, TokenID.Identifier) || this; + _this.value = value; + _this.hasEscapeSequence = hasEscapeSequence; + return _this; } IdentifierToken.prototype.getText = function () { return this.value; @@ -873,8 +876,9 @@ var TypeScript; var WhitespaceToken = (function (_super) { __extends(WhitespaceToken, _super); function WhitespaceToken(tokenId, value) { - _super.call(this, tokenId); - this.value = value; + var _this = _super.call(this, tokenId) || this; + _this.value = value; + return _this; } WhitespaceToken.prototype.getText = function () { return this.value; @@ -888,12 +892,13 @@ var TypeScript; var CommentToken = (function (_super) { __extends(CommentToken, _super); function CommentToken(tokenID, value, isBlock, startPos, line, endsLine) { - _super.call(this, tokenID); - this.value = value; - this.isBlock = isBlock; - this.startPos = startPos; - this.line = line; - this.endsLine = endsLine; + var _this = _super.call(this, tokenID) || this; + _this.value = value; + _this.isBlock = isBlock; + _this.startPos = startPos; + _this.line = line; + _this.endsLine = endsLine; + return _this; } CommentToken.prototype.getText = function () { return this.value; @@ -907,8 +912,9 @@ var TypeScript; var RegularExpressionLiteralToken = (function (_super) { __extends(RegularExpressionLiteralToken, _super); function RegularExpressionLiteralToken(regex) { - _super.call(this, TokenID.RegularExpressionLiteral); - this.regex = regex; + var _this = _super.call(this, TokenID.RegularExpressionLiteral) || this; + _this.regex = regex; + return _this; } RegularExpressionLiteralToken.prototype.getText = function () { return this.regex.toString(); diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index 0c1d1064255..eb05d13f4ed 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2386,15 +2386,16 @@ var TypeScript; var AST = (function (_super) { __extends(AST, _super); function AST(nodeType) { - _super.call(this); - this.nodeType = nodeType; - this.type = null; - this.flags = ASTFlags.Writeable; + var _this = _super.call(this) || this; + _this.nodeType = nodeType; + _this.type = null; + _this.flags = ASTFlags.Writeable; // REVIEW: for diagnostic purposes - this.passCreated = CompilerDiagnostics.analysisPass; - this.preComments = null; - this.postComments = null; - this.isParenthesized = false; + _this.passCreated = CompilerDiagnostics.analysisPass; + _this.preComments = null; + _this.postComments = null; + _this.isParenthesized = false; + return _this; } AST.prototype.isExpression = function () { return false; }; AST.prototype.isStatementOrExpression = function () { return false; }; @@ -2542,9 +2543,10 @@ var TypeScript; var IncompleteAST = (function (_super) { __extends(IncompleteAST, _super); function IncompleteAST(min, lim) { - _super.call(this, NodeType.Error); - this.minChar = min; - this.limChar = lim; + var _this = _super.call(this, NodeType.Error) || this; + _this.minChar = min; + _this.limChar = lim; + return _this; } return IncompleteAST; }(AST)); @@ -2552,9 +2554,10 @@ var TypeScript; var ASTList = (function (_super) { __extends(ASTList, _super); function ASTList() { - _super.call(this, NodeType.List); - this.enclosingScope = null; - this.members = new AST[]; + var _this = _super.call(this, NodeType.List) || this; + _this.enclosingScope = null; + _this.members = new AST[]; + return _this; } ASTList.prototype.addToControlFlow = function (context) { var len = this.members.length; @@ -2619,12 +2622,13 @@ var TypeScript; // To change text, and to avoid running into a situation where 'actualText' does not // match 'text', always use setText. function Identifier(actualText, hasEscapeSequence) { - _super.call(this, NodeType.Name); - this.actualText = actualText; - this.hasEscapeSequence = hasEscapeSequence; - this.sym = null; - this.cloId = -1; - this.setText(actualText, hasEscapeSequence); + var _this = _super.call(this, NodeType.Name) || this; + _this.actualText = actualText; + _this.hasEscapeSequence = hasEscapeSequence; + _this.sym = null; + _this.cloId = -1; + _this.setText(actualText, hasEscapeSequence); + return _this; } Identifier.prototype.setText = function (actualText, hasEscapeSequence) { this.actualText = actualText; @@ -2663,7 +2667,7 @@ var TypeScript; var MissingIdentifier = (function (_super) { __extends(MissingIdentifier, _super); function MissingIdentifier() { - _super.call(this, "__missing"); + return _super.call(this, "__missing") || this; } MissingIdentifier.prototype.isMissing = function () { return true; @@ -2677,8 +2681,9 @@ var TypeScript; var Label = (function (_super) { __extends(Label, _super); function Label(id) { - _super.call(this, NodeType.Label); - this.id = id; + var _this = _super.call(this, NodeType.Label) || this; + _this.id = id; + return _this; } Label.prototype.printLabel = function () { return this.id.actualText + ":"; }; Label.prototype.typeCheck = function (typeFlow) { @@ -2701,7 +2706,7 @@ var TypeScript; var Expression = (function (_super) { __extends(Expression, _super); function Expression(nodeType) { - _super.call(this, nodeType); + return _super.call(this, nodeType) || this; } Expression.prototype.isExpression = function () { return true; }; Expression.prototype.isStatementOrExpression = function () { return true; }; @@ -2711,10 +2716,11 @@ var TypeScript; var UnaryExpression = (function (_super) { __extends(UnaryExpression, _super); function UnaryExpression(nodeType, operand) { - _super.call(this, nodeType); - this.operand = operand; - this.targetType = null; // Target type for an object literal (null if no target type) - this.castTerm = null; + var _this = _super.call(this, nodeType) || this; + _this.operand = operand; + _this.targetType = null; // Target type for an object literal (null if no target type) + _this.castTerm = null; + return _this; } UnaryExpression.prototype.addToControlFlow = function (context) { _super.prototype.addToControlFlow.call(this, context); @@ -2855,11 +2861,12 @@ var TypeScript; var CallExpression = (function (_super) { __extends(CallExpression, _super); function CallExpression(nodeType, target, arguments) { - _super.call(this, nodeType); - this.target = target; - this.arguments = arguments; - this.signature = null; - this.minChar = this.target.minChar; + var _this = _super.call(this, nodeType) || this; + _this.target = target; + _this.arguments = arguments; + _this.signature = null; + _this.minChar = _this.target.minChar; + return _this; } CallExpression.prototype.typeCheck = function (typeFlow) { if (this.nodeType == NodeType.New) { @@ -2887,9 +2894,10 @@ var TypeScript; var BinaryExpression = (function (_super) { __extends(BinaryExpression, _super); function BinaryExpression(nodeType, operand1, operand2) { - _super.call(this, nodeType); - this.operand1 = operand1; - this.operand2 = operand2; + var _this = _super.call(this, nodeType) || this; + _this.operand1 = operand1; + _this.operand2 = operand2; + return _this; } BinaryExpression.prototype.typeCheck = function (typeFlow) { switch (this.nodeType) { @@ -3039,10 +3047,11 @@ var TypeScript; var ConditionalExpression = (function (_super) { __extends(ConditionalExpression, _super); function ConditionalExpression(operand1, operand2, operand3) { - _super.call(this, NodeType.ConditionalExpression); - this.operand1 = operand1; - this.operand2 = operand2; - this.operand3 = operand3; + var _this = _super.call(this, NodeType.ConditionalExpression) || this; + _this.operand1 = operand1; + _this.operand2 = operand2; + _this.operand3 = operand3; + return _this; } ConditionalExpression.prototype.typeCheck = function (typeFlow) { return typeFlow.typeCheckQMark(this); @@ -3064,10 +3073,11 @@ var TypeScript; var NumberLiteral = (function (_super) { __extends(NumberLiteral, _super); function NumberLiteral(value, hasEmptyFraction) { - _super.call(this, NodeType.NumberLit); - this.value = value; - this.hasEmptyFraction = hasEmptyFraction; - this.isNegativeZero = false; + var _this = _super.call(this, NodeType.NumberLit) || this; + _this.value = value; + _this.hasEmptyFraction = hasEmptyFraction; + _this.isNegativeZero = false; + return _this; } NumberLiteral.prototype.typeCheck = function (typeFlow) { this.type = typeFlow.doubleType; @@ -3105,8 +3115,9 @@ var TypeScript; var RegexLiteral = (function (_super) { __extends(RegexLiteral, _super); function RegexLiteral(regex) { - _super.call(this, NodeType.Regex); - this.regex = regex; + var _this = _super.call(this, NodeType.Regex) || this; + _this.regex = regex; + return _this; } RegexLiteral.prototype.typeCheck = function (typeFlow) { this.type = typeFlow.regexType; @@ -3125,8 +3136,9 @@ var TypeScript; var StringLiteral = (function (_super) { __extends(StringLiteral, _super); function StringLiteral(text) { - _super.call(this, NodeType.QString); - this.text = text; + var _this = _super.call(this, NodeType.QString) || this; + _this.text = text; + return _this; } StringLiteral.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); @@ -3151,7 +3163,7 @@ var TypeScript; var ModuleElement = (function (_super) { __extends(ModuleElement, _super); function ModuleElement(nodeType) { - _super.call(this, nodeType); + return _super.call(this, nodeType) || this; } return ModuleElement; }(AST)); @@ -3159,11 +3171,12 @@ var TypeScript; var ImportDeclaration = (function (_super) { __extends(ImportDeclaration, _super); function ImportDeclaration(id, alias) { - _super.call(this, NodeType.ImportDeclaration); - this.id = id; - this.alias = alias; - this.varFlags = VarFlags.None; - this.isDynamicImport = false; + var _this = _super.call(this, NodeType.ImportDeclaration) || this; + _this.id = id; + _this.alias = alias; + _this.varFlags = VarFlags.None; + _this.isDynamicImport = false; + return _this; } ImportDeclaration.prototype.isStatementOrExpression = function () { return true; }; ImportDeclaration.prototype.emit = function (emitter, tokenId, startLine) { @@ -3218,13 +3231,14 @@ var TypeScript; var BoundDecl = (function (_super) { __extends(BoundDecl, _super); function BoundDecl(id, nodeType, nestingLevel) { - _super.call(this, nodeType); - this.id = id; - this.nestingLevel = nestingLevel; - this.init = null; - this.typeExpr = null; - this.varFlags = VarFlags.None; - this.sym = null; + var _this = _super.call(this, nodeType) || this; + _this.id = id; + _this.nestingLevel = nestingLevel; + _this.init = null; + _this.typeExpr = null; + _this.varFlags = VarFlags.None; + _this.sym = null; + return _this; } BoundDecl.prototype.isStatementOrExpression = function () { return true; }; BoundDecl.prototype.isPrivate = function () { return hasFlag(this.varFlags, VarFlags.Private); }; @@ -3242,7 +3256,7 @@ var TypeScript; var VarDecl = (function (_super) { __extends(VarDecl, _super); function VarDecl(id, nest) { - _super.call(this, id, NodeType.VarDecl, nest); + return _super.call(this, id, NodeType.VarDecl, nest) || this; } VarDecl.prototype.isAmbient = function () { return hasFlag(this.varFlags, VarFlags.Ambient); }; VarDecl.prototype.isExported = function () { return hasFlag(this.varFlags, VarFlags.Exported); }; @@ -3259,9 +3273,10 @@ var TypeScript; var ArgDecl = (function (_super) { __extends(ArgDecl, _super); function ArgDecl(id) { - _super.call(this, id, NodeType.ArgDecl, 0); - this.isOptional = false; - this.parameterPropertySym = null; + var _this = _super.call(this, id, NodeType.ArgDecl, 0) || this; + _this.isOptional = false; + _this.parameterPropertySym = null; + return _this; } ArgDecl.prototype.isOptionalArg = function () { return this.isOptional || this.init; }; ArgDecl.prototype.treeViewLabel = function () { @@ -3281,36 +3296,37 @@ var TypeScript; var FuncDecl = (function (_super) { __extends(FuncDecl, _super); function FuncDecl(name, bod, isConstructor, arguments, vars, scopes, statics, nodeType) { - _super.call(this, nodeType); - this.name = name; - this.bod = bod; - this.isConstructor = isConstructor; - this.arguments = arguments; - this.vars = vars; - this.scopes = scopes; - this.statics = statics; - this.hint = null; - this.fncFlags = FncFlags.None; - this.returnTypeAnnotation = null; - this.variableArgList = false; - this.jumpRefs = null; - this.internalNameCache = null; - this.tmp1Declared = false; - this.enclosingFnc = null; - this.freeVariables = []; - this.unitIndex = -1; - this.classDecl = null; - this.boundToProperty = null; - this.isOverload = false; - this.innerStaticFuncs = []; - this.isTargetTypedAsMethod = false; - this.isInlineCallLiteral = false; - this.accessorSymbol = null; - this.leftCurlyCount = 0; - this.rightCurlyCount = 0; - this.returnStatementsWithExpressions = []; - this.scopeType = null; // Type of the FuncDecl, before target typing - this.endingToken = null; + var _this = _super.call(this, nodeType) || this; + _this.name = name; + _this.bod = bod; + _this.isConstructor = isConstructor; + _this.arguments = arguments; + _this.vars = vars; + _this.scopes = scopes; + _this.statics = statics; + _this.hint = null; + _this.fncFlags = FncFlags.None; + _this.returnTypeAnnotation = null; + _this.variableArgList = false; + _this.jumpRefs = null; + _this.internalNameCache = null; + _this.tmp1Declared = false; + _this.enclosingFnc = null; + _this.freeVariables = []; + _this.unitIndex = -1; + _this.classDecl = null; + _this.boundToProperty = null; + _this.isOverload = false; + _this.innerStaticFuncs = []; + _this.isTargetTypedAsMethod = false; + _this.isInlineCallLiteral = false; + _this.accessorSymbol = null; + _this.leftCurlyCount = 0; + _this.rightCurlyCount = 0; + _this.returnStatementsWithExpressions = []; + _this.scopeType = null; // Type of the FuncDecl, before target typing + _this.endingToken = null; + return _this; } FuncDecl.prototype.internalName = function () { if (this.internalNameCache == null) { @@ -3421,22 +3437,23 @@ var TypeScript; var Script = (function (_super) { __extends(Script, _super); function Script(vars, scopes) { - _super.call(this, new Identifier("script"), null, false, null, vars, scopes, null, NodeType.Script); - this.locationInfo = null; - this.referencedFiles = []; - this.requiresGlobal = false; - this.requiresInherits = false; - this.isResident = false; - this.isDeclareFile = false; - this.hasBeenTypeChecked = false; - this.topLevelMod = null; - this.leftCurlyCount = 0; - this.rightCurlyCount = 0; + var _this = _super.call(this, new Identifier("script"), null, false, null, vars, scopes, null, NodeType.Script) || this; + _this.locationInfo = null; + _this.referencedFiles = []; + _this.requiresGlobal = false; + _this.requiresInherits = false; + _this.isResident = false; + _this.isDeclareFile = false; + _this.hasBeenTypeChecked = false; + _this.topLevelMod = null; + _this.leftCurlyCount = 0; + _this.rightCurlyCount = 0; // Remember if the script contains Unicode chars, that is needed when generating code for this script object to decide the output file correct encoding. - this.containsUnicodeChar = false; - this.containsUnicodeCharInComment = false; - this.vars = vars; - this.scopes = scopes; + _this.containsUnicodeChar = false; + _this.containsUnicodeCharInComment = false; + _this.vars = vars; + _this.scopes = scopes; + return _this; } Script.prototype.typeCheck = function (typeFlow) { return typeFlow.typeCheckScript(this); @@ -3490,11 +3507,12 @@ var TypeScript; var NamedDeclaration = (function (_super) { __extends(NamedDeclaration, _super); function NamedDeclaration(nodeType, name, members) { - _super.call(this, nodeType); - this.name = name; - this.members = members; - this.leftCurlyCount = 0; - this.rightCurlyCount = 0; + var _this = _super.call(this, nodeType) || this; + _this.name = name; + _this.members = members; + _this.leftCurlyCount = 0; + _this.rightCurlyCount = 0; + return _this; } return NamedDeclaration; }(ModuleElement)); @@ -3502,16 +3520,17 @@ var TypeScript; var ModuleDeclaration = (function (_super) { __extends(ModuleDeclaration, _super); function ModuleDeclaration(name, members, vars, scopes, endingToken) { - _super.call(this, NodeType.ModuleDeclaration, name, members); - this.endingToken = endingToken; - this.modFlags = ModuleFlags.ShouldEmitModuleDecl; - this.amdDependencies = []; + var _this = _super.call(this, NodeType.ModuleDeclaration, name, members) || this; + _this.endingToken = endingToken; + _this.modFlags = ModuleFlags.ShouldEmitModuleDecl; + _this.amdDependencies = []; // Remember if the module contains Unicode chars, that is needed for dynamic module as we will generate a file for each. - this.containsUnicodeChar = false; - this.containsUnicodeCharInComment = false; - this.vars = vars; - this.scopes = scopes; - this.prettyName = this.name.actualText; + _this.containsUnicodeChar = false; + _this.containsUnicodeCharInComment = false; + _this.vars = vars; + _this.scopes = scopes; + _this.prettyName = _this.name.actualText; + return _this; } ModuleDeclaration.prototype.isExported = function () { return hasFlag(this.modFlags, ModuleFlags.Exported); }; ModuleDeclaration.prototype.isAmbient = function () { return hasFlag(this.modFlags, ModuleFlags.Ambient); }; @@ -3537,10 +3556,11 @@ var TypeScript; var TypeDeclaration = (function (_super) { __extends(TypeDeclaration, _super); function TypeDeclaration(nodeType, name, extendsList, implementsList, members) { - _super.call(this, nodeType, name, members); - this.extendsList = extendsList; - this.implementsList = implementsList; - this.varFlags = VarFlags.None; + var _this = _super.call(this, nodeType, name, members) || this; + _this.extendsList = extendsList; + _this.implementsList = implementsList; + _this.varFlags = VarFlags.None; + return _this; } TypeDeclaration.prototype.isExported = function () { return hasFlag(this.varFlags, VarFlags.Exported); @@ -3554,11 +3574,12 @@ var TypeScript; var ClassDeclaration = (function (_super) { __extends(ClassDeclaration, _super); function ClassDeclaration(name, members, extendsList, implementsList) { - _super.call(this, NodeType.ClassDeclaration, name, extendsList, implementsList, members); - this.knownMemberNames = {}; - this.constructorDecl = null; - this.constructorNestingLevel = 0; - this.endingToken = null; + var _this = _super.call(this, NodeType.ClassDeclaration, name, extendsList, implementsList, members) || this; + _this.knownMemberNames = {}; + _this.constructorDecl = null; + _this.constructorNestingLevel = 0; + _this.endingToken = null; + return _this; } ClassDeclaration.prototype.typeCheck = function (typeFlow) { return typeFlow.typeCheckClass(this); @@ -3572,7 +3593,7 @@ var TypeScript; var InterfaceDeclaration = (function (_super) { __extends(InterfaceDeclaration, _super); function InterfaceDeclaration(name, members, extendsList, implementsList) { - _super.call(this, NodeType.InterfaceDeclaration, name, extendsList, implementsList, members); + return _super.call(this, NodeType.InterfaceDeclaration, name, extendsList, implementsList, members) || this; } InterfaceDeclaration.prototype.typeCheck = function (typeFlow) { return typeFlow.typeCheckInterface(this); @@ -3585,8 +3606,9 @@ var TypeScript; var Statement = (function (_super) { __extends(Statement, _super); function Statement(nodeType) { - _super.call(this, nodeType); - this.flags |= ASTFlags.IsStatement; + var _this = _super.call(this, nodeType) || this; + _this.flags |= ASTFlags.IsStatement; + return _this; } Statement.prototype.isLoop = function () { return false; }; Statement.prototype.isStatementOrExpression = function () { return true; }; @@ -3601,9 +3623,10 @@ var TypeScript; var LabeledStatement = (function (_super) { __extends(LabeledStatement, _super); function LabeledStatement(labels, stmt) { - _super.call(this, NodeType.LabeledStatement); - this.labels = labels; - this.stmt = stmt; + var _this = _super.call(this, NodeType.LabeledStatement) || this; + _this.labels = labels; + _this.stmt = stmt; + return _this; } LabeledStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); @@ -3635,9 +3658,10 @@ var TypeScript; var Block = (function (_super) { __extends(Block, _super); function Block(statements, isStatementBlock) { - _super.call(this, NodeType.Block); - this.statements = statements; - this.isStatementBlock = isStatementBlock; + var _this = _super.call(this, NodeType.Block) || this; + _this.statements = statements; + _this.isStatementBlock = isStatementBlock; + return _this; } Block.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); @@ -3690,9 +3714,10 @@ var TypeScript; var Jump = (function (_super) { __extends(Jump, _super); function Jump(nodeType) { - _super.call(this, nodeType); - this.target = null; - this.resolvedTarget = null; + var _this = _super.call(this, nodeType) || this; + _this.target = null; + _this.resolvedTarget = null; + return _this; } Jump.prototype.hasExplicitTarget = function () { return (this.target); }; Jump.prototype.setResolvedTarget = function (parser, stmt) { @@ -3741,9 +3766,10 @@ var TypeScript; var WhileStatement = (function (_super) { __extends(WhileStatement, _super); function WhileStatement(cond) { - _super.call(this, NodeType.While); - this.cond = cond; - this.body = null; + var _this = _super.call(this, NodeType.While) || this; + _this.cond = cond; + _this.body = null; + return _this; } WhileStatement.prototype.isLoop = function () { return true; }; WhileStatement.prototype.emit = function (emitter, tokenId, startLine) { @@ -3793,10 +3819,11 @@ var TypeScript; var DoWhileStatement = (function (_super) { __extends(DoWhileStatement, _super); function DoWhileStatement() { - _super.call(this, NodeType.DoWhile); - this.body = null; - this.whileAST = null; - this.cond = null; + var _this = _super.call(this, NodeType.DoWhile) || this; + _this.body = null; + _this.whileAST = null; + _this.cond = null; + return _this; } DoWhileStatement.prototype.isLoop = function () { return true; }; DoWhileStatement.prototype.emit = function (emitter, tokenId, startLine) { @@ -3849,10 +3876,11 @@ var TypeScript; var IfStatement = (function (_super) { __extends(IfStatement, _super); function IfStatement(cond) { - _super.call(this, NodeType.If); - this.cond = cond; - this.elseBod = null; - this.statement = new ASTSpan(); + var _this = _super.call(this, NodeType.If) || this; + _this.cond = cond; + _this.elseBod = null; + _this.statement = new ASTSpan(); + return _this; } IfStatement.prototype.isCompoundStatement = function () { return true; }; IfStatement.prototype.emit = function (emitter, tokenId, startLine) { @@ -3927,8 +3955,9 @@ var TypeScript; var ReturnStatement = (function (_super) { __extends(ReturnStatement, _super); function ReturnStatement() { - _super.call(this, NodeType.Return); - this.returnExpression = null; + var _this = _super.call(this, NodeType.Return) || this; + _this.returnExpression = null; + return _this; } ReturnStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); @@ -3958,7 +3987,7 @@ var TypeScript; var EndCode = (function (_super) { __extends(EndCode, _super); function EndCode() { - _super.call(this, NodeType.EndCode); + return _super.call(this, NodeType.EndCode) || this; } return EndCode; }(AST)); @@ -3966,13 +3995,14 @@ var TypeScript; var ForInStatement = (function (_super) { __extends(ForInStatement, _super); function ForInStatement(lval, obj) { - _super.call(this, NodeType.ForIn); - this.lval = lval; - this.obj = obj; - this.statement = new ASTSpan(); - if (this.lval && (this.lval.nodeType == NodeType.VarDecl)) { - this.lval.varFlags |= VarFlags.AutoInit; + var _this = _super.call(this, NodeType.ForIn) || this; + _this.lval = lval; + _this.obj = obj; + _this.statement = new ASTSpan(); + if (_this.lval && (_this.lval.nodeType == NodeType.VarDecl)) { + _this.lval.varFlags |= VarFlags.AutoInit; } + return _this; } ForInStatement.prototype.isLoop = function () { return true; }; ForInStatement.prototype.isFiltered = function () { @@ -4081,8 +4111,9 @@ var TypeScript; var ForStatement = (function (_super) { __extends(ForStatement, _super); function ForStatement(init) { - _super.call(this, NodeType.For); - this.init = init; + var _this = _super.call(this, NodeType.For) || this; + _this.init = init; + return _this; } ForStatement.prototype.isLoop = function () { return true; }; ForStatement.prototype.emit = function (emitter, tokenId, startLine) { @@ -4172,9 +4203,10 @@ var TypeScript; var WithStatement = (function (_super) { __extends(WithStatement, _super); function WithStatement(expr) { - _super.call(this, NodeType.With); - this.expr = expr; - this.withSym = null; + var _this = _super.call(this, NodeType.With) || this; + _this.expr = expr; + _this.withSym = null; + return _this; } WithStatement.prototype.isCompoundStatement = function () { return true; }; WithStatement.prototype.emit = function (emitter, tokenId, startLine) { @@ -4198,10 +4230,11 @@ var TypeScript; var SwitchStatement = (function (_super) { __extends(SwitchStatement, _super); function SwitchStatement(val) { - _super.call(this, NodeType.Switch); - this.val = val; - this.defaultCase = null; - this.statement = new ASTSpan(); + var _this = _super.call(this, NodeType.Switch) || this; + _this.val = val; + _this.defaultCase = null; + _this.statement = new ASTSpan(); + return _this; } SwitchStatement.prototype.isCompoundStatement = function () { return true; }; SwitchStatement.prototype.emit = function (emitter, tokenId, startLine) { @@ -4270,8 +4303,9 @@ var TypeScript; var CaseStatement = (function (_super) { __extends(CaseStatement, _super); function CaseStatement() { - _super.call(this, NodeType.Case); - this.expr = null; + var _this = _super.call(this, NodeType.Case) || this; + _this.expr = null; + return _this; } CaseStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); @@ -4323,9 +4357,10 @@ var TypeScript; var TypeReference = (function (_super) { __extends(TypeReference, _super); function TypeReference(term, arrayCount) { - _super.call(this, NodeType.TypeRef); - this.term = term; - this.arrayCount = arrayCount; + var _this = _super.call(this, NodeType.TypeRef) || this; + _this.term = term; + _this.arrayCount = arrayCount; + return _this; } TypeReference.prototype.emit = function (emitter, tokenId, startLine) { throw new Error("should not emit a type ref"); @@ -4353,9 +4388,10 @@ var TypeScript; var TryFinally = (function (_super) { __extends(TryFinally, _super); function TryFinally(tryNode, finallyNode) { - _super.call(this, NodeType.TryFinally); - this.tryNode = tryNode; - this.finallyNode = finallyNode; + var _this = _super.call(this, NodeType.TryFinally) || this; + _this.tryNode = tryNode; + _this.finallyNode = finallyNode; + return _this; } TryFinally.prototype.isCompoundStatement = function () { return true; }; TryFinally.prototype.emit = function (emitter, tokenId, startLine) { @@ -4398,9 +4434,10 @@ var TypeScript; var TryCatch = (function (_super) { __extends(TryCatch, _super); function TryCatch(tryNode, catchNode) { - _super.call(this, NodeType.TryCatch); - this.tryNode = tryNode; - this.catchNode = catchNode; + var _this = _super.call(this, NodeType.TryCatch) || this; + _this.tryNode = tryNode; + _this.catchNode = catchNode; + return _this; } TryCatch.prototype.isCompoundStatement = function () { return true; }; TryCatch.prototype.emit = function (emitter, tokenId, startLine) { @@ -4448,8 +4485,9 @@ var TypeScript; var Try = (function (_super) { __extends(Try, _super); function Try(body) { - _super.call(this, NodeType.Try); - this.body = body; + var _this = _super.call(this, NodeType.Try) || this; + _this.body = body; + return _this; } Try.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); @@ -4476,14 +4514,15 @@ var TypeScript; var Catch = (function (_super) { __extends(Catch, _super); function Catch(param, body) { - _super.call(this, NodeType.Catch); - this.param = param; - this.body = body; - this.statement = new ASTSpan(); - this.containedScope = null; - if (this.param) { - this.param.varFlags |= VarFlags.AutoInit; + var _this = _super.call(this, NodeType.Catch) || this; + _this.param = param; + _this.body = body; + _this.statement = new ASTSpan(); + _this.containedScope = null; + if (_this.param) { + _this.param.varFlags |= VarFlags.AutoInit; } + return _this; } Catch.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); @@ -4549,8 +4588,9 @@ var TypeScript; var Finally = (function (_super) { __extends(Finally, _super); function Finally(body) { - _super.call(this, NodeType.Finally); - this.body = body; + var _this = _super.call(this, NodeType.Finally) || this; + _this.body = body; + return _this; } Finally.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); @@ -4577,11 +4617,12 @@ var TypeScript; var Comment = (function (_super) { __extends(Comment, _super); function Comment(content, isBlockComment, endsLine) { - _super.call(this, NodeType.Comment); - this.content = content; - this.isBlockComment = isBlockComment; - this.endsLine = endsLine; - this.text = null; + var _this = _super.call(this, NodeType.Comment) || this; + _this.content = content; + _this.isBlockComment = isBlockComment; + _this.endsLine = endsLine; + _this.text = null; + return _this; } Comment.prototype.getText = function () { if (this.text == null) { @@ -4603,7 +4644,7 @@ var TypeScript; var DebuggerStatement = (function (_super) { __extends(DebuggerStatement, _super); function DebuggerStatement() { - _super.call(this, NodeType.Debugger); + return _super.call(this, NodeType.Debugger) || this; } DebuggerStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 1a525c49d19..14ce4338176 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2380,9 +2380,10 @@ var Harness; var TestCase = (function (_super) { __extends(TestCase, _super); function TestCase(description, block) { - _super.call(this, description, block); - this.description = description; - this.block = block; + var _this = _super.call(this, description, block) || this; + _this.description = description; + _this.block = block; + return _this; } TestCase.prototype.addChild = function (child) { throw new Error("Testcases may not be nested inside other testcases"); @@ -2414,9 +2415,10 @@ var Harness; var Scenario = (function (_super) { __extends(Scenario, _super); function Scenario(description, block) { - _super.call(this, description, block); - this.description = description; - this.block = block; + var _this = _super.call(this, description, block) || this; + _this.description = description; + _this.block = block; + return _this; } /** Run the block, and if the block doesn't raise an error, run the children. */ Scenario.prototype.run = function (done) { @@ -2469,7 +2471,7 @@ var Harness; var Run = (function (_super) { __extends(Run, _super); function Run() { - _super.call(this, 'Test Run', null); + return _super.call(this, 'Test Run', null) || this; } Run.prototype.run = function () { emitLog('start'); diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index caf41fe2708..7b94b555eb1 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -63,7 +63,7 @@ var baz = (function () { var foo = (function (_super) { __extends(foo, _super); function foo() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } foo.prototype.bar = function () { return undefined; }; ; diff --git a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.js b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.js index 9965f472d75..1da2ec03ed7 100644 --- a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.js +++ b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.js @@ -25,7 +25,6 @@ define(["require", "exports"], function (require, exports) { } Q.foo = foo; })(Q || (Q = {})); - var Q; (function (Q) { function bar() { Q.foo(null); diff --git a/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface2.js b/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface2.js index cb61a823990..c2f88dc08f5 100644 --- a/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface2.js +++ b/tests/baselines/reference/privacyCheckExportAssignmentOnExportedGenericInterface2.js @@ -19,7 +19,6 @@ define(["require", "exports"], function (require, exports) { function Foo(array) { return undefined; } - var Foo; (function (Foo) { Foo.x = "hello"; })(Foo || (Foo = {})); diff --git a/tests/baselines/reference/privacyClass.js b/tests/baselines/reference/privacyClass.js index a149aa26f75..7e56edf2cf1 100644 --- a/tests/baselines/reference/privacyClass.js +++ b/tests/baselines/reference/privacyClass.js @@ -152,21 +152,21 @@ var m1; var m1_C1_private = (function (_super) { __extends(m1_C1_private, _super); function m1_C1_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C1_private; }(m1_c_public)); var m1_C2_private = (function (_super) { __extends(m1_C2_private, _super); function m1_C2_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C2_private; }(m1_c_private)); var m1_C3_public = (function (_super) { __extends(m1_C3_public, _super); function m1_C3_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C3_public; }(m1_c_public)); @@ -174,7 +174,7 @@ var m1; var m1_C4_public = (function (_super) { __extends(m1_C4_public, _super); function m1_C4_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C4_public; }(m1_c_private)); @@ -204,21 +204,21 @@ var m1; var m1_C9_private = (function (_super) { __extends(m1_C9_private, _super); function m1_C9_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C9_private; }(m1_c_public)); var m1_C10_private = (function (_super) { __extends(m1_C10_private, _super); function m1_C10_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C10_private; }(m1_c_private)); var m1_C11_public = (function (_super) { __extends(m1_C11_public, _super); function m1_C11_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C11_public; }(m1_c_public)); @@ -226,7 +226,7 @@ var m1; var m1_C12_public = (function (_super) { __extends(m1_C12_public, _super); function m1_C12_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C12_public; }(m1_c_private)); @@ -250,21 +250,21 @@ var m2; var m2_C1_private = (function (_super) { __extends(m2_C1_private, _super); function m2_C1_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m2_C1_private; }(m2_c_public)); var m2_C2_private = (function (_super) { __extends(m2_C2_private, _super); function m2_C2_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m2_C2_private; }(m2_c_private)); var m2_C3_public = (function (_super) { __extends(m2_C3_public, _super); function m2_C3_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m2_C3_public; }(m2_c_public)); @@ -272,7 +272,7 @@ var m2; var m2_C4_public = (function (_super) { __extends(m2_C4_public, _super); function m2_C4_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m2_C4_public; }(m2_c_private)); @@ -302,21 +302,21 @@ var m2; var m2_C9_private = (function (_super) { __extends(m2_C9_private, _super); function m2_C9_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m2_C9_private; }(m2_c_public)); var m2_C10_private = (function (_super) { __extends(m2_C10_private, _super); function m2_C10_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m2_C10_private; }(m2_c_private)); var m2_C11_public = (function (_super) { __extends(m2_C11_public, _super); function m2_C11_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m2_C11_public; }(m2_c_public)); @@ -324,7 +324,7 @@ var m2; var m2_C12_public = (function (_super) { __extends(m2_C12_public, _super); function m2_C12_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m2_C12_public; }(m2_c_private)); @@ -346,21 +346,21 @@ var glo_c_private = (function () { var glo_C1_private = (function (_super) { __extends(glo_C1_private, _super); function glo_C1_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return glo_C1_private; }(glo_c_public)); var glo_C2_private = (function (_super) { __extends(glo_C2_private, _super); function glo_C2_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return glo_C2_private; }(glo_c_private)); var glo_C3_public = (function (_super) { __extends(glo_C3_public, _super); function glo_C3_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return glo_C3_public; }(glo_c_public)); @@ -368,7 +368,7 @@ exports.glo_C3_public = glo_C3_public; var glo_C4_public = (function (_super) { __extends(glo_C4_public, _super); function glo_C4_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return glo_C4_public; }(glo_c_private)); @@ -398,21 +398,21 @@ exports.glo_C8_public = glo_C8_public; var glo_C9_private = (function (_super) { __extends(glo_C9_private, _super); function glo_C9_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return glo_C9_private; }(glo_c_public)); var glo_C10_private = (function (_super) { __extends(glo_C10_private, _super); function glo_C10_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return glo_C10_private; }(glo_c_private)); var glo_C11_public = (function (_super) { __extends(glo_C11_public, _super); function glo_C11_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return glo_C11_public; }(glo_c_public)); @@ -420,7 +420,7 @@ exports.glo_C11_public = glo_C11_public; var glo_C12_public = (function (_super) { __extends(glo_C12_public, _super); function glo_C12_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return glo_C12_public; }(glo_c_private)); diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js index e2bb58781de..e0828809416 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js @@ -122,21 +122,21 @@ var publicModule; var privateClassExtendingPublicClassInModule = (function (_super) { __extends(privateClassExtendingPublicClassInModule, _super); function privateClassExtendingPublicClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return privateClassExtendingPublicClassInModule; }(publicClassInPublicModule)); var privateClassExtendingPrivateClassInModule = (function (_super) { __extends(privateClassExtendingPrivateClassInModule, _super); function privateClassExtendingPrivateClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return privateClassExtendingPrivateClassInModule; }(privateClassInPublicModule)); var publicClassExtendingPublicClassInModule = (function (_super) { __extends(publicClassExtendingPublicClassInModule, _super); function publicClassExtendingPublicClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingPublicClassInModule; }(publicClassInPublicModule)); @@ -144,7 +144,7 @@ var publicModule; var publicClassExtendingPrivateClassInModule = (function (_super) { __extends(publicClassExtendingPrivateClassInModule, _super); function publicClassExtendingPrivateClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingPrivateClassInModule; }(privateClassInPublicModule)); @@ -152,14 +152,14 @@ var publicModule; var privateClassExtendingFromPrivateModuleClass = (function (_super) { __extends(privateClassExtendingFromPrivateModuleClass, _super); function privateClassExtendingFromPrivateModuleClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return privateClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); var publicClassExtendingFromPrivateModuleClass = (function (_super) { __extends(publicClassExtendingFromPrivateModuleClass, _super); function publicClassExtendingFromPrivateModuleClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); @@ -183,21 +183,21 @@ var privateModule; var privateClassExtendingPublicClassInModule = (function (_super) { __extends(privateClassExtendingPublicClassInModule, _super); function privateClassExtendingPublicClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return privateClassExtendingPublicClassInModule; }(publicClassInPrivateModule)); var privateClassExtendingPrivateClassInModule = (function (_super) { __extends(privateClassExtendingPrivateClassInModule, _super); function privateClassExtendingPrivateClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return privateClassExtendingPrivateClassInModule; }(privateClassInPrivateModule)); var publicClassExtendingPublicClassInModule = (function (_super) { __extends(publicClassExtendingPublicClassInModule, _super); function publicClassExtendingPublicClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingPublicClassInModule; }(publicClassInPrivateModule)); @@ -205,7 +205,7 @@ var privateModule; var publicClassExtendingPrivateClassInModule = (function (_super) { __extends(publicClassExtendingPrivateClassInModule, _super); function publicClassExtendingPrivateClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingPrivateClassInModule; }(privateClassInPrivateModule)); @@ -213,14 +213,14 @@ var privateModule; var privateClassExtendingFromPrivateModuleClass = (function (_super) { __extends(privateClassExtendingFromPrivateModuleClass, _super); function privateClassExtendingFromPrivateModuleClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return privateClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); var publicClassExtendingFromPrivateModuleClass = (function (_super) { __extends(publicClassExtendingFromPrivateModuleClass, _super); function publicClassExtendingFromPrivateModuleClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); @@ -242,21 +242,21 @@ var privateClass = (function () { var privateClassExtendingPublicClass = (function (_super) { __extends(privateClassExtendingPublicClass, _super); function privateClassExtendingPublicClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return privateClassExtendingPublicClass; }(publicClass)); var privateClassExtendingPrivateClassInModule = (function (_super) { __extends(privateClassExtendingPrivateClassInModule, _super); function privateClassExtendingPrivateClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return privateClassExtendingPrivateClassInModule; }(privateClass)); var publicClassExtendingPublicClass = (function (_super) { __extends(publicClassExtendingPublicClass, _super); function publicClassExtendingPublicClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingPublicClass; }(publicClass)); @@ -264,7 +264,7 @@ exports.publicClassExtendingPublicClass = publicClassExtendingPublicClass; var publicClassExtendingPrivateClass = (function (_super) { __extends(publicClassExtendingPrivateClass, _super); function publicClassExtendingPrivateClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingPrivateClass; }(privateClass)); @@ -272,14 +272,14 @@ exports.publicClassExtendingPrivateClass = publicClassExtendingPrivateClass; var privateClassExtendingFromPrivateModuleClass = (function (_super) { __extends(privateClassExtendingFromPrivateModuleClass, _super); function privateClassExtendingFromPrivateModuleClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return privateClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); var publicClassExtendingFromPrivateModuleClass = (function (_super) { __extends(publicClassExtendingFromPrivateModuleClass, _super); function publicClassExtendingFromPrivateModuleClass() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); @@ -308,21 +308,21 @@ var publicModuleInGlobal; var privateClassExtendingPublicClassInModule = (function (_super) { __extends(privateClassExtendingPublicClassInModule, _super); function privateClassExtendingPublicClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return privateClassExtendingPublicClassInModule; }(publicClassInPublicModule)); var privateClassExtendingPrivateClassInModule = (function (_super) { __extends(privateClassExtendingPrivateClassInModule, _super); function privateClassExtendingPrivateClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return privateClassExtendingPrivateClassInModule; }(privateClassInPublicModule)); var publicClassExtendingPublicClassInModule = (function (_super) { __extends(publicClassExtendingPublicClassInModule, _super); function publicClassExtendingPublicClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingPublicClassInModule; }(publicClassInPublicModule)); @@ -330,7 +330,7 @@ var publicModuleInGlobal; var publicClassExtendingPrivateClassInModule = (function (_super) { __extends(publicClassExtendingPrivateClassInModule, _super); function publicClassExtendingPrivateClassInModule() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingPrivateClassInModule; }(privateClassInPublicModule)); @@ -344,7 +344,7 @@ var publicClassInGlobal = (function () { var publicClassExtendingPublicClassInGlobal = (function (_super) { __extends(publicClassExtendingPublicClassInGlobal, _super); function publicClassExtendingPublicClassInGlobal() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return publicClassExtendingPublicClassInGlobal; }(publicClassInGlobal)); diff --git a/tests/baselines/reference/privacyGloClass.js b/tests/baselines/reference/privacyGloClass.js index e8c8c447cf9..fa769a606ae 100644 --- a/tests/baselines/reference/privacyGloClass.js +++ b/tests/baselines/reference/privacyGloClass.js @@ -84,21 +84,21 @@ var m1; var m1_C1_private = (function (_super) { __extends(m1_C1_private, _super); function m1_C1_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C1_private; }(m1_c_public)); var m1_C2_private = (function (_super) { __extends(m1_C2_private, _super); function m1_C2_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C2_private; }(m1_c_private)); var m1_C3_public = (function (_super) { __extends(m1_C3_public, _super); function m1_C3_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C3_public; }(m1_c_public)); @@ -106,7 +106,7 @@ var m1; var m1_C4_public = (function (_super) { __extends(m1_C4_public, _super); function m1_C4_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C4_public; }(m1_c_private)); @@ -136,21 +136,21 @@ var m1; var m1_C9_private = (function (_super) { __extends(m1_C9_private, _super); function m1_C9_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C9_private; }(m1_c_public)); var m1_C10_private = (function (_super) { __extends(m1_C10_private, _super); function m1_C10_private() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C10_private; }(m1_c_private)); var m1_C11_public = (function (_super) { __extends(m1_C11_public, _super); function m1_C11_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C11_public; }(m1_c_public)); @@ -158,7 +158,7 @@ var m1; var m1_C12_public = (function (_super) { __extends(m1_C12_public, _super); function m1_C12_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return m1_C12_public; }(m1_c_private)); @@ -174,7 +174,7 @@ var glo_c_public = (function () { var glo_C3_public = (function (_super) { __extends(glo_C3_public, _super); function glo_C3_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return glo_C3_public; }(glo_c_public)); @@ -186,7 +186,7 @@ var glo_C7_public = (function () { var glo_C11_public = (function (_super) { __extends(glo_C11_public, _super); function glo_C11_public() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return glo_C11_public; }(glo_c_public)); diff --git a/tests/baselines/reference/privacyImport.js b/tests/baselines/reference/privacyImport.js index fcac37bac36..2915b6e5f24 100644 --- a/tests/baselines/reference/privacyImport.js +++ b/tests/baselines/reference/privacyImport.js @@ -684,7 +684,6 @@ exports.glo_im2_public = glo_M3_private; // module "abc3" { // } //} -var m2; (function (m2) { //import m3 = require("use_glo_M1_public"); var m4; diff --git a/tests/baselines/reference/privacyImportParseErrors.js b/tests/baselines/reference/privacyImportParseErrors.js index 369f9f109af..b705bbe1170 100644 --- a/tests/baselines/reference/privacyImportParseErrors.js +++ b/tests/baselines/reference/privacyImportParseErrors.js @@ -562,7 +562,6 @@ exports.glo_im1_public = glo_M1_public; exports.glo_im2_public = glo_M3_private; exports.glo_im3_public = require("glo_M2_public"); exports.glo_im4_public = require("glo_M4_private"); -var m2; (function (m2_1) { var m4; (function (m4) { diff --git a/tests/baselines/reference/privateAccessInSubclass1.js b/tests/baselines/reference/privateAccessInSubclass1.js index 188c3149fd0..21ff4793fb3 100644 --- a/tests/baselines/reference/privateAccessInSubclass1.js +++ b/tests/baselines/reference/privateAccessInSubclass1.js @@ -23,7 +23,7 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.myMethod = function () { this.options; diff --git a/tests/baselines/reference/privateInstanceMemberAccessibility.js b/tests/baselines/reference/privateInstanceMemberAccessibility.js index 8fbe5121136..6fa05178f91 100644 --- a/tests/baselines/reference/privateInstanceMemberAccessibility.js +++ b/tests/baselines/reference/privateInstanceMemberAccessibility.js @@ -27,9 +27,10 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); - this.x = _super.prototype.foo; // error - this.z = _super.prototype.foo; // error + var _this = _super.apply(this, arguments) || this; + _this.x = _super.prototype.foo; // error + _this.z = _super.prototype.foo; // error + return _this; } Derived.prototype.y = function () { return _super.prototype.foo; // error diff --git a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js index 058a6ba1b65..b732661edfc 100644 --- a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js +++ b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js @@ -40,7 +40,7 @@ var K = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.prototype.m2 = function () { var a = this.priv; // error diff --git a/tests/baselines/reference/privateStaticMemberAccessibility.js b/tests/baselines/reference/privateStaticMemberAccessibility.js index 352256ac9bd..c1897e8503a 100644 --- a/tests/baselines/reference/privateStaticMemberAccessibility.js +++ b/tests/baselines/reference/privateStaticMemberAccessibility.js @@ -22,8 +22,9 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); - this.bing = function () { return Base.foo; }; // error + var _this = _super.apply(this, arguments) || this; + _this.bing = function () { return Base.foo; }; // error + return _this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule.js b/tests/baselines/reference/privateStaticNotAccessibleInClodule.js index cb67a15fb24..8405eb112e2 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule.js +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule.js @@ -17,7 +17,6 @@ var C = (function () { } return C; }()); -var C; (function (C) { C.y = C.bar; // error })(C || (C = {})); diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js index 7ed6f3d6792..a93823654d4 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js @@ -29,11 +29,10 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); -var D; (function (D) { D.y = D.bar; // error })(D || (D = {})); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js index 3b6e407d045..99a4842f636 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js @@ -14,7 +14,7 @@ var m2; var class1 = (function (_super) { __extends(class1, _super); function class1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class1; }(m2.mExported.me.class1)); @@ -27,7 +27,7 @@ var m2; var class2 = (function (_super) { __extends(class2, _super); function class2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class2; }(m2.mExported.me.class1)); @@ -40,7 +40,7 @@ var m2; var class3 = (function (_super) { __extends(class3, _super); function class3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class3; }(mNonExported.mne.class1)); @@ -53,7 +53,7 @@ var m2; var class4 = (function (_super) { __extends(class4, _super); function class4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class4; }(mNonExported.mne.class1)); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js index 3b6e407d045..99a4842f636 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js @@ -14,7 +14,7 @@ var m2; var class1 = (function (_super) { __extends(class1, _super); function class1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class1; }(m2.mExported.me.class1)); @@ -27,7 +27,7 @@ var m2; var class2 = (function (_super) { __extends(class2, _super); function class2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class2; }(m2.mExported.me.class1)); @@ -40,7 +40,7 @@ var m2; var class3 = (function (_super) { __extends(class3, _super); function class3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class3; }(mNonExported.mne.class1)); @@ -53,7 +53,7 @@ var m2; var class4 = (function (_super) { __extends(class4, _super); function class4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class4; }(mNonExported.mne.class1)); diff --git a/tests/baselines/reference/project/prologueEmit/amd/out.js b/tests/baselines/reference/project/prologueEmit/amd/out.js index 6a07c9a92ca..7ee160b82ef 100644 --- a/tests/baselines/reference/project/prologueEmit/amd/out.js +++ b/tests/baselines/reference/project/prologueEmit/amd/out.js @@ -18,7 +18,7 @@ var m; var child = (function (_super) { __extends(child, _super); function child() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return child; }(base)); diff --git a/tests/baselines/reference/project/prologueEmit/node/out.js b/tests/baselines/reference/project/prologueEmit/node/out.js index 6a07c9a92ca..7ee160b82ef 100644 --- a/tests/baselines/reference/project/prologueEmit/node/out.js +++ b/tests/baselines/reference/project/prologueEmit/node/out.js @@ -18,7 +18,7 @@ var m; var child = (function (_super) { __extends(child, _super); function child() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return child; }(base)); diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js index 64a207a7cad..b793b07534c 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js @@ -7,7 +7,7 @@ var __extends = (this && this.__extends) || function (d, b) { var ClassC = (function (_super) { __extends(ClassC, _super); function ClassC() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ClassC; }(test.ClassA)); diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js index 64a207a7cad..b793b07534c 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js @@ -7,7 +7,7 @@ var __extends = (this && this.__extends) || function (d, b) { var ClassC = (function (_super) { __extends(ClassC, _super); function ClassC() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ClassC; }(test.ClassA)); diff --git a/tests/baselines/reference/propertiesAndIndexers.js b/tests/baselines/reference/propertiesAndIndexers.js index 591c4760e58..dff86f3954e 100644 --- a/tests/baselines/reference/propertiesAndIndexers.js +++ b/tests/baselines/reference/propertiesAndIndexers.js @@ -65,7 +65,7 @@ var P = (function () { var Q = (function (_super) { __extends(Q, _super); function Q() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Q; }(P)); diff --git a/tests/baselines/reference/propertyAccess.js b/tests/baselines/reference/propertyAccess.js index 2dbb316d848..0a4c9082a21 100644 --- a/tests/baselines/reference/propertyAccess.js +++ b/tests/baselines/reference/propertyAccess.js @@ -164,7 +164,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index bbd2def2206..d36d7e27efe 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -97,7 +97,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.bar = function () { return ''; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index 76da06166d4..4aedfe12b04 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -72,7 +72,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.bar = function () { return ''; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index c49153c59b0..3cb14438141 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -59,7 +59,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.bar = function () { return ''; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js index 255c05ac3ac..429dfdf6b14 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js @@ -52,7 +52,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(C.prototype, "y", { get: function () { return this.x; }, @@ -93,7 +93,7 @@ var C = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return E; }(C)); diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js index 02ad29bd312..0571b85ea9e 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js @@ -147,7 +147,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived1.prototype.method1 = function () { var B = (function () { @@ -173,7 +173,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived2.prototype.method2 = function () { var C = (function () { @@ -199,7 +199,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived3.prototype.method3 = function () { var D = (function () { @@ -225,7 +225,7 @@ var Derived3 = (function (_super) { var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived4.prototype.method4 = function () { var E = (function () { diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index a87f67e15f2..a10b39b402e 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -34,7 +34,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(C.prototype, "y", { get: function () { return this.x; }, diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js index 05dc85e251e..a404b8049bc 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js @@ -120,7 +120,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived1.prototype.method1 = function () { var b; @@ -139,7 +139,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived2.prototype.method2 = function () { var b; @@ -158,7 +158,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived3.prototype.method3 = function () { var b; @@ -177,7 +177,7 @@ var Derived3 = (function (_super) { var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived4.prototype.method4 = function () { var b; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js index 6675589226e..7d449bdcbd4 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js @@ -30,7 +30,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived.prototype.method1 = function () { this.x; // OK, accessed within a subclass of the declaring class diff --git a/tests/baselines/reference/protectedInstanceMemberAccessibility.js b/tests/baselines/reference/protectedInstanceMemberAccessibility.js index eba89aac28e..3259d401270 100644 --- a/tests/baselines/reference/protectedInstanceMemberAccessibility.js +++ b/tests/baselines/reference/protectedInstanceMemberAccessibility.js @@ -61,7 +61,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.g = function () { var t1 = this.x; @@ -93,7 +93,7 @@ var B = (function (_super) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/protectedMembers.js b/tests/baselines/reference/protectedMembers.js index dcc68e0c946..46b4691dff7 100644 --- a/tests/baselines/reference/protectedMembers.js +++ b/tests/baselines/reference/protectedMembers.js @@ -137,7 +137,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C2.prototype.f = function () { return _super.prototype.f.call(this) + this.x; @@ -151,7 +151,7 @@ var C2 = (function (_super) { var C3 = (function (_super) { __extends(C3, _super); function C3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C3.prototype.f = function () { return _super.prototype.f.call(this); @@ -187,14 +187,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } C.foo = function (a, b, c, d, e) { a.x = 1; // Error, access must be through C or type derived from C @@ -208,7 +208,7 @@ var C = (function (_super) { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); @@ -239,7 +239,7 @@ var A2 = (function () { var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -252,7 +252,7 @@ var A3 = (function () { var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A3)); diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js index 323a5a2f2b6..ad1b1682aa7 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js @@ -63,7 +63,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived1.staticMethod1 = function () { Base.x; // OK, accessed within a class derived from their declaring class @@ -76,7 +76,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived2.staticMethod2 = function () { Base.x; // OK, accessed within a class derived from their declaring class @@ -89,7 +89,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived3.staticMethod3 = function () { Base.x; // OK, accessed within a class derived from their declaring class diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js index 1295dc7448e..a2346b8be40 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js @@ -38,7 +38,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived1.staticMethod1 = function () { this.x; // OK, accessed within a class derived from their declaring class @@ -49,7 +49,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived2.staticMethod3 = function () { this.x; // OK, accessed within a class derived from their declaring class diff --git a/tests/baselines/reference/protectedStaticNotAccessibleInClodule.js b/tests/baselines/reference/protectedStaticNotAccessibleInClodule.js index 91776654692..a1411938405 100644 --- a/tests/baselines/reference/protectedStaticNotAccessibleInClodule.js +++ b/tests/baselines/reference/protectedStaticNotAccessibleInClodule.js @@ -18,7 +18,6 @@ var C = (function () { } return C; }()); -var C; (function (C) { C.f = C.foo; // OK C.b = C.bar; // error diff --git a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js index f396c2483e8..a881eb55a18 100644 --- a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js +++ b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js @@ -19,7 +19,7 @@ var Alpha; var Beta = (function (_super) { __extends(Beta, _super); function Beta() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Beta; }(Alpha.x)); diff --git a/tests/baselines/reference/qualify.js b/tests/baselines/reference/qualify.js index ffb643b8ea4..a1e28bd9dc1 100644 --- a/tests/baselines/reference/qualify.js +++ b/tests/baselines/reference/qualify.js @@ -69,7 +69,6 @@ var M; N.n = 1; })(N = M.N || (M.N = {})); })(M || (M = {})); -var M; (function (M) { var N; (function (N) { diff --git a/tests/baselines/reference/readonlyConstructorAssignment.js b/tests/baselines/reference/readonlyConstructorAssignment.js index 40c292e4ce8..872c00486c0 100644 --- a/tests/baselines/reference/readonlyConstructorAssignment.js +++ b/tests/baselines/reference/readonlyConstructorAssignment.js @@ -56,9 +56,10 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B(x) { - _super.call(this, x); + var _this = _super.call(this, x) || this; // Fails, x is readonly - this.x = 1; + _this.x = 1; + return _this; } return B; }(A)); @@ -67,9 +68,10 @@ var C = (function (_super) { // This is the usual behavior of readonly properties: // if one is redeclared in a base class, then it can be assigned to. function C(x) { - _super.call(this, x); - this.x = x; - this.x = 1; + var _this = _super.call(this, x) || this; + _this.x = x; + _this.x = 1; + return _this; } return C; }(A)); @@ -84,9 +86,10 @@ var D = (function () { var E = (function (_super) { __extends(E, _super); function E(x) { - _super.call(this, x); - this.x = x; - this.x = 1; + var _this = _super.call(this, x) || this; + _this.x = x; + _this.x = 1; + return _this; } return E; }(D)); diff --git a/tests/baselines/reference/recursiveBaseCheck3.js b/tests/baselines/reference/recursiveBaseCheck3.js index b032ce6774d..250a9e0b618 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.js +++ b/tests/baselines/reference/recursiveBaseCheck3.js @@ -13,14 +13,14 @@ var __extends = (this && this.__extends) || function (d, b) { var A = (function (_super) { __extends(A, _super); function A() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return A; }(C)); var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/recursiveBaseCheck4.js b/tests/baselines/reference/recursiveBaseCheck4.js index 07ba40c68b1..7f0c6b5f95d 100644 --- a/tests/baselines/reference/recursiveBaseCheck4.js +++ b/tests/baselines/reference/recursiveBaseCheck4.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var M = (function (_super) { __extends(M, _super); function M() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return M; }(M)); diff --git a/tests/baselines/reference/recursiveBaseCheck6.js b/tests/baselines/reference/recursiveBaseCheck6.js index 5b880c294b7..53a608baeca 100644 --- a/tests/baselines/reference/recursiveBaseCheck6.js +++ b/tests/baselines/reference/recursiveBaseCheck6.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var S18 = (function (_super) { __extends(S18, _super); function S18() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return S18; }(S18)); diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation1.js b/tests/baselines/reference/recursiveBaseConstructorCreation1.js index dd79ba068bb..344750974cb 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation1.js +++ b/tests/baselines/reference/recursiveBaseConstructorCreation1.js @@ -21,7 +21,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(C1)); diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js index 62e5958715e..34aa110b7ee 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js @@ -28,7 +28,7 @@ var TypeScript2; var MemberNameArray = (function (_super) { __extends(MemberNameArray, _super); function MemberNameArray() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MemberNameArray; }(MemberName)); diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index 3aa066d158d..a2cf3319474 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -132,7 +132,6 @@ var Sample; })(Thing = Actions.Thing || (Actions.Thing = {})); })(Actions = Sample.Actions || (Sample.Actions = {})); })(Sample || (Sample = {})); -var Sample; (function (Sample) { var Thing; (function (Thing) { @@ -165,7 +164,6 @@ var AbstractMode = (function () { AbstractMode.prototype.getInitialState = function () { return null; }; return AbstractMode; }()); -var Sample; (function (Sample) { var Thing; (function (Thing) { @@ -190,7 +188,7 @@ var Sample; var Mode = (function (_super) { __extends(Mode, _super); function Mode() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } // scenario 2 Mode.prototype.getInitialState = function () { diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js.map b/tests/baselines/reference/recursiveClassReferenceTest.js.map index 7e0b27b82b4..0b9bb8281bc 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js.map +++ b/tests/baselines/reference/recursiveClassReferenceTest.js.map @@ -1,2 +1,2 @@ //// [recursiveClassReferenceTest.js.map] -{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAAC,IAAA,OAAO,CAUpB;IAVa,WAAA,OAAO;QAAC,IAAA,KAAK,CAU1B;QAVqB,WAAA,OAAK;YAAC,IAAA,IAAI,CAU/B;YAV2B,WAAA,IAAI;gBAC/B;oBAAA;oBAQA,CAAC;oBANO,+BAAK,GAAZ,cAAiB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBAExB,6BAAG,GAAV,UAAW,KAA6B;wBAEvC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBACF,sBAAC;gBAAD,CAAC,AARD,IAQC;gBARY,oBAAe,kBAQ3B,CAAA;YACF,CAAC,EAV2B,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAU/B;QAAD,CAAC,EAVqB,KAAK,GAAL,aAAK,KAAL,aAAK,QAU1B;IAAD,CAAC,EAVa,OAAO,GAAP,cAAO,KAAP,cAAO,QAUpB;AAAD,CAAC,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,IAAO,MAAM,CAoBZ;AApBD,WAAO,MAAM;IAAC,IAAA,KAAK,CAoBlB;IApBa,WAAA,KAAK;QAAC,IAAA,OAAO,CAoB1B;QApBmB,WAAA,OAAO;YAC1B;gBAKC,oBAAoB,SAAkC;oBAAlC,cAAS,GAAT,SAAS,CAAyB;oBAD9C,YAAO,GAAO,IAAI,CAAC;oBAEvB,aAAa;oBACb,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;gBAC3C,CAAC;gBANM,wBAAG,GAAV,UAAW,MAAyC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAAA,CAAC,CAAA,CAAC;gBAQlF,+BAAU,GAAjB;oBACC,MAAM,CAAC,OAAO,CAAC;gBAChB,CAAC;gBAEM,4BAAO,GAAd;gBAEA,CAAC;gBAEF,iBAAC;YAAD,CAAC,AAlBD,IAkBC;YAlBY,kBAAU,aAkBtB,CAAA;QACF,CAAC,EApBmB,OAAO,GAAP,aAAO,KAAP,aAAO,QAoB1B;IAAD,CAAC,EApBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAoBlB;AAAD,CAAC,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD;IAAA;IAAuF,CAAC;IAA3C,sCAAe,GAAtB,cAAmC,MAAM,CAAC,IAAI,CAAC,CAAA,CAAC;IAAC,mBAAC;AAAD,CAAC,AAAxF,IAAwF;AASxF,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM;IAAC,IAAA,KAAK,CAwBlB;IAxBa,WAAA,KAAK;QAAC,IAAA,SAAS,CAwB5B;QAxBmB,WAAA,SAAS;YAAC,IAAA,SAAS,CAwBtC;YAxB6B,WAAA,SAAS;gBAEtC;oBACO,eAAoB,IAAW;wBAAX,SAAI,GAAJ,IAAI,CAAO;oBAAI,CAAC;oBACnC,qBAAK,GAAZ;wBACC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBAEM,sBAAM,GAAb,UAAc,KAAY;wBACzB,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC;oBACvB,CAAC;oBAEM,uBAAO,GAAd,cAA0B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBACzC,YAAC;gBAAD,CAAC,AAXD,IAWC;gBAXY,eAAK,QAWjB,CAAA;gBAED;oBAA0B,wBAAY;oBAAtC;wBAA0B,8BAAY;oBAQtC,CAAC;oBANA,aAAa;oBACN,8BAAe,GAAtB;wBACC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;oBACxB,CAAC;oBAGF,WAAC;gBAAD,CAAC,AARD,CAA0B,YAAY,GAQrC;gBARY,cAAI,OAQhB,CAAA;YACF,CAAC,EAxB6B,SAAS,GAAT,mBAAS,KAAT,mBAAS,QAwBtC;QAAD,CAAC,EAxBmB,SAAS,GAAT,eAAS,KAAT,eAAS,QAwB5B;IAAD,CAAC,EAxBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAwBlB;AAAD,CAAC,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file +{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAAC,IAAA,OAAO,CAUpB;IAVa,WAAA,OAAO;QAAC,IAAA,KAAK,CAU1B;QAVqB,WAAA,OAAK;YAAC,IAAA,IAAI,CAU/B;YAV2B,WAAA,IAAI;gBAC/B;oBAAA;oBAQA,CAAC;oBANO,+BAAK,GAAZ,cAAiB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBAExB,6BAAG,GAAV,UAAW,KAA6B;wBAEvC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBACF,sBAAC;gBAAD,CAAC,AARD,IAQC;gBARY,oBAAe,kBAQ3B,CAAA;YACF,CAAC,EAV2B,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAU/B;QAAD,CAAC,EAVqB,KAAK,GAAL,aAAK,KAAL,aAAK,QAU1B;IAAD,CAAC,EAVa,OAAO,GAAP,cAAO,KAAP,cAAO,QAUpB;AAAD,CAAC,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,WAAO,MAAM;IAAC,IAAA,KAAK,CAoBlB;IApBa,WAAA,KAAK;QAAC,IAAA,OAAO,CAoB1B;QApBmB,WAAA,OAAO;YAC1B;gBAKC,oBAAoB,SAAkC;oBAAlC,cAAS,GAAT,SAAS,CAAyB;oBAD9C,YAAO,GAAO,IAAI,CAAC;oBAEvB,aAAa;oBACb,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;gBAC3C,CAAC;gBANM,wBAAG,GAAV,UAAW,MAAyC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAAA,CAAC,CAAA,CAAC;gBAQlF,+BAAU,GAAjB;oBACC,MAAM,CAAC,OAAO,CAAC;gBAChB,CAAC;gBAEM,4BAAO,GAAd;gBAEA,CAAC;gBAEF,iBAAC;YAAD,CAAC,AAlBD,IAkBC;YAlBY,kBAAU,aAkBtB,CAAA;QACF,CAAC,EApBmB,OAAO,GAAP,aAAO,KAAP,aAAO,QAoB1B;IAAD,CAAC,EApBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAoBlB;AAAD,CAAC,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD;IAAA;IAAuF,CAAC;IAA3C,sCAAe,GAAtB,cAAmC,MAAM,CAAC,IAAI,CAAC,CAAA,CAAC;IAAC,mBAAC;AAAD,CAAC,AAAxF,IAAwF;AASxF,WAAO,MAAM;IAAC,IAAA,KAAK,CAwBlB;IAxBa,WAAA,KAAK;QAAC,IAAA,SAAS,CAwB5B;QAxBmB,WAAA,SAAS;YAAC,IAAA,SAAS,CAwBtC;YAxB6B,WAAA,SAAS;gBAEtC;oBACO,eAAoB,IAAW;wBAAX,SAAI,GAAJ,IAAI,CAAO;oBAAI,CAAC;oBACnC,qBAAK,GAAZ;wBACC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBAEM,sBAAM,GAAb,UAAc,KAAY;wBACzB,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC;oBACvB,CAAC;oBAEM,uBAAO,GAAd,cAA0B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBACzC,YAAC;gBAAD,CAAC,AAXD,IAWC;gBAXY,eAAK,QAWjB,CAAA;gBAED;oBAA0B,wBAAY;oBAAtC;;oBAQA,CAAC;oBANA,aAAa;oBACN,8BAAe,GAAtB;wBACC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;oBACxB,CAAC;oBAGF,WAAC;gBAAD,CAAC,AARD,CAA0B,YAAY,GAQrC;gBARY,cAAI,OAQhB,CAAA;YACF,CAAC,EAxB6B,SAAS,GAAT,mBAAS,KAAT,mBAAS,QAwBtC;QAAD,CAAC,EAxBmB,SAAS,GAAT,eAAS,KAAT,eAAS,QAwB5B;IAAD,CAAC,EAxBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAwBlB;AAAD,CAAC,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index 7e9da7dddf3..f99a062e2c6 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -523,53 +523,18 @@ sourceFile:recursiveClassReferenceTest.ts 6 >Emitted(29, 21) Source(32, 14) + SourceIndex(0) 7 >Emitted(29, 29) Source(42, 2) + SourceIndex(0) --- ->>>var Sample; +>>>(function (Sample) { 1 > -2 >^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> +2 >^^^^^^^^^^^ +3 > ^^^^^^ 1 > > > 2 >module -3 > Sample -4 > .Thing.Widgets { - > export class FindWidget implements Sample.Thing.IWidget { - > - > public gar(runner:(widget:Sample.Thing.IWidget)=>any) { if (true) {return runner(this);}} - > - > private domNode:any = null; - > constructor(private codeThing: Sample.Thing.ICodeThing) { - > // scenario 1 - > codeThing.addWidget("addWidget", this); - > } - > - > public getDomNode() { - > return domNode; - > } - > - > public destroy() { - > - > } - > - > } - > } -1 >Emitted(30, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(30, 5) Source(44, 8) + SourceIndex(0) -3 >Emitted(30, 11) Source(44, 14) + SourceIndex(0) -4 >Emitted(30, 12) Source(64, 2) + SourceIndex(0) ---- ->>>(function (Sample) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^ -1-> -2 >module 3 > Sample -1->Emitted(31, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(31, 12) Source(44, 8) + SourceIndex(0) -3 >Emitted(31, 18) Source(44, 14) + SourceIndex(0) +1 >Emitted(30, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(30, 12) Source(44, 8) + SourceIndex(0) +3 >Emitted(30, 18) Source(44, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -601,10 +566,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(32, 5) Source(44, 15) + SourceIndex(0) -2 >Emitted(32, 9) Source(44, 15) + SourceIndex(0) -3 >Emitted(32, 14) Source(44, 20) + SourceIndex(0) -4 >Emitted(32, 15) Source(64, 2) + SourceIndex(0) +1 >Emitted(31, 5) Source(44, 15) + SourceIndex(0) +2 >Emitted(31, 9) Source(44, 15) + SourceIndex(0) +3 >Emitted(31, 14) Source(44, 20) + SourceIndex(0) +4 >Emitted(31, 15) Source(64, 2) + SourceIndex(0) --- >>> (function (Thing) { 1->^^^^ @@ -614,9 +579,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(33, 5) Source(44, 15) + SourceIndex(0) -2 >Emitted(33, 16) Source(44, 15) + SourceIndex(0) -3 >Emitted(33, 21) Source(44, 20) + SourceIndex(0) +1->Emitted(32, 5) Source(44, 15) + SourceIndex(0) +2 >Emitted(32, 16) Source(44, 15) + SourceIndex(0) +3 >Emitted(32, 21) Source(44, 20) + SourceIndex(0) --- >>> var Widgets; 1->^^^^^^^^ @@ -648,10 +613,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(34, 9) Source(44, 21) + SourceIndex(0) -2 >Emitted(34, 13) Source(44, 21) + SourceIndex(0) -3 >Emitted(34, 20) Source(44, 28) + SourceIndex(0) -4 >Emitted(34, 21) Source(64, 2) + SourceIndex(0) +1->Emitted(33, 9) Source(44, 21) + SourceIndex(0) +2 >Emitted(33, 13) Source(44, 21) + SourceIndex(0) +3 >Emitted(33, 20) Source(44, 28) + SourceIndex(0) +4 >Emitted(33, 21) Source(64, 2) + SourceIndex(0) --- >>> (function (Widgets) { 1->^^^^^^^^ @@ -661,16 +626,16 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Widgets -1->Emitted(35, 9) Source(44, 21) + SourceIndex(0) -2 >Emitted(35, 20) Source(44, 21) + SourceIndex(0) -3 >Emitted(35, 27) Source(44, 28) + SourceIndex(0) +1->Emitted(34, 9) Source(44, 21) + SourceIndex(0) +2 >Emitted(34, 20) Source(44, 21) + SourceIndex(0) +3 >Emitted(34, 27) Source(44, 28) + SourceIndex(0) --- >>> var FindWidget = (function () { 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> { > -1->Emitted(36, 13) Source(45, 2) + SourceIndex(0) +1->Emitted(35, 13) Source(45, 2) + SourceIndex(0) --- >>> function FindWidget(codeThing) { 1->^^^^^^^^^^^^^^^^ @@ -685,9 +650,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > constructor(private 3 > codeThing: Sample.Thing.ICodeThing -1->Emitted(37, 17) Source(50, 3) + SourceIndex(0) -2 >Emitted(37, 37) Source(50, 23) + SourceIndex(0) -3 >Emitted(37, 46) Source(50, 57) + SourceIndex(0) +1->Emitted(36, 17) Source(50, 3) + SourceIndex(0) +2 >Emitted(36, 37) Source(50, 23) + SourceIndex(0) +3 >Emitted(36, 46) Source(50, 57) + SourceIndex(0) --- >>> this.codeThing = codeThing; 1->^^^^^^^^^^^^^^^^^^^^ @@ -700,11 +665,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > codeThing 5 > : Sample.Thing.ICodeThing -1->Emitted(38, 21) Source(50, 23) + SourceIndex(0) -2 >Emitted(38, 35) Source(50, 32) + SourceIndex(0) -3 >Emitted(38, 38) Source(50, 23) + SourceIndex(0) -4 >Emitted(38, 47) Source(50, 32) + SourceIndex(0) -5 >Emitted(38, 48) Source(50, 57) + SourceIndex(0) +1->Emitted(37, 21) Source(50, 23) + SourceIndex(0) +2 >Emitted(37, 35) Source(50, 32) + SourceIndex(0) +3 >Emitted(37, 38) Source(50, 23) + SourceIndex(0) +4 >Emitted(37, 47) Source(50, 32) + SourceIndex(0) +5 >Emitted(37, 48) Source(50, 57) + SourceIndex(0) --- >>> this.domNode = null; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -717,11 +682,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > :any = 4 > null 5 > ; -1 >Emitted(39, 21) Source(49, 11) + SourceIndex(0) -2 >Emitted(39, 33) Source(49, 18) + SourceIndex(0) -3 >Emitted(39, 36) Source(49, 25) + SourceIndex(0) -4 >Emitted(39, 40) Source(49, 29) + SourceIndex(0) -5 >Emitted(39, 41) Source(49, 30) + SourceIndex(0) +1 >Emitted(38, 21) Source(49, 11) + SourceIndex(0) +2 >Emitted(38, 33) Source(49, 18) + SourceIndex(0) +3 >Emitted(38, 36) Source(49, 25) + SourceIndex(0) +4 >Emitted(38, 40) Source(49, 29) + SourceIndex(0) +5 >Emitted(38, 41) Source(49, 30) + SourceIndex(0) --- >>> // scenario 1 1 >^^^^^^^^^^^^^^^^^^^^ @@ -731,8 +696,8 @@ sourceFile:recursiveClassReferenceTest.ts > constructor(private codeThing: Sample.Thing.ICodeThing) { > 2 > // scenario 1 -1 >Emitted(40, 21) Source(51, 7) + SourceIndex(0) -2 >Emitted(40, 34) Source(51, 20) + SourceIndex(0) +1 >Emitted(39, 21) Source(51, 7) + SourceIndex(0) +2 >Emitted(39, 34) Source(51, 20) + SourceIndex(0) --- >>> codeThing.addWidget("addWidget", this); 1->^^^^^^^^^^^^^^^^^^^^ @@ -756,16 +721,16 @@ sourceFile:recursiveClassReferenceTest.ts 8 > this 9 > ) 10> ; -1->Emitted(41, 21) Source(52, 7) + SourceIndex(0) -2 >Emitted(41, 30) Source(52, 16) + SourceIndex(0) -3 >Emitted(41, 31) Source(52, 17) + SourceIndex(0) -4 >Emitted(41, 40) Source(52, 26) + SourceIndex(0) -5 >Emitted(41, 41) Source(52, 27) + SourceIndex(0) -6 >Emitted(41, 52) Source(52, 38) + SourceIndex(0) -7 >Emitted(41, 54) Source(52, 40) + SourceIndex(0) -8 >Emitted(41, 58) Source(52, 44) + SourceIndex(0) -9 >Emitted(41, 59) Source(52, 45) + SourceIndex(0) -10>Emitted(41, 60) Source(52, 46) + SourceIndex(0) +1->Emitted(40, 21) Source(52, 7) + SourceIndex(0) +2 >Emitted(40, 30) Source(52, 16) + SourceIndex(0) +3 >Emitted(40, 31) Source(52, 17) + SourceIndex(0) +4 >Emitted(40, 40) Source(52, 26) + SourceIndex(0) +5 >Emitted(40, 41) Source(52, 27) + SourceIndex(0) +6 >Emitted(40, 52) Source(52, 38) + SourceIndex(0) +7 >Emitted(40, 54) Source(52, 40) + SourceIndex(0) +8 >Emitted(40, 58) Source(52, 44) + SourceIndex(0) +9 >Emitted(40, 59) Source(52, 45) + SourceIndex(0) +10>Emitted(40, 60) Source(52, 46) + SourceIndex(0) --- >>> } 1 >^^^^^^^^^^^^^^^^ @@ -774,8 +739,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(42, 17) Source(53, 3) + SourceIndex(0) -2 >Emitted(42, 18) Source(53, 4) + SourceIndex(0) +1 >Emitted(41, 17) Source(53, 3) + SourceIndex(0) +2 >Emitted(41, 18) Source(53, 4) + SourceIndex(0) --- >>> FindWidget.prototype.gar = function (runner) { if (true) { 1->^^^^^^^^^^^^^^^^ @@ -804,19 +769,19 @@ sourceFile:recursiveClassReferenceTest.ts 11> ) 12> 13> { -1->Emitted(43, 17) Source(47, 10) + SourceIndex(0) -2 >Emitted(43, 41) Source(47, 13) + SourceIndex(0) -3 >Emitted(43, 44) Source(47, 3) + SourceIndex(0) -4 >Emitted(43, 54) Source(47, 14) + SourceIndex(0) -5 >Emitted(43, 60) Source(47, 55) + SourceIndex(0) -6 >Emitted(43, 64) Source(47, 59) + SourceIndex(0) -7 >Emitted(43, 66) Source(47, 61) + SourceIndex(0) -8 >Emitted(43, 67) Source(47, 62) + SourceIndex(0) -9 >Emitted(43, 68) Source(47, 63) + SourceIndex(0) -10>Emitted(43, 72) Source(47, 67) + SourceIndex(0) -11>Emitted(43, 73) Source(47, 68) + SourceIndex(0) -12>Emitted(43, 74) Source(47, 69) + SourceIndex(0) -13>Emitted(43, 75) Source(47, 70) + SourceIndex(0) +1->Emitted(42, 17) Source(47, 10) + SourceIndex(0) +2 >Emitted(42, 41) Source(47, 13) + SourceIndex(0) +3 >Emitted(42, 44) Source(47, 3) + SourceIndex(0) +4 >Emitted(42, 54) Source(47, 14) + SourceIndex(0) +5 >Emitted(42, 60) Source(47, 55) + SourceIndex(0) +6 >Emitted(42, 64) Source(47, 59) + SourceIndex(0) +7 >Emitted(42, 66) Source(47, 61) + SourceIndex(0) +8 >Emitted(42, 67) Source(47, 62) + SourceIndex(0) +9 >Emitted(42, 68) Source(47, 63) + SourceIndex(0) +10>Emitted(42, 72) Source(47, 67) + SourceIndex(0) +11>Emitted(42, 73) Source(47, 68) + SourceIndex(0) +12>Emitted(42, 74) Source(47, 69) + SourceIndex(0) +13>Emitted(42, 75) Source(47, 70) + SourceIndex(0) --- >>> return runner(this); 1 >^^^^^^^^^^^^^^^^^^^^ @@ -835,14 +800,14 @@ sourceFile:recursiveClassReferenceTest.ts 6 > this 7 > ) 8 > ; -1 >Emitted(44, 21) Source(47, 70) + SourceIndex(0) -2 >Emitted(44, 27) Source(47, 76) + SourceIndex(0) -3 >Emitted(44, 28) Source(47, 77) + SourceIndex(0) -4 >Emitted(44, 34) Source(47, 83) + SourceIndex(0) -5 >Emitted(44, 35) Source(47, 84) + SourceIndex(0) -6 >Emitted(44, 39) Source(47, 88) + SourceIndex(0) -7 >Emitted(44, 40) Source(47, 89) + SourceIndex(0) -8 >Emitted(44, 41) Source(47, 90) + SourceIndex(0) +1 >Emitted(43, 21) Source(47, 70) + SourceIndex(0) +2 >Emitted(43, 27) Source(47, 76) + SourceIndex(0) +3 >Emitted(43, 28) Source(47, 77) + SourceIndex(0) +4 >Emitted(43, 34) Source(47, 83) + SourceIndex(0) +5 >Emitted(43, 35) Source(47, 84) + SourceIndex(0) +6 >Emitted(43, 39) Source(47, 88) + SourceIndex(0) +7 >Emitted(43, 40) Source(47, 89) + SourceIndex(0) +8 >Emitted(43, 41) Source(47, 90) + SourceIndex(0) --- >>> } }; 1 >^^^^^^^^^^^^^^^^ @@ -854,10 +819,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 > } 3 > 4 > } -1 >Emitted(45, 17) Source(47, 90) + SourceIndex(0) -2 >Emitted(45, 18) Source(47, 91) + SourceIndex(0) -3 >Emitted(45, 19) Source(47, 91) + SourceIndex(0) -4 >Emitted(45, 20) Source(47, 92) + SourceIndex(0) +1 >Emitted(44, 17) Source(47, 90) + SourceIndex(0) +2 >Emitted(44, 18) Source(47, 91) + SourceIndex(0) +3 >Emitted(44, 19) Source(47, 91) + SourceIndex(0) +4 >Emitted(44, 20) Source(47, 92) + SourceIndex(0) --- >>> FindWidget.prototype.getDomNode = function () { 1->^^^^^^^^^^^^^^^^ @@ -874,9 +839,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getDomNode 3 > -1->Emitted(46, 17) Source(55, 10) + SourceIndex(0) -2 >Emitted(46, 48) Source(55, 20) + SourceIndex(0) -3 >Emitted(46, 51) Source(55, 3) + SourceIndex(0) +1->Emitted(45, 17) Source(55, 10) + SourceIndex(0) +2 >Emitted(45, 48) Source(55, 20) + SourceIndex(0) +3 >Emitted(45, 51) Source(55, 3) + SourceIndex(0) --- >>> return domNode; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -890,11 +855,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > domNode 5 > ; -1 >Emitted(47, 21) Source(56, 4) + SourceIndex(0) -2 >Emitted(47, 27) Source(56, 10) + SourceIndex(0) -3 >Emitted(47, 28) Source(56, 11) + SourceIndex(0) -4 >Emitted(47, 35) Source(56, 18) + SourceIndex(0) -5 >Emitted(47, 36) Source(56, 19) + SourceIndex(0) +1 >Emitted(46, 21) Source(56, 4) + SourceIndex(0) +2 >Emitted(46, 27) Source(56, 10) + SourceIndex(0) +3 >Emitted(46, 28) Source(56, 11) + SourceIndex(0) +4 >Emitted(46, 35) Source(56, 18) + SourceIndex(0) +5 >Emitted(46, 36) Source(56, 19) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -903,8 +868,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(48, 17) Source(57, 3) + SourceIndex(0) -2 >Emitted(48, 18) Source(57, 4) + SourceIndex(0) +1 >Emitted(47, 17) Source(57, 3) + SourceIndex(0) +2 >Emitted(47, 18) Source(57, 4) + SourceIndex(0) --- >>> FindWidget.prototype.destroy = function () { 1->^^^^^^^^^^^^^^^^ @@ -915,9 +880,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > destroy 3 > -1->Emitted(49, 17) Source(59, 10) + SourceIndex(0) -2 >Emitted(49, 45) Source(59, 17) + SourceIndex(0) -3 >Emitted(49, 48) Source(59, 3) + SourceIndex(0) +1->Emitted(48, 17) Source(59, 10) + SourceIndex(0) +2 >Emitted(48, 45) Source(59, 17) + SourceIndex(0) +3 >Emitted(48, 48) Source(59, 3) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -927,8 +892,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(50, 17) Source(61, 3) + SourceIndex(0) -2 >Emitted(50, 18) Source(61, 4) + SourceIndex(0) +1 >Emitted(49, 17) Source(61, 3) + SourceIndex(0) +2 >Emitted(49, 18) Source(61, 4) + SourceIndex(0) --- >>> return FindWidget; 1->^^^^^^^^^^^^^^^^ @@ -937,8 +902,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(51, 17) Source(63, 2) + SourceIndex(0) -2 >Emitted(51, 34) Source(63, 3) + SourceIndex(0) +1->Emitted(50, 17) Source(63, 2) + SourceIndex(0) +2 >Emitted(50, 34) Source(63, 3) + SourceIndex(0) --- >>> }()); 1 >^^^^^^^^^^^^ @@ -968,10 +933,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > > } -1 >Emitted(52, 13) Source(63, 2) + SourceIndex(0) -2 >Emitted(52, 14) Source(63, 3) + SourceIndex(0) -3 >Emitted(52, 14) Source(45, 2) + SourceIndex(0) -4 >Emitted(52, 18) Source(63, 3) + SourceIndex(0) +1 >Emitted(51, 13) Source(63, 2) + SourceIndex(0) +2 >Emitted(51, 14) Source(63, 3) + SourceIndex(0) +3 >Emitted(51, 14) Source(45, 2) + SourceIndex(0) +4 >Emitted(51, 18) Source(63, 3) + SourceIndex(0) --- >>> Widgets.FindWidget = FindWidget; 1->^^^^^^^^^^^^ @@ -1001,10 +966,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } 4 > -1->Emitted(53, 13) Source(45, 15) + SourceIndex(0) -2 >Emitted(53, 31) Source(45, 25) + SourceIndex(0) -3 >Emitted(53, 44) Source(63, 3) + SourceIndex(0) -4 >Emitted(53, 45) Source(63, 3) + SourceIndex(0) +1->Emitted(52, 13) Source(45, 15) + SourceIndex(0) +2 >Emitted(52, 31) Source(45, 25) + SourceIndex(0) +3 >Emitted(52, 44) Source(63, 3) + SourceIndex(0) +4 >Emitted(52, 45) Source(63, 3) + SourceIndex(0) --- >>> })(Widgets = Thing.Widgets || (Thing.Widgets = {})); 1->^^^^^^^^ @@ -1046,15 +1011,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(54, 9) Source(64, 1) + SourceIndex(0) -2 >Emitted(54, 10) Source(64, 2) + SourceIndex(0) -3 >Emitted(54, 12) Source(44, 21) + SourceIndex(0) -4 >Emitted(54, 19) Source(44, 28) + SourceIndex(0) -5 >Emitted(54, 22) Source(44, 21) + SourceIndex(0) -6 >Emitted(54, 35) Source(44, 28) + SourceIndex(0) -7 >Emitted(54, 40) Source(44, 21) + SourceIndex(0) -8 >Emitted(54, 53) Source(44, 28) + SourceIndex(0) -9 >Emitted(54, 61) Source(64, 2) + SourceIndex(0) +1->Emitted(53, 9) Source(64, 1) + SourceIndex(0) +2 >Emitted(53, 10) Source(64, 2) + SourceIndex(0) +3 >Emitted(53, 12) Source(44, 21) + SourceIndex(0) +4 >Emitted(53, 19) Source(44, 28) + SourceIndex(0) +5 >Emitted(53, 22) Source(44, 21) + SourceIndex(0) +6 >Emitted(53, 35) Source(44, 28) + SourceIndex(0) +7 >Emitted(53, 40) Source(44, 21) + SourceIndex(0) +8 >Emitted(53, 53) Source(44, 28) + SourceIndex(0) +9 >Emitted(53, 61) Source(64, 2) + SourceIndex(0) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -1095,15 +1060,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(55, 5) Source(64, 1) + SourceIndex(0) -2 >Emitted(55, 6) Source(64, 2) + SourceIndex(0) -3 >Emitted(55, 8) Source(44, 15) + SourceIndex(0) -4 >Emitted(55, 13) Source(44, 20) + SourceIndex(0) -5 >Emitted(55, 16) Source(44, 15) + SourceIndex(0) -6 >Emitted(55, 28) Source(44, 20) + SourceIndex(0) -7 >Emitted(55, 33) Source(44, 15) + SourceIndex(0) -8 >Emitted(55, 45) Source(44, 20) + SourceIndex(0) -9 >Emitted(55, 53) Source(64, 2) + SourceIndex(0) +1 >Emitted(54, 5) Source(64, 1) + SourceIndex(0) +2 >Emitted(54, 6) Source(64, 2) + SourceIndex(0) +3 >Emitted(54, 8) Source(44, 15) + SourceIndex(0) +4 >Emitted(54, 13) Source(44, 20) + SourceIndex(0) +5 >Emitted(54, 16) Source(44, 15) + SourceIndex(0) +6 >Emitted(54, 28) Source(44, 20) + SourceIndex(0) +7 >Emitted(54, 33) Source(44, 15) + SourceIndex(0) +8 >Emitted(54, 45) Source(44, 20) + SourceIndex(0) +9 >Emitted(54, 53) Source(64, 2) + SourceIndex(0) --- >>>})(Sample || (Sample = {})); 1 > @@ -1141,13 +1106,13 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(56, 1) Source(64, 1) + SourceIndex(0) -2 >Emitted(56, 2) Source(64, 2) + SourceIndex(0) -3 >Emitted(56, 4) Source(44, 8) + SourceIndex(0) -4 >Emitted(56, 10) Source(44, 14) + SourceIndex(0) -5 >Emitted(56, 15) Source(44, 8) + SourceIndex(0) -6 >Emitted(56, 21) Source(44, 14) + SourceIndex(0) -7 >Emitted(56, 29) Source(64, 2) + SourceIndex(0) +1 >Emitted(55, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(55, 2) Source(64, 2) + SourceIndex(0) +3 >Emitted(55, 4) Source(44, 8) + SourceIndex(0) +4 >Emitted(55, 10) Source(44, 14) + SourceIndex(0) +5 >Emitted(55, 15) Source(44, 8) + SourceIndex(0) +6 >Emitted(55, 21) Source(44, 14) + SourceIndex(0) +7 >Emitted(55, 29) Source(64, 2) + SourceIndex(0) --- >>>var AbstractMode = (function () { 1-> @@ -1156,13 +1121,13 @@ sourceFile:recursiveClassReferenceTest.ts > >interface IMode { getInitialState(): IState;} > -1->Emitted(57, 1) Source(67, 1) + SourceIndex(0) +1->Emitted(56, 1) Source(67, 1) + SourceIndex(0) --- >>> function AbstractMode() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(58, 5) Source(67, 1) + SourceIndex(0) +1->Emitted(57, 5) Source(67, 1) + SourceIndex(0) --- >>> } 1->^^^^ @@ -1170,8 +1135,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->class AbstractMode implements IMode { public getInitialState(): IState { return null;} 2 > } -1->Emitted(59, 5) Source(67, 88) + SourceIndex(0) -2 >Emitted(59, 6) Source(67, 89) + SourceIndex(0) +1->Emitted(58, 5) Source(67, 88) + SourceIndex(0) +2 >Emitted(58, 6) Source(67, 89) + SourceIndex(0) --- >>> AbstractMode.prototype.getInitialState = function () { return null; }; 1->^^^^ @@ -1194,46 +1159,44 @@ sourceFile:recursiveClassReferenceTest.ts 8 > ; 9 > 10> } -1->Emitted(60, 5) Source(67, 46) + SourceIndex(0) -2 >Emitted(60, 43) Source(67, 61) + SourceIndex(0) -3 >Emitted(60, 46) Source(67, 39) + SourceIndex(0) -4 >Emitted(60, 60) Source(67, 74) + SourceIndex(0) -5 >Emitted(60, 66) Source(67, 80) + SourceIndex(0) -6 >Emitted(60, 67) Source(67, 81) + SourceIndex(0) -7 >Emitted(60, 71) Source(67, 85) + SourceIndex(0) -8 >Emitted(60, 72) Source(67, 86) + SourceIndex(0) -9 >Emitted(60, 73) Source(67, 86) + SourceIndex(0) -10>Emitted(60, 74) Source(67, 87) + SourceIndex(0) +1->Emitted(59, 5) Source(67, 46) + SourceIndex(0) +2 >Emitted(59, 43) Source(67, 61) + SourceIndex(0) +3 >Emitted(59, 46) Source(67, 39) + SourceIndex(0) +4 >Emitted(59, 60) Source(67, 74) + SourceIndex(0) +5 >Emitted(59, 66) Source(67, 80) + SourceIndex(0) +6 >Emitted(59, 67) Source(67, 81) + SourceIndex(0) +7 >Emitted(59, 71) Source(67, 85) + SourceIndex(0) +8 >Emitted(59, 72) Source(67, 86) + SourceIndex(0) +9 >Emitted(59, 73) Source(67, 86) + SourceIndex(0) +10>Emitted(59, 74) Source(67, 87) + SourceIndex(0) --- >>> return AbstractMode; 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^ 1 > 2 > } -1 >Emitted(61, 5) Source(67, 88) + SourceIndex(0) -2 >Emitted(61, 24) Source(67, 89) + SourceIndex(0) +1 >Emitted(60, 5) Source(67, 88) + SourceIndex(0) +2 >Emitted(60, 24) Source(67, 89) + SourceIndex(0) --- >>>}()); 1 > 2 >^ 3 > 4 > ^^^^ -5 > ^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^-> 1 > 2 >} 3 > 4 > class AbstractMode implements IMode { public getInitialState(): IState { return null;} } -1 >Emitted(62, 1) Source(67, 88) + SourceIndex(0) -2 >Emitted(62, 2) Source(67, 89) + SourceIndex(0) -3 >Emitted(62, 2) Source(67, 1) + SourceIndex(0) -4 >Emitted(62, 6) Source(67, 89) + SourceIndex(0) +1 >Emitted(61, 1) Source(67, 88) + SourceIndex(0) +2 >Emitted(61, 2) Source(67, 89) + SourceIndex(0) +3 >Emitted(61, 2) Source(67, 1) + SourceIndex(0) +4 >Emitted(61, 6) Source(67, 89) + SourceIndex(0) --- ->>>var Sample; +>>>(function (Sample) { 1-> -2 >^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> +2 >^^^^^^^^^^^ +3 > ^^^^^^ 1-> > >interface IState {} @@ -1245,47 +1208,10 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 >module -3 > Sample -4 > .Thing.Languages.PlainText { - > - > export class State implements IState { - > constructor(private mode: IMode) { } - > public clone():IState { - > return this; - > } - > - > public equals(other:IState):boolean { - > return this === other; - > } - > - > public getMode(): IMode { return mode; } - > } - > - > export class Mode extends AbstractMode { - > - > // scenario 2 - > public getInitialState(): IState { - > return new State(self); - > } - > - > - > } - > } -1->Emitted(63, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(63, 5) Source(76, 8) + SourceIndex(0) -3 >Emitted(63, 11) Source(76, 14) + SourceIndex(0) -4 >Emitted(63, 12) Source(100, 2) + SourceIndex(0) ---- ->>>(function (Sample) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^ -1-> -2 >module 3 > Sample -1->Emitted(64, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(64, 12) Source(76, 8) + SourceIndex(0) -3 >Emitted(64, 18) Source(76, 14) + SourceIndex(0) +1->Emitted(62, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(62, 12) Source(76, 8) + SourceIndex(0) +3 >Emitted(62, 18) Source(76, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -1321,10 +1247,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(65, 5) Source(76, 15) + SourceIndex(0) -2 >Emitted(65, 9) Source(76, 15) + SourceIndex(0) -3 >Emitted(65, 14) Source(76, 20) + SourceIndex(0) -4 >Emitted(65, 15) Source(100, 2) + SourceIndex(0) +1 >Emitted(63, 5) Source(76, 15) + SourceIndex(0) +2 >Emitted(63, 9) Source(76, 15) + SourceIndex(0) +3 >Emitted(63, 14) Source(76, 20) + SourceIndex(0) +4 >Emitted(63, 15) Source(100, 2) + SourceIndex(0) --- >>> (function (Thing) { 1->^^^^ @@ -1334,9 +1260,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(66, 5) Source(76, 15) + SourceIndex(0) -2 >Emitted(66, 16) Source(76, 15) + SourceIndex(0) -3 >Emitted(66, 21) Source(76, 20) + SourceIndex(0) +1->Emitted(64, 5) Source(76, 15) + SourceIndex(0) +2 >Emitted(64, 16) Source(76, 15) + SourceIndex(0) +3 >Emitted(64, 21) Source(76, 20) + SourceIndex(0) --- >>> var Languages; 1->^^^^^^^^ @@ -1372,10 +1298,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(67, 9) Source(76, 21) + SourceIndex(0) -2 >Emitted(67, 13) Source(76, 21) + SourceIndex(0) -3 >Emitted(67, 22) Source(76, 30) + SourceIndex(0) -4 >Emitted(67, 23) Source(100, 2) + SourceIndex(0) +1->Emitted(65, 9) Source(76, 21) + SourceIndex(0) +2 >Emitted(65, 13) Source(76, 21) + SourceIndex(0) +3 >Emitted(65, 22) Source(76, 30) + SourceIndex(0) +4 >Emitted(65, 23) Source(100, 2) + SourceIndex(0) --- >>> (function (Languages) { 1->^^^^^^^^ @@ -1384,9 +1310,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Languages -1->Emitted(68, 9) Source(76, 21) + SourceIndex(0) -2 >Emitted(68, 20) Source(76, 21) + SourceIndex(0) -3 >Emitted(68, 29) Source(76, 30) + SourceIndex(0) +1->Emitted(66, 9) Source(76, 21) + SourceIndex(0) +2 >Emitted(66, 20) Source(76, 21) + SourceIndex(0) +3 >Emitted(66, 29) Source(76, 30) + SourceIndex(0) --- >>> var PlainText; 1 >^^^^^^^^^^^^ @@ -1422,10 +1348,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(69, 13) Source(76, 31) + SourceIndex(0) -2 >Emitted(69, 17) Source(76, 31) + SourceIndex(0) -3 >Emitted(69, 26) Source(76, 40) + SourceIndex(0) -4 >Emitted(69, 27) Source(100, 2) + SourceIndex(0) +1 >Emitted(67, 13) Source(76, 31) + SourceIndex(0) +2 >Emitted(67, 17) Source(76, 31) + SourceIndex(0) +3 >Emitted(67, 26) Source(76, 40) + SourceIndex(0) +4 >Emitted(67, 27) Source(100, 2) + SourceIndex(0) --- >>> (function (PlainText) { 1->^^^^^^^^^^^^ @@ -1435,9 +1361,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > PlainText -1->Emitted(70, 13) Source(76, 31) + SourceIndex(0) -2 >Emitted(70, 24) Source(76, 31) + SourceIndex(0) -3 >Emitted(70, 33) Source(76, 40) + SourceIndex(0) +1->Emitted(68, 13) Source(76, 31) + SourceIndex(0) +2 >Emitted(68, 24) Source(76, 31) + SourceIndex(0) +3 >Emitted(68, 33) Source(76, 40) + SourceIndex(0) --- >>> var State = (function () { 1->^^^^^^^^^^^^^^^^ @@ -1445,7 +1371,7 @@ sourceFile:recursiveClassReferenceTest.ts 1-> { > > -1->Emitted(71, 17) Source(78, 2) + SourceIndex(0) +1->Emitted(69, 17) Source(78, 2) + SourceIndex(0) --- >>> function State(mode) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1456,9 +1382,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > constructor(private 3 > mode: IMode -1->Emitted(72, 21) Source(79, 9) + SourceIndex(0) -2 >Emitted(72, 36) Source(79, 29) + SourceIndex(0) -3 >Emitted(72, 40) Source(79, 40) + SourceIndex(0) +1->Emitted(70, 21) Source(79, 9) + SourceIndex(0) +2 >Emitted(70, 36) Source(79, 29) + SourceIndex(0) +3 >Emitted(70, 40) Source(79, 40) + SourceIndex(0) --- >>> this.mode = mode; 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1471,11 +1397,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > mode 5 > : IMode -1->Emitted(73, 25) Source(79, 29) + SourceIndex(0) -2 >Emitted(73, 34) Source(79, 33) + SourceIndex(0) -3 >Emitted(73, 37) Source(79, 29) + SourceIndex(0) -4 >Emitted(73, 41) Source(79, 33) + SourceIndex(0) -5 >Emitted(73, 42) Source(79, 40) + SourceIndex(0) +1->Emitted(71, 25) Source(79, 29) + SourceIndex(0) +2 >Emitted(71, 34) Source(79, 33) + SourceIndex(0) +3 >Emitted(71, 37) Source(79, 29) + SourceIndex(0) +4 >Emitted(71, 41) Source(79, 33) + SourceIndex(0) +5 >Emitted(71, 42) Source(79, 40) + SourceIndex(0) --- >>> } 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1483,8 +1409,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(74, 21) Source(79, 44) + SourceIndex(0) -2 >Emitted(74, 22) Source(79, 45) + SourceIndex(0) +1 >Emitted(72, 21) Source(79, 44) + SourceIndex(0) +2 >Emitted(72, 22) Source(79, 45) + SourceIndex(0) --- >>> State.prototype.clone = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1494,9 +1420,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > clone 3 > -1->Emitted(75, 21) Source(80, 10) + SourceIndex(0) -2 >Emitted(75, 42) Source(80, 15) + SourceIndex(0) -3 >Emitted(75, 45) Source(80, 3) + SourceIndex(0) +1->Emitted(73, 21) Source(80, 10) + SourceIndex(0) +2 >Emitted(73, 42) Source(80, 15) + SourceIndex(0) +3 >Emitted(73, 45) Source(80, 3) + SourceIndex(0) --- >>> return this; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1510,11 +1436,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > this 5 > ; -1 >Emitted(76, 25) Source(81, 4) + SourceIndex(0) -2 >Emitted(76, 31) Source(81, 10) + SourceIndex(0) -3 >Emitted(76, 32) Source(81, 11) + SourceIndex(0) -4 >Emitted(76, 36) Source(81, 15) + SourceIndex(0) -5 >Emitted(76, 37) Source(81, 16) + SourceIndex(0) +1 >Emitted(74, 25) Source(81, 4) + SourceIndex(0) +2 >Emitted(74, 31) Source(81, 10) + SourceIndex(0) +3 >Emitted(74, 32) Source(81, 11) + SourceIndex(0) +4 >Emitted(74, 36) Source(81, 15) + SourceIndex(0) +5 >Emitted(74, 37) Source(81, 16) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1523,8 +1449,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(77, 21) Source(82, 3) + SourceIndex(0) -2 >Emitted(77, 22) Source(82, 4) + SourceIndex(0) +1 >Emitted(75, 21) Source(82, 3) + SourceIndex(0) +2 >Emitted(75, 22) Source(82, 4) + SourceIndex(0) --- >>> State.prototype.equals = function (other) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1539,11 +1465,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > public equals( 5 > other:IState -1->Emitted(78, 21) Source(84, 10) + SourceIndex(0) -2 >Emitted(78, 43) Source(84, 16) + SourceIndex(0) -3 >Emitted(78, 46) Source(84, 3) + SourceIndex(0) -4 >Emitted(78, 56) Source(84, 17) + SourceIndex(0) -5 >Emitted(78, 61) Source(84, 29) + SourceIndex(0) +1->Emitted(76, 21) Source(84, 10) + SourceIndex(0) +2 >Emitted(76, 43) Source(84, 16) + SourceIndex(0) +3 >Emitted(76, 46) Source(84, 3) + SourceIndex(0) +4 >Emitted(76, 56) Source(84, 17) + SourceIndex(0) +5 >Emitted(76, 61) Source(84, 29) + SourceIndex(0) --- >>> return this === other; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1561,13 +1487,13 @@ sourceFile:recursiveClassReferenceTest.ts 5 > === 6 > other 7 > ; -1 >Emitted(79, 25) Source(85, 4) + SourceIndex(0) -2 >Emitted(79, 31) Source(85, 10) + SourceIndex(0) -3 >Emitted(79, 32) Source(85, 11) + SourceIndex(0) -4 >Emitted(79, 36) Source(85, 15) + SourceIndex(0) -5 >Emitted(79, 41) Source(85, 20) + SourceIndex(0) -6 >Emitted(79, 46) Source(85, 25) + SourceIndex(0) -7 >Emitted(79, 47) Source(85, 26) + SourceIndex(0) +1 >Emitted(77, 25) Source(85, 4) + SourceIndex(0) +2 >Emitted(77, 31) Source(85, 10) + SourceIndex(0) +3 >Emitted(77, 32) Source(85, 11) + SourceIndex(0) +4 >Emitted(77, 36) Source(85, 15) + SourceIndex(0) +5 >Emitted(77, 41) Source(85, 20) + SourceIndex(0) +6 >Emitted(77, 46) Source(85, 25) + SourceIndex(0) +7 >Emitted(77, 47) Source(85, 26) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1576,8 +1502,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(80, 21) Source(86, 3) + SourceIndex(0) -2 >Emitted(80, 22) Source(86, 4) + SourceIndex(0) +1 >Emitted(78, 21) Source(86, 3) + SourceIndex(0) +2 >Emitted(78, 22) Source(86, 4) + SourceIndex(0) --- >>> State.prototype.getMode = function () { return mode; }; 1->^^^^^^^^^^^^^^^^^^^^ @@ -1602,16 +1528,16 @@ sourceFile:recursiveClassReferenceTest.ts 8 > ; 9 > 10> } -1->Emitted(81, 21) Source(88, 10) + SourceIndex(0) -2 >Emitted(81, 44) Source(88, 17) + SourceIndex(0) -3 >Emitted(81, 47) Source(88, 3) + SourceIndex(0) -4 >Emitted(81, 61) Source(88, 29) + SourceIndex(0) -5 >Emitted(81, 67) Source(88, 35) + SourceIndex(0) -6 >Emitted(81, 68) Source(88, 36) + SourceIndex(0) -7 >Emitted(81, 72) Source(88, 40) + SourceIndex(0) -8 >Emitted(81, 73) Source(88, 41) + SourceIndex(0) -9 >Emitted(81, 74) Source(88, 42) + SourceIndex(0) -10>Emitted(81, 75) Source(88, 43) + SourceIndex(0) +1->Emitted(79, 21) Source(88, 10) + SourceIndex(0) +2 >Emitted(79, 44) Source(88, 17) + SourceIndex(0) +3 >Emitted(79, 47) Source(88, 3) + SourceIndex(0) +4 >Emitted(79, 61) Source(88, 29) + SourceIndex(0) +5 >Emitted(79, 67) Source(88, 35) + SourceIndex(0) +6 >Emitted(79, 68) Source(88, 36) + SourceIndex(0) +7 >Emitted(79, 72) Source(88, 40) + SourceIndex(0) +8 >Emitted(79, 73) Source(88, 41) + SourceIndex(0) +9 >Emitted(79, 74) Source(88, 42) + SourceIndex(0) +10>Emitted(79, 75) Source(88, 43) + SourceIndex(0) --- >>> return State; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1619,8 +1545,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(82, 21) Source(89, 2) + SourceIndex(0) -2 >Emitted(82, 33) Source(89, 3) + SourceIndex(0) +1 >Emitted(80, 21) Source(89, 2) + SourceIndex(0) +2 >Emitted(80, 33) Source(89, 3) + SourceIndex(0) --- >>> }()); 1 >^^^^^^^^^^^^^^^^ @@ -1643,10 +1569,10 @@ sourceFile:recursiveClassReferenceTest.ts > > public getMode(): IMode { return mode; } > } -1 >Emitted(83, 17) Source(89, 2) + SourceIndex(0) -2 >Emitted(83, 18) Source(89, 3) + SourceIndex(0) -3 >Emitted(83, 18) Source(78, 2) + SourceIndex(0) -4 >Emitted(83, 22) Source(89, 3) + SourceIndex(0) +1 >Emitted(81, 17) Source(89, 2) + SourceIndex(0) +2 >Emitted(81, 18) Source(89, 3) + SourceIndex(0) +3 >Emitted(81, 18) Source(78, 2) + SourceIndex(0) +4 >Emitted(81, 22) Source(89, 3) + SourceIndex(0) --- >>> PlainText.State = State; 1->^^^^^^^^^^^^^^^^ @@ -1669,10 +1595,10 @@ sourceFile:recursiveClassReferenceTest.ts > public getMode(): IMode { return mode; } > } 4 > -1->Emitted(84, 17) Source(78, 15) + SourceIndex(0) -2 >Emitted(84, 32) Source(78, 20) + SourceIndex(0) -3 >Emitted(84, 40) Source(89, 3) + SourceIndex(0) -4 >Emitted(84, 41) Source(89, 3) + SourceIndex(0) +1->Emitted(82, 17) Source(78, 15) + SourceIndex(0) +2 >Emitted(82, 32) Source(78, 20) + SourceIndex(0) +3 >Emitted(82, 40) Source(89, 3) + SourceIndex(0) +4 >Emitted(82, 41) Source(89, 3) + SourceIndex(0) --- >>> var Mode = (function (_super) { 1->^^^^^^^^^^^^^^^^ @@ -1680,35 +1606,28 @@ sourceFile:recursiveClassReferenceTest.ts 1-> > > -1->Emitted(85, 17) Source(91, 2) + SourceIndex(0) +1->Emitted(83, 17) Source(91, 2) + SourceIndex(0) --- >>> __extends(Mode, _super); 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^ 1->export class Mode extends 2 > AbstractMode -1->Emitted(86, 21) Source(91, 28) + SourceIndex(0) -2 >Emitted(86, 45) Source(91, 40) + SourceIndex(0) +1->Emitted(84, 21) Source(91, 28) + SourceIndex(0) +2 >Emitted(84, 45) Source(91, 40) + SourceIndex(0) --- >>> function Mode() { 1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(87, 21) Source(91, 2) + SourceIndex(0) ---- ->>> _super.apply(this, arguments); -1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->export class Mode extends -2 > AbstractMode -1->Emitted(88, 25) Source(91, 28) + SourceIndex(0) -2 >Emitted(88, 55) Source(91, 40) + SourceIndex(0) +1 >Emitted(85, 21) Source(91, 2) + SourceIndex(0) --- +>>> return _super.apply(this, arguments) || this; >>> } -1 >^^^^^^^^^^^^^^^^^^^^ +1->^^^^^^^^^^^^^^^^^^^^ 2 > ^ 3 > ^^^^^^^^^^^^^-> -1 > { +1->export class Mode extends AbstractMode { > > // scenario 2 > public getInitialState(): IState { @@ -1718,8 +1637,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(89, 21) Source(99, 2) + SourceIndex(0) -2 >Emitted(89, 22) Source(99, 3) + SourceIndex(0) +1->Emitted(87, 21) Source(99, 2) + SourceIndex(0) +2 >Emitted(87, 22) Source(99, 3) + SourceIndex(0) --- >>> // scenario 2 1->^^^^^^^^^^^^^^^^^^^^ @@ -1727,8 +1646,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> 2 > // scenario 2 -1->Emitted(90, 21) Source(93, 3) + SourceIndex(0) -2 >Emitted(90, 34) Source(93, 16) + SourceIndex(0) +1->Emitted(88, 21) Source(93, 3) + SourceIndex(0) +2 >Emitted(88, 34) Source(93, 16) + SourceIndex(0) --- >>> Mode.prototype.getInitialState = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1738,9 +1657,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getInitialState 3 > -1->Emitted(91, 21) Source(94, 10) + SourceIndex(0) -2 >Emitted(91, 51) Source(94, 25) + SourceIndex(0) -3 >Emitted(91, 54) Source(94, 3) + SourceIndex(0) +1->Emitted(89, 21) Source(94, 10) + SourceIndex(0) +2 >Emitted(89, 51) Source(94, 25) + SourceIndex(0) +3 >Emitted(89, 54) Source(94, 3) + SourceIndex(0) --- >>> return new State(self); 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1762,15 +1681,15 @@ sourceFile:recursiveClassReferenceTest.ts 7 > self 8 > ) 9 > ; -1 >Emitted(92, 25) Source(95, 4) + SourceIndex(0) -2 >Emitted(92, 31) Source(95, 10) + SourceIndex(0) -3 >Emitted(92, 32) Source(95, 11) + SourceIndex(0) -4 >Emitted(92, 36) Source(95, 15) + SourceIndex(0) -5 >Emitted(92, 41) Source(95, 20) + SourceIndex(0) -6 >Emitted(92, 42) Source(95, 21) + SourceIndex(0) -7 >Emitted(92, 46) Source(95, 25) + SourceIndex(0) -8 >Emitted(92, 47) Source(95, 26) + SourceIndex(0) -9 >Emitted(92, 48) Source(95, 27) + SourceIndex(0) +1 >Emitted(90, 25) Source(95, 4) + SourceIndex(0) +2 >Emitted(90, 31) Source(95, 10) + SourceIndex(0) +3 >Emitted(90, 32) Source(95, 11) + SourceIndex(0) +4 >Emitted(90, 36) Source(95, 15) + SourceIndex(0) +5 >Emitted(90, 41) Source(95, 20) + SourceIndex(0) +6 >Emitted(90, 42) Source(95, 21) + SourceIndex(0) +7 >Emitted(90, 46) Source(95, 25) + SourceIndex(0) +8 >Emitted(90, 47) Source(95, 26) + SourceIndex(0) +9 >Emitted(90, 48) Source(95, 27) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1779,8 +1698,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(93, 21) Source(96, 3) + SourceIndex(0) -2 >Emitted(93, 22) Source(96, 4) + SourceIndex(0) +1 >Emitted(91, 21) Source(96, 3) + SourceIndex(0) +2 >Emitted(91, 22) Source(96, 4) + SourceIndex(0) --- >>> return Mode; 1->^^^^^^^^^^^^^^^^^^^^ @@ -1791,8 +1710,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(94, 21) Source(99, 2) + SourceIndex(0) -2 >Emitted(94, 32) Source(99, 3) + SourceIndex(0) +1->Emitted(92, 21) Source(99, 2) + SourceIndex(0) +2 >Emitted(92, 32) Source(99, 3) + SourceIndex(0) --- >>> }(AbstractMode)); 1->^^^^^^^^^^^^^^^^ @@ -1816,12 +1735,12 @@ sourceFile:recursiveClassReferenceTest.ts > > > } -1->Emitted(95, 17) Source(99, 2) + SourceIndex(0) -2 >Emitted(95, 18) Source(99, 3) + SourceIndex(0) -3 >Emitted(95, 18) Source(91, 2) + SourceIndex(0) -4 >Emitted(95, 19) Source(91, 28) + SourceIndex(0) -5 >Emitted(95, 31) Source(91, 40) + SourceIndex(0) -6 >Emitted(95, 34) Source(99, 3) + SourceIndex(0) +1->Emitted(93, 17) Source(99, 2) + SourceIndex(0) +2 >Emitted(93, 18) Source(99, 3) + SourceIndex(0) +3 >Emitted(93, 18) Source(91, 2) + SourceIndex(0) +4 >Emitted(93, 19) Source(91, 28) + SourceIndex(0) +5 >Emitted(93, 31) Source(91, 40) + SourceIndex(0) +6 >Emitted(93, 34) Source(99, 3) + SourceIndex(0) --- >>> PlainText.Mode = Mode; 1->^^^^^^^^^^^^^^^^ @@ -1841,10 +1760,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } 4 > -1->Emitted(96, 17) Source(91, 15) + SourceIndex(0) -2 >Emitted(96, 31) Source(91, 19) + SourceIndex(0) -3 >Emitted(96, 38) Source(99, 3) + SourceIndex(0) -4 >Emitted(96, 39) Source(99, 3) + SourceIndex(0) +1->Emitted(94, 17) Source(91, 15) + SourceIndex(0) +2 >Emitted(94, 31) Source(91, 19) + SourceIndex(0) +3 >Emitted(94, 38) Source(99, 3) + SourceIndex(0) +4 >Emitted(94, 39) Source(99, 3) + SourceIndex(0) --- >>> })(PlainText = Languages.PlainText || (Languages.PlainText = {})); 1->^^^^^^^^^^^^ @@ -1890,15 +1809,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(97, 13) Source(100, 1) + SourceIndex(0) -2 >Emitted(97, 14) Source(100, 2) + SourceIndex(0) -3 >Emitted(97, 16) Source(76, 31) + SourceIndex(0) -4 >Emitted(97, 25) Source(76, 40) + SourceIndex(0) -5 >Emitted(97, 28) Source(76, 31) + SourceIndex(0) -6 >Emitted(97, 47) Source(76, 40) + SourceIndex(0) -7 >Emitted(97, 52) Source(76, 31) + SourceIndex(0) -8 >Emitted(97, 71) Source(76, 40) + SourceIndex(0) -9 >Emitted(97, 79) Source(100, 2) + SourceIndex(0) +1->Emitted(95, 13) Source(100, 1) + SourceIndex(0) +2 >Emitted(95, 14) Source(100, 2) + SourceIndex(0) +3 >Emitted(95, 16) Source(76, 31) + SourceIndex(0) +4 >Emitted(95, 25) Source(76, 40) + SourceIndex(0) +5 >Emitted(95, 28) Source(76, 31) + SourceIndex(0) +6 >Emitted(95, 47) Source(76, 40) + SourceIndex(0) +7 >Emitted(95, 52) Source(76, 31) + SourceIndex(0) +8 >Emitted(95, 71) Source(76, 40) + SourceIndex(0) +9 >Emitted(95, 79) Source(100, 2) + SourceIndex(0) --- >>> })(Languages = Thing.Languages || (Thing.Languages = {})); 1 >^^^^^^^^ @@ -1943,15 +1862,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(98, 9) Source(100, 1) + SourceIndex(0) -2 >Emitted(98, 10) Source(100, 2) + SourceIndex(0) -3 >Emitted(98, 12) Source(76, 21) + SourceIndex(0) -4 >Emitted(98, 21) Source(76, 30) + SourceIndex(0) -5 >Emitted(98, 24) Source(76, 21) + SourceIndex(0) -6 >Emitted(98, 39) Source(76, 30) + SourceIndex(0) -7 >Emitted(98, 44) Source(76, 21) + SourceIndex(0) -8 >Emitted(98, 59) Source(76, 30) + SourceIndex(0) -9 >Emitted(98, 67) Source(100, 2) + SourceIndex(0) +1 >Emitted(96, 9) Source(100, 1) + SourceIndex(0) +2 >Emitted(96, 10) Source(100, 2) + SourceIndex(0) +3 >Emitted(96, 12) Source(76, 21) + SourceIndex(0) +4 >Emitted(96, 21) Source(76, 30) + SourceIndex(0) +5 >Emitted(96, 24) Source(76, 21) + SourceIndex(0) +6 >Emitted(96, 39) Source(76, 30) + SourceIndex(0) +7 >Emitted(96, 44) Source(76, 21) + SourceIndex(0) +8 >Emitted(96, 59) Source(76, 30) + SourceIndex(0) +9 >Emitted(96, 67) Source(100, 2) + SourceIndex(0) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -1996,15 +1915,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(99, 5) Source(100, 1) + SourceIndex(0) -2 >Emitted(99, 6) Source(100, 2) + SourceIndex(0) -3 >Emitted(99, 8) Source(76, 15) + SourceIndex(0) -4 >Emitted(99, 13) Source(76, 20) + SourceIndex(0) -5 >Emitted(99, 16) Source(76, 15) + SourceIndex(0) -6 >Emitted(99, 28) Source(76, 20) + SourceIndex(0) -7 >Emitted(99, 33) Source(76, 15) + SourceIndex(0) -8 >Emitted(99, 45) Source(76, 20) + SourceIndex(0) -9 >Emitted(99, 53) Source(100, 2) + SourceIndex(0) +1 >Emitted(97, 5) Source(100, 1) + SourceIndex(0) +2 >Emitted(97, 6) Source(100, 2) + SourceIndex(0) +3 >Emitted(97, 8) Source(76, 15) + SourceIndex(0) +4 >Emitted(97, 13) Source(76, 20) + SourceIndex(0) +5 >Emitted(97, 16) Source(76, 15) + SourceIndex(0) +6 >Emitted(97, 28) Source(76, 20) + SourceIndex(0) +7 >Emitted(97, 33) Source(76, 15) + SourceIndex(0) +8 >Emitted(97, 45) Source(76, 20) + SourceIndex(0) +9 >Emitted(97, 53) Source(100, 2) + SourceIndex(0) --- >>>})(Sample || (Sample = {})); 1 > @@ -2046,12 +1965,12 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(100, 1) Source(100, 1) + SourceIndex(0) -2 >Emitted(100, 2) Source(100, 2) + SourceIndex(0) -3 >Emitted(100, 4) Source(76, 8) + SourceIndex(0) -4 >Emitted(100, 10) Source(76, 14) + SourceIndex(0) -5 >Emitted(100, 15) Source(76, 8) + SourceIndex(0) -6 >Emitted(100, 21) Source(76, 14) + SourceIndex(0) -7 >Emitted(100, 29) Source(100, 2) + SourceIndex(0) +1 >Emitted(98, 1) Source(100, 1) + SourceIndex(0) +2 >Emitted(98, 2) Source(100, 2) + SourceIndex(0) +3 >Emitted(98, 4) Source(76, 8) + SourceIndex(0) +4 >Emitted(98, 10) Source(76, 14) + SourceIndex(0) +5 >Emitted(98, 15) Source(76, 8) + SourceIndex(0) +6 >Emitted(98, 21) Source(76, 14) + SourceIndex(0) +7 >Emitted(98, 29) Source(100, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=recursiveClassReferenceTest.js.map \ No newline at end of file diff --git a/tests/baselines/reference/recursiveCloduleReference.js b/tests/baselines/reference/recursiveCloduleReference.js index 07d80e6011a..3d261a4f9ae 100644 --- a/tests/baselines/reference/recursiveCloduleReference.js +++ b/tests/baselines/reference/recursiveCloduleReference.js @@ -19,7 +19,6 @@ var M; return C; }()); M.C = C; - var C; (function (C_1) { C_1.C = M.C; })(C = M.C || (M.C = {})); diff --git a/tests/baselines/reference/recursiveComplicatedClasses.js b/tests/baselines/reference/recursiveComplicatedClasses.js index a5756024458..8441ff9e15a 100644 --- a/tests/baselines/reference/recursiveComplicatedClasses.js +++ b/tests/baselines/reference/recursiveComplicatedClasses.js @@ -51,21 +51,21 @@ var Symbol = (function () { var InferenceSymbol = (function (_super) { __extends(InferenceSymbol, _super); function InferenceSymbol() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return InferenceSymbol; }(Symbol)); var ParameterSymbol = (function (_super) { __extends(ParameterSymbol, _super); function ParameterSymbol() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ParameterSymbol; }(InferenceSymbol)); var TypeSymbol = (function (_super) { __extends(TypeSymbol, _super); function TypeSymbol() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return TypeSymbol; }(InferenceSymbol)); diff --git a/tests/baselines/reference/recursiveMods.js b/tests/baselines/reference/recursiveMods.js index 86b3d47a48e..6f8304df658 100644 --- a/tests/baselines/reference/recursiveMods.js +++ b/tests/baselines/reference/recursiveMods.js @@ -35,7 +35,6 @@ var Foo; }()); Foo.C = C; })(Foo = exports.Foo || (exports.Foo = {})); -var Foo; (function (Foo) { function Bar() { if (true) { diff --git a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js index 92cc2f72cac..76224741e60 100644 --- a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js +++ b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js @@ -52,7 +52,7 @@ var MsPortal; var ViewModel = (function (_super) { __extends(ViewModel, _super); function ViewModel() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ViewModel; }(ItemValue)); diff --git a/tests/baselines/reference/reexportClassDefinition.js b/tests/baselines/reference/reexportClassDefinition.js index a4b68115ac2..a75a90d4d86 100644 --- a/tests/baselines/reference/reexportClassDefinition.js +++ b/tests/baselines/reference/reexportClassDefinition.js @@ -42,7 +42,7 @@ var foo2 = require("./foo2"); var x = (function (_super) { __extends(x, _super); function x() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return x; }(foo2.x)); diff --git a/tests/baselines/reference/reservedWords2.js b/tests/baselines/reference/reservedWords2.js index a5f8a680bcc..a79a0564c78 100644 --- a/tests/baselines/reference/reservedWords2.js +++ b/tests/baselines/reference/reservedWords2.js @@ -34,7 +34,6 @@ debugger; if () ; [1, 2]; -var ; (function () { })( || ( = {})); void {}; diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index 6e621a18805..94dc537298a 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1030,7 +1030,7 @@ var rionegrensis; var caniventer = (function (_super) { __extends(caniventer, _super); function caniventer() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } caniventer.prototype.salomonseni = function () { var _this = this; @@ -1068,7 +1068,7 @@ var rionegrensis; var veraecrucis = (function (_super) { __extends(veraecrucis, _super); function veraecrucis() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } veraecrucis.prototype.naso = function () { var _this = this; @@ -1247,7 +1247,7 @@ var julianae; var oralis = (function (_super) { __extends(oralis, _super); function oralis() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } oralis.prototype.cepapi = function () { var _this = this; @@ -1333,7 +1333,7 @@ var julianae; var sumatrana = (function (_super) { __extends(sumatrana, _super); function sumatrana() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } sumatrana.prototype.wolffsohni = function () { var _this = this; @@ -1533,7 +1533,7 @@ var julianae; var durangae = (function (_super) { __extends(durangae, _super); function durangae() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } durangae.prototype.Californium = function () { var _this = this; @@ -1607,7 +1607,7 @@ var Lanthanum; var nitidus = (function (_super) { __extends(nitidus, _super); function nitidus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } nitidus.prototype.granatensis = function () { var _this = this; @@ -1675,7 +1675,7 @@ var Lanthanum; var megalonyx = (function (_super) { __extends(megalonyx, _super); function megalonyx() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } megalonyx.prototype.phillipsii = function () { var _this = this; @@ -1824,7 +1824,7 @@ var rendalli; var zuluensis = (function (_super) { __extends(zuluensis, _super); function zuluensis() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } zuluensis.prototype.telfairi = function () { var _this = this; @@ -1982,7 +1982,7 @@ var rendalli; var crenulata = (function (_super) { __extends(crenulata, _super); function crenulata() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } crenulata.prototype.salvanius = function () { var _this = this; @@ -2065,7 +2065,7 @@ var trivirgatus; var mixtus = (function (_super) { __extends(mixtus, _super); function mixtus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } mixtus.prototype.ochrogaster = function () { var _this = this; @@ -2302,12 +2302,11 @@ var quasiater; }()); quasiater.bobrinskoi = bobrinskoi; })(quasiater || (quasiater = {})); -var ruatanica; (function (ruatanica) { var americanus = (function (_super) { __extends(americanus, _super); function americanus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } americanus.prototype.nasoloi = function () { var _this = this; @@ -2342,7 +2341,7 @@ var lavali; var wilsoni = (function (_super) { __extends(wilsoni, _super); function wilsoni() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } wilsoni.prototype.setiger = function () { var _this = this; @@ -2434,7 +2433,7 @@ var lavali; var otion = (function (_super) { __extends(otion, _super); function otion() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } otion.prototype.bonaerensis = function () { var _this = this; @@ -2598,7 +2597,7 @@ var lavali; var thaeleri = (function (_super) { __extends(thaeleri, _super); function thaeleri() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } thaeleri.prototype.coromandra = function () { var _this = this; @@ -2654,7 +2653,7 @@ var lavali; var lepturus = (function (_super) { __extends(lepturus, _super); function lepturus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } lepturus.prototype.ferrumequinum = function () { var _this = this; @@ -2677,7 +2676,7 @@ var dogramacii; var robustulus = (function (_super) { __extends(robustulus, _super); function robustulus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } robustulus.prototype.fossor = function () { var _this = this; @@ -2892,7 +2891,7 @@ var lutreolus; var schlegeli = (function (_super) { __extends(schlegeli, _super); function schlegeli() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } schlegeli.prototype.mittendorfi = function () { var _this = this; @@ -3119,7 +3118,7 @@ var panglima; var amphibius = (function (_super) { __extends(amphibius, _super); function amphibius() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } amphibius.prototype.bottegi = function () { var _this = this; @@ -3163,7 +3162,7 @@ var panglima; var fundatus = (function (_super) { __extends(fundatus, _super); function fundatus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } fundatus.prototype.crassulus = function () { var _this = this; @@ -3189,7 +3188,7 @@ var panglima; var abidi = (function (_super) { __extends(abidi, _super); function abidi() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } abidi.prototype.greyii = function () { var _this = this; @@ -3225,7 +3224,6 @@ var panglima; }(argurus.dauricus)); panglima.abidi = abidi; })(panglima || (panglima = {})); -var quasiater; (function (quasiater) { var carolinensis = (function () { function carolinensis() { @@ -3281,7 +3279,7 @@ var minutus; var himalayana = (function (_super) { __extends(himalayana, _super); function himalayana() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } himalayana.prototype.simoni = function () { var _this = this; @@ -3364,7 +3362,7 @@ var caurinus; var mahaganus = (function (_super) { __extends(mahaganus, _super); function mahaganus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } mahaganus.prototype.martiniquensis = function () { var _this = this; @@ -3438,7 +3436,7 @@ var howi; var angulatus = (function (_super) { __extends(angulatus, _super); function angulatus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } angulatus.prototype.pennatus = function () { var _this = this; @@ -3459,7 +3457,6 @@ var daubentonii; }()); daubentonii.nesiotes = nesiotes; })(daubentonii || (daubentonii = {})); -var nigra; (function (nigra) { var thalia = (function () { function thalia() { @@ -3521,7 +3518,7 @@ var sagitta; var walkeri = (function (_super) { __extends(walkeri, _super); function walkeri() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } walkeri.prototype.maracajuensis = function () { var _this = this; @@ -3533,12 +3530,11 @@ var sagitta; }(minutus.portoricensis)); sagitta.walkeri = walkeri; })(sagitta || (sagitta = {})); -var minutus; (function (minutus) { var inez = (function (_super) { __extends(inez, _super); function inez() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } inez.prototype.vexillaris = function () { var _this = this; @@ -3550,12 +3546,11 @@ var minutus; }(samarensis.pelurus)); minutus.inez = inez; })(minutus || (minutus = {})); -var macrorhinos; (function (macrorhinos) { var konganensis = (function (_super) { __extends(konganensis, _super); function konganensis() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return konganensis; }(imperfecta.lasiurus)); @@ -3566,7 +3561,7 @@ var panamensis; var linulus = (function (_super) { __extends(linulus, _super); function linulus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } linulus.prototype.goslingi = function () { var _this = this; @@ -3626,7 +3621,6 @@ var panamensis; }(ruatanica.hector)); panamensis.linulus = linulus; })(panamensis || (panamensis = {})); -var nigra; (function (nigra) { var gracilis = (function () { function gracilis() { @@ -3718,7 +3712,7 @@ var samarensis; var pelurus = (function (_super) { __extends(pelurus, _super); function pelurus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } pelurus.prototype.Palladium = function () { var _this = this; @@ -3804,7 +3798,7 @@ var samarensis; var fuscus = (function (_super) { __extends(fuscus, _super); function fuscus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } fuscus.prototype.planifrons = function () { var _this = this; @@ -3960,12 +3954,11 @@ var samarensis; }()); samarensis.cahirinus = cahirinus; })(samarensis || (samarensis = {})); -var sagitta; (function (sagitta) { var leptoceros = (function (_super) { __extends(leptoceros, _super); function leptoceros() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } leptoceros.prototype.victus = function () { var _this = this; @@ -4001,12 +3994,11 @@ var sagitta; }(caurinus.johorensis)); sagitta.leptoceros = leptoceros; })(sagitta || (sagitta = {})); -var daubentonii; (function (daubentonii) { var nigricans = (function (_super) { __extends(nigricans, _super); function nigricans() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } nigricans.prototype.woosnami = function () { var _this = this; @@ -4027,12 +4019,11 @@ var dammermani; }()); dammermani.siberu = siberu; })(dammermani || (dammermani = {})); -var argurus; (function (argurus) { var pygmaea = (function (_super) { __extends(pygmaea, _super); function pygmaea() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } pygmaea.prototype.pajeros = function () { var _this = this; @@ -4061,7 +4052,7 @@ var chrysaeolus; var sarasinorum = (function (_super) { __extends(sarasinorum, _super); function sarasinorum() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } sarasinorum.prototype.belzebul = function () { var _this = this; @@ -4109,7 +4100,6 @@ var chrysaeolus; }(caurinus.psilurus)); chrysaeolus.sarasinorum = sarasinorum; })(chrysaeolus || (chrysaeolus = {})); -var argurus; (function (argurus) { var wetmorei = (function () { function wetmorei() { @@ -4160,12 +4150,11 @@ var argurus; }()); argurus.wetmorei = wetmorei; })(argurus || (argurus = {})); -var argurus; (function (argurus) { var oreas = (function (_super) { __extends(oreas, _super); function oreas() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } oreas.prototype.salamonis = function () { var _this = this; @@ -4219,7 +4208,6 @@ var argurus; }(lavali.wilsoni)); argurus.oreas = oreas; })(argurus || (argurus = {})); -var daubentonii; (function (daubentonii) { var arboreus = (function () { function arboreus() { @@ -4392,7 +4380,7 @@ var provocax; var melanoleuca = (function (_super) { __extends(melanoleuca, _super); function melanoleuca() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } melanoleuca.prototype.Neodymium = function () { var _this = this; @@ -4410,7 +4398,6 @@ var provocax; }(lavali.wilsoni)); provocax.melanoleuca = melanoleuca; })(provocax || (provocax = {})); -var sagitta; (function (sagitta) { var sicarius = (function () { function sicarius() { @@ -4431,12 +4418,11 @@ var sagitta; }()); sagitta.sicarius = sicarius; })(sagitta || (sagitta = {})); -var howi; (function (howi) { var marcanoi = (function (_super) { __extends(marcanoi, _super); function marcanoi() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } marcanoi.prototype.formosae = function () { var _this = this; @@ -4526,7 +4512,6 @@ var howi; }(Lanthanum.megalonyx)); howi.marcanoi = marcanoi; })(howi || (howi = {})); -var argurus; (function (argurus) { var gilbertii = (function () { function gilbertii() { @@ -4616,7 +4601,6 @@ var petrophilus; }()); petrophilus.minutilla = minutilla; })(petrophilus || (petrophilus = {})); -var lutreolus; (function (lutreolus) { var punicus = (function () { function punicus() { @@ -4703,7 +4687,6 @@ var lutreolus; }()); lutreolus.punicus = punicus; })(lutreolus || (lutreolus = {})); -var macrorhinos; (function (macrorhinos) { var daphaenodon = (function () { function daphaenodon() { @@ -4748,7 +4731,6 @@ var macrorhinos; }()); macrorhinos.daphaenodon = daphaenodon; })(macrorhinos || (macrorhinos = {})); -var sagitta; (function (sagitta) { var cinereus = (function () { function cinereus() { @@ -4829,7 +4811,6 @@ var sagitta; }()); sagitta.cinereus = cinereus; })(sagitta || (sagitta = {})); -var nigra; (function (nigra) { var caucasica = (function () { function caucasica() { @@ -4843,7 +4824,7 @@ var gabriellae; var klossii = (function (_super) { __extends(klossii, _super); function klossii() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return klossii; }(imperfecta.lasiurus)); @@ -5046,7 +5027,7 @@ var imperfecta; var ciliolabrum = (function (_super) { __extends(ciliolabrum, _super); function ciliolabrum() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ciliolabrum.prototype.leschenaultii = function () { var _this = this; @@ -5070,7 +5051,6 @@ var imperfecta; }(dogramacii.robustulus)); imperfecta.ciliolabrum = ciliolabrum; })(imperfecta || (imperfecta = {})); -var quasiater; (function (quasiater) { var wattsi = (function () { function wattsi() { @@ -5103,12 +5083,11 @@ var quasiater; }()); quasiater.wattsi = wattsi; })(quasiater || (quasiater = {})); -var petrophilus; (function (petrophilus) { var sodyi = (function (_super) { __extends(sodyi, _super); function sodyi() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } sodyi.prototype.saundersiae = function () { var _this = this; @@ -5168,12 +5147,11 @@ var petrophilus; }(quasiater.bobrinskoi)); petrophilus.sodyi = sodyi; })(petrophilus || (petrophilus = {})); -var caurinus; (function (caurinus) { var megaphyllus = (function (_super) { __extends(megaphyllus, _super); function megaphyllus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } megaphyllus.prototype.montana = function () { var _this = this; @@ -5227,7 +5205,6 @@ var caurinus; }(imperfecta.lasiurus)); caurinus.megaphyllus = megaphyllus; })(caurinus || (caurinus = {})); -var minutus; (function (minutus) { var portoricensis = (function () { function portoricensis() { @@ -5254,7 +5231,6 @@ var minutus; }()); minutus.portoricensis = portoricensis; })(minutus || (minutus = {})); -var lutreolus; (function (lutreolus) { var foina = (function () { function foina() { @@ -5341,12 +5317,11 @@ var lutreolus; }()); lutreolus.foina = foina; })(lutreolus || (lutreolus = {})); -var lutreolus; (function (lutreolus) { var cor = (function (_super) { __extends(cor, _super); function cor() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } cor.prototype.antinorii = function () { var _this = this; @@ -5412,7 +5387,6 @@ var lutreolus; }(panglima.fundatus)); lutreolus.cor = cor; })(lutreolus || (lutreolus = {})); -var howi; (function (howi) { var coludo = (function () { function coludo() { @@ -5433,12 +5407,11 @@ var howi; }()); howi.coludo = coludo; })(howi || (howi = {})); -var argurus; (function (argurus) { var germaini = (function (_super) { __extends(germaini, _super); function germaini() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } germaini.prototype.sharpei = function () { var _this = this; @@ -5456,7 +5429,6 @@ var argurus; }(gabriellae.amicus)); argurus.germaini = germaini; })(argurus || (argurus = {})); -var sagitta; (function (sagitta) { var stolzmanni = (function () { function stolzmanni() { @@ -5531,12 +5503,11 @@ var sagitta; }()); sagitta.stolzmanni = stolzmanni; })(sagitta || (sagitta = {})); -var dammermani; (function (dammermani) { var melanops = (function (_super) { __extends(melanops, _super); function melanops() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } melanops.prototype.blarina = function () { var _this = this; @@ -5620,12 +5591,11 @@ var dammermani; }(minutus.inez)); dammermani.melanops = melanops; })(dammermani || (dammermani = {})); -var argurus; (function (argurus) { var peninsulae = (function (_super) { __extends(peninsulae, _super); function peninsulae() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } peninsulae.prototype.aitkeni = function () { var _this = this; @@ -5679,7 +5649,6 @@ var argurus; }(patas.uralensis)); argurus.peninsulae = peninsulae; })(argurus || (argurus = {})); -var argurus; (function (argurus) { var netscheri = (function () { function netscheri() { @@ -5766,12 +5735,11 @@ var argurus; }()); argurus.netscheri = netscheri; })(argurus || (argurus = {})); -var ruatanica; (function (ruatanica) { var Praseodymium = (function (_super) { __extends(Praseodymium, _super); function Praseodymium() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Praseodymium.prototype.clara = function () { var _this = this; @@ -5855,12 +5823,11 @@ var ruatanica; }(ruatanica.hector)); ruatanica.Praseodymium = Praseodymium; })(ruatanica || (ruatanica = {})); -var caurinus; (function (caurinus) { var johorensis = (function (_super) { __extends(johorensis, _super); function johorensis() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } johorensis.prototype.maini = function () { var _this = this; @@ -5872,7 +5839,6 @@ var caurinus; }(lutreolus.punicus)); caurinus.johorensis = johorensis; })(caurinus || (caurinus = {})); -var argurus; (function (argurus) { var luctuosa = (function () { function luctuosa() { @@ -5887,7 +5853,6 @@ var argurus; }()); argurus.luctuosa = luctuosa; })(argurus || (argurus = {})); -var panamensis; (function (panamensis) { var setulosus = (function () { function setulosus() { @@ -5944,7 +5909,6 @@ var panamensis; }()); panamensis.setulosus = setulosus; })(panamensis || (panamensis = {})); -var petrophilus; (function (petrophilus) { var rosalia = (function () { function rosalia() { @@ -5983,12 +5947,11 @@ var petrophilus; }()); petrophilus.rosalia = rosalia; })(petrophilus || (petrophilus = {})); -var caurinus; (function (caurinus) { var psilurus = (function (_super) { __extends(psilurus, _super); function psilurus() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } psilurus.prototype.socialis = function () { var _this = this; diff --git a/tests/baselines/reference/returnInConstructor1.js b/tests/baselines/reference/returnInConstructor1.js index fab0fe8fe09..a47fa7ed513 100644 --- a/tests/baselines/reference/returnInConstructor1.js +++ b/tests/baselines/reference/returnInConstructor1.js @@ -123,7 +123,7 @@ var G = (function () { var H = (function (_super) { __extends(H, _super); function H() { - _super.call(this); + var _this = _super.call(this) || this; return new G(); //error } return H; @@ -131,7 +131,7 @@ var H = (function (_super) { var I = (function (_super) { __extends(I, _super); function I() { - _super.call(this); + var _this = _super.call(this) || this; return new G(); } return I; diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index a543ad3bdda..f786e994963 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -48,7 +48,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js index 3833a5caf7a..1474f8ab29a 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js @@ -22,7 +22,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.c = function () { v = 1; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js index d5de584e779..0baf0187009 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js @@ -22,7 +22,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.c = function () { v = 1; diff --git a/tests/baselines/reference/scopeTests.js b/tests/baselines/reference/scopeTests.js index 833e84ee5f3..48863404a8e 100644 --- a/tests/baselines/reference/scopeTests.js +++ b/tests/baselines/reference/scopeTests.js @@ -25,10 +25,11 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this); - this.v = 1; - this.p = 1; + var _this = _super.call(this) || this; + _this.v = 1; + _this.p = 1; C.s = 1; + return _this; } return D; }(C)); diff --git a/tests/baselines/reference/shadowPrivateMembers.js b/tests/baselines/reference/shadowPrivateMembers.js index a1474a24777..4906814f7eb 100644 --- a/tests/baselines/reference/shadowPrivateMembers.js +++ b/tests/baselines/reference/shadowPrivateMembers.js @@ -18,7 +18,7 @@ var base = (function () { var derived = (function (_super) { __extends(derived, _super); function derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } derived.prototype.n = function () { }; return derived; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js index 1d852127963..4bac0210c85 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js @@ -21,9 +21,10 @@ var AbstractGreeter = (function () { var Greeter = (function (_super) { __extends(Greeter, _super); function Greeter() { - _super.apply(this, arguments); - this.a = 10; - this.nameA = "Ten"; + var _this = _super.apply(this, arguments) || this; + _this.a = 10; + _this.nameA = "Ten"; + return _this; } return Greeter; }(AbstractGreeter)); diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map index 9c350133f2b..6b18a783dfa 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map] -{"version":3,"file":"sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js","sourceRoot":"","sources":["sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts"],"names":[],"mappings":";;;;;AAAA;IAAA;IACA,CAAC;IAAD,sBAAC;AAAD,CAAC,AADD,IACC;AAED;IAAsB,2BAAe;IAArC;;QACW,MAAC,GAAG,EAAE,CAAC;QACP,UAAK,GAAG,KAAK,CAAC;IACzB,CAAC;IAAD,cAAC;AAAD,CAAC,AAHD,CAAsB,eAAe,GAGpC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js","sourceRoot":"","sources":["sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts"],"names":[],"mappings":";;;;;AAAA;IAAA;IACA,CAAC;IAAD,sBAAC;AAAD,CAAC,AADD,IACC;AAED;IAAsB,2BAAe;IAArC;QAAA,kDAGC;QAFU,OAAC,GAAG,EAAE,CAAC;QACP,WAAK,GAAG,KAAK,CAAC;;IACzB,CAAC;IAAD,cAAC;AAAD,CAAC,AAHD,CAAsB,eAAe,GAGpC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt index f3052384651..91e284fd063 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt @@ -77,48 +77,58 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts --- >>> function Greeter() { 1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 1 >Emitted(13, 5) Source(4, 1) + SourceIndex(0) --- ->>> _super.apply(this, arguments); ->>> this.a = 10; +>>> var _this = _super.apply(this, arguments) || this; 1->^^^^^^^^ -2 > ^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^-> -1->class Greeter extends AbstractGreeter { - > public -2 > a -3 > = -4 > 10 -5 > ; -1->Emitted(15, 9) Source(5, 12) + SourceIndex(0) -2 >Emitted(15, 15) Source(5, 13) + SourceIndex(0) -3 >Emitted(15, 18) Source(5, 16) + SourceIndex(0) -4 >Emitted(15, 20) Source(5, 18) + SourceIndex(0) -5 >Emitted(15, 21) Source(5, 19) + SourceIndex(0) +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > class Greeter extends AbstractGreeter { + > public a = 10; + > public nameA = "Ten"; + > } +1->Emitted(14, 9) Source(4, 1) + SourceIndex(0) +2 >Emitted(14, 59) Source(7, 2) + SourceIndex(0) --- ->>> this.nameA = "Ten"; +>>> _this.a = 10; +1 >^^^^^^^^ +2 > ^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^-> +1 > +2 > a +3 > = +4 > 10 +5 > ; +1 >Emitted(15, 9) Source(5, 12) + SourceIndex(0) +2 >Emitted(15, 16) Source(5, 13) + SourceIndex(0) +3 >Emitted(15, 19) Source(5, 16) + SourceIndex(0) +4 >Emitted(15, 21) Source(5, 18) + SourceIndex(0) +5 >Emitted(15, 22) Source(5, 19) + SourceIndex(0) +--- +>>> _this.nameA = "Ten"; 1->^^^^^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^ -5 > ^ +2 > ^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^^ +5 > ^ 1-> > public 2 > nameA -3 > = -4 > "Ten" -5 > ; +3 > = +4 > "Ten" +5 > ; 1->Emitted(16, 9) Source(6, 12) + SourceIndex(0) -2 >Emitted(16, 19) Source(6, 17) + SourceIndex(0) -3 >Emitted(16, 22) Source(6, 20) + SourceIndex(0) -4 >Emitted(16, 27) Source(6, 25) + SourceIndex(0) -5 >Emitted(16, 28) Source(6, 26) + SourceIndex(0) +2 >Emitted(16, 20) Source(6, 17) + SourceIndex(0) +3 >Emitted(16, 23) Source(6, 20) + SourceIndex(0) +4 >Emitted(16, 28) Source(6, 25) + SourceIndex(0) +5 >Emitted(16, 29) Source(6, 26) + SourceIndex(0) --- +>>> return _this; >>> } 1 >^^^^ 2 > ^ @@ -126,8 +136,8 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 1 > > 2 > } -1 >Emitted(17, 5) Source(7, 1) + SourceIndex(0) -2 >Emitted(17, 6) Source(7, 2) + SourceIndex(0) +1 >Emitted(18, 5) Source(7, 1) + SourceIndex(0) +2 >Emitted(18, 6) Source(7, 2) + SourceIndex(0) --- >>> return Greeter; 1->^^^^ @@ -135,8 +145,8 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 3 > ^^^-> 1-> 2 > } -1->Emitted(18, 5) Source(7, 1) + SourceIndex(0) -2 >Emitted(18, 19) Source(7, 2) + SourceIndex(0) +1->Emitted(19, 5) Source(7, 1) + SourceIndex(0) +2 >Emitted(19, 19) Source(7, 2) + SourceIndex(0) --- >>>}(AbstractGreeter)); 1-> @@ -155,11 +165,11 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts > public a = 10; > public nameA = "Ten"; > } -1->Emitted(19, 1) Source(7, 1) + SourceIndex(0) -2 >Emitted(19, 2) Source(7, 2) + SourceIndex(0) -3 >Emitted(19, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(19, 3) Source(4, 23) + SourceIndex(0) -5 >Emitted(19, 18) Source(4, 38) + SourceIndex(0) -6 >Emitted(19, 21) Source(7, 2) + SourceIndex(0) +1->Emitted(20, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(20, 2) Source(7, 2) + SourceIndex(0) +3 >Emitted(20, 2) Source(4, 1) + SourceIndex(0) +4 >Emitted(20, 3) Source(4, 23) + SourceIndex(0) +5 >Emitted(20, 18) Source(4, 38) + SourceIndex(0) +6 >Emitted(20, 21) Source(7, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourcemapValidationDuplicateNames.js b/tests/baselines/reference/sourcemapValidationDuplicateNames.js index 360635fe74d..34804cc8227 100644 --- a/tests/baselines/reference/sourcemapValidationDuplicateNames.js +++ b/tests/baselines/reference/sourcemapValidationDuplicateNames.js @@ -19,7 +19,6 @@ var m1; }()); m1.c = c; })(m1 || (m1 = {})); -var m1; (function (m1) { var b = new m1.c(); })(m1 || (m1 = {})); diff --git a/tests/baselines/reference/sourcemapValidationDuplicateNames.js.map b/tests/baselines/reference/sourcemapValidationDuplicateNames.js.map index 10225f979e5..2e1a02da8dd 100644 --- a/tests/baselines/reference/sourcemapValidationDuplicateNames.js.map +++ b/tests/baselines/reference/sourcemapValidationDuplicateNames.js.map @@ -1,2 +1,2 @@ //// [sourcemapValidationDuplicateNames.js.map] -{"version":3,"file":"sourcemapValidationDuplicateNames.js","sourceRoot":"","sources":["sourcemapValidationDuplicateNames.ts"],"names":[],"mappings":"AAAA,IAAO,EAAE,CAIR;AAJD,WAAO,EAAE;IACL,IAAI,CAAC,GAAG,EAAE,CAAC;IACX;QAAA;QACA,CAAC;QAAD,QAAC;IAAD,CAAC,AADD,IACC;IADY,IAAC,IACb,CAAA;AACL,CAAC,EAJM,EAAE,KAAF,EAAE,QAIR;AACD,IAAO,EAAE,CAER;AAFD,WAAO,EAAE;IACL,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;AACvB,CAAC,EAFM,EAAE,KAAF,EAAE,QAER"} \ No newline at end of file +{"version":3,"file":"sourcemapValidationDuplicateNames.js","sourceRoot":"","sources":["sourcemapValidationDuplicateNames.ts"],"names":[],"mappings":"AAAA,IAAO,EAAE,CAIR;AAJD,WAAO,EAAE;IACL,IAAI,CAAC,GAAG,EAAE,CAAC;IACX;QAAA;QACA,CAAC;QAAD,QAAC;IAAD,CAAC,AADD,IACC;IADY,IAAC,IACb,CAAA;AACL,CAAC,EAJM,EAAE,KAAF,EAAE,QAIR;AACD,WAAO,EAAE;IACL,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;AACvB,CAAC,EAFM,EAAE,KAAF,EAAE,QAER"} \ No newline at end of file diff --git a/tests/baselines/reference/sourcemapValidationDuplicateNames.sourcemap.txt b/tests/baselines/reference/sourcemapValidationDuplicateNames.sourcemap.txt index 5ae487440ee..d4b98001a57 100644 --- a/tests/baselines/reference/sourcemapValidationDuplicateNames.sourcemap.txt +++ b/tests/baselines/reference/sourcemapValidationDuplicateNames.sourcemap.txt @@ -152,35 +152,18 @@ sourceFile:sourcemapValidationDuplicateNames.ts 6 >Emitted(10, 13) Source(1, 10) + SourceIndex(0) 7 >Emitted(10, 21) Source(5, 2) + SourceIndex(0) --- ->>>var m1; -1 > -2 >^^^^ -3 > ^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - > -2 >module -3 > m1 -4 > { - > var b = new m1.c(); - > } -1 >Emitted(11, 1) Source(6, 1) + SourceIndex(0) -2 >Emitted(11, 5) Source(6, 8) + SourceIndex(0) -3 >Emitted(11, 7) Source(6, 10) + SourceIndex(0) -4 >Emitted(11, 8) Source(8, 2) + SourceIndex(0) ---- >>>(function (m1) { -1-> +1 > 2 >^^^^^^^^^^^ 3 > ^^ 4 > ^^^^^^^^^^^-> -1-> +1 > + > 2 >module 3 > m1 -1->Emitted(12, 1) Source(6, 1) + SourceIndex(0) -2 >Emitted(12, 12) Source(6, 8) + SourceIndex(0) -3 >Emitted(12, 14) Source(6, 10) + SourceIndex(0) +1 >Emitted(11, 1) Source(6, 1) + SourceIndex(0) +2 >Emitted(11, 12) Source(6, 8) + SourceIndex(0) +3 >Emitted(11, 14) Source(6, 10) + SourceIndex(0) --- >>> var b = new m1.c(); 1->^^^^ @@ -204,16 +187,16 @@ sourceFile:sourcemapValidationDuplicateNames.ts 8 > c 9 > () 10> ; -1->Emitted(13, 5) Source(7, 5) + SourceIndex(0) -2 >Emitted(13, 9) Source(7, 9) + SourceIndex(0) -3 >Emitted(13, 10) Source(7, 10) + SourceIndex(0) -4 >Emitted(13, 13) Source(7, 13) + SourceIndex(0) -5 >Emitted(13, 17) Source(7, 17) + SourceIndex(0) -6 >Emitted(13, 19) Source(7, 19) + SourceIndex(0) -7 >Emitted(13, 20) Source(7, 20) + SourceIndex(0) -8 >Emitted(13, 21) Source(7, 21) + SourceIndex(0) -9 >Emitted(13, 23) Source(7, 23) + SourceIndex(0) -10>Emitted(13, 24) Source(7, 24) + SourceIndex(0) +1->Emitted(12, 5) Source(7, 5) + SourceIndex(0) +2 >Emitted(12, 9) Source(7, 9) + SourceIndex(0) +3 >Emitted(12, 10) Source(7, 10) + SourceIndex(0) +4 >Emitted(12, 13) Source(7, 13) + SourceIndex(0) +5 >Emitted(12, 17) Source(7, 17) + SourceIndex(0) +6 >Emitted(12, 19) Source(7, 19) + SourceIndex(0) +7 >Emitted(12, 20) Source(7, 20) + SourceIndex(0) +8 >Emitted(12, 21) Source(7, 21) + SourceIndex(0) +9 >Emitted(12, 23) Source(7, 23) + SourceIndex(0) +10>Emitted(12, 24) Source(7, 24) + SourceIndex(0) --- >>>})(m1 || (m1 = {})); 1 > @@ -234,12 +217,12 @@ sourceFile:sourcemapValidationDuplicateNames.ts 7 > { > var b = new m1.c(); > } -1 >Emitted(14, 1) Source(8, 1) + SourceIndex(0) -2 >Emitted(14, 2) Source(8, 2) + SourceIndex(0) -3 >Emitted(14, 4) Source(6, 8) + SourceIndex(0) -4 >Emitted(14, 6) Source(6, 10) + SourceIndex(0) -5 >Emitted(14, 11) Source(6, 8) + SourceIndex(0) -6 >Emitted(14, 13) Source(6, 10) + SourceIndex(0) -7 >Emitted(14, 21) Source(8, 2) + SourceIndex(0) +1 >Emitted(13, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(13, 2) Source(8, 2) + SourceIndex(0) +3 >Emitted(13, 4) Source(6, 8) + SourceIndex(0) +4 >Emitted(13, 6) Source(6, 10) + SourceIndex(0) +5 >Emitted(13, 11) Source(6, 8) + SourceIndex(0) +6 >Emitted(13, 13) Source(6, 10) + SourceIndex(0) +7 >Emitted(13, 21) Source(8, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=sourcemapValidationDuplicateNames.js.map \ No newline at end of file diff --git a/tests/baselines/reference/specializedInheritedConstructors1.js b/tests/baselines/reference/specializedInheritedConstructors1.js index f521ba14838..f65f42941bf 100644 --- a/tests/baselines/reference/specializedInheritedConstructors1.js +++ b/tests/baselines/reference/specializedInheritedConstructors1.js @@ -36,7 +36,7 @@ var Model = (function () { var MyView = (function (_super) { __extends(MyView, _super); function MyView() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyView; }(View)); diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.js b/tests/baselines/reference/specializedOverloadWithRestParameters.js index 62688f7cb7e..b76afaff08c 100644 --- a/tests/baselines/reference/specializedOverloadWithRestParameters.js +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.js @@ -27,7 +27,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index 6ccd30e37d1..de7588c3ebe 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -31,7 +31,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Derived.prototype.foo = function () { return 2; }; return Derived; diff --git a/tests/baselines/reference/staticInheritance.js b/tests/baselines/reference/staticInheritance.js index 52868930792..d204c1aed47 100644 --- a/tests/baselines/reference/staticInheritance.js +++ b/tests/baselines/reference/staticInheritance.js @@ -27,9 +27,10 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); - this.p1 = doThing(A); // OK - this.p2 = doThing(B); // OK + var _this = _super.apply(this, arguments) || this; + _this.p1 = doThing(A); // OK + _this.p2 = doThing(B); // OK + return _this; } return B; }(A)); diff --git a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js index 1c76a251220..7b8ca52b9a4 100644 --- a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js +++ b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js @@ -26,7 +26,7 @@ var SomeBase = (function () { var P = (function (_super) { __extends(P, _super); function P() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return P; }(SomeBase)); diff --git a/tests/baselines/reference/staticMemberExportAccess.js b/tests/baselines/reference/staticMemberExportAccess.js index 58fddf445ee..b0261e79c8e 100644 --- a/tests/baselines/reference/staticMemberExportAccess.js +++ b/tests/baselines/reference/staticMemberExportAccess.js @@ -30,7 +30,6 @@ var Sammy = (function () { }; return Sammy; }()); -var Sammy; (function (Sammy) { Sammy.x = 1; })(Sammy || (Sammy = {})); diff --git a/tests/baselines/reference/staticPropSuper.js b/tests/baselines/reference/staticPropSuper.js index c25c406746d..6240f8c454f 100644 --- a/tests/baselines/reference/staticPropSuper.js +++ b/tests/baselines/reference/staticPropSuper.js @@ -49,8 +49,10 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { + var _this; var x = 1; // should not error - _super.call(this); + _this = _super.call(this) || this; + return _this; } return B; }(A)); @@ -58,24 +60,30 @@ B.s = 9; var C = (function (_super) { __extends(C, _super); function C() { - this.p = 10; + var _this; + _this.p = 10; var x = 1; // should error + return _this; } return C; }(A)); var D = (function (_super) { __extends(D, _super); function D() { - this.p = 11; + var _this; + _this.p = 11; var x = 1; // should error + return _this; } return D; }(A)); var E = (function (_super) { __extends(E, _super); function E() { - this.p = 12; + var _this; + _this.p = 12; var x = 1; // should error + return _this; } return E; }(A)); diff --git a/tests/baselines/reference/staticPropertyNotInClassType.js b/tests/baselines/reference/staticPropertyNotInClassType.js index 60fd3b808ca..6caa108a710 100644 --- a/tests/baselines/reference/staticPropertyNotInClassType.js +++ b/tests/baselines/reference/staticPropertyNotInClassType.js @@ -56,7 +56,6 @@ var NonGeneric; }); return C; }()); - var C; (function (C) { C.bar = ''; // not reflected in class type })(C || (C = {})); @@ -82,7 +81,6 @@ var Generic; }); return C; }()); - var C; (function (C) { C.bar = ''; // not reflected in class type })(C || (C = {})); diff --git a/tests/baselines/reference/staticsNotInScopeInClodule.js b/tests/baselines/reference/staticsNotInScopeInClodule.js index e10ed2b31d3..ccaace996cd 100644 --- a/tests/baselines/reference/staticsNotInScopeInClodule.js +++ b/tests/baselines/reference/staticsNotInScopeInClodule.js @@ -14,7 +14,6 @@ var Clod = (function () { return Clod; }()); Clod.x = 10; -var Clod; (function (Clod) { var p = x; // x isn't in scope here })(Clod || (Clod = {})); diff --git a/tests/baselines/reference/strictModeInConstructor.js b/tests/baselines/reference/strictModeInConstructor.js index 446fed5b76a..da45bda5c6e 100644 --- a/tests/baselines/reference/strictModeInConstructor.js +++ b/tests/baselines/reference/strictModeInConstructor.js @@ -75,27 +75,31 @@ var B = (function (_super) { __extends(B, _super); function B() { "use strict"; // No error - _super.call(this); - this.s = 9; + var _this = _super.call(this) || this; + _this.s = 9; + return _this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - _super.call(this); // No error - this.s = 9; + var _this = _super.call(this) || this; + _this.s = 9; "use strict"; + return _this; } return C; }(A)); var D = (function (_super) { __extends(D, _super); function D() { - this.s = 9; + var _this; + _this.s = 9; var x = 1; // Error - _super.call(this); + _this = _super.call(this) || this; "use strict"; + return _this; } return D; }(A)); @@ -103,7 +107,7 @@ var Bs = (function (_super) { __extends(Bs, _super); function Bs() { "use strict"; // No error - _super.call(this); + return _super.call(this) || this; } return Bs; }(A)); @@ -111,8 +115,9 @@ Bs.s = 9; var Cs = (function (_super) { __extends(Cs, _super); function Cs() { - _super.call(this); // No error + var _this = _super.call(this) || this; "use strict"; + return _this; } return Cs; }(A)); @@ -120,9 +125,11 @@ Cs.s = 9; var Ds = (function (_super) { __extends(Ds, _super); function Ds() { + var _this; var x = 1; // no Error - _super.call(this); + _this = _super.call(this) || this; "use strict"; + return _this; } return Ds; }(A)); diff --git a/tests/baselines/reference/strictModeReservedWord.js b/tests/baselines/reference/strictModeReservedWord.js index 210d9ec75be..29715745890 100644 --- a/tests/baselines/reference/strictModeReservedWord.js +++ b/tests/baselines/reference/strictModeReservedWord.js @@ -48,7 +48,7 @@ function foo() { var myClass = (function (_super) { __extends(package, _super); function package() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return package; }(public)); diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js index 281b4ade5d6..1507e53d8cf 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js @@ -75,14 +75,14 @@ var F1 = (function () { var G = (function (_super) { __extends(G, _super); function G() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return G; }(package)); var H = (function (_super) { __extends(H, _super); function H() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return H; }(package.A)); diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index 08a26230f37..b532df7b120 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -55,7 +55,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.bar = function () { return ''; }; return B; diff --git a/tests/baselines/reference/subtypesOfAny.js b/tests/baselines/reference/subtypesOfAny.js index 0b2965cb820..c07da732c1e 100644 --- a/tests/baselines/reference/subtypesOfAny.js +++ b/tests/baselines/reference/subtypesOfAny.js @@ -150,7 +150,6 @@ var E; E[E["A"] = 0] = "A"; })(E || (E = {})); function f() { } -var f; (function (f) { f.bar = 1; })(f || (f = {})); @@ -159,7 +158,6 @@ var c = (function () { } return c; }()); -var c; (function (c) { c.bar = 1; })(c || (c = {})); diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index 10d9e3e42ec..38f5b5f1d4b 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -120,7 +120,7 @@ var C3 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1; }(C3)); @@ -143,7 +143,6 @@ var E; E[E["A"] = 0] = "A"; })(E || (E = {})); function f() { } -var f; (function (f) { f.bar = 1; })(f || (f = {})); @@ -152,7 +151,6 @@ var c = (function () { } return c; }()); -var c; (function (c) { c.bar = 1; })(c || (c = {})); diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js index 0753c52dc9e..82bcbf14ecc 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js @@ -182,28 +182,28 @@ var C3 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1; }(C3)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(C3)); var D3 = (function (_super) { __extends(D3, _super); function D3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D3; }(C3)); var D4 = (function (_super) { __extends(D4, _super); function D4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D4; }(C3)); @@ -213,21 +213,21 @@ var D4 = (function (_super) { var D5 = (function (_super) { __extends(D5, _super); function D5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D5; }(C3)); var D6 = (function (_super) { __extends(D6, _super); function D6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D6; }(C3)); var D7 = (function (_super) { __extends(D7, _super); function D7() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D7; }(C3)); @@ -236,21 +236,21 @@ var D7 = (function (_super) { var D8 = (function (_super) { __extends(D8, _super); function D8() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D8; }(C3)); var D9 = (function (_super) { __extends(D9, _super); function D9() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D9; }(C3)); var D10 = (function (_super) { __extends(D10, _super); function D10() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D10; }(C3)); @@ -259,21 +259,21 @@ var D10 = (function (_super) { var D11 = (function (_super) { __extends(D11, _super); function D11() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D11; }(C3)); var D12 = (function (_super) { __extends(D12, _super); function D12() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D12; }(C3)); var D13 = (function (_super) { __extends(D13, _super); function D13() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D13; }(C3)); @@ -283,28 +283,28 @@ var D13 = (function (_super) { var D14 = (function (_super) { __extends(D14, _super); function D14() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D14; }(C3)); var D15 = (function (_super) { __extends(D15, _super); function D15() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D15; }(C3)); var D16 = (function (_super) { __extends(D16, _super); function D16() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D16; }(C3)); var D17 = (function (_super) { __extends(D17, _super); function D17() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D17; }(C3)); @@ -313,28 +313,28 @@ var D17 = (function (_super) { var D18 = (function (_super) { __extends(D18, _super); function D18() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D18; }(C3)); var D19 = (function (_super) { __extends(D19, _super); function D19() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D19; }(C3)); var D20 = (function (_super) { __extends(D20, _super); function D20() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D20; }(C3)); var D21 = (function (_super) { __extends(D21, _super); function D21() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D21; }(C3)); @@ -343,28 +343,28 @@ var D21 = (function (_super) { var D22 = (function (_super) { __extends(D22, _super); function D22() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D22; }(C3)); var D23 = (function (_super) { __extends(D23, _super); function D23() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D23; }(C3)); var D24 = (function (_super) { __extends(D24, _super); function D24() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D24; }(C3)); var D25 = (function (_super) { __extends(D25, _super); function D25() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D25; }(C3)); @@ -373,28 +373,28 @@ var D25 = (function (_super) { var D26 = (function (_super) { __extends(D26, _super); function D26() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D26; }(C3)); var D27 = (function (_super) { __extends(D27, _super); function D27() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D27; }(C3)); var D28 = (function (_super) { __extends(D28, _super); function D28() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D28; }(C3)); var D29 = (function (_super) { __extends(D29, _super); function D29() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D29; }(C3)); diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js index 771c2ef74f5..a41ab1d4e2e 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js @@ -200,7 +200,6 @@ var E; E[E["A"] = 0] = "A"; })(E || (E = {})); function f() { } -var f; (function (f) { f.bar = 1; })(f || (f = {})); @@ -209,7 +208,6 @@ var c = (function () { } return c; }()); -var c; (function (c) { c.bar = 1; })(c || (c = {})); diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js index f388bd4e047..e0baced37a4 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js @@ -118,63 +118,63 @@ var B1 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1; }(B1)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(B1)); var D3 = (function (_super) { __extends(D3, _super); function D3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D3; }(B1)); var D4 = (function (_super) { __extends(D4, _super); function D4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D4; }(B1)); var D5 = (function (_super) { __extends(D5, _super); function D5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D5; }(B1)); var D6 = (function (_super) { __extends(D6, _super); function D6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D6; }(B1)); var D7 = (function (_super) { __extends(D7, _super); function D7() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D7; }(B1)); var D8 = (function (_super) { __extends(D8, _super); function D8() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D8; }(B1)); var D9 = (function (_super) { __extends(D9, _super); function D9() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D9; }(B1)); diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js index cffda7d7f55..0b17fc07f24 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js @@ -217,63 +217,63 @@ var M1; var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1; }(Base)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(Base)); var D3 = (function (_super) { __extends(D3, _super); function D3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D3; }(Base)); var D4 = (function (_super) { __extends(D4, _super); function D4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D4; }(Base)); var D5 = (function (_super) { __extends(D5, _super); function D5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D5; }(Base)); var D6 = (function (_super) { __extends(D6, _super); function D6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D6; }(Base)); var D7 = (function (_super) { __extends(D7, _super); function D7() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D7; }(Base)); var D8 = (function (_super) { __extends(D8, _super); function D8() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D8; }(Base)); var D9 = (function (_super) { __extends(D9, _super); function D9() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D9; }(Base)); @@ -288,63 +288,63 @@ var M2; var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1; }(Base2)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(Base2)); var D3 = (function (_super) { __extends(D3, _super); function D3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D3; }(Base2)); var D4 = (function (_super) { __extends(D4, _super); function D4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D4; }(Base2)); var D5 = (function (_super) { __extends(D5, _super); function D5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D5; }(Base2)); var D6 = (function (_super) { __extends(D6, _super); function D6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D6; }(Base2)); var D7 = (function (_super) { __extends(D7, _super); function D7() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D7; }(Base2)); var D8 = (function (_super) { __extends(D8, _super); function D8() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D8; }(Base2)); var D9 = (function (_super) { __extends(D9, _super); function D9() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D9; }(Base2)); diff --git a/tests/baselines/reference/subtypesOfUnion.js b/tests/baselines/reference/subtypesOfUnion.js index cc0fdea7346..8168798bce2 100644 --- a/tests/baselines/reference/subtypesOfUnion.js +++ b/tests/baselines/reference/subtypesOfUnion.js @@ -69,7 +69,6 @@ var A2 = (function () { return A2; }()); function f() { } -var f; (function (f) { f.bar = 1; })(f || (f = {})); @@ -78,7 +77,6 @@ var c = (function () { } return c; }()); -var c; (function (c) { c.bar = 1; })(c || (c = {})); diff --git a/tests/baselines/reference/subtypingTransitivity.js b/tests/baselines/reference/subtypingTransitivity.js index 9d3df207a0c..9c4c9011758 100644 --- a/tests/baselines/reference/subtypingTransitivity.js +++ b/tests/baselines/reference/subtypingTransitivity.js @@ -33,14 +33,14 @@ var B = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(B)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(B)); diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.js b/tests/baselines/reference/subtypingWithCallSignatures2.js index 014ce4a3003..843a727c33e 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.js +++ b/tests/baselines/reference/subtypingWithCallSignatures2.js @@ -187,21 +187,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.js b/tests/baselines/reference/subtypingWithCallSignatures3.js index 55f5fa60e71..a9e7d01aab6 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.js +++ b/tests/baselines/reference/subtypingWithCallSignatures3.js @@ -136,21 +136,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.js b/tests/baselines/reference/subtypingWithCallSignatures4.js index b8839316e86..94f549c62c1 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.js +++ b/tests/baselines/reference/subtypingWithCallSignatures4.js @@ -126,21 +126,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.js b/tests/baselines/reference/subtypingWithConstructSignatures2.js index c4168febf4e..1d12aeb945f 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.js @@ -187,21 +187,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.js b/tests/baselines/reference/subtypingWithConstructSignatures3.js index 171e52505e0..78582304cb8 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.js @@ -138,21 +138,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.js b/tests/baselines/reference/subtypingWithConstructSignatures4.js index 1152dde04dd..17252fdb809 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.js @@ -126,21 +126,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithConstructSignatures5.js b/tests/baselines/reference/subtypingWithConstructSignatures5.js index 24a5ce77dd0..a0561606393 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures5.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures5.js @@ -64,21 +64,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithConstructSignatures6.js b/tests/baselines/reference/subtypingWithConstructSignatures6.js index 8778255dbd5..c508781e089 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures6.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures6.js @@ -67,21 +67,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithNumericIndexer.js b/tests/baselines/reference/subtypingWithNumericIndexer.js index cd447c116da..3cf75dd83fd 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer.js @@ -54,14 +54,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A)); @@ -75,28 +75,28 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A)); var B4 = (function (_super) { __extends(B4, _super); function B4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B4; }(A)); diff --git a/tests/baselines/reference/subtypingWithNumericIndexer3.js b/tests/baselines/reference/subtypingWithNumericIndexer3.js index 104141b761d..e9e8d39bf3c 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer3.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer3.js @@ -58,14 +58,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A)); @@ -79,35 +79,35 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A)); var B4 = (function (_super) { __extends(B4, _super); function B4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B4; }(A)); var B5 = (function (_super) { __extends(B5, _super); function B5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B5; }(A)); diff --git a/tests/baselines/reference/subtypingWithNumericIndexer4.js b/tests/baselines/reference/subtypingWithNumericIndexer4.js index 59f8cd95ad0..798e775083f 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer4.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer4.js @@ -42,7 +42,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -56,14 +56,14 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A)); diff --git a/tests/baselines/reference/subtypingWithObjectMembers.js b/tests/baselines/reference/subtypingWithObjectMembers.js index c3cef6601e6..3675ed6a410 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers.js +++ b/tests/baselines/reference/subtypingWithObjectMembers.js @@ -81,14 +81,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Derived)); @@ -102,7 +102,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -114,7 +114,7 @@ var A2 = (function () { var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -126,7 +126,7 @@ var A3 = (function () { var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A3)); @@ -140,7 +140,7 @@ var TwoLevels; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -152,7 +152,7 @@ var TwoLevels; var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -164,7 +164,7 @@ var TwoLevels; var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A3)); diff --git a/tests/baselines/reference/subtypingWithObjectMembers4.js b/tests/baselines/reference/subtypingWithObjectMembers4.js index d5c1107e45d..404b6cbe988 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers4.js +++ b/tests/baselines/reference/subtypingWithObjectMembers4.js @@ -48,7 +48,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -60,7 +60,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -72,7 +72,7 @@ var A2 = (function () { var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -84,7 +84,7 @@ var A3 = (function () { var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A3)); diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js index 25faacad88e..8b168ea73b5 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js @@ -48,7 +48,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -60,7 +60,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -72,7 +72,7 @@ var A2 = (function () { var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -84,7 +84,7 @@ var A3 = (function () { var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A3)); diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js index 7b0398143a2..0a83b760218 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js @@ -76,7 +76,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -90,7 +90,7 @@ var ExplicitPublic; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -102,7 +102,7 @@ var ExplicitPublic; var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -114,7 +114,7 @@ var ExplicitPublic; var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A3)); @@ -129,7 +129,7 @@ var ImplicitPublic; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -141,7 +141,7 @@ var ImplicitPublic; var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -153,7 +153,7 @@ var ImplicitPublic; var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A3)); diff --git a/tests/baselines/reference/subtypingWithStringIndexer.js b/tests/baselines/reference/subtypingWithStringIndexer.js index 0740743a5d9..195b7d2192e 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer.js +++ b/tests/baselines/reference/subtypingWithStringIndexer.js @@ -55,14 +55,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A)); @@ -76,28 +76,28 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A)); var B4 = (function (_super) { __extends(B4, _super); function B4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B4; }(A)); diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.js b/tests/baselines/reference/subtypingWithStringIndexer3.js index 5ed44177d52..0b2a57324eb 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.js +++ b/tests/baselines/reference/subtypingWithStringIndexer3.js @@ -58,14 +58,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A)); @@ -79,35 +79,35 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B2; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A)); var B4 = (function (_super) { __extends(B4, _super); function B4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B4; }(A)); var B5 = (function (_super) { __extends(B5, _super); function B5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B5; }(A)); diff --git a/tests/baselines/reference/subtypingWithStringIndexer4.js b/tests/baselines/reference/subtypingWithStringIndexer4.js index d6fb874c090..2937261ad05 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer4.js +++ b/tests/baselines/reference/subtypingWithStringIndexer4.js @@ -42,7 +42,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); @@ -56,14 +56,14 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B3; }(A)); diff --git a/tests/baselines/reference/super.js b/tests/baselines/reference/super.js index 81d76aec62b..504e8542d4d 100644 --- a/tests/baselines/reference/super.js +++ b/tests/baselines/reference/super.js @@ -58,7 +58,7 @@ var Base = (function () { var Sub1 = (function (_super) { __extends(Sub1, _super); function Sub1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Sub1.prototype.foo = function () { return "sub1" + _super.prototype.foo.call(this) + _super.prototype.bar.call(this); @@ -68,7 +68,7 @@ var Sub1 = (function (_super) { var SubSub1 = (function (_super) { __extends(SubSub1, _super); function SubSub1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } SubSub1.prototype.foo = function () { return "subsub1" + _super.prototype.foo.call(this); diff --git a/tests/baselines/reference/super1.js b/tests/baselines/reference/super1.js index 4179843b79a..9f1289dce55 100644 --- a/tests/baselines/reference/super1.js +++ b/tests/baselines/reference/super1.js @@ -84,7 +84,7 @@ var Base1 = (function () { var Sub1 = (function (_super) { __extends(Sub1, _super); function Sub1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Sub1.prototype.bar = function () { return "base"; @@ -94,7 +94,7 @@ var Sub1 = (function (_super) { var SubSub1 = (function (_super) { __extends(SubSub1, _super); function SubSub1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } SubSub1.prototype.bar = function () { return _super.prototype.super.foo; @@ -113,7 +113,7 @@ var Base2 = (function () { var SubE2 = (function (_super) { __extends(SubE2, _super); function SubE2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } SubE2.prototype.bar = function () { return _super.prototype.prototype.foo = null; @@ -132,7 +132,7 @@ var Base3 = (function () { var SubE3 = (function (_super) { __extends(SubE3, _super); function SubE3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } SubE3.prototype.bar = function () { return _super.prototype.bar.call(this); @@ -153,7 +153,7 @@ var Base4; var SubSub4 = (function (_super) { __extends(SubSub4, _super); function SubSub4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } SubSub4.prototype.x = function () { return _super.prototype.x.call(this); diff --git a/tests/baselines/reference/super2.js b/tests/baselines/reference/super2.js index 979bdba84e4..1d2331052db 100644 --- a/tests/baselines/reference/super2.js +++ b/tests/baselines/reference/super2.js @@ -71,7 +71,7 @@ var Base5 = (function () { var Sub5 = (function (_super) { __extends(Sub5, _super); function Sub5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Sub5.prototype.x = function () { return "SubX"; @@ -81,7 +81,7 @@ var Sub5 = (function (_super) { var SubSub5 = (function (_super) { __extends(SubSub5, _super); function SubSub5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } SubSub5.prototype.x = function () { return _super.prototype.x.call(this); @@ -103,7 +103,7 @@ var Base6 = (function () { var Sub6 = (function (_super) { __extends(Sub6, _super); function Sub6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Sub6.prototype.y = function () { return "SubY"; @@ -113,7 +113,7 @@ var Sub6 = (function (_super) { var SubSub6 = (function (_super) { __extends(SubSub6, _super); function SubSub6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } SubSub6.prototype.y = function () { return _super.prototype.y.call(this); diff --git a/tests/baselines/reference/superAccess.js b/tests/baselines/reference/superAccess.js index 6e5cd9aca44..0bd9d305d2e 100644 --- a/tests/baselines/reference/superAccess.js +++ b/tests/baselines/reference/superAccess.js @@ -30,7 +30,7 @@ MyBase.S1 = 5; var MyDerived = (function (_super) { __extends(MyDerived, _super); function MyDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } MyDerived.prototype.foo = function () { var l3 = _super.prototype.S1; // Expected => Error: Only public instance methods of the base class are accessible via the 'super' keyword diff --git a/tests/baselines/reference/superAccess2.js b/tests/baselines/reference/superAccess2.js index 8de13b5ef51..da19770584a 100644 --- a/tests/baselines/reference/superAccess2.js +++ b/tests/baselines/reference/superAccess2.js @@ -41,13 +41,13 @@ var Q = (function (_super) { __extends(Q, _super); // Super is not allowed in constructor args function Q(z, zz, zzz) { - var _this = this; if (z === void 0) { z = _super.; } if (zz === void 0) { zz = _super.; } if (zzz === void 0) { zzz = function () { return _super.; }; } - _super.call(this); - this.z = z; - this.xx = _super.prototype.; + var _this = _super.call(this) || this; + _this.z = z; + _this.xx = _super.prototype.; + return _this; } Q.prototype.foo = function (zz) { if (zz === void 0) { zz = _super.prototype.; } diff --git a/tests/baselines/reference/superAccessInFatArrow1.js b/tests/baselines/reference/superAccessInFatArrow1.js index 3cd4e199c62..a7f964309f7 100644 --- a/tests/baselines/reference/superAccessInFatArrow1.js +++ b/tests/baselines/reference/superAccessInFatArrow1.js @@ -34,7 +34,7 @@ var test; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.bar = function (callback) { }; diff --git a/tests/baselines/reference/superCallArgsMustMatch.js b/tests/baselines/reference/superCallArgsMustMatch.js index 9dcdbda8e31..106d7433bf5 100644 --- a/tests/baselines/reference/superCallArgsMustMatch.js +++ b/tests/baselines/reference/superCallArgsMustMatch.js @@ -40,10 +40,12 @@ var T5 = (function () { var T6 = (function (_super) { __extends(T6, _super); function T6() { + var _this = // Should error; base constructor has type T for first arg, // which is instantiated with 'number' in the extends clause - _super.call(this, "hi"); - var x = this.foo; + _super.call(this, "hi") || this; + var x = _this.foo; + return _this; } return T6; }(T5)); diff --git a/tests/baselines/reference/superCallAssignResult.js b/tests/baselines/reference/superCallAssignResult.js index 7002f94eb7d..6e30cc64052 100644 --- a/tests/baselines/reference/superCallAssignResult.js +++ b/tests/baselines/reference/superCallAssignResult.js @@ -24,8 +24,10 @@ var E = (function () { var H = (function (_super) { __extends(H, _super); function H() { - var x = _super.call(this, 5); // Should be of type void, not E. + var _this; + var x = _this = _super.call(this, 5) || this; // Should be of type void, not E. x = 5; + return _this; } return H; }(E)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing1.js b/tests/baselines/reference/superCallBeforeThisAccessing1.js index 1fc7ab39c91..e3aed9e40e9 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing1.js @@ -30,11 +30,12 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this, i); + var _this = _super.call(this, i) || this; var s = { - t: this._t + t: _this._t }; var i = Factory.create(s); + return _this; } return D; }(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing2.js b/tests/baselines/reference/superCallBeforeThisAccessing2.js index e5acf06bbfd..7331718a9ed 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing2.js @@ -24,8 +24,7 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this = this; - _super.call(this, function () { _this._t; }); // no error. only check when this is directly accessing in constructor + return _super.call(this, function () { _this._t; }) || this; } return D; }(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing3.js b/tests/baselines/reference/superCallBeforeThisAccessing3.js index 101d74e4bc7..185767fefb6 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing3.js @@ -27,11 +27,12 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this = this; + var _this; var x = function () { _this._t; }; x(); // no error; we only check super is called before this when the container is a constructor - this._t; // error - _super.call(this, undefined); + _this._t; // error + _this = _super.call(this, undefined) || this; + return _this; } return D; }(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing4.js b/tests/baselines/reference/superCallBeforeThisAccessing4.js index 9c3c5ab60c4..91acb88ce22 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing4.js @@ -24,16 +24,19 @@ var __extends = (this && this.__extends) || function (d, b) { var D = (function (_super) { __extends(D, _super); function D() { - this._t; - _super.call(this); + var _this; + _this._t; + _this = _super.call(this) || this; + return _this; } return D; }(null)); var E = (function (_super) { __extends(E, _super); function E() { - _super.call(this); - this._t; + var _this = _super.call(this) || this; + _this._t; + return _this; } return E; }(null)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing5.js b/tests/baselines/reference/superCallBeforeThisAccessing5.js index 3281a3f8b55..57228538faf 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing5.js @@ -16,7 +16,9 @@ var __extends = (this && this.__extends) || function (d, b) { var D = (function (_super) { __extends(D, _super); function D() { - this._t; // No error + var _this; + _this._t; // No error + return _this; } return D; }(null)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing6.js b/tests/baselines/reference/superCallBeforeThisAccessing6.js index 746ce9f2791..e4dfb3f714a 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing6.js @@ -24,7 +24,7 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this, this); + return _super.call(this, this) || this; } return D; }(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing7.js b/tests/baselines/reference/superCallBeforeThisAccessing7.js index c3aa1655cf7..9cfe8736774 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing7.js @@ -27,10 +27,12 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { + var _this; var x = { - j: this._t + j: _this._t }; - _super.call(this, undefined); + _this = _super.call(this, undefined) || this; + return _this; } return D; }(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing8.js b/tests/baselines/reference/superCallBeforeThisAccessing8.js index 0865c4305a5..fe459b5e031 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing8.js @@ -27,10 +27,12 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { + var _this; var x = { - k: _super.call(this, undefined), - j: this._t + k: _this = _super.call(this, undefined) || this, + j: _this._t }; + return _this; } return D; }(Base)); diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js index 50830480b1a..bc196299bf9 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js @@ -20,7 +20,7 @@ var __extends = (this && this.__extends) || function (d, b) { var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this); + return _super.call(this) || this; } return D; }(B)); diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js index ef770985888..8a0ef085590 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js @@ -19,7 +19,7 @@ var __extends = (this && this.__extends) || function (d, b) { var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this); + return _super.call(this) || this; } return D; }(B)); diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js index ebb70023b53..0529d5e3dc2 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js @@ -25,7 +25,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.call(this, function (value) { return String(value); }); + return _super.call(this, function (value) { return String(value); }) || this; } return B; }(A)); diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js index d619343ba14..fb08ec28902 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js @@ -25,7 +25,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.call(this, function (value) { return String(value); }); + return _super.call(this, function (value) { return String(value); }) || this; } return B; }(A)); diff --git a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js index e9ee84be152..50153391f62 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js @@ -25,7 +25,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.call(this, function (value) { return String(value); }); + return _super.call(this, function (value) { return String(value); }) || this; } return B; }(A)); diff --git a/tests/baselines/reference/superCallFromClassThatHasNoBaseType1.js b/tests/baselines/reference/superCallFromClassThatHasNoBaseType1.js index d793e9bb2ae..e4b358c9a0a 100644 --- a/tests/baselines/reference/superCallFromClassThatHasNoBaseType1.js +++ b/tests/baselines/reference/superCallFromClassThatHasNoBaseType1.js @@ -19,7 +19,7 @@ var A = (function () { }()); var B = (function () { function B() { - _super.call(this, function (value) { return String(value); }); + _this = _super.call(this, function (value) { return String(value); }) || this; } return B; }()); diff --git a/tests/baselines/reference/superCallFromFunction1.js b/tests/baselines/reference/superCallFromFunction1.js index a7fcbaaeff0..7f34628c58a 100644 --- a/tests/baselines/reference/superCallFromFunction1.js +++ b/tests/baselines/reference/superCallFromFunction1.js @@ -6,5 +6,5 @@ function foo() { //// [superCallFromFunction1.js] function foo() { - _super.call(this, function (value) { return String(value); }); + _this = _super.call(this, function (value) { return String(value); }) || this; } diff --git a/tests/baselines/reference/superCallInConstructorWithNoBaseType.js b/tests/baselines/reference/superCallInConstructorWithNoBaseType.js index 9746ab6a9de..dcbebeaa452 100644 --- a/tests/baselines/reference/superCallInConstructorWithNoBaseType.js +++ b/tests/baselines/reference/superCallInConstructorWithNoBaseType.js @@ -14,13 +14,13 @@ class D { //// [superCallInConstructorWithNoBaseType.js] var C = (function () { function C() { - _super.call(this); // error + _this = _super.call(this) || this; // error } return C; }()); var D = (function () { function D(x) { - _super.call(this); // error + _this = _super.call(this) || this; // error this.x = x; } return D; diff --git a/tests/baselines/reference/superCallInNonStaticMethod.js b/tests/baselines/reference/superCallInNonStaticMethod.js index 3ff07edf4c9..cd84052ca3c 100644 --- a/tests/baselines/reference/superCallInNonStaticMethod.js +++ b/tests/baselines/reference/superCallInNonStaticMethod.js @@ -66,11 +66,11 @@ var Doing = (function () { var Other = (function (_super) { __extends(Other, _super); function Other() { - var _this = this; - _super.call(this); - this.propertyInitializer = _super.prototype.instanceMethod.call(this); - this.functionProperty = function () { _super.prototype.instanceMethod.call(_this); }; - _super.prototype.instanceMethod.call(this); + var _this = _super.call(this) || this; + _this.propertyInitializer = _super.prototype.instanceMethod.call(_this); + _this.functionProperty = function () { _super.prototype.instanceMethod.call(_this); }; + _super.prototype.instanceMethod.call(_this); + return _this; } // in instance method Other.prototype.instanceMethod = function () { diff --git a/tests/baselines/reference/superCallInStaticMethod.js b/tests/baselines/reference/superCallInStaticMethod.js index 91558e47d3f..b31110fdf78 100644 --- a/tests/baselines/reference/superCallInStaticMethod.js +++ b/tests/baselines/reference/superCallInStaticMethod.js @@ -62,7 +62,7 @@ var Doing = (function () { var Other = (function (_super) { __extends(Other, _super); function Other() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } // in static method Other.staticMethod = function () { diff --git a/tests/baselines/reference/superCallInsideClassDeclaration.js b/tests/baselines/reference/superCallInsideClassDeclaration.js index e677c426e02..05e44119608 100644 --- a/tests/baselines/reference/superCallInsideClassDeclaration.js +++ b/tests/baselines/reference/superCallInsideClassDeclaration.js @@ -35,13 +35,15 @@ var C = (function () { var B = (function (_super) { __extends(B, _super); function B() { + var _this; var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this); + return _super.call(this) || this; } return D; }(C)); + return _this; } return B; }(A)); diff --git a/tests/baselines/reference/superCallInsideClassExpression.js b/tests/baselines/reference/superCallInsideClassExpression.js index ee373f69f46..3d55fe11cff 100644 --- a/tests/baselines/reference/superCallInsideClassExpression.js +++ b/tests/baselines/reference/superCallInsideClassExpression.js @@ -35,13 +35,15 @@ var C = (function () { var B = (function (_super) { __extends(B, _super); function B() { + var _this; var D = (function (_super) { __extends(class_1, _super); function class_1() { - _super.call(this); + return _super.call(this) || this; } return class_1; }(C)); + return _this; } return B; }(A)); diff --git a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js index 3f9a0a9ce9c..636b03c227f 100644 --- a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js +++ b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js @@ -28,9 +28,11 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { + var _this; var x = { - x: _super.call(this) + x: _this = _super.call(this) || this }; + return _this; } return B; }(A)); diff --git a/tests/baselines/reference/superCallOutsideConstructor.js b/tests/baselines/reference/superCallOutsideConstructor.js index 202ed531a10..e32bfc66050 100644 --- a/tests/baselines/reference/superCallOutsideConstructor.js +++ b/tests/baselines/reference/superCallOutsideConstructor.js @@ -37,14 +37,15 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this); - this.x = _super.call(this); + var _this = _super.call(this) || this; + _this.x = _this = _super.call(this) || this; var y = function () { - _super.call(this); + _this = _super.call(this) || this; }; var y2 = function () { - _super.call(this); + _this = _super.call(this) || this; }; + return _this; } return D; }(C)); diff --git a/tests/baselines/reference/superCallParameterContextualTyping1.js b/tests/baselines/reference/superCallParameterContextualTyping1.js index 5bfe3927a51..d8491b4ee83 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping1.js +++ b/tests/baselines/reference/superCallParameterContextualTyping1.js @@ -28,7 +28,7 @@ var B = (function (_super) { __extends(B, _super); // Ensure 'value' is of type 'number (and not '{}') by using its 'toExponential()' method. function B() { - _super.call(this, function (value) { return String(value.toExponential()); }); + return _super.call(this, function (value) { return String(value.toExponential()); }) || this; } return B; }(A)); diff --git a/tests/baselines/reference/superCallParameterContextualTyping2.js b/tests/baselines/reference/superCallParameterContextualTyping2.js index 539ecbed065..9868a7db124 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping2.js +++ b/tests/baselines/reference/superCallParameterContextualTyping2.js @@ -27,7 +27,7 @@ var C = (function (_super) { __extends(C, _super); // Ensure 'value' is not of type 'any' by invoking it with type arguments. function C() { - _super.call(this, function (value) { return String(value()); }); + return _super.call(this, function (value) { return String(value()); }) || this; } return C; }(A)); diff --git a/tests/baselines/reference/superCallParameterContextualTyping3.js b/tests/baselines/reference/superCallParameterContextualTyping3.js index d35a1707bb7..6a43d58c471 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping3.js +++ b/tests/baselines/reference/superCallParameterContextualTyping3.js @@ -47,20 +47,22 @@ var CBase = (function () { var C = (function (_super) { __extends(C, _super); function C() { + var _this = // Should be okay. // 'p' should have type 'string'. _super.call(this, { method: function (p) { p.length; } - }); + }) || this; // Should be okay. // 'p' should have type 'string'. - _super.prototype.foo.call(this, { + _super.prototype.foo.call(_this, { method: function (p) { p.length; } }); + return _this; } return C; }(CBase)); diff --git a/tests/baselines/reference/superCallWithMissingBaseClass.js b/tests/baselines/reference/superCallWithMissingBaseClass.js index 7758bcfd89d..16f11088640 100644 --- a/tests/baselines/reference/superCallWithMissingBaseClass.js +++ b/tests/baselines/reference/superCallWithMissingBaseClass.js @@ -18,7 +18,7 @@ var __extends = (this && this.__extends) || function (d, b) { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Foo.prototype.m1 = function () { return _super.prototype.m1.call(this); diff --git a/tests/baselines/reference/superCalls.js b/tests/baselines/reference/superCalls.js index ae8327ec200..99a3b78752c 100644 --- a/tests/baselines/reference/superCalls.js +++ b/tests/baselines/reference/superCalls.js @@ -47,11 +47,12 @@ var Derived = (function (_super) { __extends(Derived, _super); //super call in class constructor of derived type function Derived(q) { - _super.call(this, ''); - this.q = q; + var _this = _super.call(this, '') || this; + _this.q = q; //type of super call expression is void - var p = _super.call(this, ''); + var p = _this = _super.call(this, '') || this; var p = v(); + return _this; } return Derived; }(Base)); @@ -63,8 +64,10 @@ var OtherBase = (function () { var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { + var _this; var p = ''; - _super.call(this); + _this = _super.call(this) || this; + return _this; } return OtherDerived; }(OtherBase)); diff --git a/tests/baselines/reference/superCallsInConstructor.js b/tests/baselines/reference/superCallsInConstructor.js index 434f730c76b..48b79acadf4 100644 --- a/tests/baselines/reference/superCallsInConstructor.js +++ b/tests/baselines/reference/superCallsInConstructor.js @@ -41,15 +41,17 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { + var _this; with (new C()) { foo(); - _super.call(this); + _this = _super.call(this) || this; bar(); } try { } catch (e) { - _super.call(this); + _this = _super.call(this) || this; } + return _this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/superErrors.js b/tests/baselines/reference/superErrors.js index fd70114d0fd..19f0d74f677 100644 --- a/tests/baselines/reference/superErrors.js +++ b/tests/baselines/reference/superErrors.js @@ -76,8 +76,8 @@ var User = (function () { var RegisteredUser = (function (_super) { __extends(RegisteredUser, _super); function RegisteredUser() { - _super.call(this); - this.name = "Frank"; + var _this = _super.call(this) || this; + _this.name = "Frank"; // super call in an inner function in a constructor function inner() { _super.sayHello.call(this); @@ -92,6 +92,7 @@ var RegisteredUser = (function (_super) { var _this = this; return function () { return _super.; }; })(); + return _this; } RegisteredUser.prototype.sayHello = function () { // super call in a method diff --git a/tests/baselines/reference/superInCatchBlock1.js b/tests/baselines/reference/superInCatchBlock1.js index 9d5cb1affdc..e1fc0f97024 100644 --- a/tests/baselines/reference/superInCatchBlock1.js +++ b/tests/baselines/reference/superInCatchBlock1.js @@ -28,7 +28,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.m = function () { try { diff --git a/tests/baselines/reference/superInConstructorParam1.js b/tests/baselines/reference/superInConstructorParam1.js index 3c6eb0bdad2..8c99b649917 100644 --- a/tests/baselines/reference/superInConstructorParam1.js +++ b/tests/baselines/reference/superInConstructorParam1.js @@ -27,7 +27,9 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C(a) { - if (a === void 0) { a = _super.foo.call(this); } + if (a === void 0) { a = _super.foo.call(_this); } + var _this; + return _this; } return C; }(B)); diff --git a/tests/baselines/reference/superInLambdas.js b/tests/baselines/reference/superInLambdas.js index b0940b1d538..73ca53c3b5c 100644 --- a/tests/baselines/reference/superInLambdas.js +++ b/tests/baselines/reference/superInLambdas.js @@ -85,13 +85,13 @@ var User = (function () { var RegisteredUser = (function (_super) { __extends(RegisteredUser, _super); function RegisteredUser() { - var _this = this; - _super.call(this); - this.name = "Frank"; + var _this = _super.call(this) || this; + _this.name = "Frank"; // super call in a constructor - _super.prototype.sayHello.call(this); + _super.prototype.sayHello.call(_this); // super call in a lambda in a constructor var x = function () { return _super.prototype.sayHello.call(_this); }; + return _this; } RegisteredUser.prototype.sayHello = function () { var _this = this; @@ -105,11 +105,11 @@ var RegisteredUser = (function (_super) { var RegisteredUser2 = (function (_super) { __extends(RegisteredUser2, _super); function RegisteredUser2() { - var _this = this; - _super.call(this); - this.name = "Joe"; + var _this = _super.call(this) || this; + _this.name = "Joe"; // super call in a nested lambda in a constructor var x = function () { return function () { return function () { return _super.prototype.sayHello.call(_this); }; }; }; + return _this; } RegisteredUser2.prototype.sayHello = function () { var _this = this; @@ -121,11 +121,11 @@ var RegisteredUser2 = (function (_super) { var RegisteredUser3 = (function (_super) { __extends(RegisteredUser3, _super); function RegisteredUser3() { - var _this = this; - _super.call(this); - this.name = "Sam"; + var _this = _super.call(this) || this; + _this.name = "Sam"; // super property in a nested lambda in a constructor var superName = function () { return function () { return function () { return _super.prototype.name; }; }; }; + return _this; } RegisteredUser3.prototype.sayHello = function () { var _this = this; @@ -137,11 +137,11 @@ var RegisteredUser3 = (function (_super) { var RegisteredUser4 = (function (_super) { __extends(RegisteredUser4, _super); function RegisteredUser4() { - var _this = this; - _super.call(this); - this.name = "Mark"; + var _this = _super.call(this) || this; + _this.name = "Mark"; // super in a nested lambda in a constructor var x = function () { return function () { return _super.prototype.; }; }; + return _this; } RegisteredUser4.prototype.sayHello = function () { var _this = this; diff --git a/tests/baselines/reference/superInObjectLiterals_ES5.js b/tests/baselines/reference/superInObjectLiterals_ES5.js index 5d1fed24b4f..816277e4e9e 100644 --- a/tests/baselines/reference/superInObjectLiterals_ES5.js +++ b/tests/baselines/reference/superInObjectLiterals_ES5.js @@ -100,7 +100,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.f = function () { var _this = this; diff --git a/tests/baselines/reference/superNewCall1.js b/tests/baselines/reference/superNewCall1.js index 01ae169b598..30b07308bb2 100644 --- a/tests/baselines/reference/superNewCall1.js +++ b/tests/baselines/reference/superNewCall1.js @@ -27,7 +27,9 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { + var _this; new _super.prototype(function (value) { return String(value); }); + return _this; } return B; }(A)); diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index 0e1e8783448..7b5823e598b 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -61,7 +61,7 @@ var MyBase = (function () { var MyDerived = (function (_super) { __extends(MyDerived, _super); function MyDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } MyDerived.prototype.foo = function () { _super.prototype.m1.call(this, "hi"); // Should be allowed, method on base prototype diff --git a/tests/baselines/reference/superPropertyAccess1.js b/tests/baselines/reference/superPropertyAccess1.js index 4df9398024c..0b1e4fc280f 100644 --- a/tests/baselines/reference/superPropertyAccess1.js +++ b/tests/baselines/reference/superPropertyAccess1.js @@ -50,9 +50,10 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this); - _super.prototype.bar.call(this); + var _this = _super.call(this) || this; + _super.prototype.bar.call(_this); _super.prototype.x; // error + return _this; } D.prototype.foo = function () { _super.prototype.bar.call(this); diff --git a/tests/baselines/reference/superPropertyAccess2.js b/tests/baselines/reference/superPropertyAccess2.js index ec74a2ea069..7c72ad5d1bb 100644 --- a/tests/baselines/reference/superPropertyAccess2.js +++ b/tests/baselines/reference/superPropertyAccess2.js @@ -50,9 +50,10 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this); - _super.prototype.bar.call(this); // error + var _this = _super.call(this) || this; + _super.prototype.bar.call(_this); // error _super.prototype.x; // error + return _this; } D.foo = function () { _super.bar.call(this); // OK diff --git a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js index a91dfc76e3d..956bce4ef2e 100644 --- a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js +++ b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js @@ -29,7 +29,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } B.prototype.foo = function () { return 2; }; B.prototype.bar = function () { diff --git a/tests/baselines/reference/superPropertyAccessNoError.js b/tests/baselines/reference/superPropertyAccessNoError.js index df230ce3703..88a5da8b8fb 100644 --- a/tests/baselines/reference/superPropertyAccessNoError.js +++ b/tests/baselines/reference/superPropertyAccessNoError.js @@ -99,9 +99,10 @@ var SomeBaseClass = (function () { var SomeDerivedClass = (function (_super) { __extends(SomeDerivedClass, _super); function SomeDerivedClass() { - _super.call(this); - var x = _super.prototype.func.call(this); + var _this = _super.call(this) || this; + var x = _super.prototype.func.call(_this); var x; + return _this; } SomeDerivedClass.prototype.fn = function () { var _this = this; diff --git a/tests/baselines/reference/superPropertyAccess_ES5.js b/tests/baselines/reference/superPropertyAccess_ES5.js index 63f5f6f316a..45c32076be9 100644 --- a/tests/baselines/reference/superPropertyAccess_ES5.js +++ b/tests/baselines/reference/superPropertyAccess_ES5.js @@ -49,9 +49,10 @@ var MyBase = (function () { var MyDerived = (function (_super) { __extends(MyDerived, _super); function MyDerived() { - _super.call(this); - var f1 = _super.prototype.getValue.call(this); + var _this = _super.call(this) || this; + var f1 = _super.prototype.getValue.call(_this); var f2 = _super.prototype.value; + return _this; } return MyDerived; }(MyBase)); @@ -71,7 +72,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Object.defineProperty(B.prototype, "property", { set: function (value) { diff --git a/tests/baselines/reference/superSymbolIndexedAccess5.js b/tests/baselines/reference/superSymbolIndexedAccess5.js index 3acd26d2974..dd37deb5af3 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess5.js +++ b/tests/baselines/reference/superSymbolIndexedAccess5.js @@ -31,7 +31,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Bar.prototype[symbol] = function () { return _super.prototype[symbol].call(this); diff --git a/tests/baselines/reference/superSymbolIndexedAccess6.js b/tests/baselines/reference/superSymbolIndexedAccess6.js index 8b04075c411..8c8534b428a 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess6.js +++ b/tests/baselines/reference/superSymbolIndexedAccess6.js @@ -31,7 +31,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Bar[symbol] = function () { return _super[symbol].call(this); diff --git a/tests/baselines/reference/superWithGenericSpecialization.js b/tests/baselines/reference/superWithGenericSpecialization.js index a54ee1bbcbc..a0381d0b944 100644 --- a/tests/baselines/reference/superWithGenericSpecialization.js +++ b/tests/baselines/reference/superWithGenericSpecialization.js @@ -28,7 +28,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this); // uses the type parameter type of the base class, ie string + return _super.call(this) || this; } return D; }(C)); diff --git a/tests/baselines/reference/superWithGenerics.js b/tests/baselines/reference/superWithGenerics.js index b4fe56bee4c..803f229bd4b 100644 --- a/tests/baselines/reference/superWithGenerics.js +++ b/tests/baselines/reference/superWithGenerics.js @@ -20,7 +20,7 @@ var __extends = (this && this.__extends) || function (d, b) { var D = (function (_super) { __extends(D, _super); function D() { - _super.call(this); + return _super.call(this) || this; } return D; }(B)); diff --git a/tests/baselines/reference/superWithTypeArgument.js b/tests/baselines/reference/superWithTypeArgument.js index 766b5f7920e..a1c04975404 100644 --- a/tests/baselines/reference/superWithTypeArgument.js +++ b/tests/baselines/reference/superWithTypeArgument.js @@ -23,7 +23,9 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.prototype..call(this); + var _this; + _super.prototype..call(_this); + return _this; } return D; }(C)); diff --git a/tests/baselines/reference/superWithTypeArgument2.js b/tests/baselines/reference/superWithTypeArgument2.js index e0d2a40633f..42a0e46d4c0 100644 --- a/tests/baselines/reference/superWithTypeArgument2.js +++ b/tests/baselines/reference/superWithTypeArgument2.js @@ -23,7 +23,9 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D(x) { - _super.prototype..call(this, x); + var _this; + _super.prototype..call(_this, x); + return _this; } return D; }(C)); diff --git a/tests/baselines/reference/superWithTypeArgument3.js b/tests/baselines/reference/superWithTypeArgument3.js index 586dc595b39..803e5c264c2 100644 --- a/tests/baselines/reference/superWithTypeArgument3.js +++ b/tests/baselines/reference/superWithTypeArgument3.js @@ -28,7 +28,9 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.prototype..call(this); + var _this; + _super.prototype..call(_this); + return _this; } D.prototype.bar = function () { _super.prototype.bar.call(this, null); diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index db6db37ac8a..6815b71ce11 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -57,7 +57,7 @@ var F = (function () { var SuperObjectTest = (function (_super) { __extends(SuperObjectTest, _super); function SuperObjectTest() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } SuperObjectTest.prototype.testing = function () { var test = { diff --git a/tests/baselines/reference/switchStatements.js b/tests/baselines/reference/switchStatements.js index 093a7fb2f2c..2e1aecc7288 100644 --- a/tests/baselines/reference/switchStatements.js +++ b/tests/baselines/reference/switchStatements.js @@ -98,7 +98,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/systemModuleDeclarationMerging.js b/tests/baselines/reference/systemModuleDeclarationMerging.js index d5994bc9f22..4dac69c2641 100644 --- a/tests/baselines/reference/systemModuleDeclarationMerging.js +++ b/tests/baselines/reference/systemModuleDeclarationMerging.js @@ -14,7 +14,7 @@ System.register([], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; function F() { } - var F, C, C, E, E; + var C, E; exports_1("F", F); return { setters: [], diff --git a/tests/baselines/reference/systemModuleWithSuperClass.js b/tests/baselines/reference/systemModuleWithSuperClass.js index 31cd542d2e2..78c09355fa0 100644 --- a/tests/baselines/reference/systemModuleWithSuperClass.js +++ b/tests/baselines/reference/systemModuleWithSuperClass.js @@ -49,7 +49,7 @@ System.register(["./foo"], function (exports_1, context_1) { Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Bar; }(foo_1.Foo)); diff --git a/tests/baselines/reference/targetTypeBaseCalls.js b/tests/baselines/reference/targetTypeBaseCalls.js index d028c04d711..cac93023a00 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.js +++ b/tests/baselines/reference/targetTypeBaseCalls.js @@ -35,7 +35,7 @@ new Foo(function (s) { s = 5; }); // error, if types are applied correctly var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.call(this, function (s) { s = 5; }); + return _super.call(this, function (s) { s = 5; }) || this; } return Bar; }(Foo)); // error, if types are applied correctly diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index 76eeef0139c..1fc1c734639 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -70,7 +70,7 @@ var ClassWithNoInitializer = (function (_super) { __extends(ClassWithNoInitializer, _super); //'this' in optional super call function ClassWithNoInitializer() { - _super.call(this, this); // Error + return _super.call(this, _this) || this; } return ClassWithNoInitializer; }(BaseErrClass)); @@ -78,8 +78,9 @@ var ClassWithInitializer = (function (_super) { __extends(ClassWithInitializer, _super); //'this' in required super call function ClassWithInitializer() { - _super.call(this, this); // Error - this.t = 4; + var _this = _super.call(this, _this) || this; + _this.t = 4; + return _this; } return ClassWithInitializer; }(BaseErrClass)); @@ -96,7 +97,7 @@ genericFunc(undefined); // Should be an error var ErrClass3 = (function (_super) { __extends(ErrClass3, _super); function ErrClass3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ErrClass3; }(this)); diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index 634b5ef0a20..f8cb6d695dc 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -71,7 +71,7 @@ var ClassWithNoInitializer = (function (_super) { __extends(ClassWithNoInitializer, _super); //'this' in optional super call function ClassWithNoInitializer() { - _super.call(this, this); // error: "super" has to be called before "this" accessing + return _super.call(this, _this) || this; } return ClassWithNoInitializer; }(BaseErrClass)); @@ -79,8 +79,9 @@ var ClassWithInitializer = (function (_super) { __extends(ClassWithInitializer, _super); //'this' in required super call function ClassWithInitializer() { - _super.call(this, this); // Error - this.t = 4; + var _this = _super.call(this, _this) || this; + _this.t = 4; + return _this; } return ClassWithInitializer; }(BaseErrClass)); @@ -97,7 +98,7 @@ genericFunc(undefined); // Should be an error var ErrClass3 = (function (_super) { __extends(ErrClass3, _super); function ErrClass3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return ErrClass3; }(this)); diff --git a/tests/baselines/reference/thisInSuperCall.js b/tests/baselines/reference/thisInSuperCall.js index 827d101c95a..2a4d15973ab 100644 --- a/tests/baselines/reference/thisInSuperCall.js +++ b/tests/baselines/reference/thisInSuperCall.js @@ -36,23 +36,25 @@ var Base = (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - _super.call(this, this); // error: "super" has to be called before "this" accessing + return _super.call(this, _this) || this; } return Foo; }(Base)); var Foo2 = (function (_super) { __extends(Foo2, _super); function Foo2() { - _super.call(this, this); // error - this.p = 0; + var _this = _super.call(this, _this) || this; + _this.p = 0; + return _this; } return Foo2; }(Base)); var Foo3 = (function (_super) { __extends(Foo3, _super); function Foo3(p) { - _super.call(this, this); // error - this.p = p; + var _this = _super.call(this, _this) || this; + _this.p = p; + return _this; } return Foo3; }(Base)); diff --git a/tests/baselines/reference/thisInSuperCall1.js b/tests/baselines/reference/thisInSuperCall1.js index a1cfc196ac6..e3eea1fb91d 100644 --- a/tests/baselines/reference/thisInSuperCall1.js +++ b/tests/baselines/reference/thisInSuperCall1.js @@ -24,8 +24,9 @@ var Base = (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo(x) { - _super.call(this, this); - this.x = x; + var _this = _super.call(this, _this) || this; + _this.x = x; + return _this; } return Foo; }(Base)); diff --git a/tests/baselines/reference/thisInSuperCall2.js b/tests/baselines/reference/thisInSuperCall2.js index fdffdd27d6d..eabfa9d562c 100644 --- a/tests/baselines/reference/thisInSuperCall2.js +++ b/tests/baselines/reference/thisInSuperCall2.js @@ -33,15 +33,16 @@ var Base = (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - _super.call(this, this); // error: "super" has to be called before "this" accessing + return _super.call(this, _this) || this; } return Foo; }(Base)); var Foo2 = (function (_super) { __extends(Foo2, _super); function Foo2() { - _super.call(this, this); // error - this.x = 0; + var _this = _super.call(this, _this) || this; + _this.x = 0; + return _this; } return Foo2; }(Base)); diff --git a/tests/baselines/reference/thisInSuperCall3.js b/tests/baselines/reference/thisInSuperCall3.js index 09ad6b705a9..6a72f17248f 100644 --- a/tests/baselines/reference/thisInSuperCall3.js +++ b/tests/baselines/reference/thisInSuperCall3.js @@ -26,8 +26,9 @@ var Base = (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - _super.call(this, this); - this.x = 0; + var _this = _super.call(this, _this) || this; + _this.x = 0; + return _this; } return Foo; }(Base)); diff --git a/tests/baselines/reference/thisTypeInFunctions.js b/tests/baselines/reference/thisTypeInFunctions.js index cfe1706ae99..6400f410a09 100644 --- a/tests/baselines/reference/thisTypeInFunctions.js +++ b/tests/baselines/reference/thisTypeInFunctions.js @@ -227,7 +227,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D; }(C)); @@ -336,7 +336,7 @@ var Base1 = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived1; }(Base1)); @@ -350,7 +350,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.js b/tests/baselines/reference/thisTypeInFunctionsNegative.js index 4b40ca2e1e7..446bc15e6d9 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.js +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.js @@ -296,7 +296,7 @@ var Base1 = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived1; }(Base1)); @@ -310,7 +310,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/tsxDynamicTagName5.js b/tests/baselines/reference/tsxDynamicTagName5.js index a8d154998e1..d3bb404ceea 100644 --- a/tests/baselines/reference/tsxDynamicTagName5.js +++ b/tests/baselines/reference/tsxDynamicTagName5.js @@ -30,8 +30,9 @@ var React = require("react"); var Text = (function (_super) { __extends(Text, _super); function Text() { - _super.apply(this, arguments); - this._tagName = 'div'; + var _this = _super.apply(this, arguments) || this; + _this._tagName = 'div'; + return _this; } Text.prototype.render = function () { return (); diff --git a/tests/baselines/reference/tsxDynamicTagName7.js b/tests/baselines/reference/tsxDynamicTagName7.js index dbe171f9682..84debfd3e71 100644 --- a/tests/baselines/reference/tsxDynamicTagName7.js +++ b/tests/baselines/reference/tsxDynamicTagName7.js @@ -30,8 +30,9 @@ var React = require("react"); var Text = (function (_super) { __extends(Text, _super); function Text() { - _super.apply(this, arguments); - this._tagName = 'div'; + var _this = _super.apply(this, arguments) || this; + _this._tagName = 'div'; + return _this; } Text.prototype.render = function () { return ( // this should be an error diff --git a/tests/baselines/reference/tsxDynamicTagName8.js b/tests/baselines/reference/tsxDynamicTagName8.js index e6f63b6a9bf..6166b99f4ac 100644 --- a/tests/baselines/reference/tsxDynamicTagName8.js +++ b/tests/baselines/reference/tsxDynamicTagName8.js @@ -30,8 +30,9 @@ var React = require("react"); var Text = (function (_super) { __extends(Text, _super); function Text() { - _super.apply(this, arguments); - this._tagName = 'div'; + var _this = _super.apply(this, arguments) || this; + _this._tagName = 'div'; + return _this; } Text.prototype.render = function () { return ( Hello world ); diff --git a/tests/baselines/reference/tsxDynamicTagName9.js b/tests/baselines/reference/tsxDynamicTagName9.js index 589cc7cd226..928649264c8 100644 --- a/tests/baselines/reference/tsxDynamicTagName9.js +++ b/tests/baselines/reference/tsxDynamicTagName9.js @@ -30,8 +30,9 @@ var React = require("react"); var Text = (function (_super) { __extends(Text, _super); function Text() { - _super.apply(this, arguments); - this._tagName = 'div'; + var _this = _super.apply(this, arguments) || this; + _this._tagName = 'div'; + return _this; } Text.prototype.render = function () { return ( Hello world ); diff --git a/tests/baselines/reference/tsxEmit3.js b/tests/baselines/reference/tsxEmit3.js index 33e1975cdbc..bf368f9b262 100644 --- a/tests/baselines/reference/tsxEmit3.js +++ b/tests/baselines/reference/tsxEmit3.js @@ -62,7 +62,6 @@ var M; // Foo, ; })(S = M.S || (M.S = {})); })(M || (M = {})); -var M; (function (M) { // Emit M.Foo M.Foo, ; @@ -74,12 +73,10 @@ var M; S.Bar, ; })(S = M.S || (M.S = {})); })(M || (M = {})); -var M; (function (M) { // Emit M.S.Bar M.S.Bar, ; })(M || (M = {})); -var M; (function (M_1) { var M = 100; // Emit M_1.Foo diff --git a/tests/baselines/reference/tsxEmit3.js.map b/tests/baselines/reference/tsxEmit3.js.map index 051be56f256..6e12addfb6b 100644 --- a/tests/baselines/reference/tsxEmit3.js.map +++ b/tests/baselines/reference/tsxEmit3.js.map @@ -1,2 +1,2 @@ //// [file.jsx.map] -{"version":3,"file":"file.jsx","sourceRoot":"","sources":["file.tsx"],"names":[],"mappings":"AAMA,IAAO,CAAC,CAQP;AARD,WAAO,CAAC;IACP;QAAmB;QAAgB,CAAC;QAAC,UAAC;IAAD,CAAC,AAAtC,IAAsC;IAAzB,KAAG,MAAsB,CAAA;IACtC,IAAc,CAAC,CAKd;IALD,WAAc,CAAC;QACd;YAAA;YAAmB,CAAC;YAAD,UAAC;QAAD,CAAC,AAApB,IAAoB;QAAP,KAAG,MAAI,CAAA;QAEpB,WAAW;QACX,gBAAgB;IACjB,CAAC,EALa,CAAC,GAAD,GAAC,KAAD,GAAC,QAKd;AACF,CAAC,EARM,CAAC,KAAD,CAAC,QAQP;AAED,IAAO,CAAC,CAYP;AAZD,WAAO,CAAC;IACP,aAAa;IACb,EAAA,GAAG,EAAE,CAAC,EAAA,GAAG,GAAG,CAAC;IAEb,IAAc,CAAC,CAMd;IAND,WAAc,CAAC;QACd,aAAa;QACb,EAAA,GAAG,EAAE,CAAC,EAAA,GAAG,GAAG,CAAC;QAEb,aAAa;QACb,EAAA,GAAG,EAAE,CAAC,EAAA,GAAG,GAAG,CAAC;IACd,CAAC,EANa,CAAC,GAAD,GAAC,KAAD,GAAC,QAMd;AAEF,CAAC,EAZM,CAAC,KAAD,CAAC,QAYP;AAED,IAAO,CAAC,CAGP;AAHD,WAAO,CAAC;IACP,eAAe;IACf,EAAA,CAAC,CAAC,GAAG,EAAE,CAAC,EAAA,CAAC,CAAC,GAAG,GAAG,CAAC;AAClB,CAAC,EAHM,CAAC,KAAD,CAAC,QAGP;AAED,IAAO,CAAC,CAIP;AAJD,WAAO,GAAC;IACP,IAAI,CAAC,GAAG,GAAG,CAAC;IACZ,eAAe;IACf,IAAA,GAAG,EAAE,CAAC,IAAA,GAAG,GAAG,CAAC;AACd,CAAC,EAJM,CAAC,KAAD,CAAC,QAIP"} \ No newline at end of file +{"version":3,"file":"file.jsx","sourceRoot":"","sources":["file.tsx"],"names":[],"mappings":"AAMA,IAAO,CAAC,CAQP;AARD,WAAO,CAAC;IACP;QAAmB;QAAgB,CAAC;QAAC,UAAC;IAAD,CAAC,AAAtC,IAAsC;IAAzB,KAAG,MAAsB,CAAA;IACtC,IAAc,CAAC,CAKd;IALD,WAAc,CAAC;QACd;YAAA;YAAmB,CAAC;YAAD,UAAC;QAAD,CAAC,AAApB,IAAoB;QAAP,KAAG,MAAI,CAAA;QAEpB,WAAW;QACX,gBAAgB;IACjB,CAAC,EALa,CAAC,GAAD,GAAC,KAAD,GAAC,QAKd;AACF,CAAC,EARM,CAAC,KAAD,CAAC,QAQP;AAED,WAAO,CAAC;IACP,aAAa;IACb,EAAA,GAAG,EAAE,CAAC,EAAA,GAAG,GAAG,CAAC;IAEb,IAAc,CAAC,CAMd;IAND,WAAc,CAAC;QACd,aAAa;QACb,EAAA,GAAG,EAAE,CAAC,EAAA,GAAG,GAAG,CAAC;QAEb,aAAa;QACb,EAAA,GAAG,EAAE,CAAC,EAAA,GAAG,GAAG,CAAC;IACd,CAAC,EANa,CAAC,GAAD,GAAC,KAAD,GAAC,QAMd;AAEF,CAAC,EAZM,CAAC,KAAD,CAAC,QAYP;AAED,WAAO,CAAC;IACP,eAAe;IACf,EAAA,CAAC,CAAC,GAAG,EAAE,CAAC,EAAA,CAAC,CAAC,GAAG,GAAG,CAAC;AAClB,CAAC,EAHM,CAAC,KAAD,CAAC,QAGP;AAED,WAAO,GAAC;IACP,IAAI,CAAC,GAAG,GAAG,CAAC;IACZ,eAAe;IACf,IAAA,GAAG,EAAE,CAAC,IAAA,GAAG,GAAG,CAAC;AACd,CAAC,EAJM,CAAC,KAAD,CAAC,QAIP"} \ No newline at end of file diff --git a/tests/baselines/reference/tsxEmit3.sourcemap.txt b/tests/baselines/reference/tsxEmit3.sourcemap.txt index 02fec081e4c..d2ccdb264ba 100644 --- a/tests/baselines/reference/tsxEmit3.sourcemap.txt +++ b/tests/baselines/reference/tsxEmit3.sourcemap.txt @@ -288,46 +288,19 @@ sourceFile:file.tsx 6 >Emitted(20, 11) Source(7, 9) + SourceIndex(0) 7 >Emitted(20, 19) Source(15, 2) + SourceIndex(0) --- ->>>var M; +>>>(function (M) { 1 > -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^-> +2 >^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^-> 1 > > > 2 >module -3 > M -4 > { - > // Emit M.Foo - > Foo, ; - > - > export module S { - > // Emit M.Foo - > Foo, ; - > - > // Emit S.Bar - > Bar, ; - > } - > - > } -1 >Emitted(21, 1) Source(17, 1) + SourceIndex(0) -2 >Emitted(21, 5) Source(17, 8) + SourceIndex(0) -3 >Emitted(21, 6) Source(17, 9) + SourceIndex(0) -4 >Emitted(21, 7) Source(29, 2) + SourceIndex(0) ---- ->>>(function (M) { -1-> -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^-> -1-> -2 >module 3 > M -1->Emitted(22, 1) Source(17, 1) + SourceIndex(0) -2 >Emitted(22, 12) Source(17, 8) + SourceIndex(0) -3 >Emitted(22, 13) Source(17, 9) + SourceIndex(0) +1 >Emitted(21, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(21, 12) Source(17, 8) + SourceIndex(0) +3 >Emitted(21, 13) Source(17, 9) + SourceIndex(0) --- >>> // Emit M.Foo 1->^^^^ @@ -336,8 +309,8 @@ sourceFile:file.tsx 1-> { > 2 > // Emit M.Foo -1->Emitted(23, 5) Source(18, 2) + SourceIndex(0) -2 >Emitted(23, 18) Source(18, 15) + SourceIndex(0) +1->Emitted(22, 5) Source(18, 2) + SourceIndex(0) +2 >Emitted(22, 18) Source(18, 15) + SourceIndex(0) --- >>> M.Foo, ; 1->^^^^ @@ -359,15 +332,15 @@ sourceFile:file.tsx 7 > Foo 8 > /> 9 > ; -1->Emitted(24, 5) Source(19, 2) + SourceIndex(0) -2 >Emitted(24, 7) Source(19, 2) + SourceIndex(0) -3 >Emitted(24, 10) Source(19, 5) + SourceIndex(0) -4 >Emitted(24, 12) Source(19, 7) + SourceIndex(0) -5 >Emitted(24, 13) Source(19, 8) + SourceIndex(0) -6 >Emitted(24, 15) Source(19, 8) + SourceIndex(0) -7 >Emitted(24, 18) Source(19, 11) + SourceIndex(0) -8 >Emitted(24, 21) Source(19, 14) + SourceIndex(0) -9 >Emitted(24, 22) Source(19, 15) + SourceIndex(0) +1->Emitted(23, 5) Source(19, 2) + SourceIndex(0) +2 >Emitted(23, 7) Source(19, 2) + SourceIndex(0) +3 >Emitted(23, 10) Source(19, 5) + SourceIndex(0) +4 >Emitted(23, 12) Source(19, 7) + SourceIndex(0) +5 >Emitted(23, 13) Source(19, 8) + SourceIndex(0) +6 >Emitted(23, 15) Source(19, 8) + SourceIndex(0) +7 >Emitted(23, 18) Source(19, 11) + SourceIndex(0) +8 >Emitted(23, 21) Source(19, 14) + SourceIndex(0) +9 >Emitted(23, 22) Source(19, 15) + SourceIndex(0) --- >>> var S; 1 >^^^^ @@ -387,10 +360,10 @@ sourceFile:file.tsx > // Emit S.Bar > Bar, ; > } -1 >Emitted(25, 5) Source(21, 2) + SourceIndex(0) -2 >Emitted(25, 9) Source(21, 16) + SourceIndex(0) -3 >Emitted(25, 10) Source(21, 17) + SourceIndex(0) -4 >Emitted(25, 11) Source(27, 3) + SourceIndex(0) +1 >Emitted(24, 5) Source(21, 2) + SourceIndex(0) +2 >Emitted(24, 9) Source(21, 16) + SourceIndex(0) +3 >Emitted(24, 10) Source(21, 17) + SourceIndex(0) +4 >Emitted(24, 11) Source(27, 3) + SourceIndex(0) --- >>> (function (S) { 1->^^^^ @@ -400,9 +373,9 @@ sourceFile:file.tsx 1-> 2 > export module 3 > S -1->Emitted(26, 5) Source(21, 2) + SourceIndex(0) -2 >Emitted(26, 16) Source(21, 16) + SourceIndex(0) -3 >Emitted(26, 17) Source(21, 17) + SourceIndex(0) +1->Emitted(25, 5) Source(21, 2) + SourceIndex(0) +2 >Emitted(25, 16) Source(21, 16) + SourceIndex(0) +3 >Emitted(25, 17) Source(21, 17) + SourceIndex(0) --- >>> // Emit M.Foo 1->^^^^^^^^ @@ -411,8 +384,8 @@ sourceFile:file.tsx 1-> { > 2 > // Emit M.Foo -1->Emitted(27, 9) Source(22, 3) + SourceIndex(0) -2 >Emitted(27, 22) Source(22, 16) + SourceIndex(0) +1->Emitted(26, 9) Source(22, 3) + SourceIndex(0) +2 >Emitted(26, 22) Source(22, 16) + SourceIndex(0) --- >>> M.Foo, ; 1->^^^^^^^^ @@ -434,15 +407,15 @@ sourceFile:file.tsx 7 > Foo 8 > /> 9 > ; -1->Emitted(28, 9) Source(23, 3) + SourceIndex(0) -2 >Emitted(28, 11) Source(23, 3) + SourceIndex(0) -3 >Emitted(28, 14) Source(23, 6) + SourceIndex(0) -4 >Emitted(28, 16) Source(23, 8) + SourceIndex(0) -5 >Emitted(28, 17) Source(23, 9) + SourceIndex(0) -6 >Emitted(28, 19) Source(23, 9) + SourceIndex(0) -7 >Emitted(28, 22) Source(23, 12) + SourceIndex(0) -8 >Emitted(28, 25) Source(23, 15) + SourceIndex(0) -9 >Emitted(28, 26) Source(23, 16) + SourceIndex(0) +1->Emitted(27, 9) Source(23, 3) + SourceIndex(0) +2 >Emitted(27, 11) Source(23, 3) + SourceIndex(0) +3 >Emitted(27, 14) Source(23, 6) + SourceIndex(0) +4 >Emitted(27, 16) Source(23, 8) + SourceIndex(0) +5 >Emitted(27, 17) Source(23, 9) + SourceIndex(0) +6 >Emitted(27, 19) Source(23, 9) + SourceIndex(0) +7 >Emitted(27, 22) Source(23, 12) + SourceIndex(0) +8 >Emitted(27, 25) Source(23, 15) + SourceIndex(0) +9 >Emitted(27, 26) Source(23, 16) + SourceIndex(0) --- >>> // Emit S.Bar 1 >^^^^^^^^ @@ -452,8 +425,8 @@ sourceFile:file.tsx > > 2 > // Emit S.Bar -1 >Emitted(29, 9) Source(25, 3) + SourceIndex(0) -2 >Emitted(29, 22) Source(25, 16) + SourceIndex(0) +1 >Emitted(28, 9) Source(25, 3) + SourceIndex(0) +2 >Emitted(28, 22) Source(25, 16) + SourceIndex(0) --- >>> S.Bar, ; 1->^^^^^^^^ @@ -476,15 +449,15 @@ sourceFile:file.tsx 7 > Bar 8 > /> 9 > ; -1->Emitted(30, 9) Source(26, 3) + SourceIndex(0) -2 >Emitted(30, 11) Source(26, 3) + SourceIndex(0) -3 >Emitted(30, 14) Source(26, 6) + SourceIndex(0) -4 >Emitted(30, 16) Source(26, 8) + SourceIndex(0) -5 >Emitted(30, 17) Source(26, 9) + SourceIndex(0) -6 >Emitted(30, 19) Source(26, 9) + SourceIndex(0) -7 >Emitted(30, 22) Source(26, 12) + SourceIndex(0) -8 >Emitted(30, 25) Source(26, 15) + SourceIndex(0) -9 >Emitted(30, 26) Source(26, 16) + SourceIndex(0) +1->Emitted(29, 9) Source(26, 3) + SourceIndex(0) +2 >Emitted(29, 11) Source(26, 3) + SourceIndex(0) +3 >Emitted(29, 14) Source(26, 6) + SourceIndex(0) +4 >Emitted(29, 16) Source(26, 8) + SourceIndex(0) +5 >Emitted(29, 17) Source(26, 9) + SourceIndex(0) +6 >Emitted(29, 19) Source(26, 9) + SourceIndex(0) +7 >Emitted(29, 22) Source(26, 12) + SourceIndex(0) +8 >Emitted(29, 25) Source(26, 15) + SourceIndex(0) +9 >Emitted(29, 26) Source(26, 16) + SourceIndex(0) --- >>> })(S = M.S || (M.S = {})); 1->^^^^ @@ -512,15 +485,15 @@ sourceFile:file.tsx > // Emit S.Bar > Bar, ; > } -1->Emitted(31, 5) Source(27, 2) + SourceIndex(0) -2 >Emitted(31, 6) Source(27, 3) + SourceIndex(0) -3 >Emitted(31, 8) Source(21, 16) + SourceIndex(0) -4 >Emitted(31, 9) Source(21, 17) + SourceIndex(0) -5 >Emitted(31, 12) Source(21, 16) + SourceIndex(0) -6 >Emitted(31, 15) Source(21, 17) + SourceIndex(0) -7 >Emitted(31, 20) Source(21, 16) + SourceIndex(0) -8 >Emitted(31, 23) Source(21, 17) + SourceIndex(0) -9 >Emitted(31, 31) Source(27, 3) + SourceIndex(0) +1->Emitted(30, 5) Source(27, 2) + SourceIndex(0) +2 >Emitted(30, 6) Source(27, 3) + SourceIndex(0) +3 >Emitted(30, 8) Source(21, 16) + SourceIndex(0) +4 >Emitted(30, 9) Source(21, 17) + SourceIndex(0) +5 >Emitted(30, 12) Source(21, 16) + SourceIndex(0) +6 >Emitted(30, 15) Source(21, 17) + SourceIndex(0) +7 >Emitted(30, 20) Source(21, 16) + SourceIndex(0) +8 >Emitted(30, 23) Source(21, 17) + SourceIndex(0) +9 >Emitted(30, 31) Source(27, 3) + SourceIndex(0) --- >>>})(M || (M = {})); 1 > @@ -551,45 +524,27 @@ sourceFile:file.tsx > } > > } -1 >Emitted(32, 1) Source(29, 1) + SourceIndex(0) -2 >Emitted(32, 2) Source(29, 2) + SourceIndex(0) -3 >Emitted(32, 4) Source(17, 8) + SourceIndex(0) -4 >Emitted(32, 5) Source(17, 9) + SourceIndex(0) -5 >Emitted(32, 10) Source(17, 8) + SourceIndex(0) -6 >Emitted(32, 11) Source(17, 9) + SourceIndex(0) -7 >Emitted(32, 19) Source(29, 2) + SourceIndex(0) +1 >Emitted(31, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(31, 2) Source(29, 2) + SourceIndex(0) +3 >Emitted(31, 4) Source(17, 8) + SourceIndex(0) +4 >Emitted(31, 5) Source(17, 9) + SourceIndex(0) +5 >Emitted(31, 10) Source(17, 8) + SourceIndex(0) +6 >Emitted(31, 11) Source(17, 9) + SourceIndex(0) +7 >Emitted(31, 19) Source(29, 2) + SourceIndex(0) --- ->>>var M; +>>>(function (M) { 1 > -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^-> +2 >^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^-> 1 > > > 2 >module -3 > M -4 > { - > // Emit M.S.Bar - > S.Bar, ; - > } -1 >Emitted(33, 1) Source(31, 1) + SourceIndex(0) -2 >Emitted(33, 5) Source(31, 8) + SourceIndex(0) -3 >Emitted(33, 6) Source(31, 9) + SourceIndex(0) -4 >Emitted(33, 7) Source(34, 2) + SourceIndex(0) ---- ->>>(function (M) { -1-> -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^-> -1-> -2 >module 3 > M -1->Emitted(34, 1) Source(31, 1) + SourceIndex(0) -2 >Emitted(34, 12) Source(31, 8) + SourceIndex(0) -3 >Emitted(34, 13) Source(31, 9) + SourceIndex(0) +1 >Emitted(32, 1) Source(31, 1) + SourceIndex(0) +2 >Emitted(32, 12) Source(31, 8) + SourceIndex(0) +3 >Emitted(32, 13) Source(31, 9) + SourceIndex(0) --- >>> // Emit M.S.Bar 1->^^^^ @@ -598,8 +553,8 @@ sourceFile:file.tsx 1-> { > 2 > // Emit M.S.Bar -1->Emitted(35, 5) Source(32, 2) + SourceIndex(0) -2 >Emitted(35, 20) Source(32, 17) + SourceIndex(0) +1->Emitted(33, 5) Source(32, 2) + SourceIndex(0) +2 >Emitted(33, 20) Source(32, 17) + SourceIndex(0) --- >>> M.S.Bar, ; 1->^^^^ @@ -629,19 +584,19 @@ sourceFile:file.tsx 11> Bar 12> /> 13> ; -1->Emitted(36, 5) Source(33, 2) + SourceIndex(0) -2 >Emitted(36, 7) Source(33, 2) + SourceIndex(0) -3 >Emitted(36, 8) Source(33, 3) + SourceIndex(0) -4 >Emitted(36, 9) Source(33, 4) + SourceIndex(0) -5 >Emitted(36, 12) Source(33, 7) + SourceIndex(0) -6 >Emitted(36, 14) Source(33, 9) + SourceIndex(0) -7 >Emitted(36, 15) Source(33, 10) + SourceIndex(0) -8 >Emitted(36, 17) Source(33, 10) + SourceIndex(0) -9 >Emitted(36, 18) Source(33, 11) + SourceIndex(0) -10>Emitted(36, 19) Source(33, 12) + SourceIndex(0) -11>Emitted(36, 22) Source(33, 15) + SourceIndex(0) -12>Emitted(36, 25) Source(33, 18) + SourceIndex(0) -13>Emitted(36, 26) Source(33, 19) + SourceIndex(0) +1->Emitted(34, 5) Source(33, 2) + SourceIndex(0) +2 >Emitted(34, 7) Source(33, 2) + SourceIndex(0) +3 >Emitted(34, 8) Source(33, 3) + SourceIndex(0) +4 >Emitted(34, 9) Source(33, 4) + SourceIndex(0) +5 >Emitted(34, 12) Source(33, 7) + SourceIndex(0) +6 >Emitted(34, 14) Source(33, 9) + SourceIndex(0) +7 >Emitted(34, 15) Source(33, 10) + SourceIndex(0) +8 >Emitted(34, 17) Source(33, 10) + SourceIndex(0) +9 >Emitted(34, 18) Source(33, 11) + SourceIndex(0) +10>Emitted(34, 19) Source(33, 12) + SourceIndex(0) +11>Emitted(34, 22) Source(33, 15) + SourceIndex(0) +12>Emitted(34, 25) Source(33, 18) + SourceIndex(0) +13>Emitted(34, 26) Source(33, 19) + SourceIndex(0) --- >>>})(M || (M = {})); 1 > @@ -662,46 +617,27 @@ sourceFile:file.tsx > // Emit M.S.Bar > S.Bar, ; > } -1 >Emitted(37, 1) Source(34, 1) + SourceIndex(0) -2 >Emitted(37, 2) Source(34, 2) + SourceIndex(0) -3 >Emitted(37, 4) Source(31, 8) + SourceIndex(0) -4 >Emitted(37, 5) Source(31, 9) + SourceIndex(0) -5 >Emitted(37, 10) Source(31, 8) + SourceIndex(0) -6 >Emitted(37, 11) Source(31, 9) + SourceIndex(0) -7 >Emitted(37, 19) Source(34, 2) + SourceIndex(0) +1 >Emitted(35, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(35, 2) Source(34, 2) + SourceIndex(0) +3 >Emitted(35, 4) Source(31, 8) + SourceIndex(0) +4 >Emitted(35, 5) Source(31, 9) + SourceIndex(0) +5 >Emitted(35, 10) Source(31, 8) + SourceIndex(0) +6 >Emitted(35, 11) Source(31, 9) + SourceIndex(0) +7 >Emitted(35, 19) Source(34, 2) + SourceIndex(0) --- ->>>var M; +>>>(function (M_1) { 1 > -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^-> +2 >^^^^^^^^^^^ +3 > ^^^ +4 > ^^^-> 1 > > > 2 >module -3 > M -4 > { - > var M = 100; - > // Emit M_1.Foo - > Foo, ; - > } -1 >Emitted(38, 1) Source(36, 1) + SourceIndex(0) -2 >Emitted(38, 5) Source(36, 8) + SourceIndex(0) -3 >Emitted(38, 6) Source(36, 9) + SourceIndex(0) -4 >Emitted(38, 7) Source(40, 2) + SourceIndex(0) ---- ->>>(function (M_1) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^ -4 > ^^^-> -1-> -2 >module 3 > M -1->Emitted(39, 1) Source(36, 1) + SourceIndex(0) -2 >Emitted(39, 12) Source(36, 8) + SourceIndex(0) -3 >Emitted(39, 15) Source(36, 9) + SourceIndex(0) +1 >Emitted(36, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(36, 12) Source(36, 8) + SourceIndex(0) +3 >Emitted(36, 15) Source(36, 9) + SourceIndex(0) --- >>> var M = 100; 1->^^^^ @@ -718,12 +654,12 @@ sourceFile:file.tsx 4 > = 5 > 100 6 > ; -1->Emitted(40, 5) Source(37, 2) + SourceIndex(0) -2 >Emitted(40, 9) Source(37, 6) + SourceIndex(0) -3 >Emitted(40, 10) Source(37, 7) + SourceIndex(0) -4 >Emitted(40, 13) Source(37, 10) + SourceIndex(0) -5 >Emitted(40, 16) Source(37, 13) + SourceIndex(0) -6 >Emitted(40, 17) Source(37, 14) + SourceIndex(0) +1->Emitted(37, 5) Source(37, 2) + SourceIndex(0) +2 >Emitted(37, 9) Source(37, 6) + SourceIndex(0) +3 >Emitted(37, 10) Source(37, 7) + SourceIndex(0) +4 >Emitted(37, 13) Source(37, 10) + SourceIndex(0) +5 >Emitted(37, 16) Source(37, 13) + SourceIndex(0) +6 >Emitted(37, 17) Source(37, 14) + SourceIndex(0) --- >>> // Emit M_1.Foo 1->^^^^ @@ -732,8 +668,8 @@ sourceFile:file.tsx 1-> > 2 > // Emit M_1.Foo -1->Emitted(41, 5) Source(38, 2) + SourceIndex(0) -2 >Emitted(41, 20) Source(38, 17) + SourceIndex(0) +1->Emitted(38, 5) Source(38, 2) + SourceIndex(0) +2 >Emitted(38, 20) Source(38, 17) + SourceIndex(0) --- >>> M_1.Foo, ; 1->^^^^ @@ -755,15 +691,15 @@ sourceFile:file.tsx 7 > Foo 8 > /> 9 > ; -1->Emitted(42, 5) Source(39, 2) + SourceIndex(0) -2 >Emitted(42, 9) Source(39, 2) + SourceIndex(0) -3 >Emitted(42, 12) Source(39, 5) + SourceIndex(0) -4 >Emitted(42, 14) Source(39, 7) + SourceIndex(0) -5 >Emitted(42, 15) Source(39, 8) + SourceIndex(0) -6 >Emitted(42, 19) Source(39, 8) + SourceIndex(0) -7 >Emitted(42, 22) Source(39, 11) + SourceIndex(0) -8 >Emitted(42, 25) Source(39, 14) + SourceIndex(0) -9 >Emitted(42, 26) Source(39, 15) + SourceIndex(0) +1->Emitted(39, 5) Source(39, 2) + SourceIndex(0) +2 >Emitted(39, 9) Source(39, 2) + SourceIndex(0) +3 >Emitted(39, 12) Source(39, 5) + SourceIndex(0) +4 >Emitted(39, 14) Source(39, 7) + SourceIndex(0) +5 >Emitted(39, 15) Source(39, 8) + SourceIndex(0) +6 >Emitted(39, 19) Source(39, 8) + SourceIndex(0) +7 >Emitted(39, 22) Source(39, 11) + SourceIndex(0) +8 >Emitted(39, 25) Source(39, 14) + SourceIndex(0) +9 >Emitted(39, 26) Source(39, 15) + SourceIndex(0) --- >>>})(M || (M = {})); 1 > @@ -786,12 +722,12 @@ sourceFile:file.tsx > // Emit M_1.Foo > Foo, ; > } -1 >Emitted(43, 1) Source(40, 1) + SourceIndex(0) -2 >Emitted(43, 2) Source(40, 2) + SourceIndex(0) -3 >Emitted(43, 4) Source(36, 8) + SourceIndex(0) -4 >Emitted(43, 5) Source(36, 9) + SourceIndex(0) -5 >Emitted(43, 10) Source(36, 8) + SourceIndex(0) -6 >Emitted(43, 11) Source(36, 9) + SourceIndex(0) -7 >Emitted(43, 19) Source(40, 2) + SourceIndex(0) +1 >Emitted(40, 1) Source(40, 1) + SourceIndex(0) +2 >Emitted(40, 2) Source(40, 2) + SourceIndex(0) +3 >Emitted(40, 4) Source(36, 8) + SourceIndex(0) +4 >Emitted(40, 5) Source(36, 9) + SourceIndex(0) +5 >Emitted(40, 10) Source(36, 8) + SourceIndex(0) +6 >Emitted(40, 11) Source(36, 9) + SourceIndex(0) +7 >Emitted(40, 19) Source(40, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=file.jsx.map \ No newline at end of file diff --git a/tests/baselines/reference/tsxExternalModuleEmit1.js b/tests/baselines/reference/tsxExternalModuleEmit1.js index 0d4e58d7008..58e7f1c8d85 100644 --- a/tests/baselines/reference/tsxExternalModuleEmit1.js +++ b/tests/baselines/reference/tsxExternalModuleEmit1.js @@ -42,7 +42,7 @@ var React = require("react"); var Button = (function (_super) { __extends(Button, _super); function Button() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Button.prototype.render = function () { return ; @@ -63,7 +63,7 @@ var button_1 = require("./button"); var App = (function (_super) { __extends(App, _super); function App() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } App.prototype.render = function () { return ; diff --git a/tests/baselines/reference/tsxPreserveEmit1.js b/tests/baselines/reference/tsxPreserveEmit1.js index b9a7d369fc0..feb314ee2e6 100644 --- a/tests/baselines/reference/tsxPreserveEmit1.js +++ b/tests/baselines/reference/tsxPreserveEmit1.js @@ -41,7 +41,6 @@ define(["require", "exports", "react", "react-router"], function (require, expor var M; (function (M) { })(M || (M = {})); - var M; (function (M) { // Should emit 'M.X' in both opening and closing tags var y = ; diff --git a/tests/baselines/reference/tsxReactEmit6.js b/tests/baselines/reference/tsxReactEmit6.js index a85c6baa687..85aa8c123c9 100644 --- a/tests/baselines/reference/tsxReactEmit6.js +++ b/tests/baselines/reference/tsxReactEmit6.js @@ -39,7 +39,6 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { var M; (function (M) { })(M || (M = {})); -var M; (function (M) { // Should emit M.React.createElement // and M.React.__spread diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.js b/tests/baselines/reference/tsxStatelessFunctionComponents2.js index b93832567d5..88d91723501 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.js +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.js @@ -52,7 +52,7 @@ function Greet(x) { var BigGreeter = (function (_super) { __extends(BigGreeter, _super); function BigGreeter() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } BigGreeter.prototype.render = function () { return
; diff --git a/tests/baselines/reference/tsxUnionTypeComponent1.js b/tests/baselines/reference/tsxUnionTypeComponent1.js index 444542068be..3520b5af372 100644 --- a/tests/baselines/reference/tsxUnionTypeComponent1.js +++ b/tests/baselines/reference/tsxUnionTypeComponent1.js @@ -35,7 +35,7 @@ var React = require("react"); var MyComponent = (function (_super) { __extends(MyComponent, _super); function MyComponent() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } MyComponent.prototype.render = function () { var AnyComponent = this.props.AnyComponent; @@ -49,7 +49,7 @@ React.createElement(MyComponent, { AnyComponent: function () { return React.crea var MyButtonComponent = (function (_super) { __extends(MyButtonComponent, _super); function MyButtonComponent() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return MyButtonComponent; }(React.Component)); diff --git a/tests/baselines/reference/typeAssertions.js b/tests/baselines/reference/typeAssertions.js index 1d33fa927a7..a57fb222a77 100644 --- a/tests/baselines/reference/typeAssertions.js +++ b/tests/baselines/reference/typeAssertions.js @@ -74,7 +74,7 @@ var SomeBase = (function () { var SomeDerived = (function (_super) { __extends(SomeDerived, _super); function SomeDerived() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return SomeDerived; }(SomeBase)); diff --git a/tests/baselines/reference/typeGuardFunction.js b/tests/baselines/reference/typeGuardFunction.js index fcd6435ca1d..b88d1038969 100644 --- a/tests/baselines/reference/typeGuardFunction.js +++ b/tests/baselines/reference/typeGuardFunction.js @@ -102,7 +102,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/typeGuardFunctionErrors.js b/tests/baselines/reference/typeGuardFunctionErrors.js index f3ff5ffab4a..6f0880ad7f5 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.js +++ b/tests/baselines/reference/typeGuardFunctionErrors.js @@ -164,7 +164,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/typeGuardFunctionGenerics.js b/tests/baselines/reference/typeGuardFunctionGenerics.js index 2b5bd5e8265..703c809274f 100644 --- a/tests/baselines/reference/typeGuardFunctionGenerics.js +++ b/tests/baselines/reference/typeGuardFunctionGenerics.js @@ -52,7 +52,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThis.js b/tests/baselines/reference/typeGuardFunctionOfFormThis.js index ad85f679e0a..c052ea7d72b 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThis.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThis.js @@ -161,7 +161,7 @@ var RoyalGuard = (function () { var LeadGuard = (function (_super) { __extends(LeadGuard, _super); function LeadGuard() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } LeadGuard.prototype.lead = function () { }; ; @@ -170,7 +170,7 @@ var LeadGuard = (function (_super) { var FollowerGuard = (function (_super) { __extends(FollowerGuard, _super); function FollowerGuard() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } FollowerGuard.prototype.follow = function () { }; ; @@ -224,7 +224,7 @@ var ArrowGuard = (function () { var ArrowElite = (function (_super) { __extends(ArrowElite, _super); function ArrowElite() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ArrowElite.prototype.defend = function () { }; return ArrowElite; @@ -232,7 +232,7 @@ var ArrowElite = (function (_super) { var ArrowMedic = (function (_super) { __extends(ArrowMedic, _super); function ArrowMedic() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ArrowMedic.prototype.heal = function () { }; return ArrowMedic; @@ -266,7 +266,7 @@ var MimicGuard = (function () { var MimicLeader = (function (_super) { __extends(MimicLeader, _super); function MimicLeader() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } MimicLeader.prototype.lead = function () { }; return MimicLeader; @@ -274,7 +274,7 @@ var MimicLeader = (function (_super) { var MimicFollower = (function (_super) { __extends(MimicFollower, _super); function MimicFollower() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } MimicFollower.prototype.follow = function () { }; return MimicFollower; diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js index 73622bf60cc..a85a207a665 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js @@ -79,7 +79,7 @@ var RoyalGuard = (function () { var LeadGuard = (function (_super) { __extends(LeadGuard, _super); function LeadGuard() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } LeadGuard.prototype.lead = function () { }; ; @@ -88,7 +88,7 @@ var LeadGuard = (function (_super) { var FollowerGuard = (function (_super) { __extends(FollowerGuard, _super); function FollowerGuard() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } FollowerGuard.prototype.follow = function () { }; ; diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.js b/tests/baselines/reference/typeGuardOfFormInstanceOf.js index a6881cf3cea..a181a446a81 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.js +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.js @@ -91,7 +91,7 @@ var C2 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1; }(C1)); diff --git a/tests/baselines/reference/typeGuardOfFormIsType.js b/tests/baselines/reference/typeGuardOfFormIsType.js index 3f55b9d41ea..14e9259a9e7 100644 --- a/tests/baselines/reference/typeGuardOfFormIsType.js +++ b/tests/baselines/reference/typeGuardOfFormIsType.js @@ -56,7 +56,7 @@ var C2 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1; }(C1)); diff --git a/tests/baselines/reference/typeGuardOfFormThisMember.js b/tests/baselines/reference/typeGuardOfFormThisMember.js index 9d71613ed8f..52097af34f7 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMember.js +++ b/tests/baselines/reference/typeGuardOfFormThisMember.js @@ -118,8 +118,9 @@ var Test; var File = (function (_super) { __extends(File, _super); function File(path, content) { - _super.call(this, path); - this.content = content; + var _this = _super.call(this, path) || this; + _this.content = content; + return _this; } return File; }(FileSystemObject)); @@ -127,7 +128,7 @@ var Test; var Directory = (function (_super) { __extends(Directory, _super); function Directory() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Directory; }(FileSystemObject)); diff --git a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js index 5991fdd3169..c65445a3a5a 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js +++ b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js @@ -68,8 +68,9 @@ var Test; var File = (function (_super) { __extends(File, _super); function File(path, content) { - _super.call(this, path); - this.content = content; + var _this = _super.call(this, path) || this; + _this.content = content; + return _this; } return File; }(FileSystemObject)); @@ -77,7 +78,7 @@ var Test; var Directory = (function (_super) { __extends(Directory, _super); function Directory() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Directory; }(FileSystemObject)); diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index 57ba67752e2..2cae93924bc 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -65,7 +65,7 @@ var Animal = (function () { var Giraffe = (function (_super) { __extends(Giraffe, _super); function Giraffe() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Giraffe; }(Animal)); diff --git a/tests/baselines/reference/typeOfEnumAndVarRedeclarations.js b/tests/baselines/reference/typeOfEnumAndVarRedeclarations.js index 391c9c1679a..b803071d27f 100644 --- a/tests/baselines/reference/typeOfEnumAndVarRedeclarations.js +++ b/tests/baselines/reference/typeOfEnumAndVarRedeclarations.js @@ -15,7 +15,6 @@ var E; (function (E) { E[E["a"] = 0] = "a"; })(E || (E = {})); -var E; (function (E) { E[E["b"] = 1] = "b"; })(E || (E = {})); diff --git a/tests/baselines/reference/typeOfSuperCall.js b/tests/baselines/reference/typeOfSuperCall.js index 94215d4ae1b..179e981b8d1 100644 --- a/tests/baselines/reference/typeOfSuperCall.js +++ b/tests/baselines/reference/typeOfSuperCall.js @@ -22,7 +22,9 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var x = _super.call(this); + var _this; + var x = _this = _super.call(this) || this; + return _this; } return D; }(C)); diff --git a/tests/baselines/reference/typeParameterAsBaseClass.js b/tests/baselines/reference/typeParameterAsBaseClass.js index a01b6a0cac2..15d1c3b396e 100644 --- a/tests/baselines/reference/typeParameterAsBaseClass.js +++ b/tests/baselines/reference/typeParameterAsBaseClass.js @@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(T)); diff --git a/tests/baselines/reference/typeParameterAsBaseType.js b/tests/baselines/reference/typeParameterAsBaseType.js index 9c3a9bcfcd0..2d0962f01d7 100644 --- a/tests/baselines/reference/typeParameterAsBaseType.js +++ b/tests/baselines/reference/typeParameterAsBaseType.js @@ -21,14 +21,14 @@ var __extends = (this && this.__extends) || function (d, b) { var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(T)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(U)); diff --git a/tests/baselines/reference/typeParameterExtendingUnion1.js b/tests/baselines/reference/typeParameterExtendingUnion1.js index 75614f46d21..2738aa20528 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion1.js +++ b/tests/baselines/reference/typeParameterExtendingUnion1.js @@ -27,14 +27,14 @@ var Animal = (function () { var Cat = (function (_super) { __extends(Cat, _super); function Cat() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Cat; }(Animal)); var Dog = (function (_super) { __extends(Dog, _super); function Dog() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Dog; }(Animal)); diff --git a/tests/baselines/reference/typeParameterExtendingUnion2.js b/tests/baselines/reference/typeParameterExtendingUnion2.js index b32c43bc5ec..b3754436f26 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion2.js +++ b/tests/baselines/reference/typeParameterExtendingUnion2.js @@ -27,14 +27,14 @@ var Animal = (function () { var Cat = (function (_super) { __extends(Cat, _super); function Cat() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Cat; }(Animal)); var Dog = (function (_super) { __extends(Dog, _super); function Dog() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Dog; }(Animal)); diff --git a/tests/baselines/reference/typeRelationships.js b/tests/baselines/reference/typeRelationships.js index 6f8f1ccd4cc..2f97f4b0d1c 100644 --- a/tests/baselines/reference/typeRelationships.js +++ b/tests/baselines/reference/typeRelationships.js @@ -72,11 +72,12 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); - this.self1 = this; - this.self2 = this.self; - this.self3 = this.foo(); - this.d = new D(); + var _this = _super.apply(this, arguments) || this; + _this.self1 = _this; + _this.self2 = _this.self; + _this.self3 = _this.foo(); + _this.d = new D(); + return _this; } D.prototype.bar = function () { this.self = this.self1; diff --git a/tests/baselines/reference/typeValueConflict1.js b/tests/baselines/reference/typeValueConflict1.js index eaca97d31dd..8711a656bf5 100644 --- a/tests/baselines/reference/typeValueConflict1.js +++ b/tests/baselines/reference/typeValueConflict1.js @@ -33,7 +33,7 @@ var M2; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(M1.A)); diff --git a/tests/baselines/reference/typeValueConflict2.js b/tests/baselines/reference/typeValueConflict2.js index d89ab0fd357..7abda8110b6 100644 --- a/tests/baselines/reference/typeValueConflict2.js +++ b/tests/baselines/reference/typeValueConflict2.js @@ -40,7 +40,7 @@ var M2; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(M1.A)); @@ -51,7 +51,7 @@ var M3; var B = (function (_super) { __extends(B, _super); function B() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return B; }(M1.A)); diff --git a/tests/baselines/reference/typeofANonExportedType.js b/tests/baselines/reference/typeofANonExportedType.js index 76e908e622d..5c99948e9c9 100644 --- a/tests/baselines/reference/typeofANonExportedType.js +++ b/tests/baselines/reference/typeofANonExportedType.js @@ -77,7 +77,6 @@ var E; E[E["A"] = 0] = "A"; })(E || (E = {})); function foo() { } -var foo; (function (foo) { foo.y = 1; var C = (function () { diff --git a/tests/baselines/reference/typeofAnExportedType.js b/tests/baselines/reference/typeofAnExportedType.js index 0930039d253..91b19d9bebd 100644 --- a/tests/baselines/reference/typeofAnExportedType.js +++ b/tests/baselines/reference/typeofAnExportedType.js @@ -80,7 +80,6 @@ exports.Z = M; var E = exports.E; function foo() { } exports.foo = foo; -var foo; (function (foo) { foo.y = 1; var C = (function () { diff --git a/tests/baselines/reference/typeofClass2.js b/tests/baselines/reference/typeofClass2.js index a0c30c1b166..f1ec6a77b14 100644 --- a/tests/baselines/reference/typeofClass2.js +++ b/tests/baselines/reference/typeofClass2.js @@ -37,7 +37,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.baz = function (x) { }; D.prototype.foo = function () { }; diff --git a/tests/baselines/reference/typesWithSpecializedCallSignatures.js b/tests/baselines/reference/typesWithSpecializedCallSignatures.js index e83fd36ae62..045f7b40e55 100644 --- a/tests/baselines/reference/typesWithSpecializedCallSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedCallSignatures.js @@ -56,14 +56,14 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived1; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js index 63d5e9bb5b2..b4d42d819ed 100644 --- a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js @@ -54,14 +54,14 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived1; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/undeclaredBase.js b/tests/baselines/reference/undeclaredBase.js index 3dd27a3dbfb..4b7813231cf 100644 --- a/tests/baselines/reference/undeclaredBase.js +++ b/tests/baselines/reference/undeclaredBase.js @@ -14,7 +14,7 @@ var M; var C = (function (_super) { __extends(C, _super); function C() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C; }(M.I)); diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js index 513464daa85..7e480d18a0a 100644 --- a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js @@ -136,105 +136,105 @@ var Base = (function () { var D0 = (function (_super) { __extends(D0, _super); function D0() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D0; }(Base)); var DA = (function (_super) { __extends(DA, _super); function DA() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return DA; }(Base)); var D1 = (function (_super) { __extends(D1, _super); function D1() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1; }(Base)); var D1A = (function (_super) { __extends(D1A, _super); function D1A() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D1A; }(Base)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2; }(Base)); var D2A = (function (_super) { __extends(D2A, _super); function D2A() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D2A; }(Base)); var D3 = (function (_super) { __extends(D3, _super); function D3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D3; }(Base)); var D3A = (function (_super) { __extends(D3A, _super); function D3A() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D3A; }(Base)); var D4 = (function (_super) { __extends(D4, _super); function D4() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D4; }(Base)); var D5 = (function (_super) { __extends(D5, _super); function D5() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D5; }(Base)); var D6 = (function (_super) { __extends(D6, _super); function D6() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D6; }(Base)); var D7 = (function (_super) { __extends(D7, _super); function D7() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D7; }(Base)); var D8 = (function (_super) { __extends(D8, _super); function D8() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D8; }(Base)); var D9 = (function (_super) { __extends(D9, _super); function D9() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D9; }(Base)); var D10 = (function (_super) { __extends(D10, _super); function D10() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D10; }(Base)); @@ -245,19 +245,18 @@ var E; var D11 = (function (_super) { __extends(D11, _super); function D11() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D11; }(Base)); function f() { } -var f; (function (f) { f.bar = 1; })(f || (f = {})); var D12 = (function (_super) { __extends(D12, _super); function D12() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D12; }(Base)); @@ -266,28 +265,27 @@ var c = (function () { } return c; }()); -var c; (function (c) { c.bar = 1; })(c || (c = {})); var D13 = (function (_super) { __extends(D13, _super); function D13() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D13; }(Base)); var D14 = (function (_super) { __extends(D14, _super); function D14() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D14; }(Base)); var D15 = (function (_super) { __extends(D15, _super); function D15() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D15; }(Base)); @@ -297,14 +295,14 @@ var D15 = (function (_super) { var D16 = (function (_super) { __extends(D16, _super); function D16() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D16; }(Base)); var D17 = (function (_super) { __extends(D17, _super); function D17() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return D17; }(Base)); diff --git a/tests/baselines/reference/undefinedTypeAssignment4.js b/tests/baselines/reference/undefinedTypeAssignment4.js index a5d7a117a9d..575042b72c0 100644 --- a/tests/baselines/reference/undefinedTypeAssignment4.js +++ b/tests/baselines/reference/undefinedTypeAssignment4.js @@ -18,7 +18,6 @@ var undefined = (function () { } return undefined; }()); -var undefined; (function (undefined) { undefined.x = 42; })(undefined || (undefined = {})); diff --git a/tests/baselines/reference/underscoreMapFirst.js b/tests/baselines/reference/underscoreMapFirst.js index a615faea805..c8e936af527 100644 --- a/tests/baselines/reference/underscoreMapFirst.js +++ b/tests/baselines/reference/underscoreMapFirst.js @@ -57,7 +57,7 @@ var __extends = (this && this.__extends) || function (d, b) { var MyView = (function (_super) { __extends(MyView, _super); function MyView() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } MyView.prototype.getDataSeries = function () { var data = this.model.get("data"); diff --git a/tests/baselines/reference/underscoreThisInDerivedClass01.errors.txt b/tests/baselines/reference/underscoreThisInDerivedClass01.errors.txt new file mode 100644 index 00000000000..3828825cb6b --- /dev/null +++ b/tests/baselines/reference/underscoreThisInDerivedClass01.errors.txt @@ -0,0 +1,29 @@ +tests/cases/compiler/underscoreThisInDerivedClass01.ts(20,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + +==== tests/cases/compiler/underscoreThisInDerivedClass01.ts (1 errors) ==== + // @target es5 + + // Original test intent: + // When arrow functions capture 'this', the lexical 'this' owner + // currently captures 'this' using a variable named '_this'. + // That means that '_this' becomes a reserved identifier in certain places. + // + // Constructors have adopted the same identifier name ('_this') + // for capturing any potential return values from super calls, + // so we expect the same behavior. + + class C { + constructor() { + return {}; + } + } + + class D extends C { + constructor() { + var _this = "uh-oh?"; + ~~~~~ +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + super(); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/underscoreThisInDerivedClass01.js b/tests/baselines/reference/underscoreThisInDerivedClass01.js new file mode 100644 index 00000000000..000176c213f --- /dev/null +++ b/tests/baselines/reference/underscoreThisInDerivedClass01.js @@ -0,0 +1,56 @@ +//// [underscoreThisInDerivedClass01.ts] +// @target es5 + +// Original test intent: +// When arrow functions capture 'this', the lexical 'this' owner +// currently captures 'this' using a variable named '_this'. +// That means that '_this' becomes a reserved identifier in certain places. +// +// Constructors have adopted the same identifier name ('_this') +// for capturing any potential return values from super calls, +// so we expect the same behavior. + +class C { + constructor() { + return {}; + } +} + +class D extends C { + constructor() { + var _this = "uh-oh?"; + super(); + } +} + +//// [underscoreThisInDerivedClass01.js] +// @target es5 +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +// Original test intent: +// When arrow functions capture 'this', the lexical 'this' owner +// currently captures 'this' using a variable named '_this'. +// That means that '_this' becomes a reserved identifier in certain places. +// +// Constructors have adopted the same identifier name ('_this') +// for capturing any potential return values from super calls, +// so we expect the same behavior. +var C = (function () { + function C() { + return {}; + } + return C; +}()); +var D = (function (_super) { + __extends(D, _super); + function D() { + var _this; + var _this = "uh-oh?"; + _this = _super.call(this) || this; + return _this; + } + return D; +}(C)); diff --git a/tests/baselines/reference/underscoreThisInDerivedClass01.symbols b/tests/baselines/reference/underscoreThisInDerivedClass01.symbols new file mode 100644 index 00000000000..c05cd4f6fc3 --- /dev/null +++ b/tests/baselines/reference/underscoreThisInDerivedClass01.symbols @@ -0,0 +1,32 @@ +=== tests/cases/compiler/underscoreThisInDerivedClass01.ts === +// @target es5 + +// Original test intent: +// When arrow functions capture 'this', the lexical 'this' owner +// currently captures 'this' using a variable named '_this'. +// That means that '_this' becomes a reserved identifier in certain places. +// +// Constructors have adopted the same identifier name ('_this') +// for capturing any potential return values from super calls, +// so we expect the same behavior. + +class C { +>C : Symbol(C, Decl(underscoreThisInDerivedClass01.ts, 0, 0)) + + constructor() { + return {}; + } +} + +class D extends C { +>D : Symbol(D, Decl(underscoreThisInDerivedClass01.ts, 15, 1)) +>C : Symbol(C, Decl(underscoreThisInDerivedClass01.ts, 0, 0)) + + constructor() { + var _this = "uh-oh?"; +>_this : Symbol(_this, Decl(underscoreThisInDerivedClass01.ts, 19, 11)) + + super(); +>super : Symbol(C, Decl(underscoreThisInDerivedClass01.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/underscoreThisInDerivedClass01.types b/tests/baselines/reference/underscoreThisInDerivedClass01.types new file mode 100644 index 00000000000..b07f3e0efbf --- /dev/null +++ b/tests/baselines/reference/underscoreThisInDerivedClass01.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/underscoreThisInDerivedClass01.ts === +// @target es5 + +// Original test intent: +// When arrow functions capture 'this', the lexical 'this' owner +// currently captures 'this' using a variable named '_this'. +// That means that '_this' becomes a reserved identifier in certain places. +// +// Constructors have adopted the same identifier name ('_this') +// for capturing any potential return values from super calls, +// so we expect the same behavior. + +class C { +>C : C + + constructor() { + return {}; +>{} : {} + } +} + +class D extends C { +>D : D +>C : C + + constructor() { + var _this = "uh-oh?"; +>_this : string +>"uh-oh?" : string + + super(); +>super() : void +>super : typeof C + } +} diff --git a/tests/baselines/reference/underscoreThisInDerivedClass02.errors.txt b/tests/baselines/reference/underscoreThisInDerivedClass02.errors.txt new file mode 100644 index 00000000000..5569ebf1af6 --- /dev/null +++ b/tests/baselines/reference/underscoreThisInDerivedClass02.errors.txt @@ -0,0 +1,28 @@ +tests/cases/compiler/underscoreThisInDerivedClass02.ts(14,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/compiler/underscoreThisInDerivedClass02.ts(15,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + +==== tests/cases/compiler/underscoreThisInDerivedClass02.ts (2 errors) ==== + // @target es5 + + // Original test intent: + // Errors on '_this' should be reported in derived constructors, + // even if 'super()' is not called. + + class C { + constructor() { + return {}; + } + } + + class D extends C { + constructor() { + ~~~~~~~~~~~~~~~ + var _this = "uh-oh?"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~ +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + } + ~~~~~ +!!! error TS2377: Constructors for derived classes must contain a 'super' call. + } \ No newline at end of file diff --git a/tests/baselines/reference/underscoreThisInDerivedClass02.js b/tests/baselines/reference/underscoreThisInDerivedClass02.js new file mode 100644 index 00000000000..c1e9494376b --- /dev/null +++ b/tests/baselines/reference/underscoreThisInDerivedClass02.js @@ -0,0 +1,44 @@ +//// [underscoreThisInDerivedClass02.ts] +// @target es5 + +// Original test intent: +// Errors on '_this' should be reported in derived constructors, +// even if 'super()' is not called. + +class C { + constructor() { + return {}; + } +} + +class D extends C { + constructor() { + var _this = "uh-oh?"; + } +} + +//// [underscoreThisInDerivedClass02.js] +// @target es5 +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +// Original test intent: +// Errors on '_this' should be reported in derived constructors, +// even if 'super()' is not called. +var C = (function () { + function C() { + return {}; + } + return C; +}()); +var D = (function (_super) { + __extends(D, _super); + function D() { + var _this; + var _this = "uh-oh?"; + return _this; + } + return D; +}(C)); diff --git a/tests/baselines/reference/unexportedInstanceClassVariables.js b/tests/baselines/reference/unexportedInstanceClassVariables.js index 7ac4f6d1b16..5cb0723931a 100644 --- a/tests/baselines/reference/unexportedInstanceClassVariables.js +++ b/tests/baselines/reference/unexportedInstanceClassVariables.js @@ -21,7 +21,6 @@ var M; return A; }()); })(M || (M = {})); -var M; (function (M) { var A = (function () { function A() { diff --git a/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.js b/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.js index c1c6918c770..a8cc0e12d27 100644 --- a/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.js +++ b/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.js @@ -164,7 +164,6 @@ var E2; E2[E2["A"] = 0] = "A"; })(E2 || (E2 = {})); function f() { } -var f; (function (f) { f.bar = 1; })(f || (f = {})); @@ -173,7 +172,6 @@ var c = (function () { } return c; }()); -var c; (function (c) { c.bar = 1; })(c || (c = {})); diff --git a/tests/baselines/reference/unionTypeEquivalence.js b/tests/baselines/reference/unionTypeEquivalence.js index 1ff47f68e5f..e4d0acc893c 100644 --- a/tests/baselines/reference/unionTypeEquivalence.js +++ b/tests/baselines/reference/unionTypeEquivalence.js @@ -34,7 +34,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.foo = function () { }; return D; diff --git a/tests/baselines/reference/unionTypeFromArrayLiteral.js b/tests/baselines/reference/unionTypeFromArrayLiteral.js index 95dd9d39853..83ad2a34394 100644 --- a/tests/baselines/reference/unionTypeFromArrayLiteral.js +++ b/tests/baselines/reference/unionTypeFromArrayLiteral.js @@ -54,7 +54,7 @@ var D = (function () { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } E.prototype.foo3 = function () { }; return E; @@ -62,7 +62,7 @@ var E = (function (_super) { var F = (function (_super) { __extends(F, _super); function F() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } F.prototype.foo4 = function () { }; return F; diff --git a/tests/baselines/reference/unionTypesAssignability.js b/tests/baselines/reference/unionTypesAssignability.js index c7105608004..231b8b27f3b 100644 --- a/tests/baselines/reference/unionTypesAssignability.js +++ b/tests/baselines/reference/unionTypesAssignability.js @@ -88,7 +88,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } D.prototype.foo1 = function () { }; return D; @@ -96,7 +96,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } E.prototype.foo2 = function () { }; return E; diff --git a/tests/baselines/reference/unknownSymbols1.js b/tests/baselines/reference/unknownSymbols1.js index 03ed4990c29..832868c4b8f 100644 --- a/tests/baselines/reference/unknownSymbols1.js +++ b/tests/baselines/reference/unknownSymbols1.js @@ -63,7 +63,7 @@ var C3 = (function () { var C4 = (function (_super) { __extends(C4, _super); function C4() { - _super.call(this, asdf); + return _super.call(this, asdf) || this; } return C4; }(C3)); diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index 7b3938c7099..1343bea602e 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -169,7 +169,7 @@ var ts; var Type = (function (_super) { __extends(Type, _super); function Type() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } Type.prototype.equals = function (that) { if (this === that) @@ -233,10 +233,11 @@ var ts; var Property = (function (_super) { __extends(Property, _super); function Property(name, type, flags) { - _super.call(this); - this.name = name; - this.type = type; - this.flags = flags; + var _this = _super.call(this) || this; + _this.name = name; + _this.type = type; + _this.flags = flags; + return _this; } Property.prototype.equals = function (other) { return this.name === other.name && @@ -253,10 +254,11 @@ var ts; var Signature = (function (_super) { __extends(Signature, _super); function Signature(typeParameters, parameters, returnType) { - _super.call(this); - this.typeParameters = typeParameters; - this.parameters = parameters; - this.returnType = returnType; + var _this = _super.call(this) || this; + _this.typeParameters = typeParameters; + _this.parameters = parameters; + _this.returnType = returnType; + return _this; } Signature.prototype.equalsNoReturn = function (other) { return this.parameters.length === other.parameters.length && @@ -273,10 +275,11 @@ var ts; var Parameter = (function (_super) { __extends(Parameter, _super); function Parameter(name, type, flags) { - _super.call(this); - this.name = name; - this.type = type; - this.flags = flags; + var _this = _super.call(this) || this; + _this.name = name; + _this.type = type; + _this.flags = flags; + return _this; } Parameter.prototype.equals = function (other) { return this.name === other.name && diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index e991db69367..b82a7cbc0ae 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -70,7 +70,7 @@ var r4 = c2(); // should be an error var C2 = (function (_super) { __extends(C2, _super); function C2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return C2; }(Function)); // error diff --git a/tests/baselines/reference/unusedClassesinNamespace4.js b/tests/baselines/reference/unusedClassesinNamespace4.js index 65198c1c1aa..0ab1227bf3d 100644 --- a/tests/baselines/reference/unusedClassesinNamespace4.js +++ b/tests/baselines/reference/unusedClassesinNamespace4.js @@ -36,7 +36,7 @@ var Validation; var c3 = (function (_super) { __extends(c3, _super); function c3() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return c3; }(c1)); diff --git a/tests/baselines/reference/unusedIdentifiersConsolidated1.js b/tests/baselines/reference/unusedIdentifiersConsolidated1.js index 521f17bf5ef..dbb261e5f2a 100644 --- a/tests/baselines/reference/unusedIdentifiersConsolidated1.js +++ b/tests/baselines/reference/unusedIdentifiersConsolidated1.js @@ -168,7 +168,7 @@ var Greeter; var class2 = (function (_super) { __extends(class2, _super); function class2() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } return class2; }(class1)); diff --git a/tests/baselines/reference/validUseOfThisInSuper.js b/tests/baselines/reference/validUseOfThisInSuper.js index 027ba254ae0..483e905b48a 100644 --- a/tests/baselines/reference/validUseOfThisInSuper.js +++ b/tests/baselines/reference/validUseOfThisInSuper.js @@ -24,8 +24,7 @@ var Base = (function () { var Super = (function (_super) { __extends(Super, _super); function Super() { - var _this = this; - _super.call(this, (function () { return _this; })()); // ok since this is not the case: The constructor declares parameter properties or the containing class declares instance member variables with initializers. + return _super.call(this, (function () { return _this; })()) || this; } return Super; }(Base)); diff --git a/tests/baselines/reference/varArgsOnConstructorTypes.js b/tests/baselines/reference/varArgsOnConstructorTypes.js index db8f566702a..0875f2ba1dd 100644 --- a/tests/baselines/reference/varArgsOnConstructorTypes.js +++ b/tests/baselines/reference/varArgsOnConstructorTypes.js @@ -41,9 +41,10 @@ define(["require", "exports"], function (require, exports) { var B = (function (_super) { __extends(B, _super); function B(element, url) { - _super.call(this, element); - this.p1 = element; - this.p2 = url; + var _this = _super.call(this, element) || this; + _this.p1 = element; + _this.p2 = url; + return _this; } return B; }(A)); diff --git a/tests/baselines/reference/varNameConflictsWithImportInDifferentPartOfModule.js b/tests/baselines/reference/varNameConflictsWithImportInDifferentPartOfModule.js index 870b01eda8e..db5bad4009a 100644 --- a/tests/baselines/reference/varNameConflictsWithImportInDifferentPartOfModule.js +++ b/tests/baselines/reference/varNameConflictsWithImportInDifferentPartOfModule.js @@ -13,7 +13,6 @@ var M1; M1.q = 5; M1.s = ''; })(M1 || (M1 = {})); -var M1; (function (M1) { M1.q = M1.s; // Should be an error but isn't })(M1 || (M1 = {})); diff --git a/tests/cases/compiler/derivedClassConstructorWithExplicitReturns01.ts b/tests/cases/compiler/derivedClassConstructorWithExplicitReturns01.ts new file mode 100644 index 00000000000..2475eac0bb2 --- /dev/null +++ b/tests/cases/compiler/derivedClassConstructorWithExplicitReturns01.ts @@ -0,0 +1,36 @@ +// @target: es5 +// @sourcemap: true + +class C { + cProp = 10; + + foo() { return "this never gets used."; } + + constructor(value: number) { + return { + cProp: value, + foo() { + return "well this looks kinda C-ish."; + } + } + } +} + +class D extends C { + dProp = () => this; + + constructor(a = 100) { + super(a); + + if (Math.random() < 0.5) { + "You win!" + return { + cProp: 1, + dProp: () => this, + foo() { return "You win!!!!!" } + }; + } + else + return null; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/es6modulekindWithES5Target12.ts b/tests/cases/compiler/es6modulekindWithES5Target12.ts new file mode 100644 index 00000000000..3bca121a57d --- /dev/null +++ b/tests/cases/compiler/es6modulekindWithES5Target12.ts @@ -0,0 +1,39 @@ +// @target: es5 +// @module: es2015 + +export class C { +} + +export namespace C { + export const x = 1; +} + +export enum E { + w = 1 +} + +export enum E { + x = 2 +} + +export namespace E { + export const y = 1; +} + +export namespace E { + export const z = 1; +} + +export namespace N { +} + +export namespace N { + export const x = 1; +} + +export function F() { +} + +export namespace F { + export const x = 1; +} \ No newline at end of file diff --git a/tests/cases/compiler/exportInFunction.ts b/tests/cases/compiler/exportInFunction.ts new file mode 100644 index 00000000000..9bb0c5dcd0f --- /dev/null +++ b/tests/cases/compiler/exportInFunction.ts @@ -0,0 +1,2 @@ +function f() { + export = 0; diff --git a/tests/cases/compiler/underscoreThisInDerivedClass01.ts b/tests/cases/compiler/underscoreThisInDerivedClass01.ts new file mode 100644 index 00000000000..0d3f5849cb1 --- /dev/null +++ b/tests/cases/compiler/underscoreThisInDerivedClass01.ts @@ -0,0 +1,23 @@ +// @target es5 + +// Original test intent: +// When arrow functions capture 'this', the lexical 'this' owner +// currently captures 'this' using a variable named '_this'. +// That means that '_this' becomes a reserved identifier in certain places. +// +// Constructors have adopted the same identifier name ('_this') +// for capturing any potential return values from super calls, +// so we expect the same behavior. + +class C { + constructor() { + return {}; + } +} + +class D extends C { + constructor() { + var _this = "uh-oh?"; + super(); + } +} \ No newline at end of file diff --git a/tests/cases/compiler/underscoreThisInDerivedClass02.ts b/tests/cases/compiler/underscoreThisInDerivedClass02.ts new file mode 100644 index 00000000000..da197258a73 --- /dev/null +++ b/tests/cases/compiler/underscoreThisInDerivedClass02.ts @@ -0,0 +1,17 @@ +// @target es5 + +// Original test intent: +// Errors on '_this' should be reported in derived constructors, +// even if 'super()' is not called. + +class C { + constructor() { + return {}; + } +} + +class D extends C { + constructor() { + var _this = "uh-oh?"; + } +} \ No newline at end of file