Merge branch 'master' into ownJsonParsing

This commit is contained in:
Sheetal Nandi
2017-06-01 10:43:41 -07:00
210 changed files with 3705 additions and 2550 deletions
+2 -2
View File
@@ -21,8 +21,8 @@ branches:
- release-2.3
install:
- npm uninstall typescript
- npm uninstall tslint
- npm uninstall typescript --no-save
- npm uninstall tslint --no-save
- npm install
cache:
+3 -3
View File
@@ -2,12 +2,12 @@
# Set up NVM
export NVM_DIR="/home/dotnet-bot/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install $1
npm uninstall typescript
npm uninstall tslint
npm uninstall typescript --no-save
npm uninstall tslint --no-save
npm install
npm update
npm test
+62 -70
View File
@@ -1101,13 +1101,13 @@ namespace ts {
if (suggestedNameNotFoundMessage && suggestionCount < maximumSuggestionCount) {
suggestion = getSuggestionForNonexistentSymbol(originalLocation, name, meaning);
if (suggestion) {
suggestionCount++;
error(errorLocation, suggestedNameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg), suggestion);
}
}
if (!suggestion) {
error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg));
}
suggestionCount++;
}
}
return undefined;
@@ -4123,7 +4123,7 @@ namespace ts {
// This elementType will be used if the specific property corresponding to this index is not
// present (aka the tuple element property). This call also checks that the parentType is in
// fact an iterable or array (depending on target language).
const elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false, /*allowAsyncIterable*/ false);
const elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false, /*allowAsyncIterables*/ false);
if (declaration.dotDotDotToken) {
// Rest element has an array type with the same element type as the parent type
type = createArrayType(elementType);
@@ -10894,12 +10894,12 @@ namespace ts {
function getTypeOfDestructuredArrayElement(type: Type, index: number) {
return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) ||
checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) ||
checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) ||
unknownType;
}
function getTypeOfDestructuredSpreadExpression(type: Type) {
return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType);
return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType);
}
function getAssignedTypeOfBinaryExpression(node: BinaryExpression): Type {
@@ -12873,7 +12873,7 @@ namespace ts {
const index = indexOf(arrayLiteral.elements, node);
return getTypeOfPropertyOfContextualType(type, "" + index)
|| getIndexTypeOfContextualType(type, IndexKind.Number)
|| getIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false, /*checkAssignability*/ false);
|| getIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false, /*checkAssignability*/ false);
}
return undefined;
}
@@ -13111,7 +13111,7 @@ namespace ts {
}
const arrayOrIterableType = checkExpression(node.expression, checkMode);
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterable*/ false);
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterables*/ false);
}
function hasDefaultValue(node: BindingElement | Expression): boolean {
@@ -13140,7 +13140,7 @@ namespace ts {
// if there is no index type / iterated type.
const restArrayType = checkExpression((<SpreadElement>e).expression, checkMode);
const restElementType = getIndexTypeOfType(restArrayType, IndexKind.Number) ||
getIteratedTypeOrElementType(restArrayType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false, /*checkAssignability*/ false);
getIteratedTypeOrElementType(restArrayType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false, /*checkAssignability*/ false);
if (restElementType) {
elementTypes.push(restElementType);
}
@@ -16993,7 +16993,7 @@ namespace ts {
// This elementType will be used if the specific property corresponding to this index is not
// present (aka the tuple element property). This call also checks that the parentType is in
// fact an iterable or array (depending on target language).
const elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType;
const elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType;
const elements = node.elements;
for (let i = 0; i < elements.length; i++) {
checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode);
@@ -20137,12 +20137,12 @@ namespace ts {
return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true, awaitModifier !== undefined);
}
function checkIteratedTypeOrElementType(inputType: Type, errorNode: Node, allowStringInput: boolean, allowAsyncIterable: boolean): Type {
function checkIteratedTypeOrElementType(inputType: Type, errorNode: Node, allowStringInput: boolean, allowAsyncIterables: boolean): Type {
if (isTypeAny(inputType)) {
return inputType;
}
return getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, /*checkAssignability*/ true) || anyType;
return getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterables, /*checkAssignability*/ true) || anyType;
}
/**
@@ -20150,16 +20150,16 @@ namespace ts {
* we want to get the iterated type of an iterable for ES2015 or later, or the iterated type
* of a iterable (if defined globally) or element type of an array like for ES2015 or earlier.
*/
function getIteratedTypeOrElementType(inputType: Type, errorNode: Node, allowStringInput: boolean, allowAsyncIterable: boolean, checkAssignability: boolean): Type {
function getIteratedTypeOrElementType(inputType: Type, errorNode: Node, allowStringInput: boolean, allowAsyncIterables: boolean, checkAssignability: boolean): Type {
const uplevelIteration = languageVersion >= ScriptTarget.ES2015;
const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration;
// Get the iterated type of an `Iterable<T>` or `IterableIterator<T>` only in ES2015
// or higher, when inside of an async generator or for-await-if, or when
// downlevelIteration is requested.
if (uplevelIteration || downlevelIteration || allowAsyncIterable) {
if (uplevelIteration || downlevelIteration || allowAsyncIterables) {
// We only report errors for an invalid iterable type in ES2015 or higher.
const iteratedType = getIteratedTypeOfIterable(inputType, uplevelIteration ? errorNode : undefined, allowAsyncIterable, allowAsyncIterable, checkAssignability);
const iteratedType = getIteratedTypeOfIterable(inputType, uplevelIteration ? errorNode : undefined, allowAsyncIterables, /*allowSyncIterables*/ true, checkAssignability);
if (iteratedType || uplevelIteration) {
return iteratedType;
}
@@ -20273,79 +20273,75 @@ namespace ts {
* For a **for-await-of** statement or a `yield*` in an async generator we will look for
* the `[Symbol.asyncIterator]()` method first, and then the `[Symbol.iterator]()` method.
*/
function getIteratedTypeOfIterable(type: Type, errorNode: Node | undefined, isAsyncIterable: boolean, allowNonAsyncIterables: boolean, checkAssignability: boolean): Type | undefined {
function getIteratedTypeOfIterable(type: Type, errorNode: Node | undefined, allowAsyncIterables: boolean, allowSyncIterables: boolean, checkAssignability: boolean): Type | undefined {
if (isTypeAny(type)) {
return undefined;
}
const typeAsIterable = <IterableOrIteratorType>type;
if (isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable) {
return isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable;
}
return mapType(type, getIteratedType);
if (isAsyncIterable) {
// As an optimization, if the type is an instantiation of the global `AsyncIterable<T>`
// or the global `AsyncIterableIterator<T>` then just grab its type argument.
if (isReferenceToType(type, getGlobalAsyncIterableType(/*reportErrors*/ false)) ||
isReferenceToType(type, getGlobalAsyncIterableIteratorType(/*reportErrors*/ false))) {
return typeAsIterable.iteratedTypeOfAsyncIterable = (<GenericType>type).typeArguments[0];
function getIteratedType(type: Type) {
const typeAsIterable = <IterableOrIteratorType>type;
if (allowAsyncIterables) {
if (typeAsIterable.iteratedTypeOfAsyncIterable) {
return typeAsIterable.iteratedTypeOfAsyncIterable;
}
// As an optimization, if the type is an instantiation of the global `AsyncIterable<T>`
// or the global `AsyncIterableIterator<T>` then just grab its type argument.
if (isReferenceToType(type, getGlobalAsyncIterableType(/*reportErrors*/ false)) ||
isReferenceToType(type, getGlobalAsyncIterableIteratorType(/*reportErrors*/ false))) {
return typeAsIterable.iteratedTypeOfAsyncIterable = (<GenericType>type).typeArguments[0];
}
}
}
if (!isAsyncIterable || allowNonAsyncIterables) {
// As an optimization, if the type is an instantiation of the global `Iterable<T>` or
// `IterableIterator<T>` then just grab its type argument.
if (isReferenceToType(type, getGlobalIterableType(/*reportErrors*/ false)) ||
isReferenceToType(type, getGlobalIterableIteratorType(/*reportErrors*/ false))) {
return isAsyncIterable
? typeAsIterable.iteratedTypeOfAsyncIterable = (<GenericType>type).typeArguments[0]
: typeAsIterable.iteratedTypeOfIterable = (<GenericType>type).typeArguments[0];
if (allowSyncIterables) {
if (typeAsIterable.iteratedTypeOfIterable) {
return typeAsIterable.iteratedTypeOfIterable;
}
// As an optimization, if the type is an instantiation of the global `Iterable<T>` or
// `IterableIterator<T>` then just grab its type argument.
if (isReferenceToType(type, getGlobalIterableType(/*reportErrors*/ false)) ||
isReferenceToType(type, getGlobalIterableIteratorType(/*reportErrors*/ false))) {
return typeAsIterable.iteratedTypeOfIterable = (<GenericType>type).typeArguments[0];
}
}
}
let iteratorMethodSignatures: Signature[];
let isNonAsyncIterable = false;
if (isAsyncIterable) {
const iteratorMethod = getTypeOfPropertyOfType(type, getPropertyNameForKnownSymbolName("asyncIterator"));
if (isTypeAny(iteratorMethod)) {
const asyncMethodType = allowAsyncIterables && getTypeOfPropertyOfType(type, getPropertyNameForKnownSymbolName("asyncIterator"));
const methodType = asyncMethodType || (allowSyncIterables && getTypeOfPropertyOfType(type, getPropertyNameForKnownSymbolName("iterator")));
if (isTypeAny(methodType)) {
return undefined;
}
iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, SignatureKind.Call);
}
if (!isAsyncIterable || (allowNonAsyncIterables && !some(iteratorMethodSignatures))) {
const iteratorMethod = getTypeOfPropertyOfType(type, getPropertyNameForKnownSymbolName("iterator"));
if (isTypeAny(iteratorMethod)) {
const signatures = methodType && getSignaturesOfType(methodType, SignatureKind.Call);
if (!some(signatures)) {
if (errorNode) {
error(errorNode,
allowAsyncIterables
? Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
: Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator);
// only report on the first error
errorNode = undefined;
}
return undefined;
}
iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, SignatureKind.Call);
isNonAsyncIterable = true;
}
if (some(iteratorMethodSignatures)) {
const iteratorMethodReturnType = getUnionType(map(iteratorMethodSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true);
const iteratedType = getIteratedTypeOfIterator(iteratorMethodReturnType, errorNode, /*isAsyncIterator*/ !isNonAsyncIterable);
const returnType = getUnionType(map(signatures, getReturnTypeOfSignature), /*subtypeReduction*/ true);
const iteratedType = getIteratedTypeOfIterator(returnType, errorNode, /*isAsyncIterator*/ !!asyncMethodType);
if (checkAssignability && errorNode && iteratedType) {
// If `checkAssignability` was specified, we were called from
// `checkIteratedTypeOrElementType`. As such, we need to validate that
// the type passed in is actually an Iterable.
checkTypeAssignableTo(type, isNonAsyncIterable
? createIterableType(iteratedType)
: createAsyncIterableType(iteratedType), errorNode);
checkTypeAssignableTo(type, asyncMethodType
? createAsyncIterableType(iteratedType)
: createIterableType(iteratedType), errorNode);
}
return isAsyncIterable
return asyncMethodType
? typeAsIterable.iteratedTypeOfAsyncIterable = iteratedType
: typeAsIterable.iteratedTypeOfIterable = iteratedType;
}
if (errorNode) {
error(errorNode,
isAsyncIterable
? Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
: Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator);
}
return undefined;
}
/**
@@ -20445,7 +20441,7 @@ namespace ts {
return undefined;
}
return getIteratedTypeOfIterable(returnType, /*errorNode*/ undefined, isAsyncGenerator, /*allowNonAsyncIterables*/ false, /*checkAssignability*/ false)
return getIteratedTypeOfIterable(returnType, /*errorNode*/ undefined, /*allowAsyncIterables*/ isAsyncGenerator, /*allowSyncIterables*/ !isAsyncGenerator, /*checkAssignability*/ false)
|| getIteratedTypeOfIterator(returnType, /*errorNode*/ undefined, isAsyncGenerator);
}
@@ -21092,10 +21088,6 @@ namespace ts {
}
}
function isAccessor(kind: SyntaxKind): boolean {
return kind === SyntaxKind.GetAccessor || kind === SyntaxKind.SetAccessor;
}
function checkInheritedPropertiesAreIdentical(type: InterfaceType, typeNode: Node): boolean {
const baseTypes = getBaseTypes(type);
if (baseTypes.length < 2) {
@@ -22655,7 +22647,7 @@ namespace ts {
Debug.assert(expr.parent.kind === SyntaxKind.ArrayLiteralExpression);
// [{ property1: p1, property2 }] = elems;
const typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(<Expression>expr.parent);
const elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType;
const elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || unknownType;
return checkArrayLiteralDestructuringElementAssignment(<ArrayLiteralExpression>expr.parent, typeOfArrayLiteral,
indexOf((<ArrayLiteralExpression>expr.parent).elements, expr), elementType || unknownType);
}
@@ -24565,7 +24557,7 @@ namespace ts {
function checkGrammarStatementInAmbientContext(node: Node): boolean {
if (isInAmbientContext(node)) {
// An accessors is already reported about the ambient context
if (isAccessor(node.parent.kind)) {
if (isAccessor(node.parent)) {
return getNodeLinks(node).hasReportedStatementInAmbientContext = true;
}
+77 -21
View File
@@ -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<T>(to: T[] | undefined, from: T[] | undefined): T[] | undefined {
export function addRange<T>(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<T>(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<T>(array: T[]): T {
return array && array.length > 0
? array[0]
: undefined;
export function firstOrUndefined<T>(array: T[]): T | undefined {
return elementAt(array, 0);
}
/**
* Returns the last element of an array if non-empty, `undefined` otherwise.
*/
export function lastOrUndefined<T>(array: T[]): T {
return array && array.length > 0
? array[array.length - 1]
: undefined;
export function lastOrUndefined<T>(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<T>(array: T[]): T {
export function singleOrUndefined<T>(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<TOut extends TIn, TIn = any>(value: TIn | undefined, test: (value: TIn) => value is TOut): TOut | undefined {
return value !== undefined && test(value) ? value : undefined;
}
export function cast<TOut extends TIn, TIn = any>(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 {}
@@ -2224,8 +2259,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() {
@@ -2262,24 +2300,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): void {
Debug.assert(/*expression*/ false, message);
export function fail(message?: string, stackCrawlMark?: Function): void {
debugger;
const e = new Error(message ? `Debug Failure. ` : "Debug Failure.");
if ((<any>Error).captureStackTrace) {
(<any>Error).captureStackTrace(e, stackCrawlMark || fail);
}
throw e;
}
export function getFunctionName(func: Function) {
if (typeof func !== "function") {
return "";
}
else if (func.hasOwnProperty("name")) {
return (<any>func).name;
}
else {
const text = Function.prototype.toString.call(func);
const match = /^function\s+([\w\$]+)\s*\(/.exec(text);
return match ? match[1] : "";
}
}
}
@@ -2445,4 +2501,4 @@ namespace ts {
export function isCheckJsEnabledForFile(sourceFile: SourceFile, compilerOptions: CompilerOptions) {
return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs;
}
}
}
+79 -21
View File
@@ -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 <Expression>createBinary(left, SyntaxKind.CommaToken, right);
}
@@ -3208,6 +3226,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";
}
@@ -3606,7 +3644,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 {
@@ -3648,22 +3686,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) {
@@ -3710,6 +3732,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) {
@@ -3746,13 +3784,33 @@ namespace ts {
export function skipAssertions(node: Expression): Expression;
export function skipAssertions(node: Node): Node;
export function skipAssertions(node: Node): Node {
while (isAssertionExpression(node)) {
node = (<AssertionExpression>node).expression;
while (isAssertionExpression(node) || node.kind === SyntaxKind.NonNullExpression) {
node = (<AssertionExpression | NonNullExpression>node).expression;
}
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<T extends Node>(node: T): T {
node.startsOnNewLine = true;
return node;
@@ -3890,7 +3948,7 @@ namespace ts {
return bindingElement.right;
}
if (isSpreadExpression(bindingElement)) {
if (isSpreadElement(bindingElement)) {
// Recovery consistent with existing emit.
return getInitializerOfBindingOrAssignmentElement(<BindingOrAssignmentElement>bindingElement.expression);
}
@@ -3958,7 +4016,7 @@ namespace ts {
return getTargetOfBindingOrAssignmentElement(<BindingOrAssignmentElement>bindingElement.left);
}
if (isSpreadExpression(bindingElement)) {
if (isSpreadElement(bindingElement)) {
// `a` in `[...a] = ...`
return getTargetOfBindingOrAssignmentElement(<BindingOrAssignmentElement>bindingElement.expression);
}
+14 -25
View File
@@ -6355,6 +6355,12 @@ namespace ts {
comment.parent = parent;
}
if (isInJavaScriptFile(parent)) {
if (!sourceFile.jsDocDiagnostics) {
sourceFile.jsDocDiagnostics = [];
}
sourceFile.jsDocDiagnostics.push(...parseDiagnostics);
}
currentToken = saveToken;
parseDiagnostics.length = saveParseDiagnosticsLength;
parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;
@@ -6543,7 +6549,7 @@ namespace ts {
case "arg":
case "argument":
case "param":
tag = parseParamTag(atToken, tagName);
tag = parseParameterOrPropertyTag(atToken, tagName, /*shouldParseParamTag*/ true);
break;
case "return":
case "returns":
@@ -6688,11 +6694,12 @@ namespace ts {
return { name, isBracketed };
}
function parseParamTag(atToken: AtToken, tagName: Identifier) {
function parseParameterOrPropertyTag(atToken: AtToken, tagName: Identifier, shouldParseParamTag: boolean): JSDocPropertyTag | JSDocParameterTag {
let typeExpression = tryParseTypeExpression();
skipWhitespace();
const { name, isBracketed } = parseBracketNameInPropertyAndParamTag();
skipWhitespace();
if (!name) {
parseErrorAtPosition(scanner.getStartPos(), 0, Diagnostics.Identifier_expected);
@@ -6711,13 +6718,15 @@ namespace ts {
typeExpression = tryParseTypeExpression();
}
const result = <JSDocParameterTag>createNode(SyntaxKind.JSDocParameterTag, atToken.pos);
const result = shouldParseParamTag ?
<JSDocParameterTag>createNode(SyntaxKind.JSDocParameterTag, atToken.pos) :
<JSDocPropertyTag>createNode(SyntaxKind.JSDocPropertyTag, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.preParameterName = preName;
result.typeExpression = typeExpression;
result.postParameterName = postName;
result.parameterName = postName || preName;
result.name = postName || preName;
result.isBracketed = isBracketed;
return finishNode(result);
}
@@ -6746,26 +6755,6 @@ namespace ts {
return finishNode(result);
}
function parsePropertyTag(atToken: AtToken, tagName: Identifier): JSDocPropertyTag {
const typeExpression = tryParseTypeExpression();
skipWhitespace();
const { name, isBracketed } = parseBracketNameInPropertyAndParamTag();
skipWhitespace();
if (!name) {
parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, Diagnostics.Identifier_expected);
return undefined;
}
const result = <JSDocPropertyTag>createNode(SyntaxKind.JSDocPropertyTag, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.name = name;
result.typeExpression = typeExpression;
result.isBracketed = isBracketed;
return finishNode(result);
}
function parseAugmentsTag(atToken: AtToken, tagName: Identifier): JSDocAugmentsTag {
const typeExpression = tryParseTypeExpression();
@@ -6902,7 +6891,7 @@ namespace ts {
return true;
case "prop":
case "property":
const propertyTag = parsePropertyTag(atToken, tagName);
const propertyTag = parseParameterOrPropertyTag(atToken, tagName, /*shouldParseParamTag*/ false) as JSDocPropertyTag;
if (propertyTag) {
if (!parentTag.jsDocPropertyTags) {
parentTag.jsDocPropertyTags = <NodeArray<JSDocPropertyTag>>[];
+3
View File
@@ -1022,6 +1022,9 @@ namespace ts {
if (isSourceFileJavaScript(sourceFile)) {
if (!sourceFile.additionalSyntacticDiagnostics) {
sourceFile.additionalSyntacticDiagnostics = getJavaScriptSyntacticDiagnosticsForFile(sourceFile);
if (isCheckJsEnabledForFile(sourceFile, options)) {
sourceFile.additionalSyntacticDiagnostics = concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.jsDocDiagnostics);
}
}
return concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.parseDiagnostics);
}
+5
View File
@@ -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(<string[]>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;
}
}
+218 -6
View File
@@ -339,11 +339,64 @@ namespace ts {
&& !(<ReturnStatement>node).expression;
}
function isClassLikeVariableStatement(node: Node) {
if (!isVariableStatement(node)) return false;
const variable = singleOrUndefined((<VariableStatement>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<Node> {
@@ -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);
}
@@ -3396,7 +3610,7 @@ namespace ts {
else {
if (segments.length === 1) {
const firstElement = elements[0];
return needsUniqueCopy && isSpreadExpression(firstElement) && firstElement.expression.kind !== SyntaxKind.ArrayLiteralExpression
return needsUniqueCopy && isSpreadElement(firstElement) && firstElement.expression.kind !== SyntaxKind.ArrayLiteralExpression
? createArraySlice(segments[0])
: segments[0];
}
@@ -3407,7 +3621,7 @@ namespace ts {
}
function partitionSpread(node: Expression) {
return isSpreadExpression(node)
return isSpreadElement(node)
? visitSpanOfSpreads
: visitSpanOfNonSpreads;
}
@@ -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;
}
+1 -1
View File
@@ -1502,7 +1502,7 @@ namespace ts {
if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) {
return hasExportedReferenceInDestructuringTarget(node.left);
}
else if (isSpreadExpression(node)) {
else if (isSpreadElement(node)) {
return hasExportedReferenceInDestructuringTarget(node.expression);
}
else if (isObjectLiteralExpression(node)) {
+108 -38
View File
@@ -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<Statement> {
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(<EntityName>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);
}
+36 -28
View File
@@ -2145,6 +2145,10 @@ namespace ts {
parent: JSDoc;
kind: SyntaxKind.JSDocPropertyTag;
name: Identifier;
/** the parameter name, if provided *before* the type (TypeScript-style) */
preParameterName?: Identifier;
/** the parameter name, if provided *after* the type (JSDoc-standard) */
postParameterName?: Identifier;
typeExpression: JSDocTypeExpression;
isBracketed: boolean;
}
@@ -2163,7 +2167,7 @@ namespace ts {
/** the parameter name, if provided *after* the type (JSDoc-standard) */
postParameterName?: Identifier;
/** the parameter name, regardless of the location it was provided */
parameterName: Identifier;
name: Identifier;
isBracketed: boolean;
}
@@ -2312,16 +2316,19 @@ namespace ts {
/* @internal */ identifierCount: number;
/* @internal */ symbolCount: number;
// File level diagnostics reported by the parser (includes diagnostics about /// references
// File-level diagnostics reported by the parser (includes diagnostics about /// references
// as well as code diagnostics).
/* @internal */ parseDiagnostics: Diagnostic[];
// Stores additional file level diagnostics reported by the program
/* @internal */ additionalSyntacticDiagnostics?: Diagnostic[];
// File level diagnostics reported by the binder.
// File-level diagnostics reported by the binder.
/* @internal */ bindDiagnostics: Diagnostic[];
// File-level JSDoc diagnostics reported by the JSDoc parser
/* @internal */ jsDocDiagnostics?: Diagnostic[];
// Stores additional file-level diagnostics reported by the program
/* @internal */ additionalSyntacticDiagnostics?: Diagnostic[];
// Stores a line map for the file.
// This field should never be used directly to obtain line map, use getLineMap function instead.
/* @internal */ lineMap: number[];
@@ -3088,6 +3095,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
@@ -4001,34 +4009,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 {
+1406 -845
View File
File diff suppressed because it is too large Load Diff
+58 -35
View File
@@ -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((<ObjectType>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 (<any>func).name;
}
else {
const text = Function.prototype.toString.call(func);
const match = /^function\s+([\w\$]+)\s*\(/.exec(text);
return match ? match[1] : "";
}
}
}
}
+9 -6
View File
@@ -14,7 +14,9 @@ namespace ts {
describe("printFile", () => {
const printsCorrectly = makePrintsCorrectly("printsFileCorrectly");
const sourceFile = createSourceFile("source.ts", `
// Avoid eagerly creating the sourceFile so that `createSourceFile` doesn't run unless one of these tests is run.
let sourceFile: SourceFile;
before(() => sourceFile = createSourceFile("source.ts", `
interface A<T> {
// comment1
readonly prop?: T;
@@ -48,8 +50,7 @@ namespace ts {
// comment10
function functionWithDefaultArgValue(argument: string = "defaultValue"): void { }
`, ScriptTarget.ES2015);
`, ScriptTarget.ES2015));
printsCorrectly("default", {}, printer => printer.printFile(sourceFile));
printsCorrectly("removeComments", { removeComments: true }, printer => printer.printFile(sourceFile));
@@ -59,7 +60,8 @@ namespace ts {
describe("printBundle", () => {
const printsCorrectly = makePrintsCorrectly("printsBundleCorrectly");
const bundle = createBundle([
let bundle: Bundle;
before(() => bundle = createBundle([
createSourceFile("a.ts", `
/*! [a.ts] */
@@ -72,14 +74,15 @@ namespace ts {
// comment1
const b = 2;
`, ScriptTarget.ES2015)
]);
]));
printsCorrectly("default", {}, printer => printer.printBundle(bundle));
printsCorrectly("removeComments", { removeComments: true }, printer => printer.printBundle(bundle));
});
describe("printNode", () => {
const printsCorrectly = makePrintsCorrectly("printsNodeCorrectly");
const sourceFile = createSourceFile("source.ts", "", ScriptTarget.ES2015);
let sourceFile: SourceFile;
before(() => sourceFile = createSourceFile("source.ts", "", ScriptTarget.ES2015));
// tslint:disable boolean-trivia
const syntheticNode = createClassDeclaration(
undefined,
@@ -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
@@ -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
@@ -7,6 +7,6 @@ class AtomicNumbers {
var AtomicNumbers = (function () {
function AtomicNumbers() {
}
AtomicNumbers.H = 1;
return AtomicNumbers;
}());
AtomicNumbers.H = 1;
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
"end": 27,
"end": 28,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -34,7 +34,7 @@
"end": 27,
"text": "name1"
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 22,
"end": 27,
@@ -44,6 +44,6 @@
},
"length": 1,
"pos": 8,
"end": 27
"end": 28
}
}
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
"end": 32,
"end": 33,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -34,7 +34,7 @@
"end": 32,
"text": "name1"
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 27,
"end": 32,
@@ -44,6 +44,6 @@
},
"length": 1,
"pos": 8,
"end": 32
"end": 33
}
}
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
"end": 29,
"end": 30,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -34,7 +34,7 @@
"end": 29,
"text": "name1"
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 24,
"end": 29,
@@ -44,6 +44,6 @@
},
"length": 1,
"pos": 8,
"end": 29
"end": 30
}
}
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
"end": 29,
"end": 30,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -34,7 +34,7 @@
"end": 29,
"text": "name1"
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 24,
"end": 29,
@@ -44,6 +44,6 @@
},
"length": 1,
"pos": 8,
"end": 29
"end": 30
}
}
@@ -34,7 +34,7 @@
"end": 30,
"text": "name1"
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 25,
"end": 30,
@@ -34,7 +34,7 @@
"end": 31,
"text": "name1"
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 26,
"end": 31,
@@ -34,7 +34,7 @@
"end": 28
}
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 15,
"end": 20,
@@ -34,7 +34,7 @@
"end": 28
}
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 15,
"end": 20,
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
"end": 18,
"end": 19,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -24,7 +24,7 @@
"end": 18,
"text": "foo"
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 15,
"end": 18,
@@ -34,6 +34,6 @@
},
"length": 1,
"pos": 8,
"end": 18
"end": 19
}
}
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
"end": 29,
"end": 32,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -34,7 +34,7 @@
"end": 29,
"text": "name1"
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 24,
"end": 29,
@@ -45,7 +45,7 @@
"1": {
"kind": "JSDocParameterTag",
"pos": 34,
"end": 55,
"end": 56,
"atToken": {
"kind": "AtToken",
"pos": 34,
@@ -73,7 +73,7 @@
"end": 55,
"text": "name2"
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 50,
"end": 55,
@@ -83,6 +83,6 @@
},
"length": 2,
"pos": 8,
"end": 55
"end": 56
}
}
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
"end": 29,
"end": 30,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -34,7 +34,7 @@
"end": 29,
"text": "name1"
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 24,
"end": 29,
@@ -45,7 +45,7 @@
"1": {
"kind": "JSDocParameterTag",
"pos": 30,
"end": 51,
"end": 52,
"atToken": {
"kind": "AtToken",
"pos": 30,
@@ -73,7 +73,7 @@
"end": 51,
"text": "name2"
},
"parameterName": {
"name": {
"kind": "Identifier",
"pos": 46,
"end": 51,
@@ -83,6 +83,6 @@
},
"length": 2,
"pos": 8,
"end": 51
"end": 52
}
}
@@ -82,12 +82,6 @@
"end": 56,
"text": "property"
},
"name": {
"kind": "Identifier",
"pos": 66,
"end": 69,
"text": "age"
},
"typeExpression": {
"kind": "JSDocTypeExpression",
"pos": 57,
@@ -97,6 +91,18 @@
"pos": 58,
"end": 64
}
},
"postParameterName": {
"kind": "Identifier",
"pos": 66,
"end": 69,
"text": "age"
},
"name": {
"kind": "Identifier",
"pos": 66,
"end": 69,
"text": "age"
}
},
{
@@ -114,12 +120,6 @@
"end": 83,
"text": "property"
},
"name": {
"kind": "Identifier",
"pos": 93,
"end": 97,
"text": "name"
},
"typeExpression": {
"kind": "JSDocTypeExpression",
"pos": 84,
@@ -129,6 +129,18 @@
"pos": 85,
"end": 91
}
},
"postParameterName": {
"kind": "Identifier",
"pos": 93,
"end": 97,
"text": "name"
},
"name": {
"kind": "Identifier",
"pos": 93,
"end": 97,
"text": "name"
}
}
]
@@ -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) {
+1 -1
View File
@@ -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) {
@@ -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 = {}));
@@ -177,9 +177,9 @@ function foo10() {
var A = (function () {
function A() {
}
A.a = x;
return A;
}());
A.a = x;
var x;
}
function foo11() {
@@ -15,6 +15,19 @@ function foo(opts) {
foo({x: 'abc'});
/**
* @typedef {Object} AnotherOpts
* @property anotherX {string}
* @property anotherY {string=}
*
* @param {AnotherOpts} opts
*/
function foo1(opts) {
opts.anotherX;
}
foo1({anotherX: "world"});
/**
* @typedef {object} Opts1
* @property {string} x
@@ -24,10 +37,10 @@ foo({x: 'abc'});
*
* @param {Opts1} opts
*/
function foo1(opts) {
function foo2(opts) {
opts.x;
}
foo1({x: 'abc'});
foo2({x: 'abc'});
//// [0.js]
@@ -45,6 +58,17 @@ function foo(opts) {
opts.x;
}
foo({ x: 'abc' });
/**
* @typedef {Object} AnotherOpts
* @property anotherX {string}
* @property anotherY {string=}
*
* @param {AnotherOpts} opts
*/
function foo1(opts) {
opts.anotherX;
}
foo1({ anotherX: "world" });
/**
* @typedef {object} Opts1
* @property {string} x
@@ -54,7 +78,7 @@ foo({ x: 'abc' });
*
* @param {Opts1} opts
*/
function foo1(opts) {
function foo2(opts) {
opts.x;
}
foo1({ x: 'abc' });
foo2({ x: 'abc' });
@@ -23,6 +23,27 @@ foo({x: 'abc'});
>foo : Symbol(foo, Decl(0.js, 0, 0))
>x : Symbol(x, Decl(0.js, 14, 5))
/**
* @typedef {Object} AnotherOpts
* @property anotherX {string}
* @property anotherY {string=}
*
* @param {AnotherOpts} opts
*/
function foo1(opts) {
>foo1 : Symbol(foo1, Decl(0.js, 14, 16))
>opts : Symbol(opts, Decl(0.js, 23, 14))
opts.anotherX;
>opts.anotherX : Symbol(anotherX, Decl(0.js, 18, 3))
>opts : Symbol(opts, Decl(0.js, 23, 14))
>anotherX : Symbol(anotherX, Decl(0.js, 18, 3))
}
foo1({anotherX: "world"});
>foo1 : Symbol(foo1, Decl(0.js, 14, 16))
>anotherX : Symbol(anotherX, Decl(0.js, 27, 6))
/**
* @typedef {object} Opts1
* @property {string} x
@@ -32,16 +53,16 @@ foo({x: 'abc'});
*
* @param {Opts1} opts
*/
function foo1(opts) {
>foo1 : Symbol(foo1, Decl(0.js, 14, 16))
>opts : Symbol(opts, Decl(0.js, 25, 14))
function foo2(opts) {
>foo2 : Symbol(foo2, Decl(0.js, 27, 26))
>opts : Symbol(opts, Decl(0.js, 38, 14))
opts.x;
>opts.x : Symbol(x, Decl(0.js, 18, 3))
>opts : Symbol(opts, Decl(0.js, 25, 14))
>x : Symbol(x, Decl(0.js, 18, 3))
>opts.x : Symbol(x, Decl(0.js, 31, 3))
>opts : Symbol(opts, Decl(0.js, 38, 14))
>x : Symbol(x, Decl(0.js, 31, 3))
}
foo1({x: 'abc'});
>foo1 : Symbol(foo1, Decl(0.js, 14, 16))
>x : Symbol(x, Decl(0.js, 28, 6))
foo2({x: 'abc'});
>foo2 : Symbol(foo2, Decl(0.js, 27, 26))
>x : Symbol(x, Decl(0.js, 41, 6))
@@ -26,6 +26,30 @@ foo({x: 'abc'});
>x : string
>'abc' : "abc"
/**
* @typedef {Object} AnotherOpts
* @property anotherX {string}
* @property anotherY {string=}
*
* @param {AnotherOpts} opts
*/
function foo1(opts) {
>foo1 : (opts: { anotherX: string; anotherY?: string; }) => void
>opts : { anotherX: string; anotherY?: string; }
opts.anotherX;
>opts.anotherX : string
>opts : { anotherX: string; anotherY?: string; }
>anotherX : string
}
foo1({anotherX: "world"});
>foo1({anotherX: "world"}) : void
>foo1 : (opts: { anotherX: string; anotherY?: string; }) => void
>{anotherX: "world"} : { anotherX: string; }
>anotherX : string
>"world" : "world"
/**
* @typedef {object} Opts1
* @property {string} x
@@ -35,8 +59,8 @@ foo({x: 'abc'});
*
* @param {Opts1} opts
*/
function foo1(opts) {
>foo1 : (opts: { x: string; y?: string; z?: string; w?: string; }) => void
function foo2(opts) {
>foo2 : (opts: { x: string; y?: string; z?: string; w?: string; }) => void
>opts : { x: string; y?: string; z?: string; w?: string; }
opts.x;
@@ -44,9 +68,9 @@ function foo1(opts) {
>opts : { x: string; y?: string; z?: string; w?: string; }
>x : string
}
foo1({x: 'abc'});
>foo1({x: 'abc'}) : void
>foo1 : (opts: { x: string; y?: string; z?: string; w?: string; }) => void
foo2({x: 'abc'});
>foo2({x: 'abc'}) : void
>foo2 : (opts: { x: string; y?: string; z?: string; w?: string; }) => void
>{x: 'abc'} : { x: string; }
>x : string
>'abc' : "abc"
+1 -1
View File
@@ -5,6 +5,6 @@ class foo { constructor() { static f = 3; } }
var foo = (function () {
function foo() {
}
foo.f = 3;
return foo;
}());
foo.f = 3;
@@ -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;
@@ -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);
;
@@ -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 () {
@@ -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
};
@@ -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;
@@ -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() {
@@ -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;
@@ -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;
@@ -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);
@@ -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 = "";
@@ -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";
@@ -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) {
@@ -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;
@@ -22,8 +22,8 @@ var CtorDtor = (function () {
var C = (function () {
function C() {
}
C = __decorate([
CtorDtor
], C);
return C;
}());
C = __decorate([
CtorDtor
], C);
@@ -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]
@@ -24,8 +24,8 @@ var C = (function () {
function C() {
}
C.m = function () { };
C = __decorate([
dec
], C);
return C;
}());
C = __decorate([
dec
], C);
@@ -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);
@@ -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);
+10 -10
View File
@@ -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);
@@ -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);
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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);
@@ -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;
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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;
@@ -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;
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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 = {}));
@@ -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 = {}));
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);

Some files were not shown because too many files have changed in this diff Show More