diff --git a/src/compiler/core.ts b/src/compiler/core.ts index d1d21e9469498..5819e634ff423 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -752,6 +752,14 @@ namespace ts { return to; } + /** + * Gets the actual offset into an array for a relative offset. Negative offsets indicate a + * position offset from the end of the array. + */ + function toOffset(array: any[], offset: number) { + return offset < 0 ? array.length + offset : offset; + } + /** * Appends a range of value to an array, returning the array. * @@ -759,11 +767,19 @@ namespace ts { * is created if `value` was appended. * @param from The values to append to the array. If `from` is `undefined`, nothing is * appended. If an element of `from` is `undefined`, that element is not appended. + * @param start The offset in `from` at which to start copying values. + * @param end The offset in `from` at which to stop copying values (non-inclusive). */ - export function addRange(to: T[] | undefined, from: T[] | undefined): T[] | undefined { + export function addRange(to: T[] | undefined, from: T[] | undefined, start?: number, end?: number): T[] | undefined { if (from === undefined) return to; - for (const v of from) { - to = append(to, v); + if (to === undefined) return from.slice(start, end); + start = start === undefined ? 0 : toOffset(from, start); + end = end === undefined ? from.length : toOffset(from, end); + for (let i = start; i < end && i < from.length; i++) { + const v = from[i]; + if (v !== undefined) { + to.push(from[i]); + } } return to; } @@ -788,28 +804,38 @@ namespace ts { return true; } + /** + * Returns the element at a specific offset in an array if non-empty, `undefined` otherwise. + * A negative offset indicates the element should be retrieved from the end of the array. + */ + export function elementAt(array: T[] | undefined, offset: number): T | undefined { + if (array) { + offset = toOffset(array, offset); + if (offset < array.length) { + return array[offset]; + } + } + return undefined; + } + /** * Returns the first element of an array if non-empty, `undefined` otherwise. */ - export function firstOrUndefined(array: T[]): T { - return array && array.length > 0 - ? array[0] - : undefined; + export function firstOrUndefined(array: T[]): T | undefined { + return elementAt(array, 0); } /** * Returns the last element of an array if non-empty, `undefined` otherwise. */ - export function lastOrUndefined(array: T[]): T { - return array && array.length > 0 - ? array[array.length - 1] - : undefined; + export function lastOrUndefined(array: T[]): T | undefined { + return elementAt(array, -1); } /** * Returns the only element of an array if it contains only one element, `undefined` otherwise. */ - export function singleOrUndefined(array: T[]): T { + export function singleOrUndefined(array: T[]): T | undefined { return array && array.length === 1 ? array[0] : undefined; @@ -1137,6 +1163,15 @@ namespace ts { return Array.isArray ? Array.isArray(value) : value instanceof Array; } + export function tryCast(value: TIn | undefined, test: (value: TIn) => value is TOut): TOut | undefined { + return value !== undefined && test(value) ? value : undefined; + } + + export function cast(value: TIn | undefined, test: (value: TIn) => value is TOut): TOut { + if (value !== undefined && test(value)) return value; + Debug.fail(`Invalid cast. The supplied value did not pass the test '${Debug.getFunctionName(test)}'.`); + } + /** Does nothing. */ export function noop(): void {} @@ -2222,8 +2257,11 @@ namespace ts { this.declarations = undefined; } - function Type(this: Type, _checker: TypeChecker, flags: TypeFlags) { + function Type(this: Type, checker: TypeChecker, flags: TypeFlags) { this.flags = flags; + if (Debug.isDebugging) { + this.checker = checker; + } } function Signature() { @@ -2260,24 +2298,42 @@ namespace ts { export namespace Debug { export let currentAssertionLevel = AssertionLevel.None; + export let isDebugging = false; export function shouldAssert(level: AssertionLevel): boolean { return currentAssertionLevel >= level; } - export function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void { + export function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string, stackCrawlMark?: Function): void { if (!expression) { - let verboseDebugString = ""; if (verboseDebugInfo) { - verboseDebugString = "\r\nVerbose Debug Information: " + verboseDebugInfo(); + message += "\r\nVerbose Debug Information: " + verboseDebugInfo(); } - debugger; - throw new Error("Debug Failure. False expression: " + (message || "") + verboseDebugString); + fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert); + } + } + + export function fail(message?: string, stackCrawlMark?: Function): void { + debugger; + const e = new Error(message ? `Debug Failure. ` : "Debug Failure."); + if ((Error).captureStackTrace) { + (Error).captureStackTrace(e, stackCrawlMark || fail); } + throw e; } - export function fail(message?: string): void { - Debug.assert(/*expression*/ false, message); + export function getFunctionName(func: Function) { + if (typeof func !== "function") { + return ""; + } + else if (func.hasOwnProperty("name")) { + return (func).name; + } + else { + const text = Function.prototype.toString.call(func); + const match = /^function\s+([\w\$]+)\s*\(/.exec(text); + return match ? match[1] : ""; + } } } @@ -2443,4 +2499,4 @@ namespace ts { export function isCheckJsEnabledForFile(sourceFile: SourceFile, compilerOptions: CompilerOptions) { return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs; } -} +} \ No newline at end of file diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 7c690e9315528..26c40b0523997 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -2134,6 +2134,24 @@ namespace ts { // Compound nodes + export function createImmediatelyInvokedFunctionExpression(statements: Statement[]): CallExpression; + export function createImmediatelyInvokedFunctionExpression(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; + export function createImmediatelyInvokedFunctionExpression(statements: Statement[], param?: ParameterDeclaration, paramValue?: Expression) { + return createCall( + createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ param ? [param] : [], + /*type*/ undefined, + createBlock(statements, /*multiLine*/ true) + ), + /*typeArguments*/ undefined, + /*argumentsArray*/ paramValue ? [paramValue] : [] + ); + } + export function createComma(left: Expression, right: Expression) { return createBinary(left, SyntaxKind.CommaToken, right); } @@ -3216,6 +3234,26 @@ namespace ts { return isBlock(node) ? node : setTextRange(createBlock([setTextRange(createReturn(node), node)], multiLine), node); } + export function convertFunctionDeclarationToExpression(node: FunctionDeclaration) { + Debug.assert(!!node.body); + const updated = createFunctionExpression( + node.modifiers, + node.asteriskToken, + node.name, + node.typeParameters, + node.parameters, + node.type, + node.body + ); + setOriginalNode(updated, node); + setTextRange(updated, node); + if (node.startsOnNewLine) { + updated.startsOnNewLine = true; + } + aggregateTransformFlags(updated); + return updated; + } + function isUseStrictPrologue(node: ExpressionStatement): boolean { return (node.expression as StringLiteral).text === "use strict"; } @@ -3614,7 +3652,7 @@ namespace ts { if (kind === SyntaxKind.FunctionExpression || kind === SyntaxKind.ArrowFunction) { const mutableCall = getMutableClone(emittedExpression); mutableCall.expression = setTextRange(createParen(callee), callee); - return recreatePartiallyEmittedExpressions(expression, mutableCall); + return recreateOuterExpressions(expression, mutableCall, OuterExpressionKinds.PartiallyEmittedExpressions); } } else { @@ -3656,22 +3694,6 @@ namespace ts { } } - /** - * Clones a series of not-emitted expressions with a new inner expression. - * - * @param originalOuterExpression The original outer expression. - * @param newInnerExpression The new inner expression. - */ - function recreatePartiallyEmittedExpressions(originalOuterExpression: Expression, newInnerExpression: Expression) { - if (isPartiallyEmittedExpression(originalOuterExpression)) { - const clone = getMutableClone(originalOuterExpression); - clone.expression = recreatePartiallyEmittedExpressions(clone.expression, newInnerExpression); - return clone; - } - - return newInnerExpression; - } - function getLeftmostExpression(node: Expression): Expression { while (true) { switch (node.kind) { @@ -3718,6 +3740,22 @@ namespace ts { All = Parentheses | Assertions | PartiallyEmittedExpressions } + export type OuterExpression = ParenthesizedExpression | TypeAssertion | AsExpression | NonNullExpression | PartiallyEmittedExpression; + + export function isOuterExpression(node: Node, kinds = OuterExpressionKinds.All): node is OuterExpression { + switch (node.kind) { + case SyntaxKind.ParenthesizedExpression: + return (kinds & OuterExpressionKinds.Parentheses) !== 0; + case SyntaxKind.TypeAssertionExpression: + case SyntaxKind.AsExpression: + case SyntaxKind.NonNullExpression: + return (kinds & OuterExpressionKinds.Assertions) !== 0; + case SyntaxKind.PartiallyEmittedExpression: + return (kinds & OuterExpressionKinds.PartiallyEmittedExpressions) !== 0; + } + return false; + } + export function skipOuterExpressions(node: Expression, kinds?: OuterExpressionKinds): Expression; export function skipOuterExpressions(node: Node, kinds?: OuterExpressionKinds): Node; export function skipOuterExpressions(node: Node, kinds = OuterExpressionKinds.All) { @@ -3754,8 +3792,8 @@ namespace ts { export function skipAssertions(node: Expression): Expression; export function skipAssertions(node: Node): Node; export function skipAssertions(node: Node): Node { - while (isAssertionExpression(node)) { - node = (node).expression; + while (isAssertionExpression(node) || node.kind === SyntaxKind.NonNullExpression) { + node = (node).expression; } return node; @@ -3771,6 +3809,26 @@ namespace ts { return node; } + function updateOuterExpression(outerExpression: OuterExpression, expression: Expression) { + switch (outerExpression.kind) { + case SyntaxKind.ParenthesizedExpression: return updateParen(outerExpression, expression); + case SyntaxKind.TypeAssertionExpression: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case SyntaxKind.AsExpression: return updateAsExpression(outerExpression, expression, outerExpression.type); + case SyntaxKind.NonNullExpression: return updateNonNullExpression(outerExpression, expression); + case SyntaxKind.PartiallyEmittedExpression: return updatePartiallyEmittedExpression(outerExpression, expression); + } + } + + export function recreateOuterExpressions(outerExpression: Expression | undefined, innerExpression: Expression, kinds = OuterExpressionKinds.All): Expression { + if (outerExpression && isOuterExpression(outerExpression, kinds)) { + return updateOuterExpression( + outerExpression, + recreateOuterExpressions(outerExpression.expression, innerExpression) + ); + } + return innerExpression; + } + export function startOnNewLine(node: T): T { node.startsOnNewLine = true; return node; diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 7074abd3436ef..1abebe937e613 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -41,6 +41,7 @@ namespace ts { realpath?(path: string): string; /*@internal*/ getEnvironmentVariable(name: string): string; /*@internal*/ tryEnableSourceMapsForHost?(): void; + /*@internal*/ debugMode?: boolean; setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; clearTimeout?(timeoutId: any): void; } @@ -428,6 +429,7 @@ namespace ts { realpath(path: string): string { return _fs.realpathSync(path); }, + debugMode: some(process.execArgv, arg => /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg)), tryEnableSourceMapsForHost() { try { require("source-map-support").install(); @@ -517,4 +519,7 @@ namespace ts { ? AssertionLevel.Normal : AssertionLevel.None; } + if (sys && sys.debugMode) { + Debug.isDebugging = true; + } } diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index b9ea70d450663..a0656476421d4 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -339,11 +339,64 @@ namespace ts { && !(node).expression; } + function isClassLikeVariableStatement(node: Node) { + if (!isVariableStatement(node)) return false; + const variable = singleOrUndefined((node).declarationList.declarations); + return variable + && variable.initializer + && isIdentifier(variable.name) + && (isClassLike(variable.initializer) + || (isAssignmentExpression(variable.initializer) + && isIdentifier(variable.initializer.left) + && isClassLike(variable.initializer.right))); + } + + function isTypeScriptClassWrapper(node: Node) { + const call = tryCast(node, isCallExpression); + if (!call || isParseTreeNode(call) || + some(call.typeArguments) || + some(call.arguments)) { + return false; + } + + const func = tryCast(skipOuterExpressions(call.expression), isFunctionExpression); + if (!func || isParseTreeNode(func) || + some(func.typeParameters) || + some(func.parameters) || + func.type || + !func.body) { + return false; + } + + const statements = func.body.statements; + if (statements.length < 2) { + return false; + } + + const firstStatement = statements[0]; + if (isParseTreeNode(firstStatement) || + !isClassLike(firstStatement) && + !isClassLikeVariableStatement(firstStatement)) { + return false; + } + + const lastStatement = elementAt(statements, -1); + const returnStatement = tryCast(isVariableStatement(lastStatement) ? elementAt(statements, -2) : lastStatement, isReturnStatement); + if (!returnStatement || + !returnStatement.expression || + !isIdentifier(skipOuterExpressions(returnStatement.expression))) { + return false; + } + + return true; + } + function shouldVisitNode(node: Node): boolean { return (node.transformFlags & TransformFlags.ContainsES2015) !== 0 || convertedLoopState !== undefined || (hierarchyFacts & HierarchyFacts.ConstructorWithCapturedSuper && isStatement(node)) - || (isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); + || (isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)) + || isTypeScriptClassWrapper(node); } function visitor(node: Node): VisitResult { @@ -3251,6 +3304,10 @@ namespace ts { * @param node a CallExpression. */ function visitCallExpression(node: CallExpression) { + if (isTypeScriptClassWrapper(node)) { + return visitTypeScriptClassWrapper(node); + } + if (node.transformFlags & TransformFlags.ES2015) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); } @@ -3262,6 +3319,163 @@ namespace ts { ); } + function visitTypeScriptClassWrapper(node: CallExpression) { + // This is a call to a class wrapper function (an IIFE) created by the 'ts' transformer. + // The wrapper has a form similar to: + // + // (function() { + // class C { // 1 + // } + // C.x = 1; // 2 + // return C; + // }()) + // + // When we transform the class, we end up with something like this: + // + // (function () { + // var C = (function () { // 3 + // function C() { + // } + // return C; // 4 + // }()); + // C.x = 1; + // return C; + // }()) + // + // We want to simplify the two nested IIFEs to end up with something like this: + // + // (function () { + // function C() { + // } + // C.x = 1; + // return C; + // }()) + + // We skip any outer expressions in a number of places to get to the innermost + // expression, but we will restore them later to preserve comments and source maps. + const body = cast(skipOuterExpressions(node.expression), isFunctionExpression).body; + + // The class statements are the statements generated by visiting the first statement of the + // body (1), while all other statements are added to remainingStatements (2) + const classStatements = visitNodes(body.statements, visitor, isStatement, 0, 1); + const remainingStatements = visitNodes(body.statements, visitor, isStatement, 1, body.statements.length - 1); + const varStatement = cast(firstOrUndefined(classStatements), isVariableStatement); + + // We know there is only one variable declaration here as we verified this in an + // earlier call to isTypeScriptClassWrapper + const variable = varStatement.declarationList.declarations[0]; + const initializer = skipOuterExpressions(variable.initializer); + + // Under certain conditions, the 'ts' transformer may introduce a class alias, which + // we see as an assignment, for example: + // + // (function () { + // var C = C_1 = (function () { + // function C() { + // } + // C.x = function () { return C_1; } + // return C; + // }()); + // C = C_1 = __decorate([dec], C); + // return C; + // var C_1; + // }()) + // + const aliasAssignment = tryCast(initializer, isAssignmentExpression); + + // The underlying call (3) is another IIFE that may contain a '_super' argument. + const call = cast(aliasAssignment ? skipOuterExpressions(aliasAssignment.right) : initializer, isCallExpression); + const func = cast(skipOuterExpressions(call.expression), isFunctionExpression); + + const funcStatements = func.body.statements; + let classBodyStart = 0; + let classBodyEnd = -1; + + const statements: Statement[] = []; + if (aliasAssignment) { + // If we have a class alias assignment, we need to move it to the down-level constructor + // function we generated for the class. + const extendsCall = tryCast(funcStatements[classBodyStart], isExpressionStatement); + if (extendsCall) { + statements.push(extendsCall); + classBodyStart++; + } + + // We reuse the comment and source-map positions from the original variable statement + // and class alias, while converting the function declaration for the class constructor + // into an expression. + statements.push( + updateVariableStatement( + varStatement, + /*modifiers*/ undefined, + updateVariableDeclarationList(varStatement.declarationList, [ + updateVariableDeclaration(variable, + variable.name, + /*type*/ undefined, + updateBinary(aliasAssignment, + aliasAssignment.left, + convertFunctionDeclarationToExpression( + cast(funcStatements[classBodyStart], isFunctionDeclaration) + ) + ) + ) + ]) + ) + ); + classBodyStart++; + } + + // Find the trailing 'return' statement (4) + while (!isReturnStatement(elementAt(funcStatements, classBodyEnd))) { + classBodyEnd--; + } + + // When we extract the statements of the inner IIFE, we exclude the 'return' statement (4) + // as we already have one that has been introduced by the 'ts' transformer. + addRange(statements, funcStatements, classBodyStart, classBodyEnd); + + if (classBodyEnd < -1) { + // If there were any hoisted declarations following the return statement, we should + // append them. + addRange(statements, funcStatements, classBodyEnd + 1); + } + + // Add the remaining statements of the outer wrapper. + addRange(statements, remainingStatements); + + // The 'es2015' class transform may add an end-of-declaration marker. If so we will add it + // after the remaining statements from the 'ts' transformer. + addRange(statements, classStatements, /*start*/ 1); + + // Recreate any outer parentheses or partially-emitted expressions to preserve source map + // and comment locations. + return recreateOuterExpressions(node.expression, + recreateOuterExpressions(variable.initializer, + recreateOuterExpressions(aliasAssignment && aliasAssignment.right, + updateCall(call, + recreateOuterExpressions(call.expression, + updateFunctionExpression( + func, + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, + func.parameters, + /*type*/ undefined, + updateBlock( + func.body, + statements + ) + ) + ), + /*typeArguments*/ undefined, + call.arguments + ) + ) + ) + ); + } + function visitImmediateSuperCallInBody(node: CallExpression) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ false); } @@ -3806,9 +4020,7 @@ namespace ts { return false; } if (isClassElement(currentNode) && currentNode.parent === declaration) { - // we are in the class body, but we treat static fields as outside of the class body - return currentNode.kind !== SyntaxKind.PropertyDeclaration - || (getModifierFlags(currentNode) & ModifierFlags.Static) === 0; + return true; } currentNode = currentNode.parent; } diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index d02aaecf33304..bcfa5985b5749 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -18,6 +18,23 @@ namespace ts { NonQualifiedEnumMembers = 1 << 3 } + const enum ClassFacts { + None = 0, + HasStaticInitializedProperties = 1 << 0, + HasConstructorDecorators = 1 << 1, + HasMemberDecorators = 1 << 2, + IsExportOfNamespace = 1 << 3, + IsNamedExternalExport = 1 << 4, + IsDefaultExternalExport = 1 << 5, + HasExtendsClause = 1 << 6, + UseImmediatelyInvokedFunctionExpression = 1 << 7, + + HasAnyDecorators = HasConstructorDecorators | HasMemberDecorators, + NeedsName = HasStaticInitializedProperties | HasMemberDecorators, + MayNeedImmediatelyInvokedFunctionExpression = HasAnyDecorators | HasStaticInitializedProperties, + IsExported = IsExportOfNamespace | IsDefaultExternalExport | IsNamedExternalExport, + } + export function transformTypeScript(context: TransformationContext) { const { startLexicalEnvironment, @@ -505,6 +522,19 @@ namespace ts { return parameter.decorators !== undefined && parameter.decorators.length > 0; } + function getClassFacts(node: ClassDeclaration, staticProperties: PropertyDeclaration[]) { + let facts = ClassFacts.None; + if (some(staticProperties)) facts |= ClassFacts.HasStaticInitializedProperties; + if (getClassExtendsHeritageClauseElement(node)) facts |= ClassFacts.HasExtendsClause; + if (shouldEmitDecorateCallForClass(node)) facts |= ClassFacts.HasConstructorDecorators; + if (childIsDecorated(node)) facts |= ClassFacts.HasMemberDecorators; + if (isExportOfNamespace(node)) facts |= ClassFacts.IsExportOfNamespace; + else if (isDefaultExternalModuleExport(node)) facts |= ClassFacts.IsDefaultExternalExport; + else if (isNamedExternalModuleExport(node)) facts |= ClassFacts.IsNamedExternalExport; + if (languageVersion <= ScriptTarget.ES5 && (facts & ClassFacts.MayNeedImmediatelyInvokedFunctionExpression)) facts |= ClassFacts.UseImmediatelyInvokedFunctionExpression; + return facts; + } + /** * Transforms a class declaration with TypeScript syntax into compatible ES6. * @@ -518,32 +548,26 @@ namespace ts { */ function visitClassDeclaration(node: ClassDeclaration): VisitResult { const staticProperties = getInitializedProperties(node, /*isStatic*/ true); - const hasExtendsClause = getClassExtendsHeritageClauseElement(node) !== undefined; - const isDecoratedClass = shouldEmitDecorateCallForClass(node); + const facts = getClassFacts(node, staticProperties); - // emit name if - // - node has a name - // - node has static initializers - // - node has a member that is decorated - // - let name = node.name; - if (!name && (staticProperties.length > 0 || childIsDecorated(node))) { - name = getGeneratedNameForNode(node); + if (facts & ClassFacts.UseImmediatelyInvokedFunctionExpression) { + context.startLexicalEnvironment(); } - const classStatement = isDecoratedClass - ? createClassDeclarationHeadWithDecorators(node, name, hasExtendsClause) - : createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, staticProperties.length > 0); + const name = node.name || (facts & ClassFacts.NeedsName ? getGeneratedNameForNode(node) : undefined); + const classStatement = facts & ClassFacts.HasConstructorDecorators + ? createClassDeclarationHeadWithDecorators(node, name, facts) + : createClassDeclarationHeadWithoutDecorators(node, name, facts); - const statements: Statement[] = [classStatement]; + let statements: Statement[] = [classStatement]; // Emit static property assignment. Because classDeclaration is lexically evaluated, // it is safe to emit static property assignment after classDeclaration // From ES6 specification: // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - if (staticProperties.length) { - addInitializedPropertyStatements(statements, staticProperties, getLocalName(node)); + if (facts & ClassFacts.HasStaticInitializedProperties) { + addInitializedPropertyStatements(statements, staticProperties, facts & ClassFacts.UseImmediatelyInvokedFunctionExpression ? getInternalName(node) : getLocalName(node)); } // Write any decorators of the node. @@ -551,17 +575,63 @@ namespace ts { addClassElementDecorationStatements(statements, node, /*isStatic*/ true); addConstructorDecorationStatement(statements, node); + if (facts & ClassFacts.UseImmediatelyInvokedFunctionExpression) { + // When we emit a TypeScript class down to ES5, we must wrap it in an IIFE so that the + // 'es2015' transformer can properly nest static initializers and decorators. The result + // looks something like: + // + // var C = function () { + // class C { + // } + // C.static_prop = 1; + // return C; + // }(); + // + const closingBraceLocation = createTokenRange(skipTrivia(currentSourceFile.text, node.members.end), SyntaxKind.CloseBraceToken); + const localName = getInternalName(node); + + // The following partially-emitted expression exists purely to align our sourcemap + // emit with the original emitter. + const outer = createPartiallyEmittedExpression(localName); + outer.end = closingBraceLocation.end; + setEmitFlags(outer, EmitFlags.NoComments); + + const statement = createReturn(outer); + statement.pos = closingBraceLocation.pos; + setEmitFlags(statement, EmitFlags.NoComments | EmitFlags.NoTokenSourceMaps); + statements.push(statement); + + addRange(statements, context.endLexicalEnvironment()); + + const varStatement = createVariableStatement( + /*modifiers*/ undefined, + createVariableDeclarationList([ + createVariableDeclaration( + getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ false), + /*type*/ undefined, + createImmediatelyInvokedFunctionExpression(statements) + ) + ]) + ); + + setOriginalNode(varStatement, node); + setCommentRange(varStatement, node); + setSourceMapRange(varStatement, moveRangePastDecorators(node)); + startOnNewLine(varStatement); + statements = [varStatement]; + } + // If the class is exported as part of a TypeScript namespace, emit the namespace export. // Otherwise, if the class was exported at the top level and was decorated, emit an export // declaration or export default for the class. - if (isNamespaceExport(node)) { + if (facts & ClassFacts.IsExportOfNamespace) { addExportMemberAssignment(statements, node); } - else if (isDecoratedClass) { - if (isDefaultExternalModuleExport(node)) { + else if (facts & ClassFacts.UseImmediatelyInvokedFunctionExpression || facts & ClassFacts.HasConstructorDecorators) { + if (facts & ClassFacts.IsDefaultExternalExport) { statements.push(createExportDefault(getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))); } - else if (isNamedExternalModuleExport(node)) { + else if (facts & ClassFacts.IsNamedExternalExport) { statements.push(createExternalModuleExport(getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))); } } @@ -580,26 +650,31 @@ namespace ts { * * @param node A ClassDeclaration node. * @param name The name of the class. - * @param hasExtendsClause A value indicating whether the class has an extends clause. - * @param hasStaticProperties A value indicating whether the class has static properties. + * @param facts Precomputed facts about the class. */ - function createClassDeclarationHeadWithoutDecorators(node: ClassDeclaration, name: Identifier, hasExtendsClause: boolean, hasStaticProperties: boolean) { + function createClassDeclarationHeadWithoutDecorators(node: ClassDeclaration, name: Identifier, facts: ClassFacts) { // ${modifiers} class ${name} ${heritageClauses} { // ${members} // } + + // we do not emit modifiers on the declaration if we are emitting an IIFE + const modifiers = !(facts & ClassFacts.UseImmediatelyInvokedFunctionExpression) + ? visitNodes(node.modifiers, modifierVisitor, isModifier) + : undefined; + const classDeclaration = createClassDeclaration( /*decorators*/ undefined, - visitNodes(node.modifiers, modifierVisitor, isModifier), + modifiers, name, /*typeParameters*/ undefined, visitNodes(node.heritageClauses, visitor, isHeritageClause), - transformClassMembers(node, hasExtendsClause) + transformClassMembers(node, (facts & ClassFacts.HasExtendsClause) !== 0) ); // To better align with the old emitter, we should not emit a trailing source map // entry if the class has static properties. let emitFlags = getEmitFlags(node); - if (hasStaticProperties) { + if (facts & ClassFacts.HasStaticInitializedProperties) { emitFlags |= EmitFlags.NoTrailingSourceMap; } @@ -612,13 +687,8 @@ namespace ts { /** * Transforms a decorated class declaration and appends the resulting statements. If * the class requires an alias to avoid issues with double-binding, the alias is returned. - * - * @param statements A statement list to which to add the declaration. - * @param node A ClassDeclaration node. - * @param name The name of the class. - * @param hasExtendsClause A value indicating whether the class has an extends clause. */ - function createClassDeclarationHeadWithDecorators(node: ClassDeclaration, name: Identifier, hasExtendsClause: boolean) { + function createClassDeclarationHeadWithDecorators(node: ClassDeclaration, name: Identifier, facts: ClassFacts) { // When we emit an ES6 class that has a class decorator, we must tailor the // emit to certain specific cases. // @@ -713,7 +783,7 @@ namespace ts { // ${members} // } const heritageClauses = visitNodes(node.heritageClauses, visitor, isHeritageClause); - const members = transformClassMembers(node, hasExtendsClause); + const members = transformClassMembers(node, (facts & ClassFacts.HasExtendsClause) !== 0); const classExpression = createClassExpression(/*modifiers*/ undefined, name, /*typeParameters*/ undefined, heritageClauses, members); setOriginalNode(classExpression, node); setTextRange(classExpression, location); @@ -2163,7 +2233,7 @@ namespace ts { /*type*/ undefined, visitFunctionBody(node.body, visitor, context) || createBlock([]) ); - if (isNamespaceExport(node)) { + if (isExportOfNamespace(node)) { const statements: Statement[] = [updated]; addExportMemberAssignment(statements, node); return statements; @@ -2256,7 +2326,7 @@ namespace ts { * - The node is exported from a TypeScript namespace. */ function visitVariableStatement(node: VariableStatement): Statement { - if (isNamespaceExport(node)) { + if (isExportOfNamespace(node)) { const variables = getInitializedVariables(node.declarationList); if (variables.length === 0) { // elide statement if there are no initialized variables. @@ -2560,7 +2630,7 @@ namespace ts { * or `exports.x`). */ function hasNamespaceQualifiedExportName(node: Node) { - return isNamespaceExport(node) + return isExportOfNamespace(node) || (isExternalModuleExport(node) && moduleKind !== ModuleKind.ES2015 && moduleKind !== ModuleKind.System); @@ -3002,7 +3072,7 @@ namespace ts { const moduleReference = createExpressionFromEntityName(node.moduleReference); setEmitFlags(moduleReference, EmitFlags.NoComments | EmitFlags.NoNestedComments); - if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { + if (isNamedExternalModuleExport(node) || !isExportOfNamespace(node)) { // export var ${name} = ${moduleReference}; // var ${name} = ${moduleReference}; return setOriginalNode( @@ -3043,7 +3113,7 @@ namespace ts { * * @param node The node to test. */ - function isNamespaceExport(node: Node) { + function isExportOfNamespace(node: Node) { return currentNamespace !== undefined && hasModifier(node, ModifierFlags.Export); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ebb0f02f39d5e..f03c01352170a 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3087,6 +3087,7 @@ namespace ts { export interface Type { flags: TypeFlags; // Flags /* @internal */ id: number; // Unique ID + /* @internal */ checker: TypeChecker; symbol?: Symbol; // Symbol associated with type (if any) pattern?: DestructuringPattern; // Destructuring pattern represented by type (if any) aliasSymbol?: Symbol; // Alias associated with type @@ -3996,34 +3997,34 @@ namespace ts { } export const enum EmitFlags { - SingleLine = 1 << 0, // The contents of this node should be emitted on a single line. - AdviseOnEmitNode = 1 << 1, // The printer should invoke the onEmitNode callback when printing this node. - NoSubstitution = 1 << 2, // Disables further substitution of an expression. - CapturesThis = 1 << 3, // The function captures a lexical `this` - NoLeadingSourceMap = 1 << 4, // Do not emit a leading source map location for this node. - NoTrailingSourceMap = 1 << 5, // Do not emit a trailing source map location for this node. + SingleLine = 1 << 0, // The contents of this node should be emitted on a single line. + AdviseOnEmitNode = 1 << 1, // The printer should invoke the onEmitNode callback when printing this node. + NoSubstitution = 1 << 2, // Disables further substitution of an expression. + CapturesThis = 1 << 3, // The function captures a lexical `this` + NoLeadingSourceMap = 1 << 4, // Do not emit a leading source map location for this node. + NoTrailingSourceMap = 1 << 5, // Do not emit a trailing source map location for this node. NoSourceMap = NoLeadingSourceMap | NoTrailingSourceMap, // Do not emit a source map location for this node. - NoNestedSourceMaps = 1 << 6, // Do not emit source map locations for children of this node. - NoTokenLeadingSourceMaps = 1 << 7, // Do not emit leading source map location for token nodes. - NoTokenTrailingSourceMaps = 1 << 8, // Do not emit trailing source map location for token nodes. + NoNestedSourceMaps = 1 << 6, // Do not emit source map locations for children of this node. + NoTokenLeadingSourceMaps = 1 << 7, // Do not emit leading source map location for token nodes. + NoTokenTrailingSourceMaps = 1 << 8, // Do not emit trailing source map location for token nodes. NoTokenSourceMaps = NoTokenLeadingSourceMaps | NoTokenTrailingSourceMaps, // Do not emit source map locations for tokens of this node. - NoLeadingComments = 1 << 9, // Do not emit leading comments for this node. - NoTrailingComments = 1 << 10, // Do not emit trailing comments for this node. + NoLeadingComments = 1 << 9, // Do not emit leading comments for this node. + NoTrailingComments = 1 << 10, // Do not emit trailing comments for this node. NoComments = NoLeadingComments | NoTrailingComments, // Do not emit comments for this node. NoNestedComments = 1 << 11, HelperName = 1 << 12, - ExportName = 1 << 13, // Ensure an export prefix is added for an identifier that points to an exported declaration with a local name (see SymbolFlags.ExportHasLocal). - LocalName = 1 << 14, // Ensure an export prefix is not added for an identifier that points to an exported declaration. - InternalName = 1 << 15, // The name is internal to an ES5 class body function. - Indented = 1 << 16, // Adds an explicit extra indentation level for class and function bodies when printing (used to match old emitter). - NoIndentation = 1 << 17, // Do not indent the node. + ExportName = 1 << 13, // Ensure an export prefix is added for an identifier that points to an exported declaration with a local name (see SymbolFlags.ExportHasLocal). + LocalName = 1 << 14, // Ensure an export prefix is not added for an identifier that points to an exported declaration. + InternalName = 1 << 15, // The name is internal to an ES5 class body function. + Indented = 1 << 16, // Adds an explicit extra indentation level for class and function bodies when printing (used to match old emitter). + NoIndentation = 1 << 17, // Do not indent the node. AsyncFunctionBody = 1 << 18, - ReuseTempVariableScope = 1 << 19, // Reuse the existing temp variable scope during emit. - CustomPrologue = 1 << 20, // Treat the statement as if it were a prologue directive (NOTE: Prologue directives are *not* transformed). - NoHoisting = 1 << 21, // Do not hoist this declaration in --module system - HasEndOfDeclarationMarker = 1 << 22, // Declaration has an associated NotEmittedStatement to mark the end of the declaration - Iterator = 1 << 23, // The expression to a `yield*` should be treated as an Iterator when down-leveling, not an Iterable. - NoAsciiEscaping = 1 << 24, // When synthesizing nodes that lack an original node or textSourceNode, we want to write the text on the node with ASCII escaping substitutions. + ReuseTempVariableScope = 1 << 19, // Reuse the existing temp variable scope during emit. + CustomPrologue = 1 << 20, // Treat the statement as if it were a prologue directive (NOTE: Prologue directives are *not* transformed). + NoHoisting = 1 << 21, // Do not hoist this declaration in --module system + HasEndOfDeclarationMarker = 1 << 22, // Declaration has an associated NotEmittedStatement to mark the end of the declaration + Iterator = 1 << 23, // The expression to a `yield*` should be treated as an Iterator when down-leveling, not an Iterable. + NoAsciiEscaping = 1 << 24, // When synthesizing nodes that lack an original node or textSourceNode, we want to write the text on the node with ASCII escaping substitutions. } export interface EmitHelper { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 60e2fdf66799b..b52ace7861548 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2935,6 +2935,14 @@ namespace ts { return node.modifierFlagsCache & ~ModifierFlags.HasComputedFlags; } + const flags = getModifierFlagsNoCache(node); + node.modifierFlagsCache = flags | ModifierFlags.HasComputedFlags; + return flags; + } + + /* @internal */ + export function getModifierFlagsNoCache(node: Node): ModifierFlags { + let flags = ModifierFlags.None; if (node.modifiers) { for (const modifier of node.modifiers) { @@ -2946,7 +2954,6 @@ namespace ts { flags |= ModifierFlags.Export; } - node.modifierFlagsCache = flags | ModifierFlags.HasComputedFlags; return flags; } @@ -3235,27 +3242,76 @@ namespace ts { return false; } - const syntaxKindCache: string[] = []; - - export function formatSyntaxKind(kind: SyntaxKind): string { - const syntaxKindEnum = (ts).SyntaxKind; - if (syntaxKindEnum) { - const cached = syntaxKindCache[kind]; - if (cached !== undefined) { - return cached; - } - - for (const name in syntaxKindEnum) { - if (syntaxKindEnum[name] === kind) { - const result = `${kind} (${name})`; - syntaxKindCache[kind] = result; - return result; + /** + * Formats an enum value as a string for debugging and debug assertions. + */ + function formatEnum(value = 0, enumObject: any, isFlags?: boolean) { + const members = getEnumMembers(enumObject); + if (value === 0) { + return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0"; + } + if (isFlags) { + let result = ""; + let remainingFlags = value; + for (let i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) { + const [enumValue, enumName] = members[i]; + if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) { + remainingFlags &= ~enumValue; + result = `${enumName}${result ? ", " : ""}${result}`; } } + if (remainingFlags === 0) { + return result; + } } else { - return kind.toString(); + for (const [enumValue, enumName] of members) { + if (enumValue === value) { + return enumName; + } + } + } + return value.toString(); + } + + function getEnumMembers(enumObject: any) { + const result: [number, string][] = []; + for (const name in enumObject) { + const value = enumObject[name]; + if (typeof value === "number") { + result.push([value, name]); + } } + + return stableSort(result, (x, y) => compareValues(x[0], y[0])); + } + + export function formatSyntaxKind(kind: SyntaxKind): string { + return formatEnum(kind, (ts).SyntaxKind, /*isFlags*/ false); + } + + export function formatModifierFlags(flags: ModifierFlags): string { + return formatEnum(flags, (ts).ModifierFlags, /*isFlags*/ true); + } + + export function formatTransformFlags(flags: TransformFlags): string { + return formatEnum(flags, (ts).TransformFlags, /*isFlags*/ true); + } + + export function formatEmitFlags(flags: EmitFlags): string { + return formatEnum(flags, (ts).EmitFlags, /*isFlags*/ true); + } + + export function formatSymbolFlags(flags: SymbolFlags): string { + return formatEnum(flags, (ts).SymbolFlags, /*isFlags*/ true); + } + + export function formatTypeFlags(flags: TypeFlags): string { + return formatEnum(flags, (ts).TypeFlags, /*isFlags*/ true); + } + + export function formatObjectFlags(flags: ObjectFlags): string { + return formatEnum(flags, (ts).ObjectFlags, /*isFlags*/ true); } export function getRangePos(range: TextRange | undefined) { diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index fa642b7a3c49d..fc3b9c784cce1 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -1517,57 +1517,80 @@ namespace ts { } export namespace Debug { + if (isDebugging) { + // Add additional properties in debug mode to assist with debugging. + Object.defineProperties(objectAllocator.getSymbolConstructor().prototype, { + "__debugFlags": { get(this: Symbol) { return formatSymbolFlags(this.flags); } } + }); + + Object.defineProperties(objectAllocator.getTypeConstructor().prototype, { + "__debugFlags": { get(this: Type) { return formatTypeFlags(this.flags); } }, + "__debugObjectFlags": { get(this: Type) { return this.flags & TypeFlags.Object ? formatObjectFlags((this).objectFlags) : ""; } }, + "__debugTypeToString": { value(this: Type) { return this.checker.typeToString(this); } }, + }); + + for (const ctor of [objectAllocator.getNodeConstructor(), objectAllocator.getIdentifierConstructor(), objectAllocator.getTokenConstructor(), objectAllocator.getSourceFileConstructor()]) { + if (!ctor.prototype.hasOwnProperty("__debugKind")) { + Object.defineProperties(ctor.prototype, { + "__debugKind": { get(this: Node) { return formatSyntaxKind(this.kind); } }, + "__debugModifierFlags": { get(this: Node) { return formatModifierFlags(getModifierFlagsNoCache(this)); } }, + "__debugTransformFlags": { get(this: Node) { return formatTransformFlags(this.transformFlags); } }, + "__debugEmitFlags": { get(this: Node) { return formatEmitFlags(getEmitFlags(this)); } }, + "__debugGetText": { value(this: Node, includeTrivia?: boolean) { + if (nodeIsSynthesized(this)) return ""; + const parseNode = getParseTreeNode(this); + const sourceFile = parseNode && getSourceFileOfNode(parseNode); + return sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : ""; + } } + }); + } + } + } + export const failBadSyntaxKind = shouldAssert(AssertionLevel.Normal) - ? (node: Node, message?: string) => assert(false, message || "Unexpected node.", () => `Node ${formatSyntaxKind(node.kind)} was unexpected.`) + ? (node: Node, message?: string): void => fail( + `${message || "Unexpected node."}\r\nNode ${formatSyntaxKind(node.kind)} was unexpected.`, + failBadSyntaxKind) : noop; export const assertEachNode = shouldAssert(AssertionLevel.Normal) - ? (nodes: Node[], test: (node: Node) => boolean, message?: string) => assert( - test === undefined || every(nodes, test), - message || "Unexpected node.", - () => `Node array did not pass test '${getFunctionName(test)}'.`) + ? (nodes: Node[], test: (node: Node) => boolean, message?: string): void => assert( + test === undefined || every(nodes, test), + message || "Unexpected node.", + () => `Node array did not pass test '${getFunctionName(test)}'.`, + assertEachNode) : noop; export const assertNode = shouldAssert(AssertionLevel.Normal) - ? (node: Node, test: (node: Node) => boolean, message?: string) => assert( - test === undefined || test(node), - message || "Unexpected node.", - () => `Node ${formatSyntaxKind(node.kind)} did not pass test '${getFunctionName(test)}'.`) + ? (node: Node, test: (node: Node) => boolean, message?: string): void => assert( + test === undefined || test(node), + message || "Unexpected node.", + () => `Node ${formatSyntaxKind(node.kind)} did not pass test '${getFunctionName(test)}'.`, + assertNode) : noop; export const assertOptionalNode = shouldAssert(AssertionLevel.Normal) - ? (node: Node, test: (node: Node) => boolean, message?: string) => assert( - test === undefined || node === undefined || test(node), - message || "Unexpected node.", - () => `Node ${formatSyntaxKind(node.kind)} did not pass test '${getFunctionName(test)}'.`) + ? (node: Node, test: (node: Node) => boolean, message?: string): void => assert( + test === undefined || node === undefined || test(node), + message || "Unexpected node.", + () => `Node ${formatSyntaxKind(node.kind)} did not pass test '${getFunctionName(test)}'.`, + assertOptionalNode) : noop; export const assertOptionalToken = shouldAssert(AssertionLevel.Normal) - ? (node: Node, kind: SyntaxKind, message?: string) => assert( - kind === undefined || node === undefined || node.kind === kind, - message || "Unexpected node.", - () => `Node ${formatSyntaxKind(node.kind)} was not a '${formatSyntaxKind(kind)}' token.`) + ? (node: Node, kind: SyntaxKind, message?: string): void => assert( + kind === undefined || node === undefined || node.kind === kind, + message || "Unexpected node.", + () => `Node ${formatSyntaxKind(node.kind)} was not a '${formatSyntaxKind(kind)}' token.`, + assertOptionalToken) : noop; export const assertMissingNode = shouldAssert(AssertionLevel.Normal) - ? (node: Node, message?: string) => assert( - node === undefined, - message || "Unexpected node.", - () => `Node ${formatSyntaxKind(node.kind)} was unexpected'.`) + ? (node: Node, message?: string): void => assert( + node === undefined, + message || "Unexpected node.", + () => `Node ${formatSyntaxKind(node.kind)} was unexpected'.`, + assertMissingNode) : noop; - - function getFunctionName(func: Function) { - if (typeof func !== "function") { - return ""; - } - else if (func.hasOwnProperty("name")) { - return (func).name; - } - else { - const text = Function.prototype.toString.call(func); - const match = /^function\s+([\w\$]+)\s*\(/.exec(text); - return match ? match[1] : ""; - } - } } } diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js index cb2f7c6cb7748..05f14d26369d4 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js @@ -28,9 +28,9 @@ var Point = (function () { this.x = x; this.y = y; } + Point.Origin = { x: 0, y: 0 }; return Point; }()); -Point.Origin = { x: 0, y: 0 }; (function (Point) { Point.Origin = ""; //expected duplicate identifier error })(Point || (Point = {})); @@ -41,9 +41,9 @@ var A; this.x = x; this.y = y; } + Point.Origin = { x: 0, y: 0 }; return Point; }()); - Point.Origin = { x: 0, y: 0 }; A.Point = Point; (function (Point) { Point.Origin = ""; //expected duplicate identifier error diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js index ef77d6257fb62..90c7523b93171 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js @@ -28,9 +28,9 @@ var Point = (function () { this.x = x; this.y = y; } + Point.Origin = { x: 0, y: 0 }; return Point; }()); -Point.Origin = { x: 0, y: 0 }; (function (Point) { var Origin = ""; // not an error, since not exported })(Point || (Point = {})); @@ -41,9 +41,9 @@ var A; this.x = x; this.y = y; } + Point.Origin = { x: 0, y: 0 }; return Point; }()); - Point.Origin = { x: 0, y: 0 }; A.Point = Point; (function (Point) { var Origin = ""; // not an error since not exported diff --git a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js index 7633955b22701..d5c3b3d63f4fc 100644 --- a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js +++ b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js @@ -7,6 +7,6 @@ class AtomicNumbers { var AtomicNumbers = (function () { function AtomicNumbers() { } + AtomicNumbers.H = 1; return AtomicNumbers; }()); -AtomicNumbers.H = 1; diff --git a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js index 651ae7a6d3945..40bb07fa9c3b7 100644 --- a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js +++ b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js @@ -39,9 +39,9 @@ define(["require", "exports"], function (require, exports) { function C1() { this.m1 = 42; } + C1.s1 = true; return C1; }()); - C1.s1 = true; exports.C1 = C1; var E1; (function (E1) { diff --git a/tests/baselines/reference/autolift4.js b/tests/baselines/reference/autolift4.js index 6d91c61d59dc8..d784798358e33 100644 --- a/tests/baselines/reference/autolift4.js +++ b/tests/baselines/reference/autolift4.js @@ -42,9 +42,9 @@ var Point = (function () { Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; + Point.origin = new Point(0, 0); return Point; }()); -Point.origin = new Point(0, 0); var Point3D = (function (_super) { __extends(Point3D, _super); function Point3D(x, y, z, m) { diff --git a/tests/baselines/reference/blockScopedNamespaceDifferentFile.js b/tests/baselines/reference/blockScopedNamespaceDifferentFile.js index 3eab7477c092c..82d72e466e10c 100644 --- a/tests/baselines/reference/blockScopedNamespaceDifferentFile.js +++ b/tests/baselines/reference/blockScopedNamespaceDifferentFile.js @@ -27,9 +27,9 @@ var C; var Name = (function () { function Name(parameters) { } + Name.funcData = A.AA.func(); + Name.someConst = A.AA.foo; return Name; }()); - Name.funcData = A.AA.func(); - Name.someConst = A.AA.foo; C.Name = Name; })(C || (C = {})); diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js index 0197d919fef87..619ee51ce75fc 100644 --- a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js @@ -177,9 +177,9 @@ function foo10() { var A = (function () { function A() { } + A.a = x; return A; }()); - A.a = x; var x; } function foo11() { diff --git a/tests/baselines/reference/class2.js b/tests/baselines/reference/class2.js index 91ac89da1092a..6ef78ed46ee9a 100644 --- a/tests/baselines/reference/class2.js +++ b/tests/baselines/reference/class2.js @@ -5,6 +5,6 @@ class foo { constructor() { static f = 3; } } var foo = (function () { function foo() { } + foo.f = 3; return foo; }()); -foo.f = 3; diff --git a/tests/baselines/reference/classBlockScoping.js b/tests/baselines/reference/classBlockScoping.js index 76d0dd892de9c..3cae2d3cb7d1b 100644 --- a/tests/baselines/reference/classBlockScoping.js +++ b/tests/baselines/reference/classBlockScoping.js @@ -62,9 +62,9 @@ function f(b) { Foo.prototype.m = function () { new Foo(); }; + Foo.y = new Foo(); return Foo; }()); - Foo_1.y = new Foo_1(); new Foo_1(); } var _a; diff --git a/tests/baselines/reference/classExpressionWithDecorator1.js b/tests/baselines/reference/classExpressionWithDecorator1.js index 9b52891b5595c..e051e05251bb6 100644 --- a/tests/baselines/reference/classExpressionWithDecorator1.js +++ b/tests/baselines/reference/classExpressionWithDecorator1.js @@ -12,10 +12,10 @@ var v = ; var C = (function () { function C() { } + C.p = 1; + C = __decorate([ + decorate + ], C); return C; }()); -C.p = 1; -C = __decorate([ - decorate -], C); ; diff --git a/tests/baselines/reference/classMemberInitializerScoping.js b/tests/baselines/reference/classMemberInitializerScoping.js index 52bbaee894570..8f78cfb9ac686 100644 --- a/tests/baselines/reference/classMemberInitializerScoping.js +++ b/tests/baselines/reference/classMemberInitializerScoping.js @@ -27,9 +27,9 @@ var CCC = (function () { this.y = aaa; this.y = ''; // was: error, cannot assign string to number } + CCC.staticY = aaa; // This shouldnt be error return CCC; }()); -CCC.staticY = aaa; // This shouldnt be error // above is equivalent to this: var aaaa = 1; var CCCC = (function () { diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping.js b/tests/baselines/reference/classMemberInitializerWithLamdaScoping.js index c5b661831a23c..752220a4cbc5c 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping.js +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping.js @@ -40,12 +40,12 @@ var Test = (function () { console.log(field); // Using field here shouldnt be error }; } + Test.staticMessageHandler = function () { + var field = Test.field; + console.log(field); // Using field here shouldnt be error + }; return Test; }()); -Test.staticMessageHandler = function () { - var field = Test.field; - console.log(field); // Using field here shouldnt be error -}; var field1; var Test1 = (function () { function Test1(field1) { @@ -56,8 +56,8 @@ var Test1 = (function () { // it would resolve to private field1 and thats not what user intended here. }; } + Test1.staticMessageHandler = function () { + console.log(field1); // This shouldnt be error as its a static property + }; return Test1; }()); -Test1.staticMessageHandler = function () { - console.log(field1); // This shouldnt be error as its a static property -}; diff --git a/tests/baselines/reference/classWithPrivateProperty.js b/tests/baselines/reference/classWithPrivateProperty.js index c94f1d8ed80a4..6e75797523fb3 100644 --- a/tests/baselines/reference/classWithPrivateProperty.js +++ b/tests/baselines/reference/classWithPrivateProperty.js @@ -32,9 +32,9 @@ var C = (function () { } C.prototype.c = function () { return ''; }; C.f = function () { return ''; }; + C.g = function () { return ''; }; return C; }()); -C.g = function () { return ''; }; var c = new C(); var r1 = c.x; var r2 = c.a; diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index 2b12741d38f13..2bc766cd99a7e 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -47,9 +47,9 @@ var C = (function () { } C.prototype.c = function () { return ''; }; C.f = function () { return ''; }; + C.g = function () { return ''; }; return C; }()); -C.g = function () { return ''; }; var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/classWithPublicProperty.js b/tests/baselines/reference/classWithPublicProperty.js index 47708b7aff391..054713264bd01 100644 --- a/tests/baselines/reference/classWithPublicProperty.js +++ b/tests/baselines/reference/classWithPublicProperty.js @@ -30,9 +30,9 @@ var C = (function () { } C.prototype.c = function () { return ''; }; C.f = function () { return ''; }; + C.g = function () { return ''; }; return C; }()); -C.g = function () { return ''; }; // all of these are valid var c = new C(); var r1 = c.x; diff --git a/tests/baselines/reference/cloduleStaticMembers.js b/tests/baselines/reference/cloduleStaticMembers.js index b696a842f3b5b..d17a2b2497d08 100644 --- a/tests/baselines/reference/cloduleStaticMembers.js +++ b/tests/baselines/reference/cloduleStaticMembers.js @@ -16,10 +16,10 @@ module Clod { var Clod = (function () { function Clod() { } + Clod.x = 10; + Clod.y = 10; return Clod; }()); -Clod.x = 10; -Clod.y = 10; (function (Clod) { var p = Clod.x; var q = x; diff --git a/tests/baselines/reference/commentOnDecoratedClassDeclaration.js b/tests/baselines/reference/commentOnDecoratedClassDeclaration.js index 44a7047a2ac4e..8e6cd7149cf46 100644 --- a/tests/baselines/reference/commentOnDecoratedClassDeclaration.js +++ b/tests/baselines/reference/commentOnDecoratedClassDeclaration.js @@ -29,19 +29,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var Remote = (function () { function Remote() { } + Remote = __decorate([ + decorator("hello") + ], Remote); return Remote; }()); -Remote = __decorate([ - decorator("hello") -], Remote); /** * Floating Comment */ var AnotherRomote = (function () { function AnotherRomote() { } + AnotherRomote = __decorate([ + decorator("hi") + ], AnotherRomote); return AnotherRomote; }()); -AnotherRomote = __decorate([ - decorator("hi") -], AnotherRomote); diff --git a/tests/baselines/reference/commentsOnStaticMembers.js b/tests/baselines/reference/commentsOnStaticMembers.js index 94df40898805e..896aced36e473 100644 --- a/tests/baselines/reference/commentsOnStaticMembers.js +++ b/tests/baselines/reference/commentsOnStaticMembers.js @@ -23,13 +23,13 @@ class test { var test = (function () { function test() { } + /** + * p1 comment appears in output + */ + test.p1 = ""; + /** + * p3 comment appears in output + */ + test.p3 = ""; return test; }()); -/** - * p1 comment appears in output - */ -test.p1 = ""; -/** - * p3 comment appears in output - */ -test.p3 = ""; diff --git a/tests/baselines/reference/commonJSImportAsPrimaryExpression.js b/tests/baselines/reference/commonJSImportAsPrimaryExpression.js index cd62c1583bcff..d25c141089770 100644 --- a/tests/baselines/reference/commonJSImportAsPrimaryExpression.js +++ b/tests/baselines/reference/commonJSImportAsPrimaryExpression.js @@ -20,9 +20,9 @@ var C1 = (function () { function C1() { this.m1 = 42; } + C1.s1 = true; return C1; }()); -C1.s1 = true; exports.C1 = C1; //// [foo_1.js] "use strict"; diff --git a/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js b/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js index 5ac0e3fcc649e..7aee50e1106e4 100644 --- a/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js +++ b/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js @@ -38,9 +38,9 @@ var C1 = (function () { function C1() { this.m1 = 42; } + C1.s1 = true; return C1; }()); -C1.s1 = true; exports.C1 = C1; var E1; (function (E1) { diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.js b/tests/baselines/reference/computedPropertyNames12_ES5.js index 10427b5dc13f6..2aec8856286cb 100644 --- a/tests/baselines/reference/computedPropertyNames12_ES5.js +++ b/tests/baselines/reference/computedPropertyNames12_ES5.js @@ -26,6 +26,6 @@ var C = (function () { this[s + n] = 2; this["hello bye"] = 0; } + C["hello " + a + " bye"] = 0; return C; }()); -C["hello " + a + " bye"] = 0; diff --git a/tests/baselines/reference/constructableDecoratorOnClass01.js b/tests/baselines/reference/constructableDecoratorOnClass01.js index 858d67923af76..a37f96b59d1c7 100644 --- a/tests/baselines/reference/constructableDecoratorOnClass01.js +++ b/tests/baselines/reference/constructableDecoratorOnClass01.js @@ -22,8 +22,8 @@ var CtorDtor = (function () { var C = (function () { function C() { } + C = __decorate([ + CtorDtor + ], C); return C; }()); -C = __decorate([ - CtorDtor -], C); diff --git a/tests/baselines/reference/declFilePrivateStatic.js b/tests/baselines/reference/declFilePrivateStatic.js index cb1b47735f31b..409e2f21b42ba 100644 --- a/tests/baselines/reference/declFilePrivateStatic.js +++ b/tests/baselines/reference/declFilePrivateStatic.js @@ -39,10 +39,10 @@ var C = (function () { enumerable: true, configurable: true }); + C.x = 1; + C.y = 1; return C; }()); -C.x = 1; -C.y = 1; //// [declFilePrivateStatic.d.ts] diff --git a/tests/baselines/reference/decoratorCallGeneric.js b/tests/baselines/reference/decoratorCallGeneric.js index a1d470b7063c3..acc9c48297dfe 100644 --- a/tests/baselines/reference/decoratorCallGeneric.js +++ b/tests/baselines/reference/decoratorCallGeneric.js @@ -24,8 +24,8 @@ var C = (function () { function C() { } C.m = function () { }; + C = __decorate([ + dec + ], C); return C; }()); -C = __decorate([ - dec -], C); diff --git a/tests/baselines/reference/decoratorChecksFunctionBodies.js b/tests/baselines/reference/decoratorChecksFunctionBodies.js index 20a58980e44e7..562169078af86 100644 --- a/tests/baselines/reference/decoratorChecksFunctionBodies.js +++ b/tests/baselines/reference/decoratorChecksFunctionBodies.js @@ -29,12 +29,12 @@ var A = (function () { } A.prototype.m = function () { }; + __decorate([ + (function (x, p) { + var a = 3; + func(a); + return x; + }) + ], A.prototype, "m", null); return A; }()); -__decorate([ - (function (x, p) { - var a = 3; - func(a); - return x; - }) -], A.prototype, "m", null); diff --git a/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.js b/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.js index 08184bb7e6cfe..fccd0ec95d320 100644 --- a/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.js +++ b/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.js @@ -46,8 +46,8 @@ var Wat = (function () { Wat.whatever = function () { // ... }; + __decorate([ + filter(function () { return a_1.test == 'abc'; }) + ], Wat, "whatever", null); return Wat; }()); -__decorate([ - filter(function () { return a_1.test == 'abc'; }) -], Wat, "whatever", null); diff --git a/tests/baselines/reference/decoratorMetadata.js b/tests/baselines/reference/decoratorMetadata.js index 9998ae3d08a89..93453ac4cf3c8 100644 --- a/tests/baselines/reference/decoratorMetadata.js +++ b/tests/baselines/reference/decoratorMetadata.js @@ -46,15 +46,15 @@ var MyComponent = (function () { } MyComponent.prototype.method = function (x) { }; + __decorate([ + decorator, + __metadata("design:type", Function), + __metadata("design:paramtypes", [Object]), + __metadata("design:returntype", void 0) + ], MyComponent.prototype, "method", null); + MyComponent = __decorate([ + decorator, + __metadata("design:paramtypes", [service_1.default]) + ], MyComponent); return MyComponent; }()); -__decorate([ - decorator, - __metadata("design:type", Function), - __metadata("design:paramtypes", [Object]), - __metadata("design:returntype", void 0) -], MyComponent.prototype, "method", null); -MyComponent = __decorate([ - decorator, - __metadata("design:paramtypes", [service_1.default]) -], MyComponent); diff --git a/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js b/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js index 9647165b650bc..9e8b4d5278ee7 100644 --- a/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js +++ b/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js @@ -19,11 +19,11 @@ var MyClass = (function () { } MyClass.prototype.doSomething = function () { }; + __decorate([ + decorator, + __metadata("design:type", Function), + __metadata("design:paramtypes", []), + __metadata("design:returntype", void 0) + ], MyClass.prototype, "doSomething", null); return MyClass; }()); -__decorate([ - decorator, - __metadata("design:type", Function), - __metadata("design:paramtypes", []), - __metadata("design:returntype", void 0) -], MyClass.prototype, "doSomething", null); diff --git a/tests/baselines/reference/decoratorMetadataOnInferredType.js b/tests/baselines/reference/decoratorMetadataOnInferredType.js index e7bd55ada6fdd..4c532327d25a5 100644 --- a/tests/baselines/reference/decoratorMetadataOnInferredType.js +++ b/tests/baselines/reference/decoratorMetadataOnInferredType.js @@ -31,10 +31,10 @@ var B = (function () { function B() { this.x = new A(); } + __decorate([ + decorator, + __metadata("design:type", Object) + ], B.prototype, "x", void 0); return B; }()); -__decorate([ - decorator, - __metadata("design:type", Object) -], B.prototype, "x", void 0); exports.B = B; diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js index 404bc9a1d597e..f85bb4767210e 100644 --- a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js @@ -100,16 +100,16 @@ var ClassA = (function () { args[_i] = arguments[_i]; } }; + __decorate([ + annotation1(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [aux1_1.SomeClass1]), + __metadata("design:returntype", void 0) + ], ClassA.prototype, "foo", null); + ClassA = __decorate([ + annotation(), + __metadata("design:paramtypes", [aux_1.SomeClass]) + ], ClassA); return ClassA; }()); -__decorate([ - annotation1(), - __metadata("design:type", Function), - __metadata("design:paramtypes", [aux1_1.SomeClass1]), - __metadata("design:returntype", void 0) -], ClassA.prototype, "foo", null); -ClassA = __decorate([ - annotation(), - __metadata("design:paramtypes", [aux_1.SomeClass]) -], ClassA); exports.ClassA = ClassA; diff --git a/tests/baselines/reference/decoratorMetadataWithConstructorType.js b/tests/baselines/reference/decoratorMetadataWithConstructorType.js index 95c1917834598..6eff4fdc282af 100644 --- a/tests/baselines/reference/decoratorMetadataWithConstructorType.js +++ b/tests/baselines/reference/decoratorMetadataWithConstructorType.js @@ -31,10 +31,10 @@ var B = (function () { function B() { this.x = new A(); } + __decorate([ + decorator, + __metadata("design:type", A) + ], B.prototype, "x", void 0); return B; }()); -__decorate([ - decorator, - __metadata("design:type", A) -], B.prototype, "x", void 0); exports.B = B; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.js index b0e23a78971a6..f59e7f9ec13d2 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.js +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.js @@ -46,10 +46,10 @@ var MyClass = (function () { this.db = db; this.db.doSomething(); } + MyClass = __decorate([ + someDecorator, + __metadata("design:paramtypes", [db_1.db]) + ], MyClass); return MyClass; }()); -MyClass = __decorate([ - someDecorator, - __metadata("design:paramtypes", [db_1.db]) -], MyClass); exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.js index f03190cff0c09..b3a5cded57190 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.js +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.js @@ -46,10 +46,10 @@ var MyClass = (function () { this.db = db; this.db.doSomething(); } + MyClass = __decorate([ + someDecorator, + __metadata("design:paramtypes", [db_1.db]) + ], MyClass); return MyClass; }()); -MyClass = __decorate([ - someDecorator, - __metadata("design:paramtypes", [db_1.db]) -], MyClass); exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.js index c1eca0815274b..a3c170b24e678 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.js +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.js @@ -46,10 +46,10 @@ var MyClass = (function () { this.db = db; this.db.doSomething(); } + MyClass = __decorate([ + someDecorator, + __metadata("design:paramtypes", [db.db]) + ], MyClass); return MyClass; }()); -MyClass = __decorate([ - someDecorator, - __metadata("design:paramtypes", [db.db]) -], MyClass); exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.js index 7d78cf7adbe7e..d6ed8bde3eca1 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.js +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.js @@ -46,11 +46,11 @@ var MyClass = (function () { this.db = db; this.db.doSomething(); } + MyClass = __decorate([ + someDecorator, + __metadata("design:paramtypes", [typeof (_a = (typeof db_1.default !== "undefined" && db_1.default).db) === "function" && _a || Object]) + ], MyClass); return MyClass; + var _a; }()); -MyClass = __decorate([ - someDecorator, - __metadata("design:paramtypes", [typeof (_a = (typeof db_1.default !== "undefined" && db_1.default).db) === "function" && _a || Object]) -], MyClass); exports.MyClass = MyClass; -var _a; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.js index 3f7069902ce1b..a1cc10b7d3d0d 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.js +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.js @@ -46,10 +46,10 @@ var MyClass = (function () { this.db = db; this.db.doSomething(); } + MyClass = __decorate([ + someDecorator, + __metadata("design:paramtypes", [db_1.default]) + ], MyClass); return MyClass; }()); -MyClass = __decorate([ - someDecorator, - __metadata("design:paramtypes", [db_1.default]) -], MyClass); exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.js index 66eb30dc7105d..572787b6f20d6 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.js +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.js @@ -46,10 +46,10 @@ var MyClass = (function () { this.db = db; this.db.doSomething(); } + MyClass = __decorate([ + someDecorator, + __metadata("design:paramtypes", [db_1.default]) + ], MyClass); return MyClass; }()); -MyClass = __decorate([ - someDecorator, - __metadata("design:paramtypes", [db_1.default]) -], MyClass); exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision7.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision7.js index 1dd09c3a1775f..6a45f5230bd00 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision7.js +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision7.js @@ -46,10 +46,10 @@ var MyClass = (function () { this.db = db; this.db.doSomething(); } + MyClass = __decorate([ + someDecorator, + __metadata("design:paramtypes", [Object]) + ], MyClass); return MyClass; }()); -MyClass = __decorate([ - someDecorator, - __metadata("design:paramtypes", [Object]) -], MyClass); exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.js index 830e6bc80ee63..6efdc7f26dbf9 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.js +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.js @@ -46,10 +46,10 @@ var MyClass = (function () { this.db = db; this.db.doSomething(); } + MyClass = __decorate([ + someDecorator, + __metadata("design:paramtypes", [database.db]) + ], MyClass); return MyClass; }()); -MyClass = __decorate([ - someDecorator, - __metadata("design:paramtypes", [database.db]) -], MyClass); exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorOnClass1.js b/tests/baselines/reference/decoratorOnClass1.js index 5cff4c2649c27..7ea46b4698fc8 100644 --- a/tests/baselines/reference/decoratorOnClass1.js +++ b/tests/baselines/reference/decoratorOnClass1.js @@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + C = __decorate([ + dec + ], C); return C; }()); -C = __decorate([ - dec -], C); diff --git a/tests/baselines/reference/decoratorOnClass2.js b/tests/baselines/reference/decoratorOnClass2.js index 77020e7cb7739..84098a1787020 100644 --- a/tests/baselines/reference/decoratorOnClass2.js +++ b/tests/baselines/reference/decoratorOnClass2.js @@ -17,9 +17,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); var C = (function () { function C() { } + C = __decorate([ + dec + ], C); return C; }()); -C = __decorate([ - dec -], C); exports.C = C; diff --git a/tests/baselines/reference/decoratorOnClass3.js b/tests/baselines/reference/decoratorOnClass3.js index fd09a6d8de576..5a3601fc1f3e8 100644 --- a/tests/baselines/reference/decoratorOnClass3.js +++ b/tests/baselines/reference/decoratorOnClass3.js @@ -16,8 +16,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + C = __decorate([ + dec + ], C); return C; }()); -C = __decorate([ - dec -], C); diff --git a/tests/baselines/reference/decoratorOnClass4.js b/tests/baselines/reference/decoratorOnClass4.js index daf19e20327b5..adbe30db662a6 100644 --- a/tests/baselines/reference/decoratorOnClass4.js +++ b/tests/baselines/reference/decoratorOnClass4.js @@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + C = __decorate([ + dec() + ], C); return C; }()); -C = __decorate([ - dec() -], C); diff --git a/tests/baselines/reference/decoratorOnClass5.js b/tests/baselines/reference/decoratorOnClass5.js index 70fc551514070..6741b26373bb9 100644 --- a/tests/baselines/reference/decoratorOnClass5.js +++ b/tests/baselines/reference/decoratorOnClass5.js @@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + C = __decorate([ + dec() + ], C); return C; }()); -C = __decorate([ - dec() -], C); diff --git a/tests/baselines/reference/decoratorOnClass8.js b/tests/baselines/reference/decoratorOnClass8.js index ae50ab75ab8e7..e5cd8812ea780 100644 --- a/tests/baselines/reference/decoratorOnClass8.js +++ b/tests/baselines/reference/decoratorOnClass8.js @@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + C = __decorate([ + dec() + ], C); return C; }()); -C = __decorate([ - dec() -], C); diff --git a/tests/baselines/reference/decoratorOnClassAccessor1.js b/tests/baselines/reference/decoratorOnClassAccessor1.js index 27966350faecd..cf989705b79b4 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor1.js +++ b/tests/baselines/reference/decoratorOnClassAccessor1.js @@ -20,8 +20,8 @@ var C = (function () { enumerable: true, configurable: true }); + __decorate([ + dec + ], C.prototype, "accessor", null); return C; }()); -__decorate([ - dec -], C.prototype, "accessor", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor2.js b/tests/baselines/reference/decoratorOnClassAccessor2.js index 57cb3b50461b3..9e9455b438051 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor2.js +++ b/tests/baselines/reference/decoratorOnClassAccessor2.js @@ -20,8 +20,8 @@ var C = (function () { enumerable: true, configurable: true }); + __decorate([ + dec + ], C.prototype, "accessor", null); return C; }()); -__decorate([ - dec -], C.prototype, "accessor", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor3.js b/tests/baselines/reference/decoratorOnClassAccessor3.js index c02f984e70ac3..8a27914e0c898 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor3.js +++ b/tests/baselines/reference/decoratorOnClassAccessor3.js @@ -20,8 +20,8 @@ var C = (function () { enumerable: true, configurable: true }); + __decorate([ + dec + ], C.prototype, "accessor", null); return C; }()); -__decorate([ - dec -], C.prototype, "accessor", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor4.js b/tests/baselines/reference/decoratorOnClassAccessor4.js index 0e0af58f526be..85b35e95cef54 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor4.js +++ b/tests/baselines/reference/decoratorOnClassAccessor4.js @@ -20,8 +20,8 @@ var C = (function () { enumerable: true, configurable: true }); + __decorate([ + dec + ], C.prototype, "accessor", null); return C; }()); -__decorate([ - dec -], C.prototype, "accessor", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor5.js b/tests/baselines/reference/decoratorOnClassAccessor5.js index c7d5d109cc07f..12ec7a08adcb9 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor5.js +++ b/tests/baselines/reference/decoratorOnClassAccessor5.js @@ -20,8 +20,8 @@ var C = (function () { enumerable: true, configurable: true }); + __decorate([ + dec + ], C.prototype, "accessor", null); return C; }()); -__decorate([ - dec -], C.prototype, "accessor", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor6.js b/tests/baselines/reference/decoratorOnClassAccessor6.js index 8ac40e722995c..d5477deb5af10 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor6.js +++ b/tests/baselines/reference/decoratorOnClassAccessor6.js @@ -20,8 +20,8 @@ var C = (function () { enumerable: true, configurable: true }); + __decorate([ + dec + ], C.prototype, "accessor", null); return C; }()); -__decorate([ - dec -], C.prototype, "accessor", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor7.js b/tests/baselines/reference/decoratorOnClassAccessor7.js index 5ae0c29c14b38..26f0ce5c215d1 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor7.js +++ b/tests/baselines/reference/decoratorOnClassAccessor7.js @@ -48,11 +48,11 @@ var A = (function () { enumerable: true, configurable: true }); + __decorate([ + dec1 + ], A.prototype, "x", null); return A; }()); -__decorate([ - dec1 -], A.prototype, "x", null); var B = (function () { function B() { } @@ -62,11 +62,11 @@ var B = (function () { enumerable: true, configurable: true }); + __decorate([ + dec2 + ], B.prototype, "x", null); return B; }()); -__decorate([ - dec2 -], B.prototype, "x", null); var C = (function () { function C() { } @@ -76,11 +76,11 @@ var C = (function () { enumerable: true, configurable: true }); + __decorate([ + dec1 + ], C.prototype, "x", null); return C; }()); -__decorate([ - dec1 -], C.prototype, "x", null); var D = (function () { function D() { } @@ -90,11 +90,11 @@ var D = (function () { enumerable: true, configurable: true }); + __decorate([ + dec2 + ], D.prototype, "x", null); return D; }()); -__decorate([ - dec2 -], D.prototype, "x", null); var E = (function () { function E() { } @@ -104,11 +104,11 @@ var E = (function () { enumerable: true, configurable: true }); + __decorate([ + dec1 + ], E.prototype, "x", null); return E; }()); -__decorate([ - dec1 -], E.prototype, "x", null); var F = (function () { function F() { } @@ -118,8 +118,8 @@ var F = (function () { enumerable: true, configurable: true }); + __decorate([ + dec1 + ], F.prototype, "x", null); return F; }()); -__decorate([ - dec1 -], F.prototype, "x", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor8.js b/tests/baselines/reference/decoratorOnClassAccessor8.js index 7347e630eabc6..f121d1486237c 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor8.js +++ b/tests/baselines/reference/decoratorOnClassAccessor8.js @@ -48,13 +48,13 @@ var A = (function () { enumerable: true, configurable: true }); + __decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", [Number]) + ], A.prototype, "x", null); return A; }()); -__decorate([ - dec, - __metadata("design:type", Object), - __metadata("design:paramtypes", [Number]) -], A.prototype, "x", null); var B = (function () { function B() { } @@ -64,13 +64,13 @@ var B = (function () { enumerable: true, configurable: true }); + __decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) + ], B.prototype, "x", null); return B; }()); -__decorate([ - dec, - __metadata("design:type", Number), - __metadata("design:paramtypes", [Number]) -], B.prototype, "x", null); var C = (function () { function C() { } @@ -80,13 +80,13 @@ var C = (function () { enumerable: true, configurable: true }); + __decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) + ], C.prototype, "x", null); return C; }()); -__decorate([ - dec, - __metadata("design:type", Number), - __metadata("design:paramtypes", [Number]) -], C.prototype, "x", null); var D = (function () { function D() { } @@ -96,13 +96,13 @@ var D = (function () { enumerable: true, configurable: true }); + __decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", [Number]) + ], D.prototype, "x", null); return D; }()); -__decorate([ - dec, - __metadata("design:type", Object), - __metadata("design:paramtypes", [Number]) -], D.prototype, "x", null); var E = (function () { function E() { } @@ -111,13 +111,13 @@ var E = (function () { enumerable: true, configurable: true }); + __decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", []) + ], E.prototype, "x", null); return E; }()); -__decorate([ - dec, - __metadata("design:type", Object), - __metadata("design:paramtypes", []) -], E.prototype, "x", null); var F = (function () { function F() { } @@ -126,10 +126,10 @@ var F = (function () { enumerable: true, configurable: true }); + __decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) + ], F.prototype, "x", null); return F; }()); -__decorate([ - dec, - __metadata("design:type", Number), - __metadata("design:paramtypes", [Number]) -], F.prototype, "x", null); diff --git a/tests/baselines/reference/decoratorOnClassConstructor2.js b/tests/baselines/reference/decoratorOnClassConstructor2.js index 999ffbc5e60e8..2e444b62e80ca 100644 --- a/tests/baselines/reference/decoratorOnClassConstructor2.js +++ b/tests/baselines/reference/decoratorOnClassConstructor2.js @@ -53,9 +53,9 @@ var C = (function (_super) { function C(prop) { return _super.call(this) || this; } + C = __decorate([ + __param(0, _0_ts_2.foo) + ], C); return C; }(_0_ts_1.base)); -C = __decorate([ - __param(0, _0_ts_2.foo) -], C); exports.C = C; diff --git a/tests/baselines/reference/decoratorOnClassConstructor3.js b/tests/baselines/reference/decoratorOnClassConstructor3.js index 98edaebe920b8..7d9573217c411 100644 --- a/tests/baselines/reference/decoratorOnClassConstructor3.js +++ b/tests/baselines/reference/decoratorOnClassConstructor3.js @@ -56,9 +56,9 @@ var C = (function (_super) { function C(prop) { return _super.call(this) || this; } + C = __decorate([ + __param(0, _0_2.foo) + ], C); return C; }(_0_1.base)); -C = __decorate([ - __param(0, _0_2.foo) -], C); exports.C = C; diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.js b/tests/baselines/reference/decoratorOnClassConstructor4.js index 7528694341790..62fc93cbaa083 100644 --- a/tests/baselines/reference/decoratorOnClassConstructor4.js +++ b/tests/baselines/reference/decoratorOnClassConstructor4.js @@ -37,27 +37,27 @@ var __metadata = (this && this.__metadata) || function (k, v) { var A = (function () { function A() { } + A = __decorate([ + dec + ], A); return A; }()); -A = __decorate([ - dec -], A); var B = (function () { function B(x) { } + B = __decorate([ + dec, + __metadata("design:paramtypes", [Number]) + ], B); return B; }()); -B = __decorate([ - dec, - __metadata("design:paramtypes", [Number]) -], B); var C = (function (_super) { __extends(C, _super); function C() { return _super !== null && _super.apply(this, arguments) || this; } + C = __decorate([ + dec + ], C); return C; }(A)); -C = __decorate([ - dec -], C); diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter1.js b/tests/baselines/reference/decoratorOnClassConstructorParameter1.js index 176e2309ae05f..fe04f569e30a7 100644 --- a/tests/baselines/reference/decoratorOnClassConstructorParameter1.js +++ b/tests/baselines/reference/decoratorOnClassConstructorParameter1.js @@ -18,8 +18,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { var C = (function () { function C(p) { } + C = __decorate([ + __param(0, dec) + ], C); return C; }()); -C = __decorate([ - __param(0, dec) -], C); diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js index e14f035880878..8d02bd467d6dc 100644 --- a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js +++ b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js @@ -18,8 +18,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { var C = (function () { function C(public, p) { } + C = __decorate([ + __param(1, dec) + ], C); return C; }()); -C = __decorate([ - __param(1, dec) -], C); diff --git a/tests/baselines/reference/decoratorOnClassMethod1.js b/tests/baselines/reference/decoratorOnClassMethod1.js index b93d7f88771ed..ef029b845431b 100644 --- a/tests/baselines/reference/decoratorOnClassMethod1.js +++ b/tests/baselines/reference/decoratorOnClassMethod1.js @@ -16,8 +16,8 @@ var C = (function () { function C() { } C.prototype.method = function () { }; + __decorate([ + dec + ], C.prototype, "method", null); return C; }()); -__decorate([ - dec -], C.prototype, "method", null); diff --git a/tests/baselines/reference/decoratorOnClassMethod10.js b/tests/baselines/reference/decoratorOnClassMethod10.js index bfa57f0aeb704..f90251d619694 100644 --- a/tests/baselines/reference/decoratorOnClassMethod10.js +++ b/tests/baselines/reference/decoratorOnClassMethod10.js @@ -16,8 +16,8 @@ var C = (function () { function C() { } C.prototype.method = function () { }; + __decorate([ + dec + ], C.prototype, "method", null); return C; }()); -__decorate([ - dec -], C.prototype, "method", null); diff --git a/tests/baselines/reference/decoratorOnClassMethod11.js b/tests/baselines/reference/decoratorOnClassMethod11.js index c703459b88d65..f1589a39286fa 100644 --- a/tests/baselines/reference/decoratorOnClassMethod11.js +++ b/tests/baselines/reference/decoratorOnClassMethod11.js @@ -22,9 +22,9 @@ var M; } C.prototype.decorator = function (target, key) { }; C.prototype.method = function () { }; + __decorate([ + this.decorator + ], C.prototype, "method", null); return C; }()); - __decorate([ - this.decorator - ], C.prototype, "method", null); })(M || (M = {})); diff --git a/tests/baselines/reference/decoratorOnClassMethod12.js b/tests/baselines/reference/decoratorOnClassMethod12.js index c9ff30307f032..089f5961d9ca5 100644 --- a/tests/baselines/reference/decoratorOnClassMethod12.js +++ b/tests/baselines/reference/decoratorOnClassMethod12.js @@ -40,9 +40,9 @@ var M; return _super !== null && _super.apply(this, arguments) || this; } C.prototype.method = function () { }; + __decorate([ + _super.decorator + ], C.prototype, "method", null); return C; }(S)); - __decorate([ - _super.decorator - ], C.prototype, "method", null); })(M || (M = {})); diff --git a/tests/baselines/reference/decoratorOnClassMethod2.js b/tests/baselines/reference/decoratorOnClassMethod2.js index 98ad8ad43ad78..5db2922ed7187 100644 --- a/tests/baselines/reference/decoratorOnClassMethod2.js +++ b/tests/baselines/reference/decoratorOnClassMethod2.js @@ -16,8 +16,8 @@ var C = (function () { function C() { } C.prototype.method = function () { }; + __decorate([ + dec + ], C.prototype, "method", null); return C; }()); -__decorate([ - dec -], C.prototype, "method", null); diff --git a/tests/baselines/reference/decoratorOnClassMethod3.js b/tests/baselines/reference/decoratorOnClassMethod3.js index 4a5943681d4cf..30f527368f28b 100644 --- a/tests/baselines/reference/decoratorOnClassMethod3.js +++ b/tests/baselines/reference/decoratorOnClassMethod3.js @@ -16,8 +16,8 @@ var C = (function () { function C() { } C.prototype.method = function () { }; + __decorate([ + dec + ], C.prototype, "method", null); return C; }()); -__decorate([ - dec -], C.prototype, "method", null); diff --git a/tests/baselines/reference/decoratorOnClassMethod8.js b/tests/baselines/reference/decoratorOnClassMethod8.js index c1ad826cab0ef..bf8c06d9b90f6 100644 --- a/tests/baselines/reference/decoratorOnClassMethod8.js +++ b/tests/baselines/reference/decoratorOnClassMethod8.js @@ -16,8 +16,8 @@ var C = (function () { function C() { } C.prototype.method = function () { }; + __decorate([ + dec + ], C.prototype, "method", null); return C; }()); -__decorate([ - dec -], C.prototype, "method", null); diff --git a/tests/baselines/reference/decoratorOnClassMethodOverload2.js b/tests/baselines/reference/decoratorOnClassMethodOverload2.js index db077dd7b516b..eafa5da711097 100644 --- a/tests/baselines/reference/decoratorOnClassMethodOverload2.js +++ b/tests/baselines/reference/decoratorOnClassMethodOverload2.js @@ -18,8 +18,8 @@ var C = (function () { function C() { } C.prototype.method = function () { }; + __decorate([ + dec + ], C.prototype, "method", null); return C; }()); -__decorate([ - dec -], C.prototype, "method", null); diff --git a/tests/baselines/reference/decoratorOnClassMethodParameter1.js b/tests/baselines/reference/decoratorOnClassMethodParameter1.js index d5d8599d7a853..efb1e4abff2cb 100644 --- a/tests/baselines/reference/decoratorOnClassMethodParameter1.js +++ b/tests/baselines/reference/decoratorOnClassMethodParameter1.js @@ -19,8 +19,8 @@ var C = (function () { function C() { } C.prototype.method = function (p) { }; + __decorate([ + __param(0, dec) + ], C.prototype, "method", null); return C; }()); -__decorate([ - __param(0, dec) -], C.prototype, "method", null); diff --git a/tests/baselines/reference/decoratorOnClassProperty1.js b/tests/baselines/reference/decoratorOnClassProperty1.js index 6547e0bdb1873..65a399332f161 100644 --- a/tests/baselines/reference/decoratorOnClassProperty1.js +++ b/tests/baselines/reference/decoratorOnClassProperty1.js @@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + __decorate([ + dec + ], C.prototype, "prop", void 0); return C; }()); -__decorate([ - dec -], C.prototype, "prop", void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty10.js b/tests/baselines/reference/decoratorOnClassProperty10.js index 174f26a315a72..9df40eaf83a38 100644 --- a/tests/baselines/reference/decoratorOnClassProperty10.js +++ b/tests/baselines/reference/decoratorOnClassProperty10.js @@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + __decorate([ + dec() + ], C.prototype, "prop", void 0); return C; }()); -__decorate([ - dec() -], C.prototype, "prop", void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty11.js b/tests/baselines/reference/decoratorOnClassProperty11.js index c901637402d70..8b771caf8b515 100644 --- a/tests/baselines/reference/decoratorOnClassProperty11.js +++ b/tests/baselines/reference/decoratorOnClassProperty11.js @@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + __decorate([ + dec + ], C.prototype, "prop", void 0); return C; }()); -__decorate([ - dec -], C.prototype, "prop", void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty2.js b/tests/baselines/reference/decoratorOnClassProperty2.js index ceaf43caa59cf..3ab2b515e3c02 100644 --- a/tests/baselines/reference/decoratorOnClassProperty2.js +++ b/tests/baselines/reference/decoratorOnClassProperty2.js @@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + __decorate([ + dec + ], C.prototype, "prop", void 0); return C; }()); -__decorate([ - dec -], C.prototype, "prop", void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty3.js b/tests/baselines/reference/decoratorOnClassProperty3.js index 8436be9396853..9c0d3f90e42f2 100644 --- a/tests/baselines/reference/decoratorOnClassProperty3.js +++ b/tests/baselines/reference/decoratorOnClassProperty3.js @@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + __decorate([ + dec + ], C.prototype, "prop", void 0); return C; }()); -__decorate([ - dec -], C.prototype, "prop", void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty6.js b/tests/baselines/reference/decoratorOnClassProperty6.js index c7f5490c64869..823a652af2404 100644 --- a/tests/baselines/reference/decoratorOnClassProperty6.js +++ b/tests/baselines/reference/decoratorOnClassProperty6.js @@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + __decorate([ + dec + ], C.prototype, "prop", void 0); return C; }()); -__decorate([ - dec -], C.prototype, "prop", void 0); diff --git a/tests/baselines/reference/decoratorOnClassProperty7.js b/tests/baselines/reference/decoratorOnClassProperty7.js index 828d548ff6b29..134f35022e04a 100644 --- a/tests/baselines/reference/decoratorOnClassProperty7.js +++ b/tests/baselines/reference/decoratorOnClassProperty7.js @@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var C = (function () { function C() { } + __decorate([ + dec + ], C.prototype, "prop", void 0); return C; }()); -__decorate([ - dec -], C.prototype, "prop", void 0); diff --git a/tests/baselines/reference/decoratorWithUnderscoreMethod.js b/tests/baselines/reference/decoratorWithUnderscoreMethod.js index 9ac2a88aa5162..ace73ccf5953e 100644 --- a/tests/baselines/reference/decoratorWithUnderscoreMethod.js +++ b/tests/baselines/reference/decoratorWithUnderscoreMethod.js @@ -29,8 +29,8 @@ var A = (function () { A.prototype.__foo = function (bar) { // do something with bar }; + __decorate([ + dec() + ], A.prototype, "__foo"); return A; }()); -__decorate([ - dec() -], A.prototype, "__foo"); diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js index 8703215a631f4..3ca0d13e6713e 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js @@ -83,6 +83,6 @@ var Derived = (function (_super) { enumerable: true, configurable: true }); + Derived.a = _this = _super.call(this) || this; return Derived; }(Base)); -Derived.a = _this = _super.call(this) || this; diff --git a/tests/baselines/reference/emitDecoratorMetadata_object.js b/tests/baselines/reference/emitDecoratorMetadata_object.js index a8c8c360dfc51..ff4a65710a792 100644 --- a/tests/baselines/reference/emitDecoratorMetadata_object.js +++ b/tests/baselines/reference/emitDecoratorMetadata_object.js @@ -24,15 +24,15 @@ var A = (function () { function A(hi) { } A.prototype.method = function (there) { }; + __decorate([ + MyMethodDecorator, + __metadata("design:type", Function), + __metadata("design:paramtypes", [Object]), + __metadata("design:returntype", void 0) + ], A.prototype, "method", null); + A = __decorate([ + MyClassDecorator, + __metadata("design:paramtypes", [Object]) + ], A); return A; }()); -__decorate([ - MyMethodDecorator, - __metadata("design:type", Function), - __metadata("design:paramtypes", [Object]), - __metadata("design:returntype", void 0) -], A.prototype, "method", null); -A = __decorate([ - MyClassDecorator, - __metadata("design:paramtypes", [Object]) -], A); diff --git a/tests/baselines/reference/emitDecoratorMetadata_restArgs.js b/tests/baselines/reference/emitDecoratorMetadata_restArgs.js index 862a1baa02535..3f1ffd54bce75 100644 --- a/tests/baselines/reference/emitDecoratorMetadata_restArgs.js +++ b/tests/baselines/reference/emitDecoratorMetadata_restArgs.js @@ -40,18 +40,18 @@ var A = (function () { args[_i] = arguments[_i]; } }; + __decorate([ + MyMethodDecorator, + __metadata("design:type", Function), + __metadata("design:paramtypes", [Object]), + __metadata("design:returntype", void 0) + ], A.prototype, "method", null); + A = __decorate([ + MyClassDecorator, + __metadata("design:paramtypes", [Object]) + ], A); return A; }()); -__decorate([ - MyMethodDecorator, - __metadata("design:type", Function), - __metadata("design:paramtypes", [Object]), - __metadata("design:returntype", void 0) -], A.prototype, "method", null); -A = __decorate([ - MyClassDecorator, - __metadata("design:paramtypes", [Object]) -], A); var B = (function () { function B() { var args = []; @@ -65,15 +65,15 @@ var B = (function () { args[_i] = arguments[_i]; } }; + __decorate([ + MyMethodDecorator, + __metadata("design:type", Function), + __metadata("design:paramtypes", [String]), + __metadata("design:returntype", void 0) + ], B.prototype, "method", null); + B = __decorate([ + MyClassDecorator, + __metadata("design:paramtypes", [Number]) + ], B); return B; }()); -__decorate([ - MyMethodDecorator, - __metadata("design:type", Function), - __metadata("design:paramtypes", [String]), - __metadata("design:returntype", void 0) -], B.prototype, "method", null); -B = __decorate([ - MyClassDecorator, - __metadata("design:paramtypes", [Number]) -], B); diff --git a/tests/baselines/reference/errorSuperCalls.js b/tests/baselines/reference/errorSuperCalls.js index ebe9de27f42c3..db4f0ac1798ff 100644 --- a/tests/baselines/reference/errorSuperCalls.js +++ b/tests/baselines/reference/errorSuperCalls.js @@ -124,10 +124,10 @@ var NoBase = (function () { enumerable: true, configurable: true }); + //super call in static class member initializer with no base type + NoBase.k = _this = _super.call(this) || this; return NoBase; }()); -//super call in static class member initializer with no base type -NoBase.k = _this = _super.call(this) || this; var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index b33755e245ae9..3163007e742bd 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -180,10 +180,10 @@ var SomeBase = (function () { SomeBase.prototype.publicFunc = function () { }; SomeBase.privateStaticFunc = function () { }; SomeBase.publicStaticFunc = function () { }; + SomeBase.privateStaticMember = 0; + SomeBase.publicStaticMember = 0; return SomeBase; }()); -SomeBase.privateStaticMember = 0; -SomeBase.publicStaticMember = 0; //super.publicInstanceMemberNotFunction in constructor of derived class //super.publicInstanceMemberNotFunction in instance member function of derived class //super.publicInstanceMemberNotFunction in instance member accessor(get and set) of derived class diff --git a/tests/baselines/reference/es3defaultAliasIsQuoted.js b/tests/baselines/reference/es3defaultAliasIsQuoted.js index ea12fc7a3d62d..ccc2085f97af9 100644 --- a/tests/baselines/reference/es3defaultAliasIsQuoted.js +++ b/tests/baselines/reference/es3defaultAliasIsQuoted.js @@ -19,9 +19,9 @@ exports.__esModule = true; var Foo = (function () { function Foo() { } + Foo.CONSTANT = "Foo"; return Foo; }()); -Foo.CONSTANT = "Foo"; exports.Foo = Foo; function assert(value) { if (!value) diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index 9d66d2d8dc801..d727ab49a341a 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -119,9 +119,9 @@ var Foo = (function (_super) { } Foo.prototype.bar = function () { return 0; }; Foo.prototype.boo = function (x) { return x; }; + Foo.statVal = 0; return Foo; }(Bar)); -Foo.statVal = 0; var f = new Foo(); //class GetSetMonster { // // attack(target) { diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index e86d04bccd0d8..216a05ac2eb0b 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -288,9 +288,9 @@ var Statics = (function () { Statics.baz = function () { return ""; }; + Statics.foo = 1; return Statics; }()); -Statics.foo = 1; var stat = new Statics(); var ImplementsInterface = (function () { function ImplementsInterface() { diff --git a/tests/baselines/reference/es6modulekindWithES5Target.js b/tests/baselines/reference/es6modulekindWithES5Target.js index 8778d17878631..b813bc01992b6 100644 --- a/tests/baselines/reference/es6modulekindWithES5Target.js +++ b/tests/baselines/reference/es6modulekindWithES5Target.js @@ -31,22 +31,22 @@ var C = (function () { this.p = 1; } C.prototype.method = function () { }; + C.s = 0; return C; }()); export { C }; -C.s = 0; export { C as C2 }; var D = (function () { function D() { this.p = 1; } D.prototype.method = function () { }; + D.s = 0; + D = __decorate([ + foo + ], D); return D; }()); -D.s = 0; -D = __decorate([ - foo -], D); export { D }; export { D as D2 }; var E = (function () { diff --git a/tests/baselines/reference/es6modulekindWithES5Target11.js b/tests/baselines/reference/es6modulekindWithES5Target11.js index ed3d44cb5380a..e958b0ca1c6b1 100644 --- a/tests/baselines/reference/es6modulekindWithES5Target11.js +++ b/tests/baselines/reference/es6modulekindWithES5Target11.js @@ -15,17 +15,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -var C = C_1 = (function () { - function C() { +var C = (function () { + var C = C_1 = function C() { this.p = 1; - } + }; C.x = function () { return C_1.y; }; C.prototype.method = function () { }; + C.y = 1; + C = C_1 = __decorate([ + foo + ], C); return C; + var C_1; }()); -C.y = 1; -C = C_1 = __decorate([ - foo -], C); export default C; -var C_1; diff --git a/tests/baselines/reference/es6modulekindWithES5Target2.js b/tests/baselines/reference/es6modulekindWithES5Target2.js index 8b2f6dd3c53de..a67bba11e2359 100644 --- a/tests/baselines/reference/es6modulekindWithES5Target2.js +++ b/tests/baselines/reference/es6modulekindWithES5Target2.js @@ -12,7 +12,7 @@ var C = (function () { this.p = 1; } C.prototype.method = function () { }; + C.s = 0; return C; }()); export default C; -C.s = 0; diff --git a/tests/baselines/reference/es6modulekindWithES5Target3.js b/tests/baselines/reference/es6modulekindWithES5Target3.js index 87dd04090970f..2a9778691a691 100644 --- a/tests/baselines/reference/es6modulekindWithES5Target3.js +++ b/tests/baselines/reference/es6modulekindWithES5Target3.js @@ -19,10 +19,10 @@ var D = (function () { this.p = 1; } D.prototype.method = function () { }; + D.s = 0; + D = __decorate([ + foo + ], D); return D; }()); -D.s = 0; -D = __decorate([ - foo -], D); export default D; diff --git a/tests/baselines/reference/extendFromAny.js b/tests/baselines/reference/extendFromAny.js index f2a7f945cc950..33610fd8b1f30 100644 --- a/tests/baselines/reference/extendFromAny.js +++ b/tests/baselines/reference/extendFromAny.js @@ -30,9 +30,9 @@ var C = (function (_super) { _this.known = 1; return _this; } + C.sknown = 2; return C; }(Base)); -C.sknown = 2; var c = new C(); c.known.length; // error, 'known' has no 'length' property C.sknown.length; // error, 'sknown' has no 'length' property diff --git a/tests/baselines/reference/forwardRefInClassProperties.js b/tests/baselines/reference/forwardRefInClassProperties.js index 1dc455729ab59..424d950055d2d 100644 --- a/tests/baselines/reference/forwardRefInClassProperties.js +++ b/tests/baselines/reference/forwardRefInClassProperties.js @@ -25,7 +25,7 @@ var Test = (function () { var a = b; // Block-scoped variable 'b' used before its declaration var b = 3; }; + Test._B = Test._A; // undefined, no error/warning + Test._A = 3; return Test; }()); -Test._B = Test._A; // undefined, no error/warning -Test._A = 3; diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 8b0889f28ae54..a5d5a4183270c 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -616,219 +616,219 @@ var x48 = (function () { var x49 = (function () { function x49() { } + x49.member = function () { return [d1, d2]; }; return x49; }()); -x49.member = function () { return [d1, d2]; }; var x50 = (function () { function x50() { } + x50.member = function () { return [d1, d2]; }; return x50; }()); -x50.member = function () { return [d1, d2]; }; var x51 = (function () { function x51() { } + x51.member = function named() { return [d1, d2]; }; return x51; }()); -x51.member = function named() { return [d1, d2]; }; var x52 = (function () { function x52() { } + x52.member = function () { return [d1, d2]; }; return x52; }()); -x52.member = function () { return [d1, d2]; }; var x53 = (function () { function x53() { } + x53.member = function () { return [d1, d2]; }; return x53; }()); -x53.member = function () { return [d1, d2]; }; var x54 = (function () { function x54() { } + x54.member = function named() { return [d1, d2]; }; return x54; }()); -x54.member = function named() { return [d1, d2]; }; var x55 = (function () { function x55() { } + x55.member = [d1, d2]; return x55; }()); -x55.member = [d1, d2]; var x56 = (function () { function x56() { } + x56.member = [d1, d2]; return x56; }()); -x56.member = [d1, d2]; var x57 = (function () { function x57() { } + x57.member = [d1, d2]; return x57; }()); -x57.member = [d1, d2]; var x58 = (function () { function x58() { } + x58.member = { n: [d1, d2] }; return x58; }()); -x58.member = { n: [d1, d2] }; var x59 = (function () { function x59() { } + x59.member = function (n) { var n; return null; }; return x59; }()); -x59.member = function (n) { var n; return null; }; var x60 = (function () { function x60() { } + x60.member = { func: function (n) { return [d1, d2]; } }; return x60; }()); -x60.member = { func: function (n) { return [d1, d2]; } }; var x61 = (function () { function x61() { } + x61.member = function () { return [d1, d2]; }; return x61; }()); -x61.member = function () { return [d1, d2]; }; var x62 = (function () { function x62() { } + x62.member = function () { return [d1, d2]; }; return x62; }()); -x62.member = function () { return [d1, d2]; }; var x63 = (function () { function x63() { } + x63.member = function named() { return [d1, d2]; }; return x63; }()); -x63.member = function named() { return [d1, d2]; }; var x64 = (function () { function x64() { } + x64.member = function () { return [d1, d2]; }; return x64; }()); -x64.member = function () { return [d1, d2]; }; var x65 = (function () { function x65() { } + x65.member = function () { return [d1, d2]; }; return x65; }()); -x65.member = function () { return [d1, d2]; }; var x66 = (function () { function x66() { } + x66.member = function named() { return [d1, d2]; }; return x66; }()); -x66.member = function named() { return [d1, d2]; }; var x67 = (function () { function x67() { } + x67.member = [d1, d2]; return x67; }()); -x67.member = [d1, d2]; var x68 = (function () { function x68() { } + x68.member = [d1, d2]; return x68; }()); -x68.member = [d1, d2]; var x69 = (function () { function x69() { } + x69.member = [d1, d2]; return x69; }()); -x69.member = [d1, d2]; var x70 = (function () { function x70() { } + x70.member = { n: [d1, d2] }; return x70; }()); -x70.member = { n: [d1, d2] }; var x71 = (function () { function x71() { } + x71.member = function (n) { var n; return null; }; return x71; }()); -x71.member = function (n) { var n; return null; }; var x72 = (function () { function x72() { } + x72.member = { func: function (n) { return [d1, d2]; } }; return x72; }()); -x72.member = { func: function (n) { return [d1, d2]; } }; var x73 = (function () { function x73() { } + x73.member = function () { return [d1, d2]; }; return x73; }()); -x73.member = function () { return [d1, d2]; }; var x74 = (function () { function x74() { } + x74.member = function () { return [d1, d2]; }; return x74; }()); -x74.member = function () { return [d1, d2]; }; var x75 = (function () { function x75() { } + x75.member = function named() { return [d1, d2]; }; return x75; }()); -x75.member = function named() { return [d1, d2]; }; var x76 = (function () { function x76() { } + x76.member = function () { return [d1, d2]; }; return x76; }()); -x76.member = function () { return [d1, d2]; }; var x77 = (function () { function x77() { } + x77.member = function () { return [d1, d2]; }; return x77; }()); -x77.member = function () { return [d1, d2]; }; var x78 = (function () { function x78() { } + x78.member = function named() { return [d1, d2]; }; return x78; }()); -x78.member = function named() { return [d1, d2]; }; var x79 = (function () { function x79() { } + x79.member = [d1, d2]; return x79; }()); -x79.member = [d1, d2]; var x80 = (function () { function x80() { } + x80.member = [d1, d2]; return x80; }()); -x80.member = [d1, d2]; var x81 = (function () { function x81() { } + x81.member = [d1, d2]; return x81; }()); -x81.member = [d1, d2]; var x82 = (function () { function x82() { } + x82.member = { n: [d1, d2] }; return x82; }()); -x82.member = { n: [d1, d2] }; var x83 = (function () { function x83() { } + x83.member = function (n) { var n; return null; }; return x83; }()); -x83.member = function (n) { var n; return null; }; var x84 = (function () { function x84() { } + x84.member = { func: function (n) { return [d1, d2]; } }; return x84; }()); -x84.member = { func: function (n) { return [d1, d2]; } }; var x85 = (function () { function x85(parm) { if (parm === void 0) { parm = function () { return [d1, d2]; }; } diff --git a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js index 053fa785ee01a..2039e459572ac 100644 --- a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js +++ b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js @@ -25,9 +25,9 @@ var Foo = (function () { Foo.f = function (xs) { return xs.reverse(); }; + Foo.a = function (n) { }; + Foo.c = []; + Foo.d = false || (function (x) { return x || undefined; })(null); + Foo.e = function (x) { return null; }; return Foo; }()); -Foo.a = function (n) { }; -Foo.c = []; -Foo.d = false || (function (x) { return x || undefined; })(null); -Foo.e = function (x) { return null; }; diff --git a/tests/baselines/reference/gettersAndSetters.js b/tests/baselines/reference/gettersAndSetters.js index 265a1210b16f4..16d66c7dc71f6 100644 --- a/tests/baselines/reference/gettersAndSetters.js +++ b/tests/baselines/reference/gettersAndSetters.js @@ -65,9 +65,9 @@ var C = (function () { enumerable: true, configurable: true }); + C.barBack = ""; return C; }()); -C.barBack = ""; var c = new C(); var foo = c.Foo; c.Foo = "foov"; diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js index bf66829a4350d..4fc7b99a813d3 100644 --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -56,17 +56,17 @@ var C = (function () { } C.prototype.method = function (x) { }; + tslib_1.__decorate([ + tslib_1.__param(0, dec), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", [Number]), + tslib_1.__metadata("design:returntype", void 0) + ], C.prototype, "method", null); + C = tslib_1.__decorate([ + dec + ], C); return C; }()); -tslib_1.__decorate([ - tslib_1.__param(0, dec), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Number]), - tslib_1.__metadata("design:returntype", void 0) -], C.prototype, "method", null); -C = tslib_1.__decorate([ - dec -], C); //// [script.js] var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || @@ -107,14 +107,14 @@ var C = (function () { } C.prototype.method = function (x) { }; + __decorate([ + __param(0, dec), + __metadata("design:type", Function), + __metadata("design:paramtypes", [Number]), + __metadata("design:returntype", void 0) + ], C.prototype, "method", null); + C = __decorate([ + dec + ], C); return C; }()); -__decorate([ - __param(0, dec), - __metadata("design:type", Function), - __metadata("design:paramtypes", [Number]), - __metadata("design:returntype", void 0) -], C.prototype, "method", null); -C = __decorate([ - dec -], C); diff --git a/tests/baselines/reference/importHelpersInIsolatedModules.js b/tests/baselines/reference/importHelpersInIsolatedModules.js index 26a9cafa18883..561bfebb351ca 100644 --- a/tests/baselines/reference/importHelpersInIsolatedModules.js +++ b/tests/baselines/reference/importHelpersInIsolatedModules.js @@ -56,17 +56,17 @@ var C = (function () { } C.prototype.method = function (x) { }; + tslib_1.__decorate([ + tslib_1.__param(0, dec), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", [Number]), + tslib_1.__metadata("design:returntype", void 0) + ], C.prototype, "method", null); + C = tslib_1.__decorate([ + dec + ], C); return C; }()); -tslib_1.__decorate([ - tslib_1.__param(0, dec), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Number]), - tslib_1.__metadata("design:returntype", void 0) -], C.prototype, "method", null); -C = tslib_1.__decorate([ - dec -], C); //// [script.js] var tslib_1 = require("tslib"); var A = (function () { @@ -86,14 +86,14 @@ var C = (function () { } C.prototype.method = function (x) { }; + tslib_1.__decorate([ + tslib_1.__param(0, dec), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", [Number]), + tslib_1.__metadata("design:returntype", void 0) + ], C.prototype, "method", null); + C = tslib_1.__decorate([ + dec + ], C); return C; }()); -tslib_1.__decorate([ - tslib_1.__param(0, dec), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Number]), - tslib_1.__metadata("design:returntype", void 0) -], C.prototype, "method", null); -C = tslib_1.__decorate([ - dec -], C); diff --git a/tests/baselines/reference/importHelpersNoHelpers.js b/tests/baselines/reference/importHelpersNoHelpers.js index 5b98b61da2045..9e20fc13543c9 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.js +++ b/tests/baselines/reference/importHelpersNoHelpers.js @@ -55,17 +55,17 @@ var C = (function () { } C.prototype.method = function (x) { }; + tslib_1.__decorate([ + tslib_1.__param(0, dec), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", [Number]), + tslib_1.__metadata("design:returntype", void 0) + ], C.prototype, "method", null); + C = tslib_1.__decorate([ + dec + ], C); return C; }()); -tslib_1.__decorate([ - tslib_1.__param(0, dec), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Number]), - tslib_1.__metadata("design:returntype", void 0) -], C.prototype, "method", null); -C = tslib_1.__decorate([ - dec -], C); var o = { a: 1 }; var y = tslib_1.__assign({}, o); var x = tslib_1.__rest(y, []); @@ -109,14 +109,14 @@ var C = (function () { } C.prototype.method = function (x) { }; + __decorate([ + __param(0, dec), + __metadata("design:type", Function), + __metadata("design:paramtypes", [Number]), + __metadata("design:returntype", void 0) + ], C.prototype, "method", null); + C = __decorate([ + dec + ], C); return C; }()); -__decorate([ - __param(0, dec), - __metadata("design:type", Function), - __metadata("design:paramtypes", [Number]), - __metadata("design:returntype", void 0) -], C.prototype, "method", null); -C = __decorate([ - dec -], C); diff --git a/tests/baselines/reference/importHelpersNoModule.js b/tests/baselines/reference/importHelpersNoModule.js index 36a326e124d38..988bec04a427d 100644 --- a/tests/baselines/reference/importHelpersNoModule.js +++ b/tests/baselines/reference/importHelpersNoModule.js @@ -48,17 +48,17 @@ var C = (function () { } C.prototype.method = function (x) { }; + tslib_1.__decorate([ + tslib_1.__param(0, dec), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", [Number]), + tslib_1.__metadata("design:returntype", void 0) + ], C.prototype, "method", null); + C = tslib_1.__decorate([ + dec + ], C); return C; }()); -tslib_1.__decorate([ - tslib_1.__param(0, dec), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Number]), - tslib_1.__metadata("design:returntype", void 0) -], C.prototype, "method", null); -C = tslib_1.__decorate([ - dec -], C); //// [script.js] var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || @@ -99,14 +99,14 @@ var C = (function () { } C.prototype.method = function (x) { }; + __decorate([ + __param(0, dec), + __metadata("design:type", Function), + __metadata("design:paramtypes", [Number]), + __metadata("design:returntype", void 0) + ], C.prototype, "method", null); + C = __decorate([ + dec + ], C); return C; }()); -__decorate([ - __param(0, dec), - __metadata("design:type", Function), - __metadata("design:paramtypes", [Number]), - __metadata("design:returntype", void 0) -], C.prototype, "method", null); -C = __decorate([ - dec -], C); diff --git a/tests/baselines/reference/importImportOnlyModule.js b/tests/baselines/reference/importImportOnlyModule.js index 0c6f0540354c8..fa01655c47b29 100644 --- a/tests/baselines/reference/importImportOnlyModule.js +++ b/tests/baselines/reference/importImportOnlyModule.js @@ -23,9 +23,9 @@ define(["require", "exports"], function (require, exports) { function C1() { this.m1 = 42; } + C1.s1 = true; return C1; }()); - C1.s1 = true; exports.C1 = C1; }); //// [foo_1.js] diff --git a/tests/baselines/reference/inferringClassMembersFromAssignments.js b/tests/baselines/reference/inferringClassMembersFromAssignments.js index 1c1f223abe85d..c6a6d0c4e27d0 100644 --- a/tests/baselines/reference/inferringClassMembersFromAssignments.js +++ b/tests/baselines/reference/inferringClassMembersFromAssignments.js @@ -124,7 +124,6 @@ var stringOrNumberOrUndefined = C.inStaticNestedArrowFunction; //// [output.js] -var _this = this; var C = (function () { function C() { var _this = this; @@ -212,16 +211,16 @@ var C = (function () { this.inStaticSetter = "string"; } }; + C.prop = function () { + if (Math.random()) { + _this.inStaticPropertyDeclaration = 0; + } + else { + _this.inStaticPropertyDeclaration = "string"; + } + }; return C; }()); -C.prop = function () { - if (Math.random()) { - _this.inStaticPropertyDeclaration = 0; - } - else { - _this.inStaticPropertyDeclaration = "string"; - } -}; var c = new C(); var stringOrNumber; var stringOrNumber = c.inConstructor; diff --git a/tests/baselines/reference/instanceAndStaticDeclarations1.js b/tests/baselines/reference/instanceAndStaticDeclarations1.js index bf9b6963bb2f1..093e9c15cc8ea 100644 --- a/tests/baselines/reference/instanceAndStaticDeclarations1.js +++ b/tests/baselines/reference/instanceAndStaticDeclarations1.js @@ -25,6 +25,6 @@ var Point = (function () { return Math.sqrt(dx * dx + dy * dy); }; Point.distance = function (p1, p2) { return p1.distance(p2); }; + Point.origin = new Point(0, 0); return Point; }()); -Point.origin = new Point(0, 0); diff --git a/tests/baselines/reference/invalidNewTarget.es5.js b/tests/baselines/reference/invalidNewTarget.es5.js index 866dac270af7f..1c2da520fcb2d 100644 --- a/tests/baselines/reference/invalidNewTarget.es5.js +++ b/tests/baselines/reference/invalidNewTarget.es5.js @@ -56,9 +56,9 @@ var C = (function () { enumerable: true, configurable: true }); + C.j = function () { return _newTarget; }; return C; }()); -C.j = function () { return _newTarget; }; var O = (_a = {}, _a[_newTarget] = undefined, _a.k = function () { var _newTarget = void 0; return _newTarget; }, diff --git a/tests/baselines/reference/invalidStaticField.js b/tests/baselines/reference/invalidStaticField.js index 08a06d5ee27e0..dc582e830c7c7 100644 --- a/tests/baselines/reference/invalidStaticField.js +++ b/tests/baselines/reference/invalidStaticField.js @@ -12,6 +12,6 @@ var A = (function () { var B = (function () { function B() { } + B.NOT_NULL = new B(); return B; }()); -B.NOT_NULL = new B(); diff --git a/tests/baselines/reference/metadataOfClassFromAlias.js b/tests/baselines/reference/metadataOfClassFromAlias.js index c99f7cc2e2347..75fdd90652f4f 100644 --- a/tests/baselines/reference/metadataOfClassFromAlias.js +++ b/tests/baselines/reference/metadataOfClassFromAlias.js @@ -41,10 +41,10 @@ function annotation() { var ClassA = (function () { function ClassA() { } + __decorate([ + annotation(), + __metadata("design:type", Object) + ], ClassA.prototype, "array", void 0); return ClassA; }()); -__decorate([ - annotation(), - __metadata("design:type", Object) -], ClassA.prototype, "array", void 0); exports.ClassA = ClassA; diff --git a/tests/baselines/reference/metadataOfClassFromAlias2.js b/tests/baselines/reference/metadataOfClassFromAlias2.js index bcdbb34ac5075..ca56802863824 100644 --- a/tests/baselines/reference/metadataOfClassFromAlias2.js +++ b/tests/baselines/reference/metadataOfClassFromAlias2.js @@ -41,10 +41,10 @@ function annotation() { var ClassA = (function () { function ClassA() { } + __decorate([ + annotation(), + __metadata("design:type", Object) + ], ClassA.prototype, "array", void 0); return ClassA; }()); -__decorate([ - annotation(), - __metadata("design:type", Object) -], ClassA.prototype, "array", void 0); exports.ClassA = ClassA; diff --git a/tests/baselines/reference/metadataOfClassFromModule.js b/tests/baselines/reference/metadataOfClassFromModule.js index 8ef120600df0e..ca8c56e3c5e1e 100644 --- a/tests/baselines/reference/metadataOfClassFromModule.js +++ b/tests/baselines/reference/metadataOfClassFromModule.js @@ -34,11 +34,11 @@ var MyModule; var Person = (function () { function Person() { } + __decorate([ + inject, + __metadata("design:type", Leg) + ], Person.prototype, "leftLeg", void 0); return Person; }()); - __decorate([ - inject, - __metadata("design:type", Leg) - ], Person.prototype, "leftLeg", void 0); MyModule.Person = Person; })(MyModule || (MyModule = {})); diff --git a/tests/baselines/reference/metadataOfEventAlias.js b/tests/baselines/reference/metadataOfEventAlias.js index b46d5cade630a..cf04258624266 100644 --- a/tests/baselines/reference/metadataOfEventAlias.js +++ b/tests/baselines/reference/metadataOfEventAlias.js @@ -30,10 +30,10 @@ function Input(target, key) { } var SomeClass = (function () { function SomeClass() { } + __decorate([ + Input, + __metadata("design:type", Object) + ], SomeClass.prototype, "event", void 0); return SomeClass; }()); -__decorate([ - Input, - __metadata("design:type", Object) -], SomeClass.prototype, "event", void 0); exports.SomeClass = SomeClass; diff --git a/tests/baselines/reference/metadataOfStringLiteral.js b/tests/baselines/reference/metadataOfStringLiteral.js index 676914681cb91..3053627020712 100644 --- a/tests/baselines/reference/metadataOfStringLiteral.js +++ b/tests/baselines/reference/metadataOfStringLiteral.js @@ -20,9 +20,9 @@ function PropDeco(target, propKey) { } var Foo = (function () { function Foo() { } + __decorate([ + PropDeco, + __metadata("design:type", String) + ], Foo.prototype, "foo"); return Foo; }()); -__decorate([ - PropDeco, - __metadata("design:type", String) -], Foo.prototype, "foo"); diff --git a/tests/baselines/reference/metadataOfUnion.js b/tests/baselines/reference/metadataOfUnion.js index 9a88481c80a9e..7a063b0e93c13 100644 --- a/tests/baselines/reference/metadataOfUnion.js +++ b/tests/baselines/reference/metadataOfUnion.js @@ -55,20 +55,20 @@ var A = (function () { var B = (function () { function B() { } + __decorate([ + PropDeco, + __metadata("design:type", Object) + ], B.prototype, "x"); + __decorate([ + PropDeco, + __metadata("design:type", Boolean) + ], B.prototype, "y"); + __decorate([ + PropDeco, + __metadata("design:type", Object) + ], B.prototype, "z"); return B; }()); -__decorate([ - PropDeco, - __metadata("design:type", Object) -], B.prototype, "x"); -__decorate([ - PropDeco, - __metadata("design:type", Boolean) -], B.prototype, "y"); -__decorate([ - PropDeco, - __metadata("design:type", Object) -], B.prototype, "z"); var E; (function (E) { E[E["A"] = 0] = "A"; @@ -79,21 +79,21 @@ var E; var D = (function () { function D() { } + __decorate([ + PropDeco, + __metadata("design:type", Number) + ], D.prototype, "a"); + __decorate([ + PropDeco, + __metadata("design:type", Number) + ], D.prototype, "b"); + __decorate([ + PropDeco, + __metadata("design:type", Number) + ], D.prototype, "c"); + __decorate([ + PropDeco, + __metadata("design:type", Number) + ], D.prototype, "d"); return D; }()); -__decorate([ - PropDeco, - __metadata("design:type", Number) -], D.prototype, "a"); -__decorate([ - PropDeco, - __metadata("design:type", Number) -], D.prototype, "b"); -__decorate([ - PropDeco, - __metadata("design:type", Number) -], D.prototype, "c"); -__decorate([ - PropDeco, - __metadata("design:type", Number) -], D.prototype, "d"); diff --git a/tests/baselines/reference/metadataOfUnionWithNull.js b/tests/baselines/reference/metadataOfUnionWithNull.js index 0c834be96876f..e53ca85476e63 100644 --- a/tests/baselines/reference/metadataOfUnionWithNull.js +++ b/tests/baselines/reference/metadataOfUnionWithNull.js @@ -61,53 +61,53 @@ var A = (function () { var B = (function () { function B() { } + __decorate([ + PropDeco, + __metadata("design:type", Object) + ], B.prototype, "x"); + __decorate([ + PropDeco, + __metadata("design:type", Object) + ], B.prototype, "y"); + __decorate([ + PropDeco, + __metadata("design:type", Object) + ], B.prototype, "z"); + __decorate([ + PropDeco, + __metadata("design:type", void 0) + ], B.prototype, "a"); + __decorate([ + PropDeco, + __metadata("design:type", void 0) + ], B.prototype, "b"); + __decorate([ + PropDeco, + __metadata("design:type", void 0) + ], B.prototype, "c"); + __decorate([ + PropDeco, + __metadata("design:type", Object) + ], B.prototype, "d"); + __decorate([ + PropDeco, + __metadata("design:type", Object) + ], B.prototype, "e"); + __decorate([ + PropDeco, + __metadata("design:type", Object) + ], B.prototype, "f"); + __decorate([ + PropDeco, + __metadata("design:type", Object) + ], B.prototype, "g"); + __decorate([ + PropDeco, + __metadata("design:type", Object) + ], B.prototype, "h"); + __decorate([ + PropDeco, + __metadata("design:type", Object) + ], B.prototype, "j"); return B; }()); -__decorate([ - PropDeco, - __metadata("design:type", Object) -], B.prototype, "x"); -__decorate([ - PropDeco, - __metadata("design:type", Object) -], B.prototype, "y"); -__decorate([ - PropDeco, - __metadata("design:type", Object) -], B.prototype, "z"); -__decorate([ - PropDeco, - __metadata("design:type", void 0) -], B.prototype, "a"); -__decorate([ - PropDeco, - __metadata("design:type", void 0) -], B.prototype, "b"); -__decorate([ - PropDeco, - __metadata("design:type", void 0) -], B.prototype, "c"); -__decorate([ - PropDeco, - __metadata("design:type", Object) -], B.prototype, "d"); -__decorate([ - PropDeco, - __metadata("design:type", Object) -], B.prototype, "e"); -__decorate([ - PropDeco, - __metadata("design:type", Object) -], B.prototype, "f"); -__decorate([ - PropDeco, - __metadata("design:type", Object) -], B.prototype, "g"); -__decorate([ - PropDeco, - __metadata("design:type", Object) -], B.prototype, "h"); -__decorate([ - PropDeco, - __metadata("design:type", Object) -], B.prototype, "j"); diff --git a/tests/baselines/reference/missingDecoratorType.js b/tests/baselines/reference/missingDecoratorType.js index ee9fbf7ce440a..eca16c710e37e 100644 --- a/tests/baselines/reference/missingDecoratorType.js +++ b/tests/baselines/reference/missingDecoratorType.js @@ -32,8 +32,8 @@ var C = (function () { function C() { } C.prototype.method = function () { }; + __decorate([ + dec + ], C.prototype, "method", null); return C; }()); -__decorate([ - dec -], C.prototype, "method", null); diff --git a/tests/baselines/reference/newTarget.es5.js b/tests/baselines/reference/newTarget.es5.js index 2ebe4bfcadcbc..38718a771ad83 100644 --- a/tests/baselines/reference/newTarget.es5.js +++ b/tests/baselines/reference/newTarget.es5.js @@ -50,9 +50,9 @@ var A = (function () { var a = _newTarget; var b = function () { return _newTarget; }; } + A.c = function _a() { var _newTarget = this && this instanceof _a ? this.constructor : void 0; return _newTarget; }; return A; }()); -A.c = function _a() { var _newTarget = this && this instanceof _a ? this.constructor : void 0; return _newTarget; }; var B = (function (_super) { __extends(B, _super); function B() { @@ -69,11 +69,11 @@ function f1() { var g = _newTarget; var h = function () { return _newTarget; }; } -var f2 = function _b() { - var _newTarget = this && this instanceof _b ? this.constructor : void 0; +var f2 = function _a() { + var _newTarget = this && this instanceof _a ? this.constructor : void 0; var i = _newTarget; var j = function () { return _newTarget; }; }; var O = { - k: function _c() { var _newTarget = this && this instanceof _c ? this.constructor : void 0; return _newTarget; } + k: function _b() { var _newTarget = this && this instanceof _b ? this.constructor : void 0; return _newTarget; } }; diff --git a/tests/baselines/reference/noEmitHelpers2.js b/tests/baselines/reference/noEmitHelpers2.js index 44ab7900005cf..027f07cc0e89f 100644 --- a/tests/baselines/reference/noEmitHelpers2.js +++ b/tests/baselines/reference/noEmitHelpers2.js @@ -11,10 +11,10 @@ class A { var A = (function () { function A(a, b) { } + A = __decorate([ + decorator, + __param(1, decorator), + __metadata("design:paramtypes", [Number, String]) + ], A); return A; }()); -A = __decorate([ - decorator, - __param(1, decorator), - __metadata("design:paramtypes", [Number, String]) -], A); diff --git a/tests/baselines/reference/parserAccessibilityAfterStatic3.js b/tests/baselines/reference/parserAccessibilityAfterStatic3.js index 38202bc5dc8fe..7a9ae06e43929 100644 --- a/tests/baselines/reference/parserAccessibilityAfterStatic3.js +++ b/tests/baselines/reference/parserAccessibilityAfterStatic3.js @@ -9,6 +9,6 @@ static public = 1; var Outer = (function () { function Outer() { } + Outer.public = 1; return Outer; }()); -Outer.public = 1; diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js index 57d0536e97597..9bb4395e55655 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js @@ -41,10 +41,10 @@ var Shapes; } // Instance member Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; + // Static member + Point.origin = new Point(0, 0); return Point; }()); - // Static member - Point.origin = new Point(0, 0); Shapes.Point = Point; })(Shapes || (Shapes = {})); // Local variables diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js index 2bb08a14e350b..0ee73b8b1e5bf 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js @@ -42,10 +42,10 @@ var Shapes; } // Instance member Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; + // Static member + Point.origin = new Point(0, 0); return Point; }()); - // Static member - Point.origin = new Point(0, 0); Shapes.Point = Point; })(Shapes || (Shapes = {})); // Local variables diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 5090c33bdc8ca..2275a1f682e1b 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2376,11 +2376,11 @@ var Harness; errorHandlerStack[errorHandlerStack.length - 1](e); } }; + // The current stack of Runnable objects + Runnable.currentStack = []; + Runnable.errorHandlerStack = []; return Runnable; }()); - // The current stack of Runnable objects - Runnable.currentStack = []; - Runnable.errorHandlerStack = []; Harness.Runnable = Runnable; var TestCase = (function (_super) { __extends(TestCase, _super); diff --git a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js index 9da4e922f77bf..da23223510c7d 100644 --- a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js +++ b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js @@ -160,12 +160,12 @@ var publicClassWithWithPrivatePropertyTypes = (function () { this.myPublicProperty1 = exporter.createExportedWidget3(); // Error this.myPrivateProperty1 = exporter.createExportedWidget3(); } + publicClassWithWithPrivatePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget1(); // Error + publicClassWithWithPrivatePropertyTypes.myPrivateStaticProperty = exporter.createExportedWidget1(); + publicClassWithWithPrivatePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget3(); // Error + publicClassWithWithPrivatePropertyTypes.myPrivateStaticProperty1 = exporter.createExportedWidget3(); return publicClassWithWithPrivatePropertyTypes; }()); -publicClassWithWithPrivatePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget1(); // Error -publicClassWithWithPrivatePropertyTypes.myPrivateStaticProperty = exporter.createExportedWidget1(); -publicClassWithWithPrivatePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget3(); // Error -publicClassWithWithPrivatePropertyTypes.myPrivateStaticProperty1 = exporter.createExportedWidget3(); exports.publicClassWithWithPrivatePropertyTypes = publicClassWithWithPrivatePropertyTypes; var privateClassWithWithPrivatePropertyTypes = (function () { function privateClassWithWithPrivatePropertyTypes() { @@ -174,12 +174,12 @@ var privateClassWithWithPrivatePropertyTypes = (function () { this.myPublicProperty1 = exporter.createExportedWidget3(); this.myPrivateProperty1 = exporter.createExportedWidget3(); } + privateClassWithWithPrivatePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget1(); + privateClassWithWithPrivatePropertyTypes.myPrivateStaticProperty = exporter.createExportedWidget1(); + privateClassWithWithPrivatePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget3(); + privateClassWithWithPrivatePropertyTypes.myPrivateStaticProperty1 = exporter.createExportedWidget3(); return privateClassWithWithPrivatePropertyTypes; }()); -privateClassWithWithPrivatePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget1(); -privateClassWithWithPrivatePropertyTypes.myPrivateStaticProperty = exporter.createExportedWidget1(); -privateClassWithWithPrivatePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget3(); -privateClassWithWithPrivatePropertyTypes.myPrivateStaticProperty1 = exporter.createExportedWidget3(); exports.publicVarWithPrivatePropertyTypes = exporter.createExportedWidget1(); // Error var privateVarWithPrivatePropertyTypes = exporter.createExportedWidget1(); exports.publicVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); // Error @@ -189,10 +189,10 @@ var publicClassWithPrivateModulePropertyTypes = (function () { this.myPublicProperty = exporter.createExportedWidget2(); // Error this.myPublicProperty1 = exporter.createExportedWidget4(); // Error } + publicClassWithPrivateModulePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget2(); // Error + publicClassWithPrivateModulePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget4(); // Error return publicClassWithPrivateModulePropertyTypes; }()); -publicClassWithPrivateModulePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget2(); // Error -publicClassWithPrivateModulePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget4(); // Error exports.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; exports.publicVarWithPrivateModulePropertyTypes = exporter.createExportedWidget2(); // Error exports.publicVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); // Error @@ -201,10 +201,10 @@ var privateClassWithPrivateModulePropertyTypes = (function () { this.myPublicProperty = exporter.createExportedWidget2(); this.myPublicProperty1 = exporter.createExportedWidget4(); } + privateClassWithPrivateModulePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget2(); + privateClassWithPrivateModulePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget4(); return privateClassWithPrivateModulePropertyTypes; }()); -privateClassWithPrivateModulePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget2(); -privateClassWithPrivateModulePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget4(); var privateVarWithPrivateModulePropertyTypes = exporter.createExportedWidget2(); var privateVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); diff --git a/tests/baselines/reference/privateStaticMemberAccessibility.js b/tests/baselines/reference/privateStaticMemberAccessibility.js index 92a8713ef8f66..aca72ba86e5fb 100644 --- a/tests/baselines/reference/privateStaticMemberAccessibility.js +++ b/tests/baselines/reference/privateStaticMemberAccessibility.js @@ -31,6 +31,6 @@ var Derived = (function (_super) { _this.bing = function () { return Base.foo; }; // error return _this; } + Derived.bar = Base.foo; // error return Derived; }(Base)); -Derived.bar = Base.foo; // error diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/main.js b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/main.js index 6ec26abec8e44..f1d17701cf8a1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/main.js @@ -14,12 +14,12 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + foo, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); - MyClass1 = __decorate([ - foo, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) - ], MyClass1); exports.MyClass1 = MyClass1; - var _a; }); diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/main.js b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/main.js index 274520bc752b4..c7191f0e4c6d1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/main.js @@ -14,11 +14,11 @@ var MyClass1 = (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + foo, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); -MyClass1 = __decorate([ - foo, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) -], MyClass1); exports.MyClass1 = MyClass1; -var _a; diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/main.js b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/main.js index 6ec26abec8e44..f1d17701cf8a1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/main.js @@ -14,12 +14,12 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + foo, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); - MyClass1 = __decorate([ - foo, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) - ], MyClass1); exports.MyClass1 = MyClass1; - var _a; }); diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/main.js b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/main.js index 274520bc752b4..c7191f0e4c6d1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/main.js @@ -14,11 +14,11 @@ var MyClass1 = (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + foo, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); -MyClass1 = __decorate([ - foo, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) -], MyClass1); exports.MyClass1 = MyClass1; -var _a; diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/main.js index 6ec26abec8e44..f1d17701cf8a1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/main.js @@ -14,12 +14,12 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + foo, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); - MyClass1 = __decorate([ - foo, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) - ], MyClass1); exports.MyClass1 = MyClass1; - var _a; }); diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/main.js index 274520bc752b4..c7191f0e4c6d1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/main.js @@ -14,11 +14,11 @@ var MyClass1 = (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + foo, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); -MyClass1 = __decorate([ - foo, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) -], MyClass1); exports.MyClass1 = MyClass1; -var _a; diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/main.js index 6ec26abec8e44..f1d17701cf8a1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/main.js @@ -14,12 +14,12 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + foo, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); - MyClass1 = __decorate([ - foo, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) - ], MyClass1); exports.MyClass1 = MyClass1; - var _a; }); diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/main.js index 274520bc752b4..c7191f0e4c6d1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/main.js @@ -14,11 +14,11 @@ var MyClass1 = (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + foo, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); -MyClass1 = __decorate([ - foo, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) -], MyClass1); exports.MyClass1 = MyClass1; -var _a; diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/main.js index 6ec26abec8e44..f1d17701cf8a1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/main.js @@ -14,12 +14,12 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + foo, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); - MyClass1 = __decorate([ - foo, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) - ], MyClass1); exports.MyClass1 = MyClass1; - var _a; }); diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/main.js index 274520bc752b4..c7191f0e4c6d1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/main.js @@ -14,11 +14,11 @@ var MyClass1 = (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + foo, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); -MyClass1 = __decorate([ - foo, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) -], MyClass1); exports.MyClass1 = MyClass1; -var _a; diff --git a/tests/baselines/reference/propertyAccessibility2.js b/tests/baselines/reference/propertyAccessibility2.js index 3618b86fcc5b4..afce6c4c24a79 100644 --- a/tests/baselines/reference/propertyAccessibility2.js +++ b/tests/baselines/reference/propertyAccessibility2.js @@ -9,7 +9,7 @@ var c = C.x; var C = (function () { function C() { } + C.x = 1; return C; }()); -C.x = 1; var c = C.x; diff --git a/tests/baselines/reference/quotedPropertyName2.js b/tests/baselines/reference/quotedPropertyName2.js index 550e52997027f..1c4d85076eac1 100644 --- a/tests/baselines/reference/quotedPropertyName2.js +++ b/tests/baselines/reference/quotedPropertyName2.js @@ -7,6 +7,6 @@ class Test1 { var Test1 = (function () { function Test1() { } + Test1["prop1"] = 0; return Test1; }()); -Test1["prop1"] = 0; diff --git a/tests/baselines/reference/reassignStaticProp.js b/tests/baselines/reference/reassignStaticProp.js index d9c37c29ad5b6..2bf2bafa128e2 100644 --- a/tests/baselines/reference/reassignStaticProp.js +++ b/tests/baselines/reference/reassignStaticProp.js @@ -15,6 +15,6 @@ class foo { var foo = (function () { function foo() { } + foo.bar = 1; return foo; }()); -foo.bar = 1; diff --git a/tests/baselines/reference/scopeCheckStaticInitializer.js b/tests/baselines/reference/scopeCheckStaticInitializer.js index 59711f073809f..a9478d4480056 100644 --- a/tests/baselines/reference/scopeCheckStaticInitializer.js +++ b/tests/baselines/reference/scopeCheckStaticInitializer.js @@ -20,18 +20,18 @@ var X = (function () { function X() { } X.method = function () { }; + X.illegalBeforeProperty = X.data; + X.okBeforeMethod = X.method; + X.illegal2 = After.data; + X.illegal3 = After.method; + X.data = 13; return X; }()); -X.illegalBeforeProperty = X.data; -X.okBeforeMethod = X.method; -X.illegal2 = After.data; -X.illegal3 = After.method; -X.data = 13; var After = (function () { function After() { } After.method = function () { }; ; + After.data = 12; return After; }()); -After.data = 12; diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js b/tests/baselines/reference/sourceMap-FileWithComments.js index d2287d0bea290..7fd47997c972c 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js +++ b/tests/baselines/reference/sourceMap-FileWithComments.js @@ -48,10 +48,10 @@ var Shapes; } // Instance member Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; + // Static member + Point.origin = new Point(0, 0); return Point; }()); - // Static member - Point.origin = new Point(0, 0); Shapes.Point = Point; // Variable comment after class var a = 10; diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js.map b/tests/baselines/reference/sourceMap-FileWithComments.js.map index a85ce154f1175..073fa862fc771 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js.map +++ b/tests/baselines/reference/sourceMap-FileWithComments.js.map @@ -1,2 +1,2 @@ //// [sourceMap-FileWithComments.js.map] -{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":[],"mappings":"AAKA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM;IAET,QAAQ;IACR;QACI,cAAc;QACd,eAAmB,CAAS,EAAS,CAAS;YAA3B,MAAC,GAAD,CAAC,CAAQ;YAAS,MAAC,GAAD,CAAC,CAAQ;QAAI,CAAC;QAEnD,kBAAkB;QAClB,uBAAO,GAAP,cAAY,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAItE,YAAC;IAAD,CAAC,AATD;IAOI,gBAAgB;IACT,YAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IARvB,YAAK,QASjB,CAAA;IAED,+BAA+B;IAC/B,IAAI,CAAC,GAAG,EAAE,CAAC;IAEX;IACA,CAAC;IADe,UAAG,MAClB,CAAA;IAED;;MAEE;IACF,IAAI,CAAC,GAAG,EAAE,CAAC;AACf,CAAC,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAED,qBAAqB;AACrB,IAAI,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":[],"mappings":"AAKA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM;IAET,QAAQ;IACR;QACI,cAAc;QACd,eAAmB,CAAS,EAAS,CAAS;YAA3B,MAAC,GAAD,CAAC,CAAQ;YAAS,MAAC,GAAD,CAAC,CAAQ;QAAI,CAAC;QAEnD,kBAAkB;QAClB,uBAAO,GAAP,cAAY,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAElE,gBAAgB;QACT,YAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACpC,YAAC;KAAA,AATD,IASC;IATY,YAAK,QASjB,CAAA;IAED,+BAA+B;IAC/B,IAAI,CAAC,GAAG,EAAE,CAAC;IAEX;IACA,CAAC;IADe,UAAG,MAClB,CAAA;IAED;;MAEE;IACF,IAAI,CAAC,GAAG,EAAE,CAAC;AACf,CAAC,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAED,qBAAqB;AACrB,IAAI,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt index 9e81aba718aa1..b53a0a4a7ce94 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt @@ -264,89 +264,90 @@ sourceFile:sourceMap-FileWithComments.ts 28>Emitted(12, 102) Source(15, 74) + SourceIndex(0) 29>Emitted(12, 103) Source(15, 75) + SourceIndex(0) --- +>>> // Static member +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^-> +1 > + > + > +2 > // Static member +1 >Emitted(13, 9) Source(17, 9) + SourceIndex(0) +2 >Emitted(13, 25) Source(17, 25) + SourceIndex(0) +--- +>>> Point.origin = new Point(0, 0); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^ +5 > ^^^^^ +6 > ^ +7 > ^ +8 > ^^ +9 > ^ +10> ^ +11> ^ +1-> + > static +2 > origin +3 > = +4 > new +5 > Point +6 > ( +7 > 0 +8 > , +9 > 0 +10> ) +11> ; +1->Emitted(14, 9) Source(18, 16) + SourceIndex(0) +2 >Emitted(14, 21) Source(18, 22) + SourceIndex(0) +3 >Emitted(14, 24) Source(18, 25) + SourceIndex(0) +4 >Emitted(14, 28) Source(18, 29) + SourceIndex(0) +5 >Emitted(14, 33) Source(18, 34) + SourceIndex(0) +6 >Emitted(14, 34) Source(18, 35) + SourceIndex(0) +7 >Emitted(14, 35) Source(18, 36) + SourceIndex(0) +8 >Emitted(14, 37) Source(18, 38) + SourceIndex(0) +9 >Emitted(14, 38) Source(18, 39) + SourceIndex(0) +10>Emitted(14, 39) Source(18, 40) + SourceIndex(0) +11>Emitted(14, 40) Source(18, 41) + SourceIndex(0) +--- >>> return Point; 1 >^^^^^^^^ 2 > ^^^^^^^^^^^^ 1 > - > - > // Static member - > static origin = new Point(0, 0); > 2 > } -1 >Emitted(13, 9) Source(19, 5) + SourceIndex(0) -2 >Emitted(13, 21) Source(19, 6) + SourceIndex(0) +1 >Emitted(15, 9) Source(19, 5) + SourceIndex(0) +2 >Emitted(15, 21) Source(19, 6) + SourceIndex(0) --- >>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^^^^^^^^^^^^^-> +1 >^^^^^ +2 > +3 > ^^^^ +4 > ^^^^^^^^^^^^^^^^^-> 1 > -2 > } -3 > -1 >Emitted(14, 5) Source(19, 5) + SourceIndex(0) -2 >Emitted(14, 6) Source(19, 6) + SourceIndex(0) -3 >Emitted(14, 6) Source(10, 5) + SourceIndex(0) ---- ->>> // Static member -1->^^^^ -2 > ^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^-> -1->export class Point implements IPoint { - > // Constructor - > constructor(public x: number, public y: number) { } - > - > // Instance member - > getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } - > - > -2 > // Static member -1->Emitted(15, 5) Source(17, 9) + SourceIndex(0) -2 >Emitted(15, 21) Source(17, 25) + SourceIndex(0) ---- ->>> Point.origin = new Point(0, 0); -1->^^^^ -2 > ^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^ -6 > ^ -7 > ^ -8 > ^^ -9 > ^ -10> ^ -11> ^ -1-> - > static -2 > origin -3 > = -4 > new -5 > Point -6 > ( -7 > 0 -8 > , -9 > 0 -10> ) -11> ; -1->Emitted(16, 5) Source(18, 16) + SourceIndex(0) -2 >Emitted(16, 17) Source(18, 22) + SourceIndex(0) -3 >Emitted(16, 20) Source(18, 25) + SourceIndex(0) -4 >Emitted(16, 24) Source(18, 29) + SourceIndex(0) -5 >Emitted(16, 29) Source(18, 34) + SourceIndex(0) -6 >Emitted(16, 30) Source(18, 35) + SourceIndex(0) -7 >Emitted(16, 31) Source(18, 36) + SourceIndex(0) -8 >Emitted(16, 33) Source(18, 38) + SourceIndex(0) -9 >Emitted(16, 34) Source(18, 39) + SourceIndex(0) -10>Emitted(16, 35) Source(18, 40) + SourceIndex(0) -11>Emitted(16, 36) Source(18, 41) + SourceIndex(0) +2 > +3 > export class Point implements IPoint { + > // Constructor + > constructor(public x: number, public y: number) { } + > + > // Instance member + > getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } + > + > // Static member + > static origin = new Point(0, 0); + > } +1 >Emitted(16, 6) Source(19, 6) + SourceIndex(0) +2 >Emitted(16, 6) Source(10, 5) + SourceIndex(0) +3 >Emitted(16, 10) Source(19, 6) + SourceIndex(0) --- >>> Shapes.Point = Point; -1 >^^^^ +1->^^^^ 2 > ^^^^^^^^^^^^ 3 > ^^^^^^^^ 4 > ^ 5 > ^^^^^^^^^^^-> -1 > +1-> 2 > Point 3 > implements IPoint { > // Constructor @@ -359,7 +360,7 @@ sourceFile:sourceMap-FileWithComments.ts > static origin = new Point(0, 0); > } 4 > -1 >Emitted(17, 5) Source(10, 18) + SourceIndex(0) +1->Emitted(17, 5) Source(10, 18) + SourceIndex(0) 2 >Emitted(17, 17) Source(10, 23) + SourceIndex(0) 3 >Emitted(17, 25) Source(19, 6) + SourceIndex(0) 4 >Emitted(17, 26) Source(19, 6) + SourceIndex(0) diff --git a/tests/baselines/reference/sourceMapValidationDecorators.js b/tests/baselines/reference/sourceMapValidationDecorators.js index 63cdb25900cb9..c3bb5cd722526 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.js +++ b/tests/baselines/reference/sourceMapValidationDecorators.js @@ -88,37 +88,37 @@ var Greeter = (function () { enumerable: true, configurable: true }); + Greeter.x1 = 10; + __decorate([ + PropertyDecorator1, + PropertyDecorator2(40) + ], Greeter.prototype, "greet", null); + __decorate([ + PropertyDecorator1, + PropertyDecorator2(50) + ], Greeter.prototype, "x", void 0); + __decorate([ + __param(0, ParameterDecorator1), + __param(0, ParameterDecorator2(70)) + ], Greeter.prototype, "fn", null); + __decorate([ + PropertyDecorator1, + PropertyDecorator2(80), + __param(0, ParameterDecorator1), + __param(0, ParameterDecorator2(90)) + ], Greeter.prototype, "greetings", null); + __decorate([ + PropertyDecorator1, + PropertyDecorator2(60) + ], Greeter, "x1", void 0); + Greeter = __decorate([ + ClassDecorator1, + ClassDecorator2(10), + __param(0, ParameterDecorator1), + __param(0, ParameterDecorator2(20)), + __param(1, ParameterDecorator1), + __param(1, ParameterDecorator2(30)) + ], Greeter); return Greeter; }()); -Greeter.x1 = 10; -__decorate([ - PropertyDecorator1, - PropertyDecorator2(40) -], Greeter.prototype, "greet", null); -__decorate([ - PropertyDecorator1, - PropertyDecorator2(50) -], Greeter.prototype, "x", void 0); -__decorate([ - __param(0, ParameterDecorator1), - __param(0, ParameterDecorator2(70)) -], Greeter.prototype, "fn", null); -__decorate([ - PropertyDecorator1, - PropertyDecorator2(80), - __param(0, ParameterDecorator1), - __param(0, ParameterDecorator2(90)) -], Greeter.prototype, "greetings", null); -__decorate([ - PropertyDecorator1, - PropertyDecorator2(60) -], Greeter, "x1", void 0); -Greeter = __decorate([ - ClassDecorator1, - ClassDecorator2(10), - __param(0, ParameterDecorator1), - __param(0, ParameterDecorator2(20)), - __param(1, ParameterDecorator1), - __param(1, ParameterDecorator2(30)) -], Greeter); //# sourceMappingURL=sourceMapValidationDecorators.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDecorators.js.map b/tests/baselines/reference/sourceMapValidationDecorators.js.map index ac635a518f157..c5666dc31474f 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.js.map +++ b/tests/baselines/reference/sourceMapValidationDecorators.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationDecorators.js.map] -{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":[],"mappings":";;;;;;;;;AASA,IAAM,OAAO;IACT,iBAGS,QAAgB;QAIvB,WAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,0BAAc;;QAJP,aAAQ,GAAR,QAAQ,CAAQ;IAKzB,CAAC;IAID,uBAAK,GAAL;QACI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5C,CAAC;IAUO,oBAAE,GAAV,UAGE,CAAS;QACP,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAID,sBAAI,8BAAS;aAAb;YACI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;aAED,UAGE,SAAiB;YACf,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC9B,CAAC;;;OAPA;IAQL,cAAC;AAAD,CAAC,AA5CD,IA4CC;AArBkB,UAAE,GAAW,EAAE,CAAC;AAV/B;IAFC,kBAAkB;IAClB,kBAAkB,CAAC,EAAE,CAAC;oCAGtB;AAID;IAFC,kBAAkB;IAClB,kBAAkB,CAAC,EAAE,CAAC;kCACL;AAMlB;IACG,WAAA,mBAAmB,CAAA;IACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;iCAGzB;AAID;IAFC,kBAAkB;IAClB,kBAAkB,CAAC,EAAE,CAAC;IAMpB,WAAA,mBAAmB,CAAA;IACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;wCAJzB;AAbD;IAFC,kBAAkB;IAClB,kBAAkB,CAAC,EAAE,CAAC;yBACQ;AAvB7B,OAAO;IAFZ,eAAe;IACf,eAAe,CAAC,EAAE,CAAC;IAGb,WAAA,mBAAmB,CAAA;IACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;IAGvB,WAAA,mBAAmB,CAAA;IACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;GAPxB,OAAO,CA4CZ"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":[],"mappings":";;;;;;;;;AASA;IACI,iBAGS,QAAgB;QAIvB,WAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,0BAAc;;QAJP,aAAQ,GAAR,QAAQ,CAAQ;IAKzB,CAAC;IAID,uBAAK,GAAL;QACI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5C,CAAC;IAUO,oBAAE,GAAV,UAGE,CAAS;QACP,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAID,sBAAI,8BAAS;aAAb;YACI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;aAED,UAGE,SAAiB;YACf,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC9B,CAAC;;;OAPA;IAbc,UAAE,GAAW,EAAE,CAAC;IAV/B;QAFC,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;wCAGtB;IAID;QAFC,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;sCACL;IAMlB;QACG,WAAA,mBAAmB,CAAA;QACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;qCAGzB;IAID;QAFC,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;QAMpB,WAAA,mBAAmB,CAAA;QACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;4CAJzB;IAbD;QAFC,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;6BACQ;IAvB7B,OAAO;QAFZ,eAAe;QACf,eAAe,CAAC,EAAE,CAAC;QAGb,WAAA,mBAAmB,CAAA;QACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;QAGvB,WAAA,mBAAmB,CAAA;QACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;OAPxB,OAAO,CA4CZ;IAAD,cAAC;CAAA,AA5CD,IA4CC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt index d581fdef88634..2cec971546b15 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt @@ -19,9 +19,7 @@ sourceFile:sourceMapValidationDecorators.ts >>>}; >>>var Greeter = (function () { 1 > -2 >^^^^ -3 > ^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >declare function ClassDecorator1(target: Function): void; >declare function ClassDecorator2(x: number): (target: Function) => void; >declare function PropertyDecorator1(target: Object, key: string | symbol, descriptor?: PropertyDescriptor): void; @@ -32,17 +30,13 @@ sourceFile:sourceMapValidationDecorators.ts >@ClassDecorator1 >@ClassDecorator2(10) > -2 >class -3 > Greeter 1 >Emitted(10, 1) Source(10, 1) + SourceIndex(0) -2 >Emitted(10, 5) Source(10, 7) + SourceIndex(0) -3 >Emitted(10, 12) Source(10, 14) + SourceIndex(0) --- >>> function Greeter(greeting) { 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^ -1-> { +1->class Greeter { > 2 > constructor( > @ParameterDecorator1 @@ -362,191 +356,116 @@ sourceFile:sourceMapValidationDecorators.ts >>> configurable: true >>> }); 1->^^^^^^^ -2 > ^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^-> 1-> 1->Emitted(33, 8) Source(46, 6) + SourceIndex(0) --- ->>> return Greeter; +>>> Greeter.x1 = 10; 1->^^^^ -2 > ^^^^^^^^^^^^^^ -1-> - > - > set greetings( - > @ParameterDecorator1 - > @ParameterDecorator2(90) - > greetings: string) { - > this.greeting = greetings; - > } - > -2 > } -1->Emitted(34, 5) Source(54, 1) + SourceIndex(0) -2 >Emitted(34, 19) Source(54, 2) + SourceIndex(0) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class Greeter { - > constructor( - > @ParameterDecorator1 - > @ParameterDecorator2(20) - > public greeting: string, - > - > @ParameterDecorator1 - > @ParameterDecorator2(30) - > ...b: string[]) { - > } - > - > @PropertyDecorator1 - > @PropertyDecorator2(40) - > greet() { - > return "

" + this.greeting + "

"; - > } - > - > @PropertyDecorator1 - > @PropertyDecorator2(50) - > private x: string; - > - > @PropertyDecorator1 - > @PropertyDecorator2(60) - > private static x1: number = 10; - > - > private fn( - > @ParameterDecorator1 - > @ParameterDecorator2(70) - > x: number) { - > return this.greeting; - > } - > - > @PropertyDecorator1 - > @PropertyDecorator2(80) - > get greetings() { - > return this.greeting; - > } - > - > set greetings( - > @ParameterDecorator1 - > @ParameterDecorator2(90) - > greetings: string) { - > this.greeting = greetings; - > } - > } -1 >Emitted(35, 1) Source(54, 1) + SourceIndex(0) -2 >Emitted(35, 2) Source(54, 2) + SourceIndex(0) -3 >Emitted(35, 2) Source(10, 1) + SourceIndex(0) -4 >Emitted(35, 6) Source(54, 2) + SourceIndex(0) ---- ->>>Greeter.x1 = 10; -1-> -2 >^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ +2 > ^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ 1-> -2 >x1 -3 > : number = -4 > 10 -5 > ; -1->Emitted(36, 1) Source(33, 20) + SourceIndex(0) -2 >Emitted(36, 11) Source(33, 22) + SourceIndex(0) -3 >Emitted(36, 14) Source(33, 33) + SourceIndex(0) -4 >Emitted(36, 16) Source(33, 35) + SourceIndex(0) -5 >Emitted(36, 17) Source(33, 36) + SourceIndex(0) ---- ->>>__decorate([ -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > x1 +3 > : number = +4 > 10 +5 > ; +1->Emitted(34, 5) Source(33, 20) + SourceIndex(0) +2 >Emitted(34, 15) Source(33, 22) + SourceIndex(0) +3 >Emitted(34, 18) Source(33, 33) + SourceIndex(0) +4 >Emitted(34, 20) Source(33, 35) + SourceIndex(0) +5 >Emitted(34, 21) Source(33, 36) + SourceIndex(0) +--- +>>> __decorate([ +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(37, 1) Source(23, 5) + SourceIndex(0) +1 >Emitted(35, 5) Source(23, 5) + SourceIndex(0) --- ->>> PropertyDecorator1, -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^^^-> +>>> PropertyDecorator1, +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^^^^-> 1-> -2 > PropertyDecorator1 -1->Emitted(38, 5) Source(21, 6) + SourceIndex(0) -2 >Emitted(38, 23) Source(21, 24) + SourceIndex(0) +2 > PropertyDecorator1 +1->Emitted(36, 9) Source(21, 6) + SourceIndex(0) +2 >Emitted(36, 27) Source(21, 24) + SourceIndex(0) --- ->>> PropertyDecorator2(40) -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> +>>> PropertyDecorator2(40) +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^^^^^-> 1-> > @ -2 > PropertyDecorator2 -3 > ( -4 > 40 -5 > ) -1->Emitted(39, 5) Source(22, 6) + SourceIndex(0) -2 >Emitted(39, 23) Source(22, 24) + SourceIndex(0) -3 >Emitted(39, 24) Source(22, 25) + SourceIndex(0) -4 >Emitted(39, 26) Source(22, 27) + SourceIndex(0) -5 >Emitted(39, 27) Source(22, 28) + SourceIndex(0) ---- ->>>], Greeter.prototype, "greet", null); -1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > PropertyDecorator2 +3 > ( +4 > 40 +5 > ) +1->Emitted(37, 9) Source(22, 6) + SourceIndex(0) +2 >Emitted(37, 27) Source(22, 24) + SourceIndex(0) +3 >Emitted(37, 28) Source(22, 25) + SourceIndex(0) +4 >Emitted(37, 30) Source(22, 27) + SourceIndex(0) +5 >Emitted(37, 31) Source(22, 28) + SourceIndex(0) +--- +>>> ], Greeter.prototype, "greet", null); +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > greet() { > return "

" + this.greeting + "

"; > } -1->Emitted(40, 37) Source(25, 6) + SourceIndex(0) +1->Emitted(38, 41) Source(25, 6) + SourceIndex(0) --- ->>>__decorate([ -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +>>> __decorate([ +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > > @PropertyDecorator1 > @PropertyDecorator2(50) > -1 >Emitted(41, 1) Source(29, 5) + SourceIndex(0) +1 >Emitted(39, 5) Source(29, 5) + SourceIndex(0) --- ->>> PropertyDecorator1, -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^^^-> +>>> PropertyDecorator1, +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^^^^-> 1-> -2 > PropertyDecorator1 -1->Emitted(42, 5) Source(27, 6) + SourceIndex(0) -2 >Emitted(42, 23) Source(27, 24) + SourceIndex(0) +2 > PropertyDecorator1 +1->Emitted(40, 9) Source(27, 6) + SourceIndex(0) +2 >Emitted(40, 27) Source(27, 24) + SourceIndex(0) --- ->>> PropertyDecorator2(50) -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^-> +>>> PropertyDecorator2(50) +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^^^-> 1-> > @ -2 > PropertyDecorator2 -3 > ( -4 > 50 -5 > ) -1->Emitted(43, 5) Source(28, 6) + SourceIndex(0) -2 >Emitted(43, 23) Source(28, 24) + SourceIndex(0) -3 >Emitted(43, 24) Source(28, 25) + SourceIndex(0) -4 >Emitted(43, 26) Source(28, 27) + SourceIndex(0) -5 >Emitted(43, 27) Source(28, 28) + SourceIndex(0) ---- ->>>], Greeter.prototype, "x", void 0); -1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > PropertyDecorator2 +3 > ( +4 > 50 +5 > ) +1->Emitted(41, 9) Source(28, 6) + SourceIndex(0) +2 >Emitted(41, 27) Source(28, 24) + SourceIndex(0) +3 >Emitted(41, 28) Source(28, 25) + SourceIndex(0) +4 >Emitted(41, 30) Source(28, 27) + SourceIndex(0) +5 >Emitted(41, 31) Source(28, 28) + SourceIndex(0) +--- +>>> ], Greeter.prototype, "x", void 0); +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > private x: string; -1->Emitted(44, 35) Source(29, 23) + SourceIndex(0) +1->Emitted(42, 39) Source(29, 23) + SourceIndex(0) --- ->>>__decorate([ -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>> __decorate([ +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > > @PropertyDecorator1 @@ -554,100 +473,100 @@ sourceFile:sourceMapValidationDecorators.ts > private static x1: number = 10; > > -1 >Emitted(45, 1) Source(35, 5) + SourceIndex(0) +1 >Emitted(43, 5) Source(35, 5) + SourceIndex(0) --- ->>> __param(0, ParameterDecorator1), -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^-> +>>> __param(0, ParameterDecorator1), +1->^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^-> 1->private fn( > @ -2 > -3 > ParameterDecorator1 -4 > -1->Emitted(46, 5) Source(36, 8) + SourceIndex(0) -2 >Emitted(46, 16) Source(36, 8) + SourceIndex(0) -3 >Emitted(46, 35) Source(36, 27) + SourceIndex(0) -4 >Emitted(46, 36) Source(36, 27) + SourceIndex(0) ---- ->>> __param(0, ParameterDecorator2(70)) -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ +2 > +3 > ParameterDecorator1 +4 > +1->Emitted(44, 9) Source(36, 8) + SourceIndex(0) +2 >Emitted(44, 20) Source(36, 8) + SourceIndex(0) +3 >Emitted(44, 39) Source(36, 27) + SourceIndex(0) +4 >Emitted(44, 40) Source(36, 27) + SourceIndex(0) +--- +>>> __param(0, ParameterDecorator2(70)) +1->^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^ 1-> > @ -2 > -3 > ParameterDecorator2 -4 > ( -5 > 70 -6 > ) -7 > -1->Emitted(47, 5) Source(37, 8) + SourceIndex(0) -2 >Emitted(47, 16) Source(37, 8) + SourceIndex(0) -3 >Emitted(47, 35) Source(37, 27) + SourceIndex(0) -4 >Emitted(47, 36) Source(37, 28) + SourceIndex(0) -5 >Emitted(47, 38) Source(37, 30) + SourceIndex(0) -6 >Emitted(47, 39) Source(37, 31) + SourceIndex(0) -7 >Emitted(47, 40) Source(37, 31) + SourceIndex(0) ---- ->>>], Greeter.prototype, "fn", null); -1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > +3 > ParameterDecorator2 +4 > ( +5 > 70 +6 > ) +7 > +1->Emitted(45, 9) Source(37, 8) + SourceIndex(0) +2 >Emitted(45, 20) Source(37, 8) + SourceIndex(0) +3 >Emitted(45, 39) Source(37, 27) + SourceIndex(0) +4 >Emitted(45, 40) Source(37, 28) + SourceIndex(0) +5 >Emitted(45, 42) Source(37, 30) + SourceIndex(0) +6 >Emitted(45, 43) Source(37, 31) + SourceIndex(0) +7 >Emitted(45, 44) Source(37, 31) + SourceIndex(0) +--- +>>> ], Greeter.prototype, "fn", null); +1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > > x: number) { > return this.greeting; > } -1 >Emitted(48, 34) Source(40, 6) + SourceIndex(0) +1 >Emitted(46, 38) Source(40, 6) + SourceIndex(0) --- ->>>__decorate([ -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +>>> __decorate([ +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > > @PropertyDecorator1 > @PropertyDecorator2(80) > -1 >Emitted(49, 1) Source(44, 5) + SourceIndex(0) +1 >Emitted(47, 5) Source(44, 5) + SourceIndex(0) --- ->>> PropertyDecorator1, -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^-> +>>> PropertyDecorator1, +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^-> 1-> -2 > PropertyDecorator1 -1->Emitted(50, 5) Source(42, 6) + SourceIndex(0) -2 >Emitted(50, 23) Source(42, 24) + SourceIndex(0) +2 > PropertyDecorator1 +1->Emitted(48, 9) Source(42, 6) + SourceIndex(0) +2 >Emitted(48, 27) Source(42, 24) + SourceIndex(0) --- ->>> PropertyDecorator2(80), -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^-> +>>> PropertyDecorator2(80), +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^^^^-> 1-> > @ -2 > PropertyDecorator2 -3 > ( -4 > 80 -5 > ) -1->Emitted(51, 5) Source(43, 6) + SourceIndex(0) -2 >Emitted(51, 23) Source(43, 24) + SourceIndex(0) -3 >Emitted(51, 24) Source(43, 25) + SourceIndex(0) -4 >Emitted(51, 26) Source(43, 27) + SourceIndex(0) -5 >Emitted(51, 27) Source(43, 28) + SourceIndex(0) ---- ->>> __param(0, ParameterDecorator1), -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^-> +2 > PropertyDecorator2 +3 > ( +4 > 80 +5 > ) +1->Emitted(49, 9) Source(43, 6) + SourceIndex(0) +2 >Emitted(49, 27) Source(43, 24) + SourceIndex(0) +3 >Emitted(49, 28) Source(43, 25) + SourceIndex(0) +4 >Emitted(49, 30) Source(43, 27) + SourceIndex(0) +5 >Emitted(49, 31) Source(43, 28) + SourceIndex(0) +--- +>>> __param(0, ParameterDecorator1), +1->^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^-> 1-> > get greetings() { > return this.greeting; @@ -655,259 +574,323 @@ sourceFile:sourceMapValidationDecorators.ts > > set greetings( > @ -2 > -3 > ParameterDecorator1 -4 > -1->Emitted(52, 5) Source(49, 8) + SourceIndex(0) -2 >Emitted(52, 16) Source(49, 8) + SourceIndex(0) -3 >Emitted(52, 35) Source(49, 27) + SourceIndex(0) -4 >Emitted(52, 36) Source(49, 27) + SourceIndex(0) ---- ->>> __param(0, ParameterDecorator2(90)) -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -8 > ^^^-> +2 > +3 > ParameterDecorator1 +4 > +1->Emitted(50, 9) Source(49, 8) + SourceIndex(0) +2 >Emitted(50, 20) Source(49, 8) + SourceIndex(0) +3 >Emitted(50, 39) Source(49, 27) + SourceIndex(0) +4 >Emitted(50, 40) Source(49, 27) + SourceIndex(0) +--- +>>> __param(0, ParameterDecorator2(90)) +1->^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^ +8 > ^^^-> 1-> > @ -2 > -3 > ParameterDecorator2 -4 > ( -5 > 90 -6 > ) -7 > -1->Emitted(53, 5) Source(50, 8) + SourceIndex(0) -2 >Emitted(53, 16) Source(50, 8) + SourceIndex(0) -3 >Emitted(53, 35) Source(50, 27) + SourceIndex(0) -4 >Emitted(53, 36) Source(50, 28) + SourceIndex(0) -5 >Emitted(53, 38) Source(50, 30) + SourceIndex(0) -6 >Emitted(53, 39) Source(50, 31) + SourceIndex(0) -7 >Emitted(53, 40) Source(50, 31) + SourceIndex(0) ---- ->>>], Greeter.prototype, "greetings", null); -1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > +3 > ParameterDecorator2 +4 > ( +5 > 90 +6 > ) +7 > +1->Emitted(51, 9) Source(50, 8) + SourceIndex(0) +2 >Emitted(51, 20) Source(50, 8) + SourceIndex(0) +3 >Emitted(51, 39) Source(50, 27) + SourceIndex(0) +4 >Emitted(51, 40) Source(50, 28) + SourceIndex(0) +5 >Emitted(51, 42) Source(50, 30) + SourceIndex(0) +6 >Emitted(51, 43) Source(50, 31) + SourceIndex(0) +7 >Emitted(51, 44) Source(50, 31) + SourceIndex(0) +--- +>>> ], Greeter.prototype, "greetings", null); +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> -1->Emitted(54, 41) Source(46, 6) + SourceIndex(0) +1->Emitted(52, 45) Source(46, 6) + SourceIndex(0) --- ->>>__decorate([ -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +>>> __decorate([ +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(55, 1) Source(33, 5) + SourceIndex(0) +1 >Emitted(53, 5) Source(33, 5) + SourceIndex(0) --- ->>> PropertyDecorator1, -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^^^-> +>>> PropertyDecorator1, +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^^^^-> 1-> -2 > PropertyDecorator1 -1->Emitted(56, 5) Source(31, 6) + SourceIndex(0) -2 >Emitted(56, 23) Source(31, 24) + SourceIndex(0) +2 > PropertyDecorator1 +1->Emitted(54, 9) Source(31, 6) + SourceIndex(0) +2 >Emitted(54, 27) Source(31, 24) + SourceIndex(0) --- ->>> PropertyDecorator2(60) -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -6 > ^-> +>>> PropertyDecorator2(60) +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^-> 1-> > @ -2 > PropertyDecorator2 -3 > ( -4 > 60 -5 > ) -1->Emitted(57, 5) Source(32, 6) + SourceIndex(0) -2 >Emitted(57, 23) Source(32, 24) + SourceIndex(0) -3 >Emitted(57, 24) Source(32, 25) + SourceIndex(0) -4 >Emitted(57, 26) Source(32, 27) + SourceIndex(0) -5 >Emitted(57, 27) Source(32, 28) + SourceIndex(0) ---- ->>>], Greeter, "x1", void 0); -1->^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > PropertyDecorator2 +3 > ( +4 > 60 +5 > ) +1->Emitted(55, 9) Source(32, 6) + SourceIndex(0) +2 >Emitted(55, 27) Source(32, 24) + SourceIndex(0) +3 >Emitted(55, 28) Source(32, 25) + SourceIndex(0) +4 >Emitted(55, 30) Source(32, 27) + SourceIndex(0) +5 >Emitted(55, 31) Source(32, 28) + SourceIndex(0) +--- +>>> ], Greeter, "x1", void 0); +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > private static x1: number = 10; -1->Emitted(58, 26) Source(33, 36) + SourceIndex(0) +1->Emitted(56, 30) Source(33, 36) + SourceIndex(0) --- ->>>Greeter = __decorate([ -1 > -2 >^^^^^^^ -3 > ^^^^^^^^^^^^^^-> +>>> Greeter = __decorate([ +1 >^^^^ +2 > ^^^^^^^ +3 > ^^^^^^^^^^^^^^-> 1 > -2 >Greeter -1 >Emitted(59, 1) Source(10, 7) + SourceIndex(0) -2 >Emitted(59, 8) Source(10, 14) + SourceIndex(0) +2 > Greeter +1 >Emitted(57, 5) Source(10, 7) + SourceIndex(0) +2 >Emitted(57, 12) Source(10, 14) + SourceIndex(0) --- ->>> ClassDecorator1, -1->^^^^ -2 > ^^^^^^^^^^^^^^^ -3 > ^^^^^^-> +>>> ClassDecorator1, +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^^^^^-> 1-> -2 > ClassDecorator1 -1->Emitted(60, 5) Source(8, 2) + SourceIndex(0) -2 >Emitted(60, 20) Source(8, 17) + SourceIndex(0) +2 > ClassDecorator1 +1->Emitted(58, 9) Source(8, 2) + SourceIndex(0) +2 >Emitted(58, 24) Source(8, 17) + SourceIndex(0) --- ->>> ClassDecorator2(10), -1->^^^^ -2 > ^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^^^-> +>>> ClassDecorator2(10), +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^^^^^^^-> 1-> >@ -2 > ClassDecorator2 -3 > ( -4 > 10 -5 > ) -1->Emitted(61, 5) Source(9, 2) + SourceIndex(0) -2 >Emitted(61, 20) Source(9, 17) + SourceIndex(0) -3 >Emitted(61, 21) Source(9, 18) + SourceIndex(0) -4 >Emitted(61, 23) Source(9, 20) + SourceIndex(0) -5 >Emitted(61, 24) Source(9, 21) + SourceIndex(0) ---- ->>> __param(0, ParameterDecorator1), -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^-> +2 > ClassDecorator2 +3 > ( +4 > 10 +5 > ) +1->Emitted(59, 9) Source(9, 2) + SourceIndex(0) +2 >Emitted(59, 24) Source(9, 17) + SourceIndex(0) +3 >Emitted(59, 25) Source(9, 18) + SourceIndex(0) +4 >Emitted(59, 27) Source(9, 20) + SourceIndex(0) +5 >Emitted(59, 28) Source(9, 21) + SourceIndex(0) +--- +>>> __param(0, ParameterDecorator1), +1->^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^^-> 1-> >class Greeter { > constructor( > @ -2 > -3 > ParameterDecorator1 -4 > -1->Emitted(62, 5) Source(12, 8) + SourceIndex(0) -2 >Emitted(62, 16) Source(12, 8) + SourceIndex(0) -3 >Emitted(62, 35) Source(12, 27) + SourceIndex(0) -4 >Emitted(62, 36) Source(12, 27) + SourceIndex(0) ---- ->>> __param(0, ParameterDecorator2(20)), -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ +2 > +3 > ParameterDecorator1 +4 > +1->Emitted(60, 9) Source(12, 8) + SourceIndex(0) +2 >Emitted(60, 20) Source(12, 8) + SourceIndex(0) +3 >Emitted(60, 39) Source(12, 27) + SourceIndex(0) +4 >Emitted(60, 40) Source(12, 27) + SourceIndex(0) +--- +>>> __param(0, ParameterDecorator2(20)), +1->^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^ 1-> > @ -2 > -3 > ParameterDecorator2 -4 > ( -5 > 20 -6 > ) -7 > -1->Emitted(63, 5) Source(13, 8) + SourceIndex(0) -2 >Emitted(63, 16) Source(13, 8) + SourceIndex(0) -3 >Emitted(63, 35) Source(13, 27) + SourceIndex(0) -4 >Emitted(63, 36) Source(13, 28) + SourceIndex(0) -5 >Emitted(63, 38) Source(13, 30) + SourceIndex(0) -6 >Emitted(63, 39) Source(13, 31) + SourceIndex(0) -7 >Emitted(63, 40) Source(13, 31) + SourceIndex(0) ---- ->>> __param(1, ParameterDecorator1), -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^-> +2 > +3 > ParameterDecorator2 +4 > ( +5 > 20 +6 > ) +7 > +1->Emitted(61, 9) Source(13, 8) + SourceIndex(0) +2 >Emitted(61, 20) Source(13, 8) + SourceIndex(0) +3 >Emitted(61, 39) Source(13, 27) + SourceIndex(0) +4 >Emitted(61, 40) Source(13, 28) + SourceIndex(0) +5 >Emitted(61, 42) Source(13, 30) + SourceIndex(0) +6 >Emitted(61, 43) Source(13, 31) + SourceIndex(0) +7 >Emitted(61, 44) Source(13, 31) + SourceIndex(0) +--- +>>> __param(1, ParameterDecorator1), +1 >^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^-> 1 > > public greeting: string, > > @ -2 > -3 > ParameterDecorator1 -4 > -1 >Emitted(64, 5) Source(16, 8) + SourceIndex(0) -2 >Emitted(64, 16) Source(16, 8) + SourceIndex(0) -3 >Emitted(64, 35) Source(16, 27) + SourceIndex(0) -4 >Emitted(64, 36) Source(16, 27) + SourceIndex(0) ---- ->>> __param(1, ParameterDecorator2(30)) -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ +2 > +3 > ParameterDecorator1 +4 > +1 >Emitted(62, 9) Source(16, 8) + SourceIndex(0) +2 >Emitted(62, 20) Source(16, 8) + SourceIndex(0) +3 >Emitted(62, 39) Source(16, 27) + SourceIndex(0) +4 >Emitted(62, 40) Source(16, 27) + SourceIndex(0) +--- +>>> __param(1, ParameterDecorator2(30)) +1->^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^ 1-> > @ -2 > -3 > ParameterDecorator2 -4 > ( -5 > 30 -6 > ) -7 > -1->Emitted(65, 5) Source(17, 8) + SourceIndex(0) -2 >Emitted(65, 16) Source(17, 8) + SourceIndex(0) -3 >Emitted(65, 35) Source(17, 27) + SourceIndex(0) -4 >Emitted(65, 36) Source(17, 28) + SourceIndex(0) -5 >Emitted(65, 38) Source(17, 30) + SourceIndex(0) -6 >Emitted(65, 39) Source(17, 31) + SourceIndex(0) -7 >Emitted(65, 40) Source(17, 31) + SourceIndex(0) ---- ->>>], Greeter); -1 >^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > +3 > ParameterDecorator2 +4 > ( +5 > 30 +6 > ) +7 > +1->Emitted(63, 9) Source(17, 8) + SourceIndex(0) +2 >Emitted(63, 20) Source(17, 8) + SourceIndex(0) +3 >Emitted(63, 39) Source(17, 27) + SourceIndex(0) +4 >Emitted(63, 40) Source(17, 28) + SourceIndex(0) +5 >Emitted(63, 42) Source(17, 30) + SourceIndex(0) +6 >Emitted(63, 43) Source(17, 31) + SourceIndex(0) +7 >Emitted(63, 44) Source(17, 31) + SourceIndex(0) +--- +>>> ], Greeter); +1 >^^^^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^^^-> 1 > -2 > Greeter -3 > { - > constructor( - > @ParameterDecorator1 - > @ParameterDecorator2(20) - > public greeting: string, - > - > @ParameterDecorator1 - > @ParameterDecorator2(30) - > ...b: string[]) { - > } +2 > Greeter +3 > { + > constructor( + > @ParameterDecorator1 + > @ParameterDecorator2(20) + > public greeting: string, + > + > @ParameterDecorator1 + > @ParameterDecorator2(30) + > ...b: string[]) { + > } + > + > @PropertyDecorator1 + > @PropertyDecorator2(40) + > greet() { + > return "

" + this.greeting + "

"; + > } + > + > @PropertyDecorator1 + > @PropertyDecorator2(50) + > private x: string; + > + > @PropertyDecorator1 + > @PropertyDecorator2(60) + > private static x1: number = 10; + > + > private fn( + > @ParameterDecorator1 + > @ParameterDecorator2(70) + > x: number) { + > return this.greeting; + > } > - > @PropertyDecorator1 - > @PropertyDecorator2(40) - > greet() { - > return "

" + this.greeting + "

"; - > } - > - > @PropertyDecorator1 - > @PropertyDecorator2(50) - > private x: string; - > - > @PropertyDecorator1 - > @PropertyDecorator2(60) - > private static x1: number = 10; + > @PropertyDecorator1 + > @PropertyDecorator2(80) + > get greetings() { + > return this.greeting; + > } > - > private fn( - > @ParameterDecorator1 - > @ParameterDecorator2(70) - > x: number) { - > return this.greeting; - > } - > - > @PropertyDecorator1 - > @PropertyDecorator2(80) - > get greetings() { - > return this.greeting; - > } - > - > set greetings( - > @ParameterDecorator1 - > @ParameterDecorator2(90) - > greetings: string) { - > this.greeting = greetings; - > } - > } -1 >Emitted(66, 4) Source(10, 7) + SourceIndex(0) -2 >Emitted(66, 11) Source(10, 14) + SourceIndex(0) -3 >Emitted(66, 12) Source(54, 2) + SourceIndex(0) + > set greetings( + > @ParameterDecorator1 + > @ParameterDecorator2(90) + > greetings: string) { + > this.greeting = greetings; + > } + > } +1 >Emitted(64, 8) Source(10, 7) + SourceIndex(0) +2 >Emitted(64, 15) Source(10, 14) + SourceIndex(0) +3 >Emitted(64, 16) Source(54, 2) + SourceIndex(0) +--- +>>> return Greeter; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +1-> +2 > } +1->Emitted(65, 5) Source(54, 1) + SourceIndex(0) +2 >Emitted(65, 19) Source(54, 2) + SourceIndex(0) +--- +>>>}()); +1 >^ +2 > +3 > ^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 > +3 > class Greeter { + > constructor( + > @ParameterDecorator1 + > @ParameterDecorator2(20) + > public greeting: string, + > + > @ParameterDecorator1 + > @ParameterDecorator2(30) + > ...b: string[]) { + > } + > + > @PropertyDecorator1 + > @PropertyDecorator2(40) + > greet() { + > return "

" + this.greeting + "

"; + > } + > + > @PropertyDecorator1 + > @PropertyDecorator2(50) + > private x: string; + > + > @PropertyDecorator1 + > @PropertyDecorator2(60) + > private static x1: number = 10; + > + > private fn( + > @ParameterDecorator1 + > @ParameterDecorator2(70) + > x: number) { + > return this.greeting; + > } + > + > @PropertyDecorator1 + > @PropertyDecorator2(80) + > get greetings() { + > return this.greeting; + > } + > + > set greetings( + > @ParameterDecorator1 + > @ParameterDecorator2(90) + > greetings: string) { + > this.greeting = greetings; + > } + > } +1 >Emitted(66, 2) Source(54, 2) + SourceIndex(0) +2 >Emitted(66, 2) Source(10, 1) + SourceIndex(0) +3 >Emitted(66, 6) Source(54, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMapValidationDecorators.js.map \ No newline at end of file diff --git a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.js b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.js index a641ecd6f0375..62a23d538c43b 100644 --- a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.js +++ b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.js @@ -148,9 +148,9 @@ function outer(x) { var Inner = (function () { function Inner() { } + Inner.y = x; return Inner; }()); - Inner.y = x; return Inner; } var y = outer(5).y; diff --git a/tests/baselines/reference/staticClassProps.js b/tests/baselines/reference/staticClassProps.js index 48798bd4def67..31aa67c56df4c 100644 --- a/tests/baselines/reference/staticClassProps.js +++ b/tests/baselines/reference/staticClassProps.js @@ -14,6 +14,6 @@ var C = (function () { } C.prototype.foo = function () { }; + C.z = 1; return C; }()); -C.z = 1; diff --git a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js index 41f2da7f4afe9..684594ffd5c55 100644 --- a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js +++ b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js @@ -33,6 +33,6 @@ var P = (function (_super) { function P() { return _super !== null && _super.apply(this, arguments) || this; } + P.SomeNumber = P.GetNumber(); return P; }(SomeBase)); -P.SomeNumber = P.GetNumber(); diff --git a/tests/baselines/reference/staticMemberInitialization.js b/tests/baselines/reference/staticMemberInitialization.js index 13a5c8c25c6aa..c21c29ed4f815 100644 --- a/tests/baselines/reference/staticMemberInitialization.js +++ b/tests/baselines/reference/staticMemberInitialization.js @@ -10,8 +10,8 @@ var r = C.x; var C = (function () { function C() { } + C.x = 1; return C; }()); -C.x = 1; var c = new C(); var r = C.x; diff --git a/tests/baselines/reference/staticMemberWithStringAndNumberNames.js b/tests/baselines/reference/staticMemberWithStringAndNumberNames.js index 9d8846ba963f0..2fdd64ea04b76 100644 --- a/tests/baselines/reference/staticMemberWithStringAndNumberNames.js +++ b/tests/baselines/reference/staticMemberWithStringAndNumberNames.js @@ -19,10 +19,10 @@ var C = (function () { this.x2 = C['0']; this.x3 = C[0]; } + C["foo"] = 0; + C[0] = 1; + C.s = C['foo']; + C.s2 = C['0']; + C.s3 = C[0]; return C; }()); -C["foo"] = 0; -C[0] = 1; -C.s = C['foo']; -C.s2 = C['0']; -C.s3 = C[0]; diff --git a/tests/baselines/reference/staticModifierAlreadySeen.js b/tests/baselines/reference/staticModifierAlreadySeen.js index c37d4c0807ad3..76f8b050d6f39 100644 --- a/tests/baselines/reference/staticModifierAlreadySeen.js +++ b/tests/baselines/reference/staticModifierAlreadySeen.js @@ -9,6 +9,6 @@ var C = (function () { function C() { } C.bar = function () { }; + C.foo = 1; return C; }()); -C.foo = 1; diff --git a/tests/baselines/reference/staticPropSuper.js b/tests/baselines/reference/staticPropSuper.js index 5c22232534fef..dc308a4769e53 100644 --- a/tests/baselines/reference/staticPropSuper.js +++ b/tests/baselines/reference/staticPropSuper.js @@ -59,9 +59,9 @@ var B = (function (_super) { _this = _super.call(this) || this; return _this; } + B.s = 9; return B; }(A)); -B.s = 9; var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/statics.js b/tests/baselines/reference/statics.js index d52a28208e6c9..3776c09c8ceae 100644 --- a/tests/baselines/reference/statics.js +++ b/tests/baselines/reference/statics.js @@ -45,11 +45,11 @@ var M; C.f = function (n) { return "wow: " + (n + C.y + C.pub + C.priv); }; + C.priv = 2; + C.pub = 3; + C.y = C.priv; return C; }()); - C.priv = 2; - C.pub = 3; - C.y = C.priv; M.C = C; var c = C.y; function f() { diff --git a/tests/baselines/reference/staticsInConstructorBodies.js b/tests/baselines/reference/staticsInConstructorBodies.js index edd49456ef711..9bc3ed293251c 100644 --- a/tests/baselines/reference/staticsInConstructorBodies.js +++ b/tests/baselines/reference/staticsInConstructorBodies.js @@ -11,6 +11,6 @@ var C = (function () { function C() { } C.m1 = function () { }; // ERROR + C.p1 = 0; // ERROR return C; }()); -C.p1 = 0; // ERROR diff --git a/tests/baselines/reference/staticsNotInScopeInClodule.js b/tests/baselines/reference/staticsNotInScopeInClodule.js index ccaace996cd2e..c43e22fce4ceb 100644 --- a/tests/baselines/reference/staticsNotInScopeInClodule.js +++ b/tests/baselines/reference/staticsNotInScopeInClodule.js @@ -11,9 +11,9 @@ module Clod { var Clod = (function () { function Clod() { } + Clod.x = 10; return Clod; }()); -Clod.x = 10; (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 65426391967af..eb2286556ac03 100644 --- a/tests/baselines/reference/strictModeInConstructor.js +++ b/tests/baselines/reference/strictModeInConstructor.js @@ -114,9 +114,9 @@ var Bs = (function (_super) { "use strict"; // No error return _super.call(this) || this; } + Bs.s = 9; return Bs; }(A)); -Bs.s = 9; var Cs = (function (_super) { __extends(Cs, _super); function Cs() { @@ -124,9 +124,9 @@ var Cs = (function (_super) { "use strict"; return _this; } + Cs.s = 9; return Cs; }(A)); -Cs.s = 9; var Ds = (function (_super) { __extends(Ds, _super); function Ds() { @@ -136,6 +136,6 @@ var Ds = (function (_super) { "use strict"; return _this; } + Ds.s = 9; return Ds; }(A)); -Ds.s = 9; diff --git a/tests/baselines/reference/superAccess.js b/tests/baselines/reference/superAccess.js index 468e2155e4801..aac0025961359 100644 --- a/tests/baselines/reference/superAccess.js +++ b/tests/baselines/reference/superAccess.js @@ -29,9 +29,9 @@ var MyBase = (function () { this.S2 = "test"; this.f = function () { return 5; }; } + MyBase.S1 = 5; return MyBase; }()); -MyBase.S1 = 5; var MyDerived = (function (_super) { __extends(MyDerived, _super); function MyDerived() { diff --git a/tests/baselines/reference/superAccess2.js b/tests/baselines/reference/superAccess2.js index 51e8f61ab28d1..9fa848dbf6a6f 100644 --- a/tests/baselines/reference/superAccess2.js +++ b/tests/baselines/reference/superAccess2.js @@ -64,6 +64,6 @@ var Q = (function (_super) { _super.x.call(this); // error _super.y.call(this); }; + Q.yy = _super.; // error for static initializer accessing super return Q; }(P)); -Q.yy = _super.; // error for static initializer accessing super diff --git a/tests/baselines/reference/thisInArrowFunctionInStaticInitializer1.js b/tests/baselines/reference/thisInArrowFunctionInStaticInitializer1.js index 03b86b1d225e8..88a4f5c6e5ccc 100644 --- a/tests/baselines/reference/thisInArrowFunctionInStaticInitializer1.js +++ b/tests/baselines/reference/thisInArrowFunctionInStaticInitializer1.js @@ -9,14 +9,13 @@ class Vector { } //// [thisInArrowFunctionInStaticInitializer1.js] -var _this = this; function log(a) { } var Vector = (function () { function Vector() { } + Vector.foo = function () { + // 'this' should not be available in a static initializer. + log(_this); + }; return Vector; }()); -Vector.foo = function () { - // 'this' should not be available in a static initializer. - log(_this); -}; diff --git a/tests/baselines/reference/thisInConstructorParameter2.js b/tests/baselines/reference/thisInConstructorParameter2.js index ba2917c5a4e66..7260ecafcb98c 100644 --- a/tests/baselines/reference/thisInConstructorParameter2.js +++ b/tests/baselines/reference/thisInConstructorParameter2.js @@ -25,6 +25,6 @@ var P = (function () { if (zz === void 0) { zz = this; } zz.y; }; + P.y = this; return P; }()); -P.y = this; diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index 25350fb78cf24..24b25d46a34b7 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -63,9 +63,9 @@ var __extends = (this && this.__extends) || (function () { var ErrClass1 = (function () { function ErrClass1() { } + ErrClass1.t = this; // Error return ErrClass1; }()); -ErrClass1.t = this; // Error var BaseErrClass = (function () { function BaseErrClass(t) { } diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index 070d5597fcc17..845183d8df5f1 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -64,9 +64,9 @@ var __extends = (this && this.__extends) || (function () { var ErrClass1 = (function () { function ErrClass1() { } + ErrClass1.t = this; // Error return ErrClass1; }()); -ErrClass1.t = this; // Error var BaseErrClass = (function () { function BaseErrClass(t) { } diff --git a/tests/baselines/reference/thisInOuterClassBody.js b/tests/baselines/reference/thisInOuterClassBody.js index 40b0e2b78ae58..40e4a2e2485da 100644 --- a/tests/baselines/reference/thisInOuterClassBody.js +++ b/tests/baselines/reference/thisInOuterClassBody.js @@ -36,6 +36,6 @@ var Foo = (function () { var a = this.y; var b = this.x; }; + Foo.y = this; return Foo; }()); -Foo.y = this; diff --git a/tests/baselines/reference/thisInPropertyBoundDeclarations.js b/tests/baselines/reference/thisInPropertyBoundDeclarations.js index f5967fbb5b2ad..0b378cec51aaf 100644 --- a/tests/baselines/reference/thisInPropertyBoundDeclarations.js +++ b/tests/baselines/reference/thisInPropertyBoundDeclarations.js @@ -74,13 +74,13 @@ var Bug = (function () { Bug.prototype.foo = function (name) { this.name = name; }; + Bug.func = [ + function (that, name) { + that.foo(name); + } + ]; return Bug; }()); -Bug.func = [ - function (that, name) { - that.foo(name); - } -]; // Valid use of this in a property bound decl var A = (function () { function A() { diff --git a/tests/baselines/reference/thisInStaticMethod1.js b/tests/baselines/reference/thisInStaticMethod1.js index 1e39ded3b6171..a42415c0b62b1 100644 --- a/tests/baselines/reference/thisInStaticMethod1.js +++ b/tests/baselines/reference/thisInStaticMethod1.js @@ -14,7 +14,7 @@ var foo = (function () { foo.bar = function () { return this.x; }; + foo.x = 3; return foo; }()); -foo.x = 3; var x = foo.bar(); diff --git a/tests/baselines/reference/thisTypeErrors.js b/tests/baselines/reference/thisTypeErrors.js index 5811ec6b70922..f246b80f4f4f6 100644 --- a/tests/baselines/reference/thisTypeErrors.js +++ b/tests/baselines/reference/thisTypeErrors.js @@ -75,9 +75,9 @@ var C2 = (function () { C2.foo = function (x) { return undefined; }; + C2.y = undefined; return C2; }()); -C2.y = undefined; var N1; (function (N1) { N1.y = this; diff --git a/tests/baselines/reference/transpile/Correctly serialize metadata when transpile with CommonJS option.js b/tests/baselines/reference/transpile/Correctly serialize metadata when transpile with CommonJS option.js index cd4ce3c862e53..9bdbfba8396b6 100644 --- a/tests/baselines/reference/transpile/Correctly serialize metadata when transpile with CommonJS option.js +++ b/tests/baselines/reference/transpile/Correctly serialize metadata when transpile with CommonJS option.js @@ -14,11 +14,11 @@ var MyClass1 = (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + fooexport, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); -MyClass1 = __decorate([ - fooexport, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) -], MyClass1); -var _a; //# sourceMappingURL=file.js.map \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Correctly serialize metadata when transpile with System option.js b/tests/baselines/reference/transpile/Correctly serialize metadata when transpile with System option.js index 9e3d59ce27c89..e79eeceae5063 100644 --- a/tests/baselines/reference/transpile/Correctly serialize metadata when transpile with System option.js +++ b/tests/baselines/reference/transpile/Correctly serialize metadata when transpile with System option.js @@ -10,7 +10,7 @@ System.register(["angular2/core"], function (exports_1, context_1) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __moduleName = context_1 && context_1.id; - var ng, MyClass1, _a; + var ng, MyClass1; return { setters: [ function (ng_1) { @@ -22,12 +22,13 @@ System.register(["angular2/core"], function (exports_1, context_1) { function MyClass1(_elementRef) { this._elementRef = _elementRef; } + MyClass1 = __decorate([ + fooexport, + __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) + ], MyClass1); return MyClass1; + var _a; }()); - MyClass1 = __decorate([ - fooexport, - __metadata("design:paramtypes", [typeof (_a = (typeof ng !== "undefined" && ng).ElementRef) === "function" && _a || Object]) - ], MyClass1); } }; }); diff --git a/tests/baselines/reference/transpile/Transpile with emit decorators and emit metadata.js b/tests/baselines/reference/transpile/Transpile with emit decorators and emit metadata.js index 0b3bbaa8d7333..236f91f959473 100644 --- a/tests/baselines/reference/transpile/Transpile with emit decorators and emit metadata.js +++ b/tests/baselines/reference/transpile/Transpile with emit decorators and emit metadata.js @@ -9,12 +9,12 @@ var MyClass = (function () { this.db = db; this.db.doSomething(); } + MyClass = __decorate([ + someDecorator, + __metadata("design:paramtypes", [typeof (_a = typeof db_1.db !== "undefined" && db_1.db) === "function" && _a || Object]) + ], MyClass); return MyClass; + var _a; }()); -MyClass = __decorate([ - someDecorator, - __metadata("design:paramtypes", [typeof (_a = typeof db_1.db !== "undefined" && db_1.db) === "function" && _a || Object]) -], MyClass); exports.MyClass = MyClass; -var _a; //# sourceMappingURL=file.js.map \ No newline at end of file diff --git a/tests/baselines/reference/tsxDefaultImports.js b/tests/baselines/reference/tsxDefaultImports.js index a6c1a4217a3ac..c3a287c478d19 100644 --- a/tests/baselines/reference/tsxDefaultImports.js +++ b/tests/baselines/reference/tsxDefaultImports.js @@ -23,9 +23,9 @@ var SomeEnum; var SomeClass = (function () { function SomeClass() { } + SomeClass.E = SomeEnum; return SomeClass; }()); -SomeClass.E = SomeEnum; exports["default"] = SomeClass; //// [b.js] "use strict"; diff --git a/tests/baselines/reference/typeOfPrototype.js b/tests/baselines/reference/typeOfPrototype.js index a0f076113e0c0..3e8b31869361c 100644 --- a/tests/baselines/reference/typeOfPrototype.js +++ b/tests/baselines/reference/typeOfPrototype.js @@ -11,7 +11,7 @@ var Foo = (function () { function Foo() { this.bar = 3; } + Foo.bar = ''; return Foo; }()); -Foo.bar = ''; Foo.prototype.bar = undefined; // Should be OK diff --git a/tests/baselines/reference/typeOfThisInStaticMembers2.js b/tests/baselines/reference/typeOfThisInStaticMembers2.js index 886ea04e23db4..b01770446beea 100644 --- a/tests/baselines/reference/typeOfThisInStaticMembers2.js +++ b/tests/baselines/reference/typeOfThisInStaticMembers2.js @@ -11,12 +11,12 @@ class C2 { var C = (function () { function C() { } + C.foo = this; // error return C; }()); -C.foo = this; // error var C2 = (function () { function C2() { } + C2.foo = this; // error return C2; }()); -C2.foo = this; // error diff --git a/tests/baselines/reference/typeQueryOnClass.js b/tests/baselines/reference/typeQueryOnClass.js index 80623af5be827..85dff0de831e0 100644 --- a/tests/baselines/reference/typeQueryOnClass.js +++ b/tests/baselines/reference/typeQueryOnClass.js @@ -99,10 +99,10 @@ var C = (function () { enumerable: true, configurable: true }); + C.sa = 1; + C.sb = function () { return 1; }; return C; }()); -C.sa = 1; -C.sb = function () { return 1; }; var c; // BUG 820454 var r1; diff --git a/tests/baselines/reference/typeofUsedBeforeBlockScoped.js b/tests/baselines/reference/typeofUsedBeforeBlockScoped.js index eebf4beae67a8..cc9003dd4f6e4 100644 --- a/tests/baselines/reference/typeofUsedBeforeBlockScoped.js +++ b/tests/baselines/reference/typeofUsedBeforeBlockScoped.js @@ -12,8 +12,8 @@ let o = { n: 12 }; var C = (function () { function C() { } + C.s = 2; return C; }()); -C.s = 2; var o2; var o = { n: 12 }; diff --git a/tests/baselines/reference/unqualifiedCallToClassStatic1.js b/tests/baselines/reference/unqualifiedCallToClassStatic1.js index 906e9d3795ff1..6c78a737fe862 100644 --- a/tests/baselines/reference/unqualifiedCallToClassStatic1.js +++ b/tests/baselines/reference/unqualifiedCallToClassStatic1.js @@ -10,9 +10,9 @@ class Vector { var Vector = (function () { function Vector() { } + Vector.foo = function () { + // 'foo' cannot be called in an unqualified manner. + foo(); + }; return Vector; }()); -Vector.foo = function () { - // 'foo' cannot be called in an unqualified manner. - foo(); -}; diff --git a/tests/baselines/reference/witness.js b/tests/baselines/reference/witness.js index 9f92c90ffa44b..ebd1669d17764 100644 --- a/tests/baselines/reference/witness.js +++ b/tests/baselines/reference/witness.js @@ -258,9 +258,9 @@ var c2inst; var C3 = (function () { function C3() { } + C3.q = C3.q; return C3; }()); -C3.q = C3.q; var qq = C3.q; var qq; // Parentheses - tested a bunch above