mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into moduleResolutionStrategies
This commit is contained in:
Vendored
+1
@@ -1450,6 +1450,7 @@ declare namespace ts {
|
||||
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
|
||||
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant: ts.LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
|
||||
}
|
||||
declare namespace ts {
|
||||
function getDefaultLibFileName(options: CompilerOptions): string;
|
||||
|
||||
+7
-1
@@ -43,5 +43,11 @@
|
||||
"build:compiler": "jake local",
|
||||
"build:tests": "jake tests",
|
||||
"clean": "jake clean"
|
||||
}
|
||||
},
|
||||
"browser": {
|
||||
"buffer": false,
|
||||
"fs": false,
|
||||
"os": false,
|
||||
"path": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace ts {
|
||||
// If the current node is a container that also container that also contains locals. Examples:
|
||||
//
|
||||
// Functions, Methods, Modules, Source-files.
|
||||
IsContainerWithLocals = IsContainer | HasLocals
|
||||
IsContainerWithLocals = IsContainer | HasLocals
|
||||
}
|
||||
|
||||
export function bindSourceFile(file: SourceFile) {
|
||||
@@ -1062,4 +1062,4 @@ namespace ts {
|
||||
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+121
-73
@@ -2166,10 +2166,13 @@ namespace ts {
|
||||
function collectLinkedAliases(node: Identifier): Node[] {
|
||||
let exportSymbol: Symbol;
|
||||
if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) {
|
||||
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, node);
|
||||
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias, Diagnostics.Cannot_find_name_0, node);
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ExportSpecifier) {
|
||||
exportSymbol = getTargetOfExportSpecifier(<ExportSpecifier>node.parent);
|
||||
let exportSpecifier = <ExportSpecifier>node.parent;
|
||||
exportSymbol = (<ExportDeclaration>exportSpecifier.parent.parent).moduleSpecifier ?
|
||||
getExternalModuleMember(<ExportDeclaration>exportSpecifier.parent.parent, exportSpecifier) :
|
||||
resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);
|
||||
}
|
||||
let result: Node[] = [];
|
||||
if (exportSymbol) {
|
||||
@@ -3122,52 +3125,66 @@ namespace ts {
|
||||
setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType);
|
||||
}
|
||||
|
||||
function findMatchingSignature(signature: Signature, signatureList: Signature[]): Signature {
|
||||
for (let s of signatureList) {
|
||||
// Only signatures with no type parameters may differ in return types
|
||||
if (compareSignatures(signature, s, /*compareReturnTypes*/ !!signature.typeParameters, compareTypes)) {
|
||||
function findMatchingSignature(signatureList: Signature[], signature: Signature, partialMatch: boolean, ignoreReturnTypes: boolean): Signature {
|
||||
for (let s of signatureList) {
|
||||
if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findMatchingSignatures(signature: Signature, signatureLists: Signature[][]): Signature[] {
|
||||
function findMatchingSignatures(signatureLists: Signature[][], signature: Signature, listIndex: number): Signature[] {
|
||||
if (signature.typeParameters) {
|
||||
// We require an exact match for generic signatures, so we only return signatures from the first
|
||||
// signature list and only if they have exact matches in the other signature lists.
|
||||
if (listIndex > 0) {
|
||||
return undefined;
|
||||
}
|
||||
for (let i = 1; i < signatureLists.length; i++) {
|
||||
if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ false)) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return [signature];
|
||||
}
|
||||
let result: Signature[] = undefined;
|
||||
for (let i = 1; i < signatureLists.length; i++) {
|
||||
let match = findMatchingSignature(signature, signatureLists[i]);
|
||||
for (let i = 0; i < signatureLists.length; i++) {
|
||||
// Allow matching non-generic signatures to have excess parameters and different return types
|
||||
let match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreReturnTypes*/ true);
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
if (!result) {
|
||||
result = [signature];
|
||||
}
|
||||
if (match !== signature) {
|
||||
result.push(match);
|
||||
if (!contains(result, match)) {
|
||||
(result || (result = [])).push(match);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// The signatures of a union type are those signatures that are present and identical in each of the
|
||||
// constituent types, except that non-generic signatures may differ in return types. When signatures
|
||||
// differ in return types, the resulting return type is the union of the constituent return types.
|
||||
// The signatures of a union type are those signatures that are present in each of the constituent types.
|
||||
// Generic signatures must match exactly, but non-generic signatures are allowed to have extra optional
|
||||
// parameters and may differ in return types. When signatures differ in return types, the resulting return
|
||||
// type is the union of the constituent return types.
|
||||
function getUnionSignatures(types: Type[], kind: SignatureKind): Signature[] {
|
||||
let signatureLists = map(types, t => getSignaturesOfType(t, kind));
|
||||
let result: Signature[] = undefined;
|
||||
for (let source of signatureLists[0]) {
|
||||
let unionSignatures = findMatchingSignatures(source, signatureLists);
|
||||
if (unionSignatures) {
|
||||
let signature: Signature = undefined;
|
||||
if (unionSignatures.length === 1 || source.typeParameters) {
|
||||
signature = source;
|
||||
for (let i = 0; i < signatureLists.length; i++) {
|
||||
for (let signature of signatureLists[i]) {
|
||||
// Only process signatures with parameter lists that aren't already in the result list
|
||||
if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true)) {
|
||||
let unionSignatures = findMatchingSignatures(signatureLists, signature, i);
|
||||
if (unionSignatures) {
|
||||
let s = signature;
|
||||
// Union the result types when more than one signature matches
|
||||
if (unionSignatures.length > 1) {
|
||||
s = cloneSignature(signature);
|
||||
// Clear resolved return type we possibly got from cloneSignature
|
||||
s.resolvedReturnType = undefined;
|
||||
s.unionSignatures = unionSignatures;
|
||||
}
|
||||
(result || (result = [])).push(s);
|
||||
}
|
||||
}
|
||||
else {
|
||||
signature = cloneSignature(source);
|
||||
// Clear resolved return type we possibly got from cloneSignature
|
||||
signature.resolvedReturnType = undefined;
|
||||
signature.unionSignatures = unionSignatures;
|
||||
}
|
||||
(result || (result = [])).push(signature);
|
||||
}
|
||||
}
|
||||
return result || emptyArray;
|
||||
@@ -3465,8 +3482,10 @@ namespace ts {
|
||||
return emptyArray;
|
||||
}
|
||||
|
||||
// Return the signatures of the given kind in the given type. Creates synthetic union signatures when necessary and
|
||||
// maps primitive types and type parameters are to their apparent types.
|
||||
/**
|
||||
* Return the signatures of the given kind in the given type. Creates synthetic union signatures when necessary and
|
||||
* maps primitive types and type parameters are to their apparent types.
|
||||
*/
|
||||
function getSignaturesOfType(type: Type, kind: SignatureKind): Signature[] {
|
||||
return getSignaturesOfStructuredType(getApparentType(type), kind);
|
||||
}
|
||||
@@ -5081,30 +5100,24 @@ namespace ts {
|
||||
let result = Ternary.True;
|
||||
let saveErrorInfo = errorInfo;
|
||||
|
||||
// Because the "abstractness" of a class is the same across all construct signatures
|
||||
// (internally we are checking the corresponding declaration), it is enough to perform
|
||||
// the check and report an error once over all pairs of source and target construct signatures.
|
||||
let sourceSig = sourceSignatures[0];
|
||||
// Note that in an extends-clause, targetSignatures is stripped, so the check never proceeds.
|
||||
let targetSig = targetSignatures[0];
|
||||
|
||||
if (sourceSig && targetSig) {
|
||||
let sourceErasedSignature = getErasedSignature(sourceSig);
|
||||
let targetErasedSignature = getErasedSignature(targetSig);
|
||||
|
||||
let sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature);
|
||||
let targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature);
|
||||
if (kind === SignatureKind.Construct) {
|
||||
// Only want to compare the construct signatures for abstractness guarantees.
|
||||
|
||||
// Because the "abstractness" of a class is the same across all construct signatures
|
||||
// (internally we are checking the corresponding declaration), it is enough to perform
|
||||
// the check and report an error once over all pairs of source and target construct signatures.
|
||||
//
|
||||
// sourceSig and targetSig are (possibly) undefined.
|
||||
//
|
||||
// Note that in an extends-clause, targetSignatures is stripped, so the check never proceeds.
|
||||
let sourceSig = sourceSignatures[0];
|
||||
let targetSig = targetSignatures[0];
|
||||
|
||||
let sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getDeclarationOfKind(sourceReturnType.symbol, SyntaxKind.ClassDeclaration);
|
||||
let targetReturnDecl = targetReturnType && targetReturnType.symbol && getDeclarationOfKind(targetReturnType.symbol, SyntaxKind.ClassDeclaration);
|
||||
let sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & NodeFlags.Abstract;
|
||||
let targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & NodeFlags.Abstract;
|
||||
|
||||
if (sourceIsAbstract && !targetIsAbstract) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);
|
||||
}
|
||||
return Ternary.False;
|
||||
result &= abstractSignatureRelatedTo(source, sourceSig, target, targetSig);
|
||||
if (result !== Ternary.True) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5128,6 +5141,40 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
function abstractSignatureRelatedTo(source: Type, sourceSig: Signature, target: Type, targetSig: Signature) {
|
||||
if (sourceSig && targetSig) {
|
||||
|
||||
let sourceDecl = source.symbol && getDeclarationOfKind(source.symbol, SyntaxKind.ClassDeclaration);
|
||||
let targetDecl = target.symbol && getDeclarationOfKind(target.symbol, SyntaxKind.ClassDeclaration);
|
||||
|
||||
if (!sourceDecl) {
|
||||
// If the source object isn't itself a class declaration, it can be freely assigned, regardless
|
||||
// of whether the constructed object is abstract or not.
|
||||
return Ternary.True;
|
||||
}
|
||||
|
||||
let sourceErasedSignature = getErasedSignature(sourceSig);
|
||||
let targetErasedSignature = getErasedSignature(targetSig);
|
||||
|
||||
let sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature);
|
||||
let targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature);
|
||||
|
||||
let sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getDeclarationOfKind(sourceReturnType.symbol, SyntaxKind.ClassDeclaration);
|
||||
let targetReturnDecl = targetReturnType && targetReturnType.symbol && getDeclarationOfKind(targetReturnType.symbol, SyntaxKind.ClassDeclaration);
|
||||
let sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & NodeFlags.Abstract;
|
||||
let targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & NodeFlags.Abstract;
|
||||
|
||||
if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) {
|
||||
// if target isn't a class-declaration type, then it can be new'd, so we forbid the assignment.
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
}
|
||||
return Ternary.True;
|
||||
}
|
||||
}
|
||||
|
||||
function signatureRelatedTo(source: Signature, target: Signature, reportErrors: boolean): Ternary {
|
||||
@@ -5233,7 +5280,7 @@ namespace ts {
|
||||
}
|
||||
let result = Ternary.True;
|
||||
for (let i = 0, len = sourceSignatures.length; i < len; ++i) {
|
||||
let related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*compareReturnTypes*/ true, isRelatedTo);
|
||||
let related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreReturnTypes*/ false, isRelatedTo);
|
||||
if (!related) {
|
||||
return Ternary.False;
|
||||
}
|
||||
@@ -5363,14 +5410,18 @@ namespace ts {
|
||||
return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
|
||||
}
|
||||
|
||||
function compareSignatures(source: Signature, target: Signature, compareReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary {
|
||||
function compareSignatures(source: Signature, target: Signature, partialMatch: boolean, ignoreReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary {
|
||||
if (source === target) {
|
||||
return Ternary.True;
|
||||
}
|
||||
if (source.parameters.length !== target.parameters.length ||
|
||||
source.minArgumentCount !== target.minArgumentCount ||
|
||||
source.hasRestParameter !== target.hasRestParameter) {
|
||||
return Ternary.False;
|
||||
if (!partialMatch ||
|
||||
source.parameters.length < target.parameters.length && !source.hasRestParameter ||
|
||||
source.minArgumentCount > target.minArgumentCount) {
|
||||
return Ternary.False;
|
||||
}
|
||||
}
|
||||
let result = Ternary.True;
|
||||
if (source.typeParameters && target.typeParameters) {
|
||||
@@ -5392,16 +5443,18 @@ namespace ts {
|
||||
// M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N
|
||||
source = getErasedSignature(source);
|
||||
target = getErasedSignature(target);
|
||||
for (let i = 0, len = source.parameters.length; i < len; i++) {
|
||||
let s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]);
|
||||
let t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]);
|
||||
let sourceLen = source.parameters.length;
|
||||
let targetLen = target.parameters.length;
|
||||
for (let i = 0; i < targetLen; i++) {
|
||||
let s = source.hasRestParameter && i === sourceLen - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]);
|
||||
let t = target.hasRestParameter && i === targetLen - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]);
|
||||
let related = compareTypes(s, t);
|
||||
if (!related) {
|
||||
return Ternary.False;
|
||||
}
|
||||
result &= related;
|
||||
}
|
||||
if (compareReturnTypes) {
|
||||
if (!ignoreReturnTypes) {
|
||||
result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
|
||||
}
|
||||
return result;
|
||||
@@ -6915,20 +6968,13 @@ namespace ts {
|
||||
let signatureList: Signature[];
|
||||
let types = (<UnionType>type).types;
|
||||
for (let current of types) {
|
||||
// The signature set of all constituent type with call signatures should match
|
||||
// So number of signatures allowed is either 0 or 1
|
||||
if (signatureList &&
|
||||
getSignaturesOfStructuredType(current, SignatureKind.Call).length > 1) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let signature = getNonGenericSignature(current);
|
||||
if (signature) {
|
||||
if (!signatureList) {
|
||||
// This signature will contribute to contextual union signature
|
||||
signatureList = [signature];
|
||||
}
|
||||
else if (!compareSignatures(signatureList[0], signature, /*compareReturnTypes*/ false, compareTypes)) {
|
||||
else if (!compareSignatures(signatureList[0], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true, compareTypes)) {
|
||||
// Signatures aren't identical, do not use
|
||||
return undefined;
|
||||
}
|
||||
@@ -13276,7 +13322,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
if (languageVersion >= ScriptTarget.ES6 && !isInAmbientContext(node)) {
|
||||
// Import equals declaration is deprecated in es6 or above
|
||||
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead);
|
||||
}
|
||||
@@ -14342,15 +14388,17 @@ namespace ts {
|
||||
return type.flags & TypeFlags.ObjectType && getSignaturesOfType(type, SignatureKind.Call).length > 0;
|
||||
}
|
||||
|
||||
function getTypeReferenceSerializationKind(node: TypeReferenceNode): TypeReferenceSerializationKind {
|
||||
function getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind {
|
||||
// Resolve the symbol as a value to ensure the type can be reached at runtime during emit.
|
||||
let symbol = resolveEntityName(node.typeName, SymbolFlags.Value, /*ignoreErrors*/ true);
|
||||
let constructorType = symbol ? getTypeOfSymbol(symbol) : undefined;
|
||||
let valueSymbol = resolveEntityName(typeName, SymbolFlags.Value, /*ignoreErrors*/ true);
|
||||
let constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined;
|
||||
if (constructorType && isConstructorType(constructorType)) {
|
||||
return TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue;
|
||||
}
|
||||
|
||||
let type = getTypeFromTypeNode(node);
|
||||
// Resolve the symbol as a type so that we can provide a more useful hint for the type serializer.
|
||||
let typeSymbol = resolveEntityName(typeName, SymbolFlags.Type, /*ignoreErrors*/ true);
|
||||
let type = getDeclaredTypeOfSymbol(typeSymbol);
|
||||
if (type === unknownType) {
|
||||
return TypeReferenceSerializationKind.Unknown;
|
||||
}
|
||||
|
||||
@@ -198,6 +198,13 @@ namespace ts {
|
||||
return array[array.length - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a binary search, finding the index at which 'value' occurs in 'array'.
|
||||
* If no such index is found, returns the 2's-complement of first index at which
|
||||
* number[index] exceeds number.
|
||||
* @param array A sorted array whose first element must be no larger than number
|
||||
* @param number The value to be searched for in the array.
|
||||
*/
|
||||
export function binarySearch(array: number[], value: number): number {
|
||||
let low = 0;
|
||||
let high = array.length - 1;
|
||||
|
||||
@@ -750,14 +750,18 @@ namespace ts {
|
||||
}
|
||||
|
||||
function writeTypeAliasDeclaration(node: TypeAliasDeclaration) {
|
||||
let prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
write("type ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
emitTypeParameters(node.typeParameters);
|
||||
write(" = ");
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError);
|
||||
write(";");
|
||||
writeLine();
|
||||
enclosingDeclaration = prevEnclosingDeclaration;
|
||||
|
||||
function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
return {
|
||||
@@ -1497,11 +1501,8 @@ namespace ts {
|
||||
// emit : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void;
|
||||
writeTextOfNode(currentSourceFile, bindingElement.propertyName);
|
||||
write(": ");
|
||||
|
||||
// If bindingElement has propertyName property, then its name must be another bindingPattern of SyntaxKind.ObjectBindingPattern
|
||||
emitBindingPattern(<BindingPattern>bindingElement.name);
|
||||
}
|
||||
else if (bindingElement.name) {
|
||||
if (bindingElement.name) {
|
||||
if (isBindingPattern(bindingElement.name)) {
|
||||
// If it is a nested binding pattern, we will recursively descend into each element and emit each one separately.
|
||||
// In the case of rest element, we will omit rest element.
|
||||
|
||||
+279
-174
@@ -163,7 +163,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
let writeComment = writeCommentRange;
|
||||
|
||||
/** Emit a node */
|
||||
let emit = emitNodeWithoutSourceMap;
|
||||
let emit = emitNodeWithCommentsAndWithoutSourcemap;
|
||||
|
||||
/** Called just before starting emit of a node */
|
||||
let emitStart = function (node: Node) { };
|
||||
@@ -687,9 +687,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitNodeWithCommentsAndWithSourcemap(node: Node) {
|
||||
emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap);
|
||||
}
|
||||
|
||||
writeEmittedFiles = writeJavaScriptAndSourceMapFile;
|
||||
emit = emitNodeWithSourceMap;
|
||||
emit = emitNodeWithCommentsAndWithSourcemap;
|
||||
emitStart = recordEmitNodeStartSpan;
|
||||
emitEnd = recordEmitNodeEndSpan;
|
||||
emitToken = writeTextWithSpanRecord;
|
||||
@@ -832,7 +836,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(", ");
|
||||
}
|
||||
}
|
||||
emitNode(nodes[start + i]);
|
||||
let node = nodes[start + i];
|
||||
// This emitting is to make sure we emit following comment properly
|
||||
// ...(x, /*comment1*/ y)...
|
||||
// ^ => node.pos
|
||||
// "comment1" is not considered leading comment for "y" but rather
|
||||
// considered as trailing comment of the previous node.
|
||||
emitTrailingCommentsOfPosition(node.pos);
|
||||
emitNode(node);
|
||||
leadingComma = true;
|
||||
}
|
||||
if (trailingComma) {
|
||||
@@ -1976,6 +1987,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
function emitPropertyAssignment(node: PropertyDeclaration) {
|
||||
emit(node.name);
|
||||
write(": ");
|
||||
// This is to ensure that we emit comment in the following case:
|
||||
// For example:
|
||||
// obj = {
|
||||
// id: /*comment1*/ ()=>void
|
||||
// }
|
||||
// "comment1" is not considered to be leading comment for node.initializer
|
||||
// but rather a trailing comment on the previous node.
|
||||
emitTrailingCommentsOfPosition(node.initializer.pos);
|
||||
emit(node.initializer);
|
||||
}
|
||||
|
||||
@@ -2111,7 +2130,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(node.right);
|
||||
emit(node.right);
|
||||
}
|
||||
|
||||
function emitEntityNameAsExpression(node: EntityName, useFallback: boolean) {
|
||||
@@ -2803,7 +2822,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitNodeWithoutSourceMap(counter);
|
||||
write(" < ");
|
||||
|
||||
emitNodeWithoutSourceMap(rhsReference);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(rhsReference);
|
||||
write(".length");
|
||||
|
||||
emitEnd(node.initializer);
|
||||
@@ -2838,7 +2857,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
else {
|
||||
// The following call does not include the initializer, so we have
|
||||
// to emit it separately.
|
||||
emitNodeWithoutSourceMap(declaration);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(declaration);
|
||||
write(" = ");
|
||||
emitNodeWithoutSourceMap(rhsIterationValue);
|
||||
}
|
||||
@@ -2861,7 +2880,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined);
|
||||
}
|
||||
else {
|
||||
emitNodeWithoutSourceMap(assignmentExpression);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression);
|
||||
}
|
||||
}
|
||||
emitEnd(node.initializer);
|
||||
@@ -3017,7 +3036,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write("exports.");
|
||||
}
|
||||
}
|
||||
emitNodeWithoutSourceMap(node.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node.name);
|
||||
emitEnd(node.name);
|
||||
}
|
||||
|
||||
@@ -3063,7 +3082,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write("default");
|
||||
}
|
||||
else {
|
||||
emitNodeWithoutSourceMap(node.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node.name);
|
||||
}
|
||||
write(`", `);
|
||||
emitDeclarationName(node);
|
||||
@@ -3091,31 +3110,38 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
function emitExportMemberAssignments(name: Identifier) {
|
||||
if (compilerOptions.module === ModuleKind.System) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!exportEquals && exportSpecifiers && hasProperty(exportSpecifiers, name.text)) {
|
||||
for (let specifier of exportSpecifiers[name.text]) {
|
||||
writeLine();
|
||||
if (compilerOptions.module === ModuleKind.System) {
|
||||
emitStart(specifier.name);
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithoutSourceMap(specifier.name);
|
||||
write(`", `);
|
||||
emitExpressionIdentifier(name);
|
||||
write(")");
|
||||
emitEnd(specifier.name);
|
||||
}
|
||||
else {
|
||||
emitStart(specifier.name);
|
||||
emitContainingModuleName(specifier);
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(specifier.name);
|
||||
emitEnd(specifier.name);
|
||||
write(" = ");
|
||||
emitExpressionIdentifier(name);
|
||||
}
|
||||
emitStart(specifier.name);
|
||||
emitContainingModuleName(specifier);
|
||||
write(".");
|
||||
emitNodeWithCommentsAndWithoutSourcemap(specifier.name);
|
||||
emitEnd(specifier.name);
|
||||
write(" = ");
|
||||
emitExpressionIdentifier(name);
|
||||
write(";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitExportSpecifierInSystemModule(specifier: ExportSpecifier): void {
|
||||
Debug.assert(compilerOptions.module === ModuleKind.System);
|
||||
|
||||
writeLine();
|
||||
emitStart(specifier.name);
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(specifier.name);
|
||||
write(`", `);
|
||||
emitExpressionIdentifier(specifier.propertyName || specifier.name);
|
||||
write(")");
|
||||
emitEnd(specifier.name);
|
||||
write(";");
|
||||
}
|
||||
|
||||
function emitDestructuring(root: BinaryExpression | VariableDeclaration | ParameterDeclaration, isAssignmentExpressionStatement: boolean, value?: Expression) {
|
||||
let emitCount = 0;
|
||||
@@ -3154,7 +3180,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
if (exportChanged) {
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithoutSourceMap(name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(name);
|
||||
write(`", `);
|
||||
}
|
||||
|
||||
@@ -3386,7 +3412,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
if (exportChanged) {
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithoutSourceMap(node.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node.name);
|
||||
write(`", `);
|
||||
}
|
||||
|
||||
@@ -3542,9 +3568,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitEnd(parameter);
|
||||
write(" { ");
|
||||
emitStart(parameter);
|
||||
emitNodeWithoutSourceMap(paramName);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(paramName);
|
||||
write(" = ");
|
||||
emitNodeWithoutSourceMap(initializer);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(initializer);
|
||||
emitEnd(parameter);
|
||||
write("; }");
|
||||
}
|
||||
@@ -3567,7 +3593,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitLeadingComments(restParam);
|
||||
emitStart(restParam);
|
||||
write("var ");
|
||||
emitNodeWithoutSourceMap(restParam.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(restParam.name);
|
||||
write(" = [];");
|
||||
emitEnd(restParam);
|
||||
emitTrailingComments(restParam);
|
||||
@@ -3588,7 +3614,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
increaseIndent();
|
||||
writeLine();
|
||||
emitStart(restParam);
|
||||
emitNodeWithoutSourceMap(restParam.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(restParam.name);
|
||||
write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];");
|
||||
emitEnd(restParam);
|
||||
decreaseIndent();
|
||||
@@ -3609,7 +3635,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
function emitDeclarationName(node: Declaration) {
|
||||
if (node.name) {
|
||||
emitNodeWithoutSourceMap(node.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node.name);
|
||||
}
|
||||
else {
|
||||
write(getGeneratedNameForNode(node));
|
||||
@@ -3632,11 +3658,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return emitOnlyPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
|
||||
if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) {
|
||||
// Methods will emit the comments as part of emitting method declaration
|
||||
// TODO (yuisu) : we should not have special cases to condition emitting comments
|
||||
// but have one place to fix check for these conditions.
|
||||
if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature &&
|
||||
node.parent && node.parent.kind !== SyntaxKind.PropertyAssignment &&
|
||||
node.parent.kind !== SyntaxKind.CallExpression) {
|
||||
// 1. Methods will emit the comments as part of emitting method declaration
|
||||
|
||||
// 2. If the function is a property of object literal, emitting leading-comments
|
||||
// is done by emitNodeWithoutSourceMap which then call this function.
|
||||
// In particular, we would like to avoid emit comments twice in following case:
|
||||
// For example:
|
||||
// var obj = {
|
||||
// id:
|
||||
// /*comment*/ () => void
|
||||
// }
|
||||
|
||||
// 3. If the function is an argument in call expression, emitting of comments will be
|
||||
// taken care of in emit list of arguments inside of emitCallexpression
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
|
||||
emitStart(node);
|
||||
// For targeting below es6, emit functions-like declaration including arrow function using function keyword.
|
||||
// When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead
|
||||
if (!shouldEmitAsArrowFunction(node)) {
|
||||
@@ -3662,6 +3705,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (languageVersion < ScriptTarget.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile && node.name) {
|
||||
emitExportMemberAssignments((<FunctionDeclaration>node).name);
|
||||
}
|
||||
|
||||
emitEnd(node);
|
||||
if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
@@ -4017,10 +4062,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
function emitMemberAccessForPropertyName(memberName: DeclarationName) {
|
||||
// TODO: (jfreeman,drosen): comment on why this is emitNodeWithoutSourceMap instead of emit here.
|
||||
// This does not emit source map because it is emitted by caller as caller
|
||||
// is aware how the property name changes to the property access
|
||||
// eg. public x = 10; becomes this.x and static x = 10 becomes className.x
|
||||
if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) {
|
||||
write("[");
|
||||
emitNodeWithoutSourceMap(memberName);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(memberName);
|
||||
write("]");
|
||||
}
|
||||
else if (memberName.kind === SyntaxKind.ComputedPropertyName) {
|
||||
@@ -4028,7 +4075,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
else {
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(memberName);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(memberName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4096,10 +4143,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitMemberAccessForPropertyName((<MethodDeclaration>member).name);
|
||||
emitEnd((<MethodDeclaration>member).name);
|
||||
write(" = ");
|
||||
emitStart(member);
|
||||
emitFunctionDeclaration(<MethodDeclaration>member);
|
||||
emitEnd(member);
|
||||
emitEnd(member);
|
||||
write(";");
|
||||
emitTrailingComments(member);
|
||||
}
|
||||
@@ -4945,8 +4990,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
/** Serializes a TypeReferenceNode to an appropriate JS constructor value. Used by the __metadata decorator. */
|
||||
function emitSerializedTypeReferenceNode(node: TypeReferenceNode) {
|
||||
let typeName = node.typeName;
|
||||
let result = resolver.getTypeReferenceSerializationKind(node);
|
||||
let location: Node = node.parent;
|
||||
while (isDeclaration(location) || isTypeNode(location)) {
|
||||
location = location.parent;
|
||||
}
|
||||
|
||||
// Clone the type name and parent it to a location outside of the current declaration.
|
||||
let typeName = cloneEntityName(node.typeName);
|
||||
typeName.parent = location;
|
||||
|
||||
let result = resolver.getTypeReferenceSerializationKind(typeName);
|
||||
switch (result) {
|
||||
case TypeReferenceSerializationKind.Unknown:
|
||||
let temp = createAndRecordTempVariable(TempFlags.Auto);
|
||||
@@ -5078,6 +5131,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
argumentsWritten++;
|
||||
}
|
||||
if (shouldEmitParamTypesMetadata(node)) {
|
||||
debugger;
|
||||
if (writeComma || argumentsWritten) {
|
||||
write(", ");
|
||||
}
|
||||
@@ -5296,13 +5350,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitExportMemberAssignments(<Identifier>node.name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Some bundlers (SystemJS builder) sometimes want to rename dependencies.
|
||||
* Here we check if alternative name was provided for a given moduleName and return it if possible.
|
||||
*/
|
||||
function tryRenameExternalModule(moduleName: LiteralExpression): string {
|
||||
if (currentSourceFile.renamedDependencies && hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) {
|
||||
return `"${currentSourceFile.renamedDependencies[moduleName.text]}"`
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function emitRequire(moduleName: Expression) {
|
||||
if (moduleName.kind === SyntaxKind.StringLiteral) {
|
||||
write("require(");
|
||||
emitStart(moduleName);
|
||||
emitLiteral(<LiteralExpression>moduleName);
|
||||
emitEnd(moduleName);
|
||||
let text = tryRenameExternalModule(<LiteralExpression>moduleName);
|
||||
if (text) {
|
||||
write(text);
|
||||
}
|
||||
else {
|
||||
emitStart(moduleName);
|
||||
emitLiteral(<LiteralExpression>moduleName);
|
||||
emitEnd(moduleName);
|
||||
}
|
||||
emitToken(SyntaxKind.CloseParenToken, moduleName.end);
|
||||
}
|
||||
else {
|
||||
@@ -5516,11 +5587,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitStart(specifier);
|
||||
emitContainingModuleName(specifier);
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(specifier.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(specifier.name);
|
||||
write(" = ");
|
||||
write(generatedName);
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(specifier.propertyName || specifier.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name);
|
||||
write(";");
|
||||
emitEnd(specifier);
|
||||
}
|
||||
@@ -5543,7 +5614,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
else {
|
||||
if (!node.exportClause || resolver.isValueAliasDeclaration(node)) {
|
||||
emitStart(node);
|
||||
write("export ");
|
||||
if (node.exportClause) {
|
||||
// export { x, y, ... }
|
||||
@@ -5556,10 +5626,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
if (node.moduleSpecifier) {
|
||||
write(" from ");
|
||||
emitNodeWithoutSourceMap(node.moduleSpecifier);
|
||||
emit(node.moduleSpecifier);
|
||||
}
|
||||
write(";");
|
||||
emitEnd(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5573,13 +5642,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (needsComma) {
|
||||
write(", ");
|
||||
}
|
||||
emitStart(specifier);
|
||||
if (specifier.propertyName) {
|
||||
emitNodeWithoutSourceMap(specifier.propertyName);
|
||||
emit(specifier.propertyName);
|
||||
write(" as ");
|
||||
}
|
||||
emitNodeWithoutSourceMap(specifier.name);
|
||||
emitEnd(specifier);
|
||||
emit(specifier.name);
|
||||
needsComma = true;
|
||||
}
|
||||
}
|
||||
@@ -5705,7 +5772,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
function getExternalModuleNameText(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration): string {
|
||||
let moduleName = getExternalModuleName(importNode);
|
||||
if (moduleName.kind === SyntaxKind.StringLiteral) {
|
||||
return getLiteralText(<LiteralExpression>moduleName);
|
||||
return tryRenameExternalModule(<LiteralExpression>moduleName) || getLiteralText(<LiteralExpression>moduleName);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -5866,7 +5933,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
writeLine();
|
||||
write("'");
|
||||
if (node.kind === SyntaxKind.Identifier) {
|
||||
emitNodeWithoutSourceMap(node);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node);
|
||||
}
|
||||
else {
|
||||
emitDeclarationName(<Declaration>node);
|
||||
@@ -6051,7 +6118,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return compilerOptions.module === ModuleKind.System && isExternalModule(currentSourceFile);
|
||||
}
|
||||
|
||||
function emitSystemModuleBody(node: SourceFile, startIndex: number): void {
|
||||
function emitSystemModuleBody(node: SourceFile, dependencyGroups: DependencyGroup[], startIndex: number): void {
|
||||
// shape of the body in system modules:
|
||||
// function (exports) {
|
||||
// <list of local aliases for imports>
|
||||
@@ -6096,7 +6163,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write("return {");
|
||||
increaseIndent();
|
||||
writeLine();
|
||||
emitSetters(exportStarFunction);
|
||||
emitSetters(exportStarFunction, dependencyGroups);
|
||||
writeLine();
|
||||
emitExecute(node, startIndex);
|
||||
decreaseIndent();
|
||||
@@ -6105,115 +6172,90 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitTempDeclarations(/*newLine*/ true);
|
||||
}
|
||||
|
||||
function emitSetters(exportStarFunction: string) {
|
||||
function emitSetters(exportStarFunction: string, dependencyGroups: DependencyGroup[]) {
|
||||
write("setters:[");
|
||||
for (let i = 0; i < externalImports.length; ++i) {
|
||||
|
||||
for (let i = 0; i < dependencyGroups.length; ++i) {
|
||||
if (i !== 0) {
|
||||
write(",");
|
||||
}
|
||||
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
let importNode = externalImports[i];
|
||||
let importVariableName = getLocalNameForExternalImport(importNode) || "";
|
||||
let parameterName = "_" + importVariableName;
|
||||
|
||||
let group = dependencyGroups[i];
|
||||
|
||||
// derive a unique name for parameter from the first named entry in the group
|
||||
let parameterName = makeUniqueName(forEach(group, getLocalNameForExternalImport) || "");
|
||||
write(`function (${parameterName}) {`);
|
||||
increaseIndent();
|
||||
|
||||
for(let entry of group) {
|
||||
let importVariableName = getLocalNameForExternalImport(entry) || "";
|
||||
|
||||
switch (entry.kind) {
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
if (!(<ImportDeclaration>entry).importClause) {
|
||||
// 'import "..."' case
|
||||
// module is imported only for side-effects, no emit required
|
||||
break;
|
||||
}
|
||||
// fall-through
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
Debug.assert(importVariableName !== "");
|
||||
|
||||
switch (importNode.kind) {
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
if (!(<ImportDeclaration>importNode).importClause) {
|
||||
// 'import "..."' case
|
||||
// module is imported only for side-effects, setter body will be empty
|
||||
break;
|
||||
}
|
||||
// fall-through
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
Debug.assert(importVariableName !== "");
|
||||
|
||||
increaseIndent();
|
||||
writeLine();
|
||||
// save import into the local
|
||||
write(`${importVariableName} = ${parameterName};`);
|
||||
writeLine();
|
||||
|
||||
let defaultName =
|
||||
importNode.kind === SyntaxKind.ImportDeclaration
|
||||
? (<ImportDeclaration>importNode).importClause.name
|
||||
: (<ImportEqualsDeclaration>importNode).name;
|
||||
|
||||
if (defaultName) {
|
||||
// emit re-export for imported default name
|
||||
// import n1 from 'foo1'
|
||||
// import n2 = require('foo2')
|
||||
// export {n1}
|
||||
// export {n2}
|
||||
emitExportMemberAssignments(defaultName);
|
||||
writeLine();
|
||||
}
|
||||
// save import into the local
|
||||
write(`${importVariableName} = ${parameterName};`);
|
||||
writeLine();
|
||||
break;
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
Debug.assert(importVariableName !== "");
|
||||
|
||||
if (importNode.kind === SyntaxKind.ImportDeclaration &&
|
||||
(<ImportDeclaration>importNode).importClause.namedBindings) {
|
||||
|
||||
let namedBindings = (<ImportDeclaration>importNode).importClause.namedBindings;
|
||||
if (namedBindings.kind === SyntaxKind.NamespaceImport) {
|
||||
// emit re-export for namespace
|
||||
// import * as n from 'foo'
|
||||
// export {n}
|
||||
emitExportMemberAssignments((<NamespaceImport>namedBindings).name);
|
||||
if ((<ExportDeclaration>entry).exportClause) {
|
||||
// export {a, b as c} from 'foo'
|
||||
// emit as:
|
||||
// exports_({
|
||||
// "a": _["a"],
|
||||
// "c": _["b"]
|
||||
// });
|
||||
writeLine();
|
||||
write(`${exportFunctionForFile}({`);
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
for (let i = 0, len = (<ExportDeclaration>entry).exportClause.elements.length; i < len; ++i) {
|
||||
if (i !== 0) {
|
||||
write(",");
|
||||
writeLine();
|
||||
}
|
||||
|
||||
let e = (<ExportDeclaration>entry).exportClause.elements[i];
|
||||
write(`"`);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(e.name);
|
||||
write(`": ${parameterName}["`);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name);
|
||||
write(`"]`);
|
||||
}
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("});")
|
||||
}
|
||||
else {
|
||||
// emit re-exports for named imports
|
||||
// import {a, b} from 'foo'
|
||||
// export {a, b as c}
|
||||
for (let element of (<NamedImports>namedBindings).elements) {
|
||||
emitExportMemberAssignments(element.name || element.propertyName);
|
||||
writeLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
decreaseIndent();
|
||||
break;
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
Debug.assert(importVariableName !== "");
|
||||
|
||||
increaseIndent();
|
||||
|
||||
if ((<ExportDeclaration>importNode).exportClause) {
|
||||
// export {a, b as c} from 'foo'
|
||||
// emit as:
|
||||
// var reexports = {}
|
||||
// reexports['a'] = _foo["a"];
|
||||
// reexports['c'] = _foo["b"];
|
||||
// exports_(reexports);
|
||||
let reexportsVariableName = makeUniqueName("reexports");
|
||||
writeLine();
|
||||
write(`var ${reexportsVariableName} = {};`);
|
||||
writeLine();
|
||||
for (let e of (<ExportDeclaration>importNode).exportClause.elements) {
|
||||
write(`${reexportsVariableName}["`);
|
||||
emitNodeWithoutSourceMap(e.name);
|
||||
write(`"] = ${parameterName}["`);
|
||||
emitNodeWithoutSourceMap(e.propertyName || e.name);
|
||||
write(`"];`);
|
||||
writeLine();
|
||||
// export * from 'foo'
|
||||
// emit as:
|
||||
// exportStar(_foo);
|
||||
write(`${exportStarFunction}(${parameterName});`);
|
||||
}
|
||||
write(`${exportFunctionForFile}(${reexportsVariableName});`);
|
||||
}
|
||||
else {
|
||||
writeLine();
|
||||
// export * from 'foo'
|
||||
// emit as:
|
||||
// exportStar(_foo);
|
||||
write(`${exportStarFunction}(${parameterName});`);
|
||||
}
|
||||
|
||||
writeLine();
|
||||
decreaseIndent();
|
||||
break;
|
||||
writeLine();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
decreaseIndent();
|
||||
|
||||
write("}");
|
||||
decreaseIndent();
|
||||
}
|
||||
@@ -6226,26 +6268,40 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
writeLine();
|
||||
for (let i = startIndex; i < node.statements.length; ++i) {
|
||||
let statement = node.statements[i];
|
||||
// - external module related imports/exports are not emitted for system modules
|
||||
// - function declarations are not emitted because they were already hoisted
|
||||
switch (statement.kind) {
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
// - function declarations are not emitted because they were already hoisted
|
||||
// - import declarations are not emitted since they are already handled in setters
|
||||
// - export declarations with module specifiers are not emitted since they were already written in setters
|
||||
// - export declarations without module specifiers are emitted preserving the order
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
continue;
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
if (!(<ExportDeclaration>statement).moduleSpecifier) {
|
||||
for (let element of (<ExportDeclaration>statement).exportClause.elements) {
|
||||
// write call to exporter function for every export specifier in exports list
|
||||
emitExportSpecifierInSystemModule(element);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
if (!isInternalModuleImportEqualsDeclaration(statement)) {
|
||||
// - import equals declarations that import external modules are not emitted
|
||||
continue;
|
||||
}
|
||||
}
|
||||
writeLine();
|
||||
emit(statement);
|
||||
// fall-though for import declarations that import internal modules
|
||||
default:
|
||||
writeLine();
|
||||
emit(statement);
|
||||
}
|
||||
}
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("}"); // execute
|
||||
}
|
||||
|
||||
|
||||
type DependencyGroup = Array<ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration>;
|
||||
|
||||
function emitSystemModule(node: SourceFile, startIndex: number): void {
|
||||
collectExternalModuleInfo(node);
|
||||
// System modules has the following shape
|
||||
@@ -6265,11 +6321,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(`"${node.moduleName}", `);
|
||||
}
|
||||
write("[");
|
||||
|
||||
let groupIndices: Map<number> = {};
|
||||
let dependencyGroups: DependencyGroup[] = [];
|
||||
|
||||
for (let i = 0; i < externalImports.length; ++i) {
|
||||
let text = getExternalModuleNameText(externalImports[i]);
|
||||
if (hasProperty(groupIndices, text)) {
|
||||
// deduplicate/group entries in dependency list by the dependency name
|
||||
let groupIndex = groupIndices[text];
|
||||
dependencyGroups[groupIndex].push(externalImports[i]);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
groupIndices[text] = dependencyGroups.length;
|
||||
dependencyGroups.push([externalImports[i]]);
|
||||
}
|
||||
|
||||
if (i !== 0) {
|
||||
write(", ");
|
||||
}
|
||||
|
||||
write(text);
|
||||
}
|
||||
write(`], function(${exportFunctionForFile}) {`);
|
||||
@@ -6277,7 +6349,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
increaseIndent();
|
||||
emitEmitHelpers(node);
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitSystemModuleBody(node, startIndex);
|
||||
emitSystemModuleBody(node, dependencyGroups, startIndex);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("});");
|
||||
@@ -6618,28 +6690,41 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitLeadingComments(node.endOfFileToken);
|
||||
}
|
||||
|
||||
function emitNodeWithoutSourceMap(node: Node): void {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
function emitNodeWithCommentsAndWithoutSourcemap(node: Node): void {
|
||||
emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap);
|
||||
}
|
||||
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return emitOnlyPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
function emitNodeConsideringCommentsOption(node: Node, emitNodeConsideringSourcemap: (node: Node) => void): void {
|
||||
if (node) {
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return emitOnlyPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
|
||||
let emitComments = shouldEmitLeadingAndTrailingComments(node);
|
||||
if (emitComments) {
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
if (isSpecializedCommentHandling(node)) {
|
||||
// This is the node that will handle its own comments and sourcemap
|
||||
return emitNodeWithoutSourceMap(node);
|
||||
}
|
||||
|
||||
emitJavaScriptWorker(node);
|
||||
let emitComments = shouldEmitLeadingAndTrailingComments(node);
|
||||
if (emitComments) {
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
|
||||
if (emitComments) {
|
||||
emitTrailingComments(node);
|
||||
emitNodeConsideringSourcemap(node);
|
||||
|
||||
if (emitComments) {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function shouldEmitLeadingAndTrailingComments(node: Node) {
|
||||
function emitNodeWithoutSourceMap(node: Node): void {
|
||||
if (node) {
|
||||
emitJavaScriptWorker(node);
|
||||
}
|
||||
}
|
||||
|
||||
function isSpecializedCommentHandling(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
// All of these entities are emitted in a specialized fashion. As such, we allow
|
||||
// the specialized methods for each to handle the comments on the nodes.
|
||||
@@ -6649,8 +6734,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function shouldEmitLeadingAndTrailingComments(node: Node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VariableStatement:
|
||||
return shouldEmitLeadingAndTrailingCommentsForVariableStatement(<VariableStatement>node);
|
||||
|
||||
@@ -6665,6 +6754,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return shouldEmitEnumDeclaration(<EnumDeclaration>node);
|
||||
}
|
||||
|
||||
// If the node is emitted in specialized fashion, dont emit comments as this node will handle
|
||||
// emitting comments when emitting itself
|
||||
Debug.assert(!isSpecializedCommentHandling(node));
|
||||
|
||||
// If this is the expression body of an arrow function that we're down-leveling,
|
||||
// then we don't want to emit comments when we emit the body. It will have already
|
||||
// been taken care of when we emitted the 'return' statement for the function
|
||||
@@ -6941,6 +7034,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit trailing comments at the position. The term trailing comment is used here to describe following comment:
|
||||
* x, /comment1/ y
|
||||
* ^ => pos; the function will emit "comment1" in the emitJS
|
||||
*/
|
||||
function emitTrailingCommentsOfPosition(pos: number) {
|
||||
let trailingComments = filterComments(getTrailingCommentRanges(currentSourceFile.text, pos), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments);
|
||||
|
||||
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
|
||||
emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment);
|
||||
}
|
||||
|
||||
function emitLeadingCommentsOfPosition(pos: number) {
|
||||
let leadingComments: CommentRange[];
|
||||
if (hasDetachedComments(pos)) {
|
||||
|
||||
+44
-16
@@ -844,6 +844,10 @@ namespace ts {
|
||||
return token = scanner.scanJsxIdentifier();
|
||||
}
|
||||
|
||||
function scanJsxText(): SyntaxKind {
|
||||
return token = scanner.scanJsxToken();
|
||||
}
|
||||
|
||||
function speculationHelper<T>(callback: () => T, isLookAhead: boolean): T {
|
||||
// Keep track of the state we'll need to rollback to if lookahead fails (or if the
|
||||
// caller asked us to always reset our state).
|
||||
@@ -913,9 +917,11 @@ namespace ts {
|
||||
return token > SyntaxKind.LastReservedWord;
|
||||
}
|
||||
|
||||
function parseExpected(kind: SyntaxKind, diagnosticMessage?: DiagnosticMessage): boolean {
|
||||
function parseExpected(kind: SyntaxKind, diagnosticMessage?: DiagnosticMessage, shouldAdvance = true): boolean {
|
||||
if (token === kind) {
|
||||
nextToken();
|
||||
if (shouldAdvance) {
|
||||
nextToken();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3178,7 +3184,7 @@ namespace ts {
|
||||
return parseTypeAssertion();
|
||||
}
|
||||
if (lookAhead(nextTokenIsIdentifierOrKeyword)) {
|
||||
return parseJsxElementOrSelfClosingElement();
|
||||
return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true);
|
||||
}
|
||||
// Fall through
|
||||
default:
|
||||
@@ -3308,14 +3314,14 @@ namespace ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseJsxElementOrSelfClosingElement(): JsxElement|JsxSelfClosingElement {
|
||||
let opening = parseJsxOpeningOrSelfClosingElement();
|
||||
function parseJsxElementOrSelfClosingElement(inExpressionContext: boolean): JsxElement | JsxSelfClosingElement {
|
||||
let opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext);
|
||||
if (opening.kind === SyntaxKind.JsxOpeningElement) {
|
||||
let node = <JsxElement>createNode(SyntaxKind.JsxElement, opening.pos);
|
||||
node.openingElement = opening;
|
||||
|
||||
node.children = parseJsxChildren(node.openingElement.tagName);
|
||||
node.closingElement = parseJsxClosingElement();
|
||||
node.closingElement = parseJsxClosingElement(inExpressionContext);
|
||||
return finishNode(node);
|
||||
}
|
||||
else {
|
||||
@@ -3336,9 +3342,9 @@ namespace ts {
|
||||
case SyntaxKind.JsxText:
|
||||
return parseJsxText();
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return parseJsxExpression();
|
||||
return parseJsxExpression(/*inExpressionContext*/ false);
|
||||
case SyntaxKind.LessThanToken:
|
||||
return parseJsxElementOrSelfClosingElement();
|
||||
return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ false);
|
||||
}
|
||||
Debug.fail("Unknown JSX child kind " + token);
|
||||
}
|
||||
@@ -3368,7 +3374,7 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseJsxOpeningOrSelfClosingElement(): JsxOpeningElement|JsxSelfClosingElement {
|
||||
function parseJsxOpeningOrSelfClosingElement(inExpressionContext: boolean): JsxOpeningElement|JsxSelfClosingElement {
|
||||
let fullStart = scanner.getStartPos();
|
||||
|
||||
parseExpected(SyntaxKind.LessThanToken);
|
||||
@@ -3378,12 +3384,22 @@ namespace ts {
|
||||
let attributes = parseList(ParsingContext.JsxAttributes, parseJsxAttribute);
|
||||
let node: JsxOpeningLikeElement;
|
||||
|
||||
if (parseOptional(SyntaxKind.GreaterThanToken)) {
|
||||
if (token === SyntaxKind.GreaterThanToken) {
|
||||
// Closing tag, so scan the immediately-following text with the JSX scanning instead
|
||||
// of regular scanning to avoid treating illegal characters (e.g. '#') as immediate
|
||||
// scanning errors
|
||||
node = <JsxOpeningElement>createNode(SyntaxKind.JsxOpeningElement, fullStart);
|
||||
scanJsxText();
|
||||
}
|
||||
else {
|
||||
parseExpected(SyntaxKind.SlashToken);
|
||||
parseExpected(SyntaxKind.GreaterThanToken);
|
||||
if (inExpressionContext) {
|
||||
parseExpected(SyntaxKind.GreaterThanToken);
|
||||
}
|
||||
else {
|
||||
parseExpected(SyntaxKind.GreaterThanToken, /*diagnostic*/ undefined, /*advance*/ false);
|
||||
scanJsxText();
|
||||
}
|
||||
node = <JsxSelfClosingElement>createNode(SyntaxKind.JsxSelfClosingElement, fullStart);
|
||||
}
|
||||
|
||||
@@ -3406,14 +3422,20 @@ namespace ts {
|
||||
return elementName;
|
||||
}
|
||||
|
||||
function parseJsxExpression(): JsxExpression {
|
||||
function parseJsxExpression(inExpressionContext: boolean): JsxExpression {
|
||||
let node = <JsxExpression>createNode(SyntaxKind.JsxExpression);
|
||||
|
||||
parseExpected(SyntaxKind.OpenBraceToken);
|
||||
if (token !== SyntaxKind.CloseBraceToken) {
|
||||
node.expression = parseExpression();
|
||||
}
|
||||
parseExpected(SyntaxKind.CloseBraceToken);
|
||||
if (inExpressionContext) {
|
||||
parseExpected(SyntaxKind.CloseBraceToken);
|
||||
}
|
||||
else {
|
||||
parseExpected(SyntaxKind.CloseBraceToken, /*message*/ undefined, /*advance*/ false);
|
||||
scanJsxText();
|
||||
}
|
||||
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -3432,7 +3454,7 @@ namespace ts {
|
||||
node.initializer = parseLiteralNode();
|
||||
break;
|
||||
default:
|
||||
node.initializer = parseJsxExpression();
|
||||
node.initializer = parseJsxExpression(/*inExpressionContext*/ true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3448,11 +3470,17 @@ namespace ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseJsxClosingElement(): JsxClosingElement {
|
||||
function parseJsxClosingElement(inExpressionContext: boolean): JsxClosingElement {
|
||||
let node = <JsxClosingElement>createNode(SyntaxKind.JsxClosingElement);
|
||||
parseExpected(SyntaxKind.LessThanSlashToken);
|
||||
node.tagName = parseJsxElementName();
|
||||
parseExpected(SyntaxKind.GreaterThanToken);
|
||||
if (inExpressionContext) {
|
||||
parseExpected(SyntaxKind.GreaterThanToken);
|
||||
}
|
||||
else {
|
||||
parseExpected(SyntaxKind.GreaterThanToken, /*diagnostic*/ undefined, /*advance*/ false);
|
||||
scanJsxText();
|
||||
}
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
|
||||
+13
-14
@@ -753,13 +753,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) {
|
||||
let start: number;
|
||||
let length: number;
|
||||
let diagnosticArgument: string[];
|
||||
if (refEnd !== undefined && refPos !== undefined) {
|
||||
start = refPos;
|
||||
length = refEnd - refPos;
|
||||
}
|
||||
let diagnostic: DiagnosticMessage;
|
||||
if (hasExtension(fileName)) {
|
||||
if (!options.allowNonTsExtensions && !forEach(supportedExtensions, extension => fileExtensionIs(host.getCanonicalFileName(fileName), extension))) {
|
||||
@@ -791,8 +785,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (diagnostic) {
|
||||
if (refFile) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, ...diagnosticArgument));
|
||||
if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, diagnostic, ...diagnosticArgument));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument));
|
||||
@@ -801,7 +795,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Get source file from normalized fileName
|
||||
function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refStart?: number, refLength?: number): SourceFile {
|
||||
function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number): SourceFile {
|
||||
let canonicalName = host.getCanonicalFileName(normalizeSlashes(fileName));
|
||||
if (filesByName.contains(canonicalName)) {
|
||||
// We've already looked for this file, use cached result
|
||||
@@ -816,8 +810,8 @@ namespace ts {
|
||||
|
||||
// We haven't looked for this file, do so now and cache result
|
||||
let file = host.getSourceFile(fileName, options.target, hostErrorMessage => {
|
||||
if (refFile) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refStart, refLength,
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
|
||||
Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
else {
|
||||
@@ -853,8 +847,13 @@ namespace ts {
|
||||
if (file && host.useCaseSensitiveFileNames()) {
|
||||
let sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName;
|
||||
if (canonicalName !== sourceFileName) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refStart, refLength,
|
||||
Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
|
||||
Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
return file;
|
||||
@@ -891,7 +890,7 @@ namespace ts {
|
||||
return;
|
||||
|
||||
function findModuleSourceFile(fileName: string, nameLiteral: Expression) {
|
||||
return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos);
|
||||
return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
-10
@@ -319,14 +319,21 @@ namespace ts {
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
/**
|
||||
* We assume the first line starts at position 0 and 'position' is non-negative.
|
||||
*/
|
||||
export function computeLineAndCharacterOfPosition(lineStarts: number[], position: number) {
|
||||
let lineNumber = binarySearch(lineStarts, position);
|
||||
if (lineNumber < 0) {
|
||||
// If the actual position was not found,
|
||||
// the binary search returns the negative value of the next line start
|
||||
// the binary search returns the 2's-complement of the next line start
|
||||
// e.g. if the line starts at [5, 10, 23, 80] and the position requested was 20
|
||||
// then the search will return -2
|
||||
// then the search will return -2.
|
||||
//
|
||||
// We want the index of the previous line start, so we subtract 1.
|
||||
// Review 2's-complement if this is confusing.
|
||||
lineNumber = ~lineNumber - 1;
|
||||
Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file");
|
||||
}
|
||||
return {
|
||||
line: lineNumber,
|
||||
@@ -552,13 +559,17 @@ namespace ts {
|
||||
return pos;
|
||||
}
|
||||
|
||||
// Extract comments from the given source text starting at the given position. If trailing is
|
||||
// false, whitespace is skipped until the first line break and comments between that location
|
||||
// and the next token are returned.If trailing is true, comments occurring between the given
|
||||
// position and the next line break are returned.The return value is an array containing a
|
||||
// TextRange for each comment. Single-line comment ranges include the beginning '//' characters
|
||||
// but not the ending line break. Multi - line comment ranges include the beginning '/* and
|
||||
// ending '*/' characters.The return value is undefined if no comments were found.
|
||||
/**
|
||||
* Extract comments from text prefixing the token closest following `pos`.
|
||||
* The return value is an array containing a TextRange for each comment.
|
||||
* Single-line comment ranges include the beginning '//' characters but not the ending line break.
|
||||
* Multi - line comment ranges include the beginning '/* and ending '<asterisk>/' characters.
|
||||
* The return value is undefined if no comments were found.
|
||||
* @param trailing
|
||||
* If false, whitespace is skipped until the first line break and comments between that location
|
||||
* and the next token are returned.
|
||||
* If true, comments occurring between the given position and the next line break are returned.
|
||||
*/
|
||||
function getCommentRanges(text: string, pos: number, trailing: boolean): CommentRange[] {
|
||||
let result: CommentRange[];
|
||||
let collecting = trailing || pos === 0;
|
||||
@@ -661,7 +672,6 @@ namespace ts {
|
||||
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion);
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
// Creates a scanner over a (possibly unspecified) range of a piece of text.
|
||||
export function createScanner(languageVersion: ScriptTarget,
|
||||
skipTrivia: boolean,
|
||||
|
||||
+3
-1
@@ -334,7 +334,9 @@ namespace ts {
|
||||
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
|
||||
return getWScriptSystem();
|
||||
}
|
||||
else if (typeof module !== "undefined" && module.exports) {
|
||||
else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") {
|
||||
// process and process.nextTick checks if current environment is node-like
|
||||
// process.browser check excludes webpack and browserify
|
||||
return getNodeSystem();
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -363,7 +363,7 @@ namespace ts {
|
||||
// If we didn't have any syntactic errors, then also try getting the global and
|
||||
// semantic errors.
|
||||
if (diagnostics.length === 0) {
|
||||
diagnostics = program.getGlobalDiagnostics();
|
||||
diagnostics = program.getOptionsDiagnostics().concat(program.getGlobalDiagnostics());
|
||||
|
||||
if (diagnostics.length === 0) {
|
||||
diagnostics = program.getSemanticDiagnostics();
|
||||
|
||||
@@ -587,9 +587,9 @@ namespace ts {
|
||||
* Several node kinds share function-like features such as a signature,
|
||||
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
|
||||
* Examples:
|
||||
* FunctionDeclaration
|
||||
* MethodDeclaration
|
||||
* AccessorDeclaration
|
||||
* - FunctionDeclaration
|
||||
* - MethodDeclaration
|
||||
* - AccessorDeclaration
|
||||
*/
|
||||
export interface FunctionLikeDeclaration extends SignatureDeclaration {
|
||||
_functionLikeDeclarationBrand: any;
|
||||
@@ -1244,6 +1244,10 @@ namespace ts {
|
||||
moduleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
languageVariant: LanguageVariant;
|
||||
|
||||
// this map is used by transpiler to supply alternative names for dependencies (i.e. in case of bundling)
|
||||
/* @internal */
|
||||
renamedDependencies?: Map<string>;
|
||||
|
||||
/**
|
||||
* lib.d.ts should have a reference comment like
|
||||
@@ -1592,7 +1596,7 @@ namespace ts {
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
getReferencedValueDeclaration(reference: Identifier): Declaration;
|
||||
getTypeReferenceSerializationKind(node: TypeReferenceNode): TypeReferenceSerializationKind;
|
||||
getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind;
|
||||
isOptionalParameter(node: ParameterDeclaration): boolean;
|
||||
}
|
||||
|
||||
|
||||
+19
-15
@@ -416,24 +416,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile) {
|
||||
// If parameter/type parameter, the prev token trailing comments are part of this node too
|
||||
if (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) {
|
||||
// e.g. (/** blah */ a, /** blah */ b);
|
||||
|
||||
// e.g.: (
|
||||
// /** blah */ a,
|
||||
// /** blah */ b);
|
||||
return concatenate(
|
||||
getTrailingCommentRanges(sourceFileOfNode.text, node.pos),
|
||||
getLeadingCommentRanges(sourceFileOfNode.text, node.pos));
|
||||
}
|
||||
else {
|
||||
return getLeadingCommentRanges(sourceFileOfNode.text, node.pos);
|
||||
}
|
||||
return getLeadingCommentRanges(sourceFileOfNode.text, node.pos);
|
||||
}
|
||||
|
||||
export function getJsDocComments(node: Node, sourceFileOfNode: SourceFile) {
|
||||
return filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment);
|
||||
let commentRanges = (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) ?
concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos),
getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) :
getLeadingCommentRangesOfNode(node, sourceFileOfNode);
|
||||
return filter(commentRanges, isJsDocComment);
|
||||
|
||||
function isJsDocComment(comment: CommentRange) {
|
||||
// True if the comment starts with '/**' but not if it is '/**/'
|
||||
@@ -1457,6 +1445,22 @@ namespace ts {
|
||||
return isFunctionLike(n) || n.kind === SyntaxKind.ModuleDeclaration || n.kind === SyntaxKind.SourceFile;
|
||||
}
|
||||
|
||||
export function cloneEntityName(node: EntityName): EntityName {
|
||||
if (node.kind === SyntaxKind.Identifier) {
|
||||
let clone = <Identifier>createSynthesizedNode(SyntaxKind.Identifier);
|
||||
clone.text = (<Identifier>node).text;
|
||||
return clone;
|
||||
}
|
||||
else {
|
||||
let clone = <QualifiedName>createSynthesizedNode(SyntaxKind.QualifiedName);
|
||||
clone.left = cloneEntityName((<QualifiedName>node).left);
|
||||
clone.left.parent = clone;
|
||||
clone.right = <Identifier>cloneEntityName((<QualifiedName>node).right);
|
||||
clone.right.parent = clone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
export function nodeIsSynthesized(node: Node): boolean {
|
||||
return node.pos === -1;
|
||||
}
|
||||
|
||||
@@ -366,6 +366,7 @@ module FourSlash {
|
||||
InsertSpaceAfterKeywordsInControlFlowStatements: true,
|
||||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
|
||||
PlaceOpenBraceOnNewLineForFunctions: false,
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: false,
|
||||
};
|
||||
@@ -1885,7 +1886,7 @@ module FourSlash {
|
||||
);
|
||||
assert.equal(
|
||||
expected.join(","),
|
||||
actual.fileNameList.map( file => {
|
||||
actual.fileNames.map( file => {
|
||||
return file.replace(this.basePath + "/", "");
|
||||
}).join(",")
|
||||
);
|
||||
@@ -1943,6 +1944,32 @@ module FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyDocCommentTemplate(expected?: ts.TextInsertion) {
|
||||
const name = "verifyDocCommentTemplate";
|
||||
let actual = this.languageService.getDocCommentTemplateAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
|
||||
if (expected === undefined) {
|
||||
if (actual) {
|
||||
this.raiseError(name + ' failed - expected no template but got {newText: \"' + actual.newText + '\" caretOffset: ' + actual.caretOffset + '}');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (actual === undefined) {
|
||||
this.raiseError(name + ' failed - expected the template {newText: \"' + actual.newText + '\" caretOffset: ' + actual.caretOffset + '} but got nothing instead');
|
||||
}
|
||||
|
||||
if (actual.newText !== expected.newText) {
|
||||
this.raiseError(name + ' failed - expected insertion:\n' + expected.newText + '\nactual insertion:\n' + actual.newText);
|
||||
}
|
||||
|
||||
if (actual.caretOffset !== expected.caretOffset) {
|
||||
this.raiseError(name + ' failed - expected caretOffset: ' + expected.caretOffset + ',\nactual caretOffset:' + actual.caretOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public verifyMatchingBracePosition(bracePosition: number, expectedMatchPosition: number) {
|
||||
this.taoInvalidReason = "verifyMatchingBracePosition NYI";
|
||||
|
||||
@@ -2117,17 +2144,17 @@ module FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
private getOccurancesAtCurrentPosition() {
|
||||
private getOccurrencesAtCurrentPosition() {
|
||||
return this.languageService.getOccurrencesAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
}
|
||||
|
||||
public verifyOccurrencesAtPositionListContains(fileName: string, start: number, end: number, isWriteAccess?: boolean) {
|
||||
this.taoInvalidReason = "verifyOccurrencesAtPositionListContains NYI";
|
||||
|
||||
let occurrences = this.getOccurancesAtCurrentPosition();
|
||||
let occurrences = this.getOccurrencesAtCurrentPosition();
|
||||
|
||||
if (!occurrences || occurrences.length === 0) {
|
||||
this.raiseError('verifyOccurancesAtPositionListContains failed - found 0 references, expected at least one.');
|
||||
this.raiseError('verifyOccurrencesAtPositionListContains failed - found 0 references, expected at least one.');
|
||||
}
|
||||
|
||||
for (let occurrence of occurrences) {
|
||||
@@ -2146,7 +2173,7 @@ module FourSlash {
|
||||
public verifyOccurrencesAtPositionListCount(expectedCount: number) {
|
||||
this.taoInvalidReason = "verifyOccurrencesAtPositionListCount NYI";
|
||||
|
||||
let occurrences = this.getOccurancesAtCurrentPosition();
|
||||
let occurrences = this.getOccurrencesAtCurrentPosition();
|
||||
let actualCount = occurrences ? occurrences.length : 0;
|
||||
if (expectedCount !== actualCount) {
|
||||
this.raiseError(`verifyOccurrencesAtPositionListCount failed - actual: ${actualCount}, expected:${expectedCount}`);
|
||||
@@ -2174,7 +2201,7 @@ module FourSlash {
|
||||
for (let highlight of highlightSpans) {
|
||||
if (highlight && highlight.textSpan.start === start && ts.textSpanEnd(highlight.textSpan) === end) {
|
||||
if (typeof kind !== "undefined" && highlight.kind !== kind) {
|
||||
this.raiseError('verifyDocumentHighlightsAtPositionListContains failed - item "kind" value does not match, actual: ' + highlight.kind + ', expected: ' + kind + '.');
|
||||
this.raiseError(`verifyDocumentHighlightsAtPositionListContains failed - item "kind" value does not match, actual: ${highlight.kind}, expected: ${kind}.`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2183,7 +2210,7 @@ module FourSlash {
|
||||
}
|
||||
|
||||
let missingItem = { fileName: fileName, start: start, end: end, kind: kind };
|
||||
this.raiseError('verifyOccurancesAtPositionListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(documentHighlights) + ')');
|
||||
this.raiseError(`verifyDocumentHighlightsAtPositionListContains failed - could not find the item: ${JSON.stringify(missingItem)} in the returned list: (${JSON.stringify(documentHighlights)})`);
|
||||
}
|
||||
|
||||
public verifyDocumentHighlightsAtPositionListCount(expectedCount: number, fileNamesToSearch: string[]) {
|
||||
@@ -2810,4 +2837,4 @@ module FourSlash {
|
||||
fileName: fileName
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,6 +411,9 @@ module Harness.LanguageService {
|
||||
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: ts.FormatCodeOptions): ts.TextChange[] {
|
||||
return unwrapJSONCallResult(this.shim.getFormattingEditsAfterKeystroke(fileName, position, key, JSON.stringify(options)));
|
||||
}
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number): ts.TextInsertion {
|
||||
return unwrapJSONCallResult(this.shim.getDocCommentTemplateAtPosition(fileName, position));
|
||||
}
|
||||
getEmitOutput(fileName: string): ts.EmitOutput {
|
||||
return unwrapJSONCallResult(this.shim.getEmitOutput(fileName));
|
||||
}
|
||||
|
||||
@@ -71,4 +71,4 @@ class TypeWriterWalker {
|
||||
symbol: symbolString
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+3
-3
@@ -11962,7 +11962,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
onvolumechange: (ev: Event) => any;
|
||||
onwaiting: (ev: Event) => any;
|
||||
opener: Window;
|
||||
orientation: string;
|
||||
orientation: string | number;
|
||||
outerHeight: number;
|
||||
outerWidth: number;
|
||||
pageXOffset: number;
|
||||
@@ -12777,7 +12777,7 @@ declare var onunload: (ev: Event) => any;
|
||||
declare var onvolumechange: (ev: Event) => any;
|
||||
declare var onwaiting: (ev: Event) => any;
|
||||
declare var opener: Window;
|
||||
declare var orientation: string;
|
||||
declare var orientation: string | number;
|
||||
declare var outerHeight: number;
|
||||
declare var outerWidth: number;
|
||||
declare var pageXOffset: number;
|
||||
@@ -12952,4 +12952,4 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any,
|
||||
declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
|
||||
Vendored
+1
-1
@@ -806,7 +806,7 @@ interface EventListenerObject {
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
(event: Event | string, source?: string, fileno?: number, columnNumber?: number): void;
|
||||
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
|
||||
}
|
||||
interface PositionCallback {
|
||||
(position: Position): void;
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace ts.server {
|
||||
|
||||
return {
|
||||
configFileName: response.body.configFileName,
|
||||
fileNameList: response.body.fileNameList
|
||||
fileNames: response.body.fileNames
|
||||
};
|
||||
}
|
||||
|
||||
@@ -563,6 +563,10 @@ namespace ts.server {
|
||||
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] {
|
||||
throw new Error("Not Implemented Yet.");
|
||||
}
|
||||
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion {
|
||||
throw new Error("Not Implemented Yet.");
|
||||
}
|
||||
|
||||
getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[] {
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
|
||||
@@ -368,7 +368,7 @@ namespace ts.server {
|
||||
return this.projectService.openFile(filename, false);
|
||||
}
|
||||
|
||||
getFileNameList() {
|
||||
getFileNames() {
|
||||
let sourceFiles = this.program.getSourceFiles();
|
||||
return sourceFiles.map(sourceFile => sourceFile.fileName);
|
||||
}
|
||||
@@ -1054,6 +1054,7 @@ namespace ts.server {
|
||||
InsertSpaceAfterKeywordsInControlFlowStatements: true,
|
||||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
|
||||
PlaceOpenBraceOnNewLineForFunctions: false,
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: false,
|
||||
}
|
||||
|
||||
Vendored
+7
-2
@@ -123,9 +123,14 @@ declare module NodeJS {
|
||||
|
||||
export interface ReadWriteStream extends ReadableStream, WritableStream { }
|
||||
|
||||
interface WindowSize {
|
||||
columns: number;
|
||||
rows: number;
|
||||
}
|
||||
|
||||
export interface Process extends EventEmitter {
|
||||
stdout: WritableStream;
|
||||
stderr: WritableStream;
|
||||
stdout: WritableStream & WindowSize;
|
||||
stderr: WritableStream & WindowSize;
|
||||
stdin: ReadableStream;
|
||||
argv: string[];
|
||||
execPath: string;
|
||||
|
||||
Vendored
+29
-1
@@ -116,7 +116,7 @@ declare namespace ts.server.protocol {
|
||||
/**
|
||||
* The list of normalized file name in the project, including 'lib.d.ts'
|
||||
*/
|
||||
fileNameList?: string[];
|
||||
fileNames?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -452,6 +452,9 @@ declare namespace ts.server.protocol {
|
||||
|
||||
/** Defines space handling after opening and before closing non empty parenthesis. Default value is false. */
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
|
||||
|
||||
/** Defines space handling after opening and before closing non empty brackets. Default value is false. */
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
|
||||
|
||||
/** Defines whether an open brace is put onto a new line for functions or not. Default value is false. */
|
||||
placeOpenBraceOnNewLineForFunctions?: boolean;
|
||||
@@ -894,6 +897,31 @@ declare namespace ts.server.protocol {
|
||||
export interface SignatureHelpResponse extends Response {
|
||||
body?: SignatureHelpItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arguments for GeterrForProject request.
|
||||
*/
|
||||
export interface GeterrForProjectRequestArgs {
|
||||
/**
|
||||
* the file requesting project error list
|
||||
*/
|
||||
file: string;
|
||||
|
||||
/**
|
||||
* Delay in milliseconds to wait before starting to compute
|
||||
* errors for the files in the file list
|
||||
*/
|
||||
delay: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* GeterrForProjectRequest request; value of command field is
|
||||
* "geterrForProject". It works similarly with 'Geterr', only
|
||||
* it request for every file in this project.
|
||||
*/
|
||||
export interface GeterrForProjectRequest extends Request {
|
||||
arguments: GeterrForProjectRequestArgs
|
||||
}
|
||||
|
||||
/**
|
||||
* Arguments for geterr messages.
|
||||
|
||||
+55
-4
@@ -86,6 +86,7 @@ namespace ts.server {
|
||||
export const Format = "format";
|
||||
export const Formatonkey = "formatonkey";
|
||||
export const Geterr = "geterr";
|
||||
export const GeterrForProject = "geterrForProject";
|
||||
export const NavBar = "navbar";
|
||||
export const Navto = "navto";
|
||||
export const Occurrences = "occurrences";
|
||||
@@ -235,7 +236,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
private updateErrorCheck(checkList: PendingErrorCheck[], seq: number,
|
||||
matchSeq: (seq: number) => boolean, ms = 1500, followMs = 200) {
|
||||
matchSeq: (seq: number) => boolean, ms = 1500, followMs = 200, requireOpen = true) {
|
||||
if (followMs > ms) {
|
||||
followMs = ms;
|
||||
}
|
||||
@@ -250,7 +251,7 @@ namespace ts.server {
|
||||
var checkOne = () => {
|
||||
if (matchSeq(seq)) {
|
||||
var checkSpec = checkList[index++];
|
||||
if (checkSpec.project.getSourceFileFromName(checkSpec.fileName, true)) {
|
||||
if (checkSpec.project.getSourceFileFromName(checkSpec.fileName, requireOpen)) {
|
||||
this.syntacticCheck(checkSpec.fileName, checkSpec.project);
|
||||
this.immediateId = setImmediate(() => {
|
||||
this.semanticCheck(checkSpec.fileName, checkSpec.project);
|
||||
@@ -389,7 +390,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
if (needFileNameList) {
|
||||
projectInfo.fileNameList = project.getFileNameList();
|
||||
projectInfo.fileNames = project.getFileNames();
|
||||
}
|
||||
|
||||
return projectInfo;
|
||||
@@ -873,7 +874,53 @@ namespace ts.server {
|
||||
}));
|
||||
}
|
||||
|
||||
public exit() {
|
||||
getDiagnosticsForProject(delay: number, fileName: string) {
|
||||
let { configFileName, fileNames: fileNamesInProject } = this.getProjectInfo(fileName, true);
|
||||
// No need to analyze lib.d.ts
|
||||
fileNamesInProject = fileNamesInProject.filter((value, index, array) => value.indexOf("lib.d.ts") < 0);
|
||||
|
||||
// Sort the file name list to make the recently touched files come first
|
||||
let highPriorityFiles: string[] = [];
|
||||
let mediumPriorityFiles: string[] = [];
|
||||
let lowPriorityFiles: string[] = [];
|
||||
let veryLowPriorityFiles: string[] = [];
|
||||
let normalizedFileName = ts.normalizePath(fileName);
|
||||
let project = this.projectService.getProjectForFile(normalizedFileName);
|
||||
for (let fileNameInProject of fileNamesInProject) {
|
||||
if (this.getCanonicalFileName(fileNameInProject) == this.getCanonicalFileName(fileName))
|
||||
highPriorityFiles.push(fileNameInProject);
|
||||
else {
|
||||
let info = this.projectService.getScriptInfo(fileNameInProject);
|
||||
if (!info.isOpen) {
|
||||
if (fileNameInProject.indexOf(".d.ts") > 0)
|
||||
veryLowPriorityFiles.push(fileNameInProject);
|
||||
else
|
||||
lowPriorityFiles.push(fileNameInProject);
|
||||
}
|
||||
else
|
||||
mediumPriorityFiles.push(fileNameInProject);
|
||||
}
|
||||
}
|
||||
|
||||
fileNamesInProject = highPriorityFiles.concat(mediumPriorityFiles).concat(lowPriorityFiles).concat(veryLowPriorityFiles);
|
||||
|
||||
if (fileNamesInProject.length > 0) {
|
||||
let checkList = fileNamesInProject.map<PendingErrorCheck>((fileName: string) => {
|
||||
let normalizedFileName = ts.normalizePath(fileName);
|
||||
return { fileName: normalizedFileName, project };
|
||||
});
|
||||
// Project level error analysis runs on background files too, therefore
|
||||
// doesn't require the file to be opened
|
||||
this.updateErrorCheck(checkList, this.changeSeq, (n) => n == this.changeSeq, delay, 200, /*requireOpen*/ false);
|
||||
}
|
||||
}
|
||||
|
||||
getCanonicalFileName(fileName: string) {
|
||||
let name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
|
||||
return ts.normalizePath(name);
|
||||
}
|
||||
|
||||
exit() {
|
||||
}
|
||||
|
||||
private handlers : Map<(request: protocol.Request) => {response?: any, responseRequired?: boolean}> = {
|
||||
@@ -931,6 +978,10 @@ namespace ts.server {
|
||||
var geterrArgs = <protocol.GeterrRequestArgs>request.arguments;
|
||||
return {response: this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false};
|
||||
},
|
||||
[CommandNames.GeterrForProject]: (request: protocol.Request) => {
|
||||
let { file, delay } = <protocol.GeterrForProjectRequestArgs>request.arguments;
|
||||
return {response: this.getDiagnosticsForProject(delay, file), responseRequired: false};
|
||||
},
|
||||
[CommandNames.Change]: (request: protocol.Request) => {
|
||||
var changeArgs = <protocol.ChangeRequestArgs>request.arguments;
|
||||
this.change(changeArgs.line, changeArgs.offset, changeArgs.endLine, changeArgs.endOffset,
|
||||
|
||||
@@ -39,12 +39,12 @@ namespace ts.formatting {
|
||||
public SpaceBetweenCloseBraceAndWhile: Rule;
|
||||
public NoSpaceAfterCloseBrace: Rule;
|
||||
|
||||
// No space for indexer and dot
|
||||
// No space for dot
|
||||
public NoSpaceBeforeDot: Rule;
|
||||
public NoSpaceAfterDot: Rule;
|
||||
|
||||
// No space before and after indexer
|
||||
public NoSpaceBeforeOpenBracket: Rule;
|
||||
public NoSpaceAfterOpenBracket: Rule;
|
||||
public NoSpaceBeforeCloseBracket: Rule;
|
||||
public NoSpaceAfterCloseBracket: Rule;
|
||||
|
||||
// Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}.
|
||||
@@ -135,6 +135,7 @@ namespace ts.formatting {
|
||||
public NoSpaceAfterOpenAngularBracket: Rule;
|
||||
public NoSpaceBeforeCloseAngularBracket: Rule;
|
||||
public NoSpaceAfterCloseAngularBracket: Rule;
|
||||
public NoSpaceAfterTypeAssertion: Rule;
|
||||
|
||||
// Remove spaces in empty interface literals. e.g.: x: {}
|
||||
public NoSpaceBetweenEmptyInterfaceBraceBrackets: Rule;
|
||||
@@ -190,6 +191,13 @@ namespace ts.formatting {
|
||||
public NoSpaceAfterOpenParen: Rule;
|
||||
public NoSpaceBeforeCloseParen: Rule;
|
||||
|
||||
// Insert space after opening and before closing nonempty brackets
|
||||
public SpaceAfterOpenBracket: Rule;
|
||||
public SpaceBeforeCloseBracket: Rule;
|
||||
public NoSpaceBetweenBrackets: Rule;
|
||||
public NoSpaceAfterOpenBracket: Rule;
|
||||
public NoSpaceBeforeCloseBracket: Rule;
|
||||
|
||||
// Insert space after function keyword for anonymous functions
|
||||
public SpaceAfterAnonymousFunctionKeyword: Rule;
|
||||
public NoSpaceAfterAnonymousFunctionKeyword: Rule;
|
||||
@@ -231,13 +239,13 @@ namespace ts.formatting {
|
||||
this.SpaceBetweenCloseBraceAndWhile = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.WhileKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken, SyntaxKind.SemicolonToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// No space for indexer and dot
|
||||
// No space for dot
|
||||
this.NoSpaceBeforeDot = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.DotToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterDot = new Rule(RuleDescriptor.create3(SyntaxKind.DotToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// No space before and after indexer
|
||||
this.NoSpaceBeforeOpenBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext ), RuleAction.Delete));
|
||||
|
||||
// Place a space before open brace in a function declaration
|
||||
this.FunctionOpenBraceLeftTokenRange = Shared.TokenRange.AnyIncludingMultilineComments;
|
||||
@@ -331,12 +339,13 @@ namespace ts.formatting {
|
||||
this.NoSpaceAfterEllipsis = new Rule(RuleDescriptor.create1(SyntaxKind.DotDotDotToken, SyntaxKind.Identifier), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOptionalParameters = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete));
|
||||
|
||||
// generics
|
||||
this.NoSpaceBeforeOpenAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.TypeNames, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), RuleAction.Delete));
|
||||
this.NoSpaceBetweenCloseParenAndAngularBracket = new Rule(RuleDescriptor.create1(SyntaxKind.CloseParenToken, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.LessThanToken, Shared.TokenRange.TypeNames), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.GreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.FromTokens([SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.GreaterThanToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), RuleAction.Delete));
|
||||
// generics and type assertions
|
||||
this.NoSpaceBeforeOpenAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.TypeNames, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceBetweenCloseParenAndAngularBracket = new Rule(RuleDescriptor.create1(SyntaxKind.CloseParenToken, SyntaxKind.LessThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.LessThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseAngularBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.GreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseAngularBracket = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.FromTokens([SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.GreaterThanToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterTypeAssertion = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeAssertionContext), RuleAction.Delete));
|
||||
|
||||
// Remove spaces in empty interface literals. e.g.: x: {}
|
||||
this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), RuleAction.Delete));
|
||||
@@ -391,6 +400,7 @@ namespace ts.formatting {
|
||||
this.NoSpaceAfterOpenAngularBracket,
|
||||
this.NoSpaceBeforeCloseAngularBracket,
|
||||
this.NoSpaceAfterCloseAngularBracket,
|
||||
this.NoSpaceAfterTypeAssertion,
|
||||
this.SpaceBeforeAt,
|
||||
this.NoSpaceAfterAt,
|
||||
this.SpaceAfterDecorator,
|
||||
@@ -402,8 +412,8 @@ namespace ts.formatting {
|
||||
this.NoSpaceBeforeSemicolon,
|
||||
this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock,
|
||||
this.NoSpaceBeforeComma,
|
||||
this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket,
|
||||
this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket,
|
||||
this.NoSpaceBeforeOpenBracket,
|
||||
this.NoSpaceAfterCloseBracket,
|
||||
this.SpaceAfterSemicolon,
|
||||
this.NoSpaceBeforeOpenParenInFuncDecl,
|
||||
this.SpaceBetweenStatements, this.SpaceAfterTryFinally
|
||||
@@ -448,6 +458,13 @@ namespace ts.formatting {
|
||||
this.NoSpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after opening and before closing nonempty brackets
|
||||
this.SpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after function keyword for anonymous functions
|
||||
this.SpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
this.NoSpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Delete));
|
||||
@@ -704,13 +721,15 @@ namespace ts.formatting {
|
||||
return context.contextNode.kind === SyntaxKind.TypeLiteral;// && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
|
||||
}
|
||||
|
||||
static IsTypeArgumentOrParameter(token: TextRangeWithKind, parent: Node): boolean {
|
||||
static IsTypeArgumentOrParameterOrAssertion(token: TextRangeWithKind, parent: Node): boolean {
|
||||
if (token.kind !== SyntaxKind.LessThanToken && token.kind !== SyntaxKind.GreaterThanToken) {
|
||||
return false;
|
||||
}
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.TypeReference:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
@@ -721,6 +740,7 @@ namespace ts.formatting {
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -728,9 +748,13 @@ namespace ts.formatting {
|
||||
}
|
||||
}
|
||||
|
||||
static IsTypeArgumentOrParameterContext(context: FormattingContext): boolean {
|
||||
return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) ||
|
||||
Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent);
|
||||
static IsTypeArgumentOrParameterOrAssertionContext(context: FormattingContext): boolean {
|
||||
return Rules.IsTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) ||
|
||||
Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent);
|
||||
}
|
||||
|
||||
static IsTypeAssertionContext(context: FormattingContext): boolean {
|
||||
return context.contextNode.kind === SyntaxKind.TypeAssertionExpression;
|
||||
}
|
||||
|
||||
static IsVoidOpContext(context: FormattingContext): boolean {
|
||||
|
||||
@@ -71,6 +71,17 @@ namespace ts.formatting {
|
||||
rules.push(this.globalRules.NoSpaceBetweenParens);
|
||||
}
|
||||
|
||||
if ( options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets ) {
|
||||
rules.push( this.globalRules.SpaceAfterOpenBracket );
|
||||
rules.push( this.globalRules.SpaceBeforeCloseBracket );
|
||||
rules.push( this.globalRules.NoSpaceBetweenBrackets );
|
||||
}
|
||||
else {
|
||||
rules.push( this.globalRules.NoSpaceAfterOpenBracket );
|
||||
rules.push( this.globalRules.NoSpaceBeforeCloseBracket );
|
||||
rules.push( this.globalRules.NoSpaceBetweenBrackets );
|
||||
}
|
||||
|
||||
if (options.InsertSpaceAfterSemicolonInForStatements) {
|
||||
rules.push(this.globalRules.SpaceAfterSemicolonInFor);
|
||||
}
|
||||
|
||||
@@ -428,6 +428,7 @@ namespace ts.formatting {
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.JsxElement:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
+98
-37
@@ -1049,6 +1049,8 @@ namespace ts {
|
||||
getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[];
|
||||
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[];
|
||||
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion;
|
||||
|
||||
getEmitOutput(fileName: string): EmitOutput;
|
||||
|
||||
getProgram(): Program;
|
||||
@@ -1095,6 +1097,12 @@ namespace ts {
|
||||
newText: string;
|
||||
}
|
||||
|
||||
export interface TextInsertion {
|
||||
newText: string;
|
||||
/** The position in newText the caret should point to after the insertion. */
|
||||
caretOffset: number;
|
||||
}
|
||||
|
||||
export interface RenameLocation {
|
||||
textSpan: TextSpan;
|
||||
fileName: string;
|
||||
@@ -1150,6 +1158,7 @@ namespace ts {
|
||||
InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
|
||||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
|
||||
PlaceOpenBraceOnNewLineForFunctions: boolean;
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
[s: string]: boolean | number| string;
|
||||
@@ -1569,13 +1578,6 @@ namespace ts {
|
||||
|
||||
/// Language Service
|
||||
|
||||
interface FormattingOptions {
|
||||
useTabs: boolean;
|
||||
spacesPerTab: number;
|
||||
indentSpaces: number;
|
||||
newLineCharacter: string;
|
||||
}
|
||||
|
||||
// Information about a specific host file.
|
||||
interface HostFileInformation {
|
||||
hostFileName: string;
|
||||
@@ -1774,6 +1776,7 @@ namespace ts {
|
||||
fileName?: string;
|
||||
reportDiagnostics?: boolean;
|
||||
moduleName?: string;
|
||||
renamedDependencies?: Map<string>;
|
||||
}
|
||||
|
||||
export interface TranspileOutput {
|
||||
@@ -1790,8 +1793,8 @@ namespace ts {
|
||||
* - allowNonTsExtensions = true
|
||||
* - noLib = true
|
||||
* - noResolve = true
|
||||
*/
|
||||
export function transpileModule(input: string, transpileOptions?: TranspileOptions): TranspileOutput {
|
||||
*/
|
||||
export function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput {
|
||||
let options = transpileOptions.compilerOptions ? clone(transpileOptions.compilerOptions) : getDefaultCompilerOptions();
|
||||
|
||||
options.isolatedModules = true;
|
||||
@@ -1814,6 +1817,8 @@ namespace ts {
|
||||
sourceFile.moduleName = transpileOptions.moduleName;
|
||||
}
|
||||
|
||||
sourceFile.renamedDependencies = transpileOptions.renamedDependencies;
|
||||
|
||||
let newLine = getNewLineCharacter(options);
|
||||
|
||||
// Output
|
||||
@@ -2569,7 +2574,7 @@ namespace ts {
|
||||
getCancellationToken: () => cancellationToken,
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitivefileNames,
|
||||
getNewLine: () => host.getNewLine ? host.getNewLine() : "\r\n",
|
||||
getNewLine: () => getNewLineOrDefaultFromHost(host),
|
||||
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
|
||||
writeFile: (fileName, data, writeByteOrderMark) => { },
|
||||
getCurrentDirectory: () => host.getCurrentDirectory(),
|
||||
@@ -4669,7 +4674,7 @@ namespace ts {
|
||||
case SyntaxKind.BreakKeyword:
|
||||
case SyntaxKind.ContinueKeyword:
|
||||
if (hasKind(node.parent, SyntaxKind.BreakStatement) || hasKind(node.parent, SyntaxKind.ContinueStatement)) {
|
||||
return getBreakOrContinueStatementOccurences(<BreakOrContinueStatement>node.parent);
|
||||
return getBreakOrContinueStatementOccurrences(<BreakOrContinueStatement>node.parent);
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ForKeyword:
|
||||
@@ -4995,7 +5000,7 @@ namespace ts {
|
||||
return map(keywords, getHighlightSpanForNode);
|
||||
}
|
||||
|
||||
function getBreakOrContinueStatementOccurences(breakOrContinueStatement: BreakOrContinueStatement): HighlightSpan[] {
|
||||
function getBreakOrContinueStatementOccurrences(breakOrContinueStatement: BreakOrContinueStatement): HighlightSpan[] {
|
||||
let owner = getBreakOrContinueOwner(breakOrContinueStatement);
|
||||
|
||||
if (owner) {
|
||||
@@ -5535,7 +5540,7 @@ namespace ts {
|
||||
symbolToIndex: number[]): void {
|
||||
|
||||
let sourceFile = container.getSourceFile();
|
||||
let tripleSlashDirectivePrefixRegex = /^\/\/\/\s*</
|
||||
let tripleSlashDirectivePrefixRegex = /^\/\/\/\s*</;
|
||||
|
||||
let possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, container.getStart(), container.getEnd());
|
||||
|
||||
@@ -5551,8 +5556,8 @@ namespace ts {
|
||||
// This wasn't the start of a token. Check to see if it might be a
|
||||
// match in a comment or string if that's what the caller is asking
|
||||
// for.
|
||||
if ((findInStrings && isInString(position)) ||
|
||||
(findInComments && isInComment(position))) {
|
||||
if ((findInStrings && isInString(sourceFile, position)) ||
|
||||
(findInComments && isInNonReferenceComment(sourceFile, position))) {
|
||||
|
||||
// In the case where we're looking inside comments/strings, we don't have
|
||||
// an actual definition. So just use 'undefined' here. Features like
|
||||
@@ -5616,30 +5621,13 @@ namespace ts {
|
||||
return result[index];
|
||||
}
|
||||
|
||||
function isInString(position: number) {
|
||||
let token = getTokenAtPosition(sourceFile, position);
|
||||
return token && token.kind === SyntaxKind.StringLiteral && position > token.getStart();
|
||||
}
|
||||
function isInNonReferenceComment(sourceFile: SourceFile, position: number): boolean {
|
||||
return isInCommentHelper(sourceFile, position, isNonReferenceComment);
|
||||
|
||||
function isInComment(position: number) {
|
||||
let token = getTokenAtPosition(sourceFile, position);
|
||||
if (token && position < token.getStart()) {
|
||||
// First, we have to see if this position actually landed in a comment.
|
||||
let commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
|
||||
|
||||
// Then we want to make sure that it wasn't in a "///<" directive comment
|
||||
// We don't want to unintentionally update a file name.
|
||||
return forEach(commentRanges, c => {
|
||||
if (c.pos < position && position < c.end) {
|
||||
let commentText = sourceFile.text.substring(c.pos, c.end);
|
||||
if (!tripleSlashDirectivePrefixRegex.test(commentText)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
function isNonReferenceComment(c: CommentRange): boolean {
|
||||
let commentText = sourceFile.text.substring(c.pos, c.end);
|
||||
return !tripleSlashDirectivePrefixRegex.test(commentText);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6866,6 +6854,78 @@ namespace ts {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if position points to a valid position to add JSDoc comments, and if so,
|
||||
* returns the appropriate template. Otherwise returns an empty string.
|
||||
* Valid positions are
|
||||
* - outside of comments, statements, and expressions, and
|
||||
* - preceding a function declaration.
|
||||
*
|
||||
* Hosts should ideally check that:
|
||||
* - The line is all whitespace up to 'position' before performing the insertion.
|
||||
* - If the keystroke sequence "/\*\*" induced the call, we also check that the next
|
||||
* non-whitespace character is '*', which (approximately) indicates whether we added
|
||||
* the second '*' to complete an existing (JSDoc) comment.
|
||||
* @param fileName The file in which to perform the check.
|
||||
* @param position The (character-indexed) position in the file where the check should
|
||||
* be performed.
|
||||
*/
|
||||
function getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion {
|
||||
let start = new Date().getTime();
|
||||
let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
|
||||
// Check if in a context where we don't want to perform any insertion
|
||||
if (isInString(sourceFile, position) || isInComment(sourceFile, position) || hasDocComment(sourceFile, position)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let tokenAtPos = getTokenAtPosition(sourceFile, position);
|
||||
let tokenStart = tokenAtPos.getStart()
|
||||
if (!tokenAtPos || tokenStart < position) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// TODO: add support for:
|
||||
// - methods
|
||||
// - constructors
|
||||
// - class decls
|
||||
let containingFunction = <FunctionDeclaration>getAncestor(tokenAtPos, SyntaxKind.FunctionDeclaration);
|
||||
|
||||
if (!containingFunction || containingFunction.getStart() < position) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let parameters = containingFunction.parameters;
|
||||
let posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position);
|
||||
let lineStart = sourceFile.getLineStarts()[posLineAndChar.line];
|
||||
|
||||
let indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);
|
||||
|
||||
// TODO: call a helper method instead once PR #4133 gets merged in.
|
||||
const newLine = host.getNewLine ? host.getNewLine() : "\r\n";
|
||||
|
||||
let docParams = parameters.reduce((prev, cur, index) =>
|
||||
prev +
|
||||
indentationStr + " * @param " + (cur.name.kind === SyntaxKind.Identifier ? (<Identifier>cur.name).text : "param" + index) + newLine, "");
|
||||
|
||||
// A doc comment consists of the following
|
||||
// * The opening comment line
|
||||
// * the first line (without a param) for the object's untagged info (this is also where the caret ends up)
|
||||
// * the '@param'-tagged lines
|
||||
// * TODO: other tags.
|
||||
// * the closing comment line
|
||||
// * if the caret was directly in front of the object, then we add an extra line and indentation.
|
||||
const preamble = "/**" + newLine +
|
||||
indentationStr + " * ";
|
||||
let result =
|
||||
preamble + newLine +
|
||||
docParams +
|
||||
indentationStr + " */" +
|
||||
(tokenStart === position ? newLine + indentationStr : "");
|
||||
|
||||
return { newText: result, caretOffset: preamble.length };
|
||||
}
|
||||
|
||||
function getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] {
|
||||
// Note: while getting todo comments seems like a syntactic operation, we actually
|
||||
// treat it as a semantic operation here. This is because we expect our host to call
|
||||
@@ -7107,6 +7167,7 @@ namespace ts {
|
||||
getFormattingEditsForRange,
|
||||
getFormattingEditsForDocument,
|
||||
getFormattingEditsAfterKeystroke,
|
||||
getDocCommentTemplateAtPosition,
|
||||
getEmitOutput,
|
||||
getSourceFile,
|
||||
getProgram
|
||||
|
||||
+17
-6
@@ -207,6 +207,11 @@ namespace ts {
|
||||
getFormattingEditsForDocument(fileName: string, options: string/*Services.FormatCodeOptions*/): string;
|
||||
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: string/*Services.FormatCodeOptions*/): string;
|
||||
|
||||
/**
|
||||
* Returns JSON-encoded value of the type TextInsertion.
|
||||
*/
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number): string;
|
||||
|
||||
getEmitOutput(fileName: string): string;
|
||||
}
|
||||
|
||||
@@ -549,7 +554,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
private realizeDiagnostics(diagnostics: Diagnostic[]): { message: string; start: number; length: number; category: string; }[]{
|
||||
var newLine = this.getNewLine();
|
||||
var newLine = getNewLineOrDefaultFromHost(this.host);
|
||||
return ts.realizeDiagnostics(diagnostics, newLine);
|
||||
}
|
||||
|
||||
@@ -591,10 +596,6 @@ namespace ts {
|
||||
});
|
||||
}
|
||||
|
||||
private getNewLine(): string {
|
||||
return this.host.getNewLine ? this.host.getNewLine() : "\r\n";
|
||||
}
|
||||
|
||||
public getSyntacticDiagnostics(fileName: string): string {
|
||||
return this.forwardJSONCall(
|
||||
"getSyntacticDiagnostics('" + fileName + "')",
|
||||
@@ -771,7 +772,10 @@ namespace ts {
|
||||
return this.forwardJSONCall(
|
||||
"getDocumentHighlights('" + fileName + "', " + position + ")",
|
||||
() => {
|
||||
return this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch));
|
||||
var results = this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch));
|
||||
// workaround for VS document higlighting issue - keep only items from the initial file
|
||||
let normalizedName = normalizeSlashes(fileName).toLowerCase();
|
||||
return filter(results, r => normalizeSlashes(r.fileName).toLowerCase() === normalizedName);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -831,6 +835,13 @@ namespace ts {
|
||||
});
|
||||
}
|
||||
|
||||
public getDocCommentTemplateAtPosition(fileName: string, position: number): string {
|
||||
return this.forwardJSONCall(
|
||||
"getDocCommentTemplateAtPosition('" + fileName + "', " + position + ")",
|
||||
() => this.languageService.getDocCommentTemplateAtPosition(fileName, position)
|
||||
);
|
||||
}
|
||||
|
||||
/// NAVIGATE TO
|
||||
|
||||
/** Return a list of symbols that are interesting to navigate to */
|
||||
|
||||
@@ -414,6 +414,60 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function isInString(sourceFile: SourceFile, position: number) {
|
||||
let token = getTokenAtPosition(sourceFile, position);
|
||||
return token && token.kind === SyntaxKind.StringLiteral && position > token.getStart();
|
||||
}
|
||||
|
||||
export function isInComment(sourceFile: SourceFile, position: number) {
|
||||
return isInCommentHelper(sourceFile, position, /*predicate*/ undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the cursor at position in sourceFile is within a comment that additionally
|
||||
* satisfies predicate, and false otherwise.
|
||||
*/
|
||||
export function isInCommentHelper(sourceFile: SourceFile, position: number, predicate?: (c: CommentRange) => boolean): boolean {
|
||||
let token = getTokenAtPosition(sourceFile, position);
|
||||
|
||||
if (token && position <= token.getStart()) {
|
||||
let commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
|
||||
|
||||
// The end marker of a single-line comment does not include the newline character.
|
||||
// In the following case, we are inside a comment (^ denotes the cursor position):
|
||||
//
|
||||
// // asdf ^\n
|
||||
//
|
||||
// But for multi-line comments, we don't want to be inside the comment in the following case:
|
||||
//
|
||||
// /* asdf */^
|
||||
//
|
||||
// Internally, we represent the end of the comment at the newline and closing '/', respectively.
|
||||
return predicate ?
|
||||
forEach(commentRanges, c => c.pos < position &&
|
||||
(c.kind == SyntaxKind.SingleLineCommentTrivia ? position <= c.end : position < c.end) &&
|
||||
predicate(c)) :
|
||||
forEach(commentRanges, c => c.pos < position &&
|
||||
(c.kind == SyntaxKind.SingleLineCommentTrivia ? position <= c.end : position < c.end));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function hasDocComment(sourceFile: SourceFile, position: number) {
|
||||
let token = getTokenAtPosition(sourceFile, position);
|
||||
|
||||
// First, we have to see if this position actually landed in a comment.
|
||||
let commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
|
||||
|
||||
return forEach(commentRanges, jsDocPrefix);
|
||||
|
||||
function jsDocPrefix(c: CommentRange): boolean {
|
||||
var text = sourceFile.text;
|
||||
return text.length >= c.pos + 3 && text[c.pos] === '/' && text[c.pos + 1] === '*' && text[c.pos + 2] === '*';
|
||||
}
|
||||
}
|
||||
|
||||
function nodeHasTokens(n: Node): boolean {
|
||||
// If we have a token or node that has a non-zero width, it must have tokens.
|
||||
@@ -625,6 +679,14 @@ namespace ts {
|
||||
return displayPart(text, SymbolDisplayPartKind.text);
|
||||
}
|
||||
|
||||
const carriageReturnLineFeed = "\r\n";
|
||||
/**
|
||||
* The default is CRLF.
|
||||
*/
|
||||
export function getNewLineOrDefaultFromHost(host: LanguageServiceHost | LanguageServiceShimHost) {
|
||||
return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed;
|
||||
}
|
||||
|
||||
export function lineBreakPart() {
|
||||
return displayPart("\n", SymbolDisplayPartKind.lineBreak);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ exports.delint = delint;
|
||||
var fileNames = process.argv.slice(2);
|
||||
fileNames.forEach(function (fileName) {
|
||||
// Parse a file
|
||||
var sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), 2 /* ES6 */, true);
|
||||
var sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), 2 /* ES6 */, /*setParentNodes */ true);
|
||||
// delint it
|
||||
delint(sourceFile);
|
||||
});
|
||||
|
||||
@@ -22,8 +22,8 @@ System.register(['foo'], function(exports_1) {
|
||||
var cls, cls2, x, y, z, M;
|
||||
return {
|
||||
setters:[
|
||||
function (_alias) {
|
||||
alias = _alias;
|
||||
function (alias_1) {
|
||||
alias = alias_1;
|
||||
}],
|
||||
execute: function() {
|
||||
cls = alias.Class;
|
||||
|
||||
@@ -21,8 +21,8 @@ System.register(["foo"], function(exports_1) {
|
||||
var cls, cls2, x, y, z, M;
|
||||
return {
|
||||
setters:[
|
||||
function (_foo_1) {
|
||||
foo_1 = _foo_1;
|
||||
function (foo_1_1) {
|
||||
foo_1 = foo_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
cls = foo_1.alias.Class;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts(7,1): error TS2322: Type 'typeof A' is not assignable to type 'new () => A'.
|
||||
Cannot assign an abstract constructor type to a non-abstract constructor type.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts(8,1): error TS2322: Type 'string' is not assignable to type 'new () => A'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts (2 errors) ====
|
||||
abstract class A { }
|
||||
|
||||
// var AA: typeof A;
|
||||
var AAA: new() => A;
|
||||
|
||||
// AA = A; // okay
|
||||
AAA = A; // error.
|
||||
~~~
|
||||
!!! error TS2322: Type 'typeof A' is not assignable to type 'new () => A'.
|
||||
!!! error TS2322: Cannot assign an abstract constructor type to a non-abstract constructor type.
|
||||
AAA = "asdf";
|
||||
~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'new () => A'.
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [classAbstractAssignabilityConstructorFunction.ts]
|
||||
abstract class A { }
|
||||
|
||||
// var AA: typeof A;
|
||||
var AAA: new() => A;
|
||||
|
||||
// AA = A; // okay
|
||||
AAA = A; // error.
|
||||
AAA = "asdf";
|
||||
|
||||
//// [classAbstractAssignabilityConstructorFunction.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
// var AA: typeof A;
|
||||
var AAA;
|
||||
// AA = A; // okay
|
||||
AAA = A; // error.
|
||||
AAA = "asdf";
|
||||
@@ -8,4 +8,5 @@ s.map(// do something
|
||||
//// [commentInMethodCall.js]
|
||||
//commment here
|
||||
var s;
|
||||
s.map(function () { });
|
||||
s.map(// do something
|
||||
function () { });
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//// [commentsArgumentsOfCallExpression1.ts]
|
||||
function foo(/*c1*/ x: any) { }
|
||||
foo(/*c2*/ 1);
|
||||
foo(/*c3*/ function () { });
|
||||
foo(
|
||||
/*c4*/
|
||||
() => { });
|
||||
foo(
|
||||
/*c5*/
|
||||
/*c6*/
|
||||
() => { });
|
||||
foo(/*c7*/
|
||||
() => { });
|
||||
foo(
|
||||
/*c7*/
|
||||
/*c8*/() => { });
|
||||
|
||||
//// [commentsArgumentsOfCallExpression1.js]
|
||||
function foo(/*c1*/ x) { }
|
||||
foo(/*c2*/ 1);
|
||||
foo(/*c3*/ function () { });
|
||||
foo(
|
||||
/*c4*/
|
||||
function () { });
|
||||
foo(
|
||||
/*c5*/
|
||||
/*c6*/
|
||||
function () { });
|
||||
foo(/*c7*/ function () { });
|
||||
foo(
|
||||
/*c7*/
|
||||
/*c8*/ function () { });
|
||||
@@ -0,0 +1,31 @@
|
||||
=== tests/cases/compiler/commentsArgumentsOfCallExpression1.ts ===
|
||||
function foo(/*c1*/ x: any) { }
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(commentsArgumentsOfCallExpression1.ts, 0, 13))
|
||||
|
||||
foo(/*c2*/ 1);
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0))
|
||||
|
||||
foo(/*c3*/ function () { });
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0))
|
||||
|
||||
foo(
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0))
|
||||
|
||||
/*c4*/
|
||||
() => { });
|
||||
foo(
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0))
|
||||
|
||||
/*c5*/
|
||||
/*c6*/
|
||||
() => { });
|
||||
foo(/*c7*/
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0))
|
||||
|
||||
() => { });
|
||||
foo(
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0))
|
||||
|
||||
/*c7*/
|
||||
/*c8*/() => { });
|
||||
@@ -0,0 +1,47 @@
|
||||
=== tests/cases/compiler/commentsArgumentsOfCallExpression1.ts ===
|
||||
function foo(/*c1*/ x: any) { }
|
||||
>foo : (x: any) => void
|
||||
>x : any
|
||||
|
||||
foo(/*c2*/ 1);
|
||||
>foo(/*c2*/ 1) : void
|
||||
>foo : (x: any) => void
|
||||
>1 : number
|
||||
|
||||
foo(/*c3*/ function () { });
|
||||
>foo(/*c3*/ function () { }) : void
|
||||
>foo : (x: any) => void
|
||||
>function () { } : () => void
|
||||
|
||||
foo(
|
||||
>foo( /*c4*/ () => { }) : void
|
||||
>foo : (x: any) => void
|
||||
|
||||
/*c4*/
|
||||
() => { });
|
||||
>() => { } : () => void
|
||||
|
||||
foo(
|
||||
>foo( /*c5*/ /*c6*/ () => { }) : void
|
||||
>foo : (x: any) => void
|
||||
|
||||
/*c5*/
|
||||
/*c6*/
|
||||
() => { });
|
||||
>() => { } : () => void
|
||||
|
||||
foo(/*c7*/
|
||||
>foo(/*c7*/ () => { }) : void
|
||||
>foo : (x: any) => void
|
||||
|
||||
() => { });
|
||||
>() => { } : () => void
|
||||
|
||||
foo(
|
||||
>foo( /*c7*/ /*c8*/() => { }) : void
|
||||
>foo : (x: any) => void
|
||||
|
||||
/*c7*/
|
||||
/*c8*/() => { });
|
||||
>() => { } : () => void
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [commentsArgumentsOfCallExpression2.ts]
|
||||
function foo(/*c1*/ x: any, /*d1*/ y: any,/*e1*/w?: any) { }
|
||||
var a, b: any;
|
||||
foo(/*c2*/ 1, /*d2*/ 1 + 2, /*e1*/ a + b);
|
||||
foo(/*c3*/ function () { }, /*d2*/() => { }, /*e2*/ a + /*e3*/ b);
|
||||
foo(/*c3*/ function () { }, /*d3*/() => { }, /*e3*/(a + b));
|
||||
foo(
|
||||
/*c4*/ function () { },
|
||||
/*d4*/() => { },
|
||||
/*e4*/
|
||||
/*e5*/ "hello");
|
||||
|
||||
//// [commentsArgumentsOfCallExpression2.js]
|
||||
function foo(/*c1*/ x, /*d1*/ y, /*e1*/ w) { }
|
||||
var a, b;
|
||||
foo(/*c2*/ 1, /*d2*/ 1 + 2, /*e1*/ a + b);
|
||||
foo(/*c3*/ function () { }, /*d2*/ function () { }, /*e2*/ a + b);
|
||||
foo(/*c3*/ function () { }, /*d3*/ function () { }, /*e3*/ (a + b));
|
||||
foo(
|
||||
/*c4*/ function () { },
|
||||
/*d4*/ function () { },
|
||||
/*e4*/
|
||||
/*e5*/ "hello");
|
||||
@@ -0,0 +1,33 @@
|
||||
=== tests/cases/compiler/commentsArgumentsOfCallExpression2.ts ===
|
||||
function foo(/*c1*/ x: any, /*d1*/ y: any,/*e1*/w?: any) { }
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression2.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(commentsArgumentsOfCallExpression2.ts, 0, 13))
|
||||
>y : Symbol(y, Decl(commentsArgumentsOfCallExpression2.ts, 0, 27))
|
||||
>w : Symbol(w, Decl(commentsArgumentsOfCallExpression2.ts, 0, 42))
|
||||
|
||||
var a, b: any;
|
||||
>a : Symbol(a, Decl(commentsArgumentsOfCallExpression2.ts, 1, 3))
|
||||
>b : Symbol(b, Decl(commentsArgumentsOfCallExpression2.ts, 1, 6))
|
||||
|
||||
foo(/*c2*/ 1, /*d2*/ 1 + 2, /*e1*/ a + b);
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression2.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(commentsArgumentsOfCallExpression2.ts, 1, 3))
|
||||
>b : Symbol(b, Decl(commentsArgumentsOfCallExpression2.ts, 1, 6))
|
||||
|
||||
foo(/*c3*/ function () { }, /*d2*/() => { }, /*e2*/ a + /*e3*/ b);
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression2.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(commentsArgumentsOfCallExpression2.ts, 1, 3))
|
||||
>b : Symbol(b, Decl(commentsArgumentsOfCallExpression2.ts, 1, 6))
|
||||
|
||||
foo(/*c3*/ function () { }, /*d3*/() => { }, /*e3*/(a + b));
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression2.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(commentsArgumentsOfCallExpression2.ts, 1, 3))
|
||||
>b : Symbol(b, Decl(commentsArgumentsOfCallExpression2.ts, 1, 6))
|
||||
|
||||
foo(
|
||||
>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression2.ts, 0, 0))
|
||||
|
||||
/*c4*/ function () { },
|
||||
/*d4*/() => { },
|
||||
/*e4*/
|
||||
/*e5*/ "hello");
|
||||
@@ -0,0 +1,55 @@
|
||||
=== tests/cases/compiler/commentsArgumentsOfCallExpression2.ts ===
|
||||
function foo(/*c1*/ x: any, /*d1*/ y: any,/*e1*/w?: any) { }
|
||||
>foo : (x: any, y: any, w?: any) => void
|
||||
>x : any
|
||||
>y : any
|
||||
>w : any
|
||||
|
||||
var a, b: any;
|
||||
>a : any
|
||||
>b : any
|
||||
|
||||
foo(/*c2*/ 1, /*d2*/ 1 + 2, /*e1*/ a + b);
|
||||
>foo(/*c2*/ 1, /*d2*/ 1 + 2, /*e1*/ a + b) : void
|
||||
>foo : (x: any, y: any, w?: any) => void
|
||||
>1 : number
|
||||
>1 + 2 : number
|
||||
>1 : number
|
||||
>2 : number
|
||||
>a + b : any
|
||||
>a : any
|
||||
>b : any
|
||||
|
||||
foo(/*c3*/ function () { }, /*d2*/() => { }, /*e2*/ a + /*e3*/ b);
|
||||
>foo(/*c3*/ function () { }, /*d2*/() => { }, /*e2*/ a + /*e3*/ b) : void
|
||||
>foo : (x: any, y: any, w?: any) => void
|
||||
>function () { } : () => void
|
||||
>() => { } : () => void
|
||||
>a + /*e3*/ b : any
|
||||
>a : any
|
||||
>b : any
|
||||
|
||||
foo(/*c3*/ function () { }, /*d3*/() => { }, /*e3*/(a + b));
|
||||
>foo(/*c3*/ function () { }, /*d3*/() => { }, /*e3*/(a + b)) : void
|
||||
>foo : (x: any, y: any, w?: any) => void
|
||||
>function () { } : () => void
|
||||
>() => { } : () => void
|
||||
>(a + b) : any
|
||||
>a + b : any
|
||||
>a : any
|
||||
>b : any
|
||||
|
||||
foo(
|
||||
>foo( /*c4*/ function () { }, /*d4*/() => { }, /*e4*/ /*e5*/ "hello") : void
|
||||
>foo : (x: any, y: any, w?: any) => void
|
||||
|
||||
/*c4*/ function () { },
|
||||
>function () { } : () => void
|
||||
|
||||
/*d4*/() => { },
|
||||
>() => { } : () => void
|
||||
|
||||
/*e4*/
|
||||
/*e5*/ "hello");
|
||||
>"hello" : string
|
||||
|
||||
@@ -6,5 +6,5 @@ var v = {
|
||||
|
||||
//// [commentsBeforeFunctionExpression1.js]
|
||||
var v = {
|
||||
f: function (a) { return 0; }
|
||||
f: /**own f*/ function (a) { return 0; }
|
||||
};
|
||||
|
||||
@@ -89,7 +89,7 @@ var i2_i_nc_fnfoo = i2_i.nc_fnfoo;
|
||||
var i2_i_nc_fnfoo_r = i2_i.nc_fnfoo(10);
|
||||
var i3_i;
|
||||
i3_i = {
|
||||
f: function (/**i3_i a*/ a) { return "Hello" + a; },
|
||||
f: /**own f*/ function (/**i3_i a*/ a) { return "Hello" + a; },
|
||||
l: this.f,
|
||||
/** own x*/
|
||||
x: this.f(10),
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//// [commentsOnPropertyOfObjectLiteral1.ts]
|
||||
var resolve = {
|
||||
id: /*! @ngInject */ (details: any) => details.id,
|
||||
id1: /* c1 */ "hello",
|
||||
id2:
|
||||
/*! @ngInject */ (details: any) => details.id,
|
||||
id3:
|
||||
/*! @ngInject */
|
||||
(details: any) => details.id,
|
||||
id4:
|
||||
/*! @ngInject */
|
||||
/* C2 */
|
||||
(details: any) => details.id,
|
||||
};
|
||||
|
||||
//// [commentsOnPropertyOfObjectLiteral1.js]
|
||||
var resolve = {
|
||||
id: /*! @ngInject */ function (details) { return details.id; },
|
||||
id1: /* c1 */ "hello",
|
||||
id2:
|
||||
/*! @ngInject */ function (details) { return details.id; },
|
||||
id3:
|
||||
/*! @ngInject */
|
||||
function (details) { return details.id; },
|
||||
id4:
|
||||
/*! @ngInject */
|
||||
/* C2 */
|
||||
function (details) { return details.id; }
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
=== tests/cases/compiler/commentsOnPropertyOfObjectLiteral1.ts ===
|
||||
var resolve = {
|
||||
>resolve : Symbol(resolve, Decl(commentsOnPropertyOfObjectLiteral1.ts, 0, 3))
|
||||
|
||||
id: /*! @ngInject */ (details: any) => details.id,
|
||||
>id : Symbol(id, Decl(commentsOnPropertyOfObjectLiteral1.ts, 0, 15))
|
||||
>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 1, 26))
|
||||
>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 1, 26))
|
||||
|
||||
id1: /* c1 */ "hello",
|
||||
>id1 : Symbol(id1, Decl(commentsOnPropertyOfObjectLiteral1.ts, 1, 54))
|
||||
|
||||
id2:
|
||||
>id2 : Symbol(id2, Decl(commentsOnPropertyOfObjectLiteral1.ts, 2, 26))
|
||||
|
||||
/*! @ngInject */ (details: any) => details.id,
|
||||
>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 4, 26))
|
||||
>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 4, 26))
|
||||
|
||||
id3:
|
||||
>id3 : Symbol(id3, Decl(commentsOnPropertyOfObjectLiteral1.ts, 4, 54))
|
||||
|
||||
/*! @ngInject */
|
||||
(details: any) => details.id,
|
||||
>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 7, 5))
|
||||
>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 7, 5))
|
||||
|
||||
id4:
|
||||
>id4 : Symbol(id4, Decl(commentsOnPropertyOfObjectLiteral1.ts, 7, 33))
|
||||
|
||||
/*! @ngInject */
|
||||
/* C2 */
|
||||
(details: any) => details.id,
|
||||
>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 11, 5))
|
||||
>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 11, 5))
|
||||
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
=== tests/cases/compiler/commentsOnPropertyOfObjectLiteral1.ts ===
|
||||
var resolve = {
|
||||
>resolve : { id: (details: any) => any; id1: string; id2: (details: any) => any; id3: (details: any) => any; id4: (details: any) => any; }
|
||||
>{ id: /*! @ngInject */ (details: any) => details.id, id1: /* c1 */ "hello", id2: /*! @ngInject */ (details: any) => details.id, id3: /*! @ngInject */ (details: any) => details.id, id4: /*! @ngInject */ /* C2 */ (details: any) => details.id,} : { id: (details: any) => any; id1: string; id2: (details: any) => any; id3: (details: any) => any; id4: (details: any) => any; }
|
||||
|
||||
id: /*! @ngInject */ (details: any) => details.id,
|
||||
>id : (details: any) => any
|
||||
>(details: any) => details.id : (details: any) => any
|
||||
>details : any
|
||||
>details.id : any
|
||||
>details : any
|
||||
>id : any
|
||||
|
||||
id1: /* c1 */ "hello",
|
||||
>id1 : string
|
||||
>"hello" : string
|
||||
|
||||
id2:
|
||||
>id2 : (details: any) => any
|
||||
|
||||
/*! @ngInject */ (details: any) => details.id,
|
||||
>(details: any) => details.id : (details: any) => any
|
||||
>details : any
|
||||
>details.id : any
|
||||
>details : any
|
||||
>id : any
|
||||
|
||||
id3:
|
||||
>id3 : (details: any) => any
|
||||
|
||||
/*! @ngInject */
|
||||
(details: any) => details.id,
|
||||
>(details: any) => details.id : (details: any) => any
|
||||
>details : any
|
||||
>details.id : any
|
||||
>details : any
|
||||
>id : any
|
||||
|
||||
id4:
|
||||
>id4 : (details: any) => any
|
||||
|
||||
/*! @ngInject */
|
||||
/* C2 */
|
||||
(details: any) => details.id,
|
||||
>(details: any) => details.id : (details: any) => any
|
||||
>details : any
|
||||
>details.id : any
|
||||
>details : any
|
||||
>id : any
|
||||
|
||||
};
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [computedPropertyNamesSourceMap2_ES5.js.map]
|
||||
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;;CACJ,CAAA"}
|
||||
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC,GAAT;QACIA,QAAQA,CAACA;IACbA,CAACA;;CACJ,CAAA"}
|
||||
@@ -28,26 +28,28 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
|
||||
2 > ^^^
|
||||
3 > ^^^^^^^
|
||||
4 > ^
|
||||
5 > ^^^->
|
||||
5 > ^^^
|
||||
1->{
|
||||
>
|
||||
2 > [
|
||||
3 > "hello"
|
||||
4 > ]
|
||||
5 >
|
||||
1->Emitted(2, 5) Source(2, 5) + SourceIndex(0)
|
||||
2 >Emitted(2, 8) Source(2, 6) + SourceIndex(0)
|
||||
3 >Emitted(2, 15) Source(2, 13) + SourceIndex(0)
|
||||
4 >Emitted(2, 16) Source(2, 14) + SourceIndex(0)
|
||||
5 >Emitted(2, 19) Source(2, 5) + SourceIndex(0)
|
||||
---
|
||||
>>> debugger;
|
||||
1->^^^^^^^^
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^^^^^
|
||||
3 > ^
|
||||
1->() {
|
||||
1 >["hello"]() {
|
||||
>
|
||||
2 > debugger
|
||||
3 > ;
|
||||
1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"])
|
||||
1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"])
|
||||
2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"])
|
||||
3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"])
|
||||
---
|
||||
|
||||
@@ -82,5 +82,7 @@ var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any
|
||||
>IWithCallSignatures : Symbol(IWithCallSignatures, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 9, 1))
|
||||
>IWithCallSignatures4 : Symbol(IWithCallSignatures4, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 18, 1))
|
||||
>a : Symbol(a, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 35, 52))
|
||||
>a.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
|
||||
>a : Symbol(a, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 35, 52))
|
||||
>toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
|
||||
|
||||
|
||||
@@ -90,10 +90,10 @@ var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any
|
||||
>x4 : IWithCallSignatures | IWithCallSignatures4
|
||||
>IWithCallSignatures : IWithCallSignatures
|
||||
>IWithCallSignatures4 : IWithCallSignatures4
|
||||
>a => /*here a should be any*/ a.toString() : (a: any) => any
|
||||
>a : any
|
||||
>a.toString() : any
|
||||
>a.toString : any
|
||||
>a : any
|
||||
>toString : any
|
||||
>a => /*here a should be any*/ a.toString() : (a: number) => string
|
||||
>a : number
|
||||
>a.toString() : string
|
||||
>a.toString : (radix?: number) => string
|
||||
>a : number
|
||||
>toString : (radix?: number) => string
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -10,8 +10,7 @@ sourceFile:contextualTyping.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>// CONTEXT: Class property declaration
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1 >// DEFAULT INTERFACES
|
||||
>interface IFoo {
|
||||
> n: number;
|
||||
@@ -24,21 +23,23 @@ sourceFile:contextualTyping.ts
|
||||
> foo: IFoo;
|
||||
>}
|
||||
>
|
||||
>// CONTEXT: Class property declaration
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Class property declaration
|
||||
1 >Emitted(1, 1) Source(14, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 1) Source(13, 1) + SourceIndex(0)
|
||||
3 >Emitted(1, 39) Source(13, 39) + SourceIndex(0)
|
||||
2 >// CONTEXT: Class property declaration
|
||||
1 >Emitted(1, 1) Source(13, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 39) Source(13, 39) + SourceIndex(0)
|
||||
---
|
||||
>>>var C1T5 = (function () {
|
||||
>>> function C1T5() {
|
||||
1 >^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
1 >Emitted(3, 5) Source(14, 1) + SourceIndex(0) name (C1T5)
|
||||
1 >Emitted(2, 1) Source(14, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function C1T5() {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
1->Emitted(3, 5) Source(14, 1) + SourceIndex(0) name (C1T5)
|
||||
---
|
||||
>>> this.foo = function (i) {
|
||||
1->^^^^^^^^
|
||||
@@ -127,17 +128,13 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Module property declaration
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Module property declaration
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Module property declaration
|
||||
1->Emitted(10, 1) Source(21, 1) + SourceIndex(0)
|
||||
2 >Emitted(10, 1) Source(20, 1) + SourceIndex(0)
|
||||
3 >Emitted(10, 40) Source(20, 40) + SourceIndex(0)
|
||||
2 >// CONTEXT: Module property declaration
|
||||
1->Emitted(10, 1) Source(20, 1) + SourceIndex(0)
|
||||
2 >Emitted(10, 40) Source(20, 40) + SourceIndex(0)
|
||||
---
|
||||
>>>var C2T5;
|
||||
1 >
|
||||
@@ -257,66 +254,65 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Variable declaration
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^^^^^->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Variable declaration
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Variable declaration
|
||||
1->Emitted(17, 1) Source(28, 1) + SourceIndex(0)
|
||||
2 >Emitted(17, 1) Source(27, 1) + SourceIndex(0)
|
||||
3 >Emitted(17, 33) Source(27, 33) + SourceIndex(0)
|
||||
2 >// CONTEXT: Variable declaration
|
||||
1->Emitted(17, 1) Source(27, 1) + SourceIndex(0)
|
||||
2 >Emitted(17, 33) Source(27, 33) + SourceIndex(0)
|
||||
---
|
||||
>>>var c3t1 = (function (s) { return s; });
|
||||
1->^^^^
|
||||
2 > ^^^^
|
||||
3 > ^^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^
|
||||
6 > ^
|
||||
7 > ^^^^
|
||||
8 > ^^^^^^
|
||||
9 > ^
|
||||
10> ^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^
|
||||
14> ^
|
||||
15> ^
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^^^^^^^^^^
|
||||
7 > ^
|
||||
8 > ^^^^
|
||||
9 > ^^^^^^
|
||||
10> ^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^
|
||||
14> ^
|
||||
15> ^
|
||||
16> ^
|
||||
1->
|
||||
>var
|
||||
2 > c3t1
|
||||
3 > : (s: string) => string =
|
||||
4 > (
|
||||
5 > function(
|
||||
6 > s
|
||||
7 > ) {
|
||||
8 > return
|
||||
9 >
|
||||
10> s
|
||||
11>
|
||||
12>
|
||||
13> }
|
||||
14> )
|
||||
15> ;
|
||||
1->Emitted(18, 5) Source(28, 5) + SourceIndex(0)
|
||||
2 >Emitted(18, 9) Source(28, 9) + SourceIndex(0)
|
||||
3 >Emitted(18, 12) Source(28, 35) + SourceIndex(0)
|
||||
4 >Emitted(18, 13) Source(28, 36) + SourceIndex(0)
|
||||
5 >Emitted(18, 23) Source(28, 45) + SourceIndex(0)
|
||||
6 >Emitted(18, 24) Source(28, 46) + SourceIndex(0)
|
||||
7 >Emitted(18, 28) Source(28, 50) + SourceIndex(0)
|
||||
8 >Emitted(18, 34) Source(28, 56) + SourceIndex(0)
|
||||
9 >Emitted(18, 35) Source(28, 57) + SourceIndex(0)
|
||||
10>Emitted(18, 36) Source(28, 58) + SourceIndex(0)
|
||||
11>Emitted(18, 37) Source(28, 58) + SourceIndex(0)
|
||||
12>Emitted(18, 38) Source(28, 59) + SourceIndex(0)
|
||||
13>Emitted(18, 39) Source(28, 60) + SourceIndex(0)
|
||||
14>Emitted(18, 40) Source(28, 61) + SourceIndex(0)
|
||||
15>Emitted(18, 41) Source(28, 62) + SourceIndex(0)
|
||||
>
|
||||
2 >var
|
||||
3 > c3t1
|
||||
4 > : (s: string) => string =
|
||||
5 > (
|
||||
6 > function(
|
||||
7 > s
|
||||
8 > ) {
|
||||
9 > return
|
||||
10>
|
||||
11> s
|
||||
12>
|
||||
13>
|
||||
14> }
|
||||
15> )
|
||||
16> ;
|
||||
1->Emitted(18, 1) Source(28, 1) + SourceIndex(0)
|
||||
2 >Emitted(18, 5) Source(28, 5) + SourceIndex(0)
|
||||
3 >Emitted(18, 9) Source(28, 9) + SourceIndex(0)
|
||||
4 >Emitted(18, 12) Source(28, 35) + SourceIndex(0)
|
||||
5 >Emitted(18, 13) Source(28, 36) + SourceIndex(0)
|
||||
6 >Emitted(18, 23) Source(28, 45) + SourceIndex(0)
|
||||
7 >Emitted(18, 24) Source(28, 46) + SourceIndex(0)
|
||||
8 >Emitted(18, 28) Source(28, 50) + SourceIndex(0)
|
||||
9 >Emitted(18, 34) Source(28, 56) + SourceIndex(0)
|
||||
10>Emitted(18, 35) Source(28, 57) + SourceIndex(0)
|
||||
11>Emitted(18, 36) Source(28, 58) + SourceIndex(0)
|
||||
12>Emitted(18, 37) Source(28, 58) + SourceIndex(0)
|
||||
13>Emitted(18, 38) Source(28, 59) + SourceIndex(0)
|
||||
14>Emitted(18, 39) Source(28, 60) + SourceIndex(0)
|
||||
15>Emitted(18, 40) Source(28, 61) + SourceIndex(0)
|
||||
16>Emitted(18, 41) Source(28, 62) + SourceIndex(0)
|
||||
---
|
||||
>>>var c3t2 = ({
|
||||
1 >
|
||||
@@ -945,27 +941,28 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Class property assignment
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Class property assignment
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Class property assignment
|
||||
1->Emitted(40, 1) Source(56, 1) + SourceIndex(0)
|
||||
2 >Emitted(40, 1) Source(55, 1) + SourceIndex(0)
|
||||
3 >Emitted(40, 38) Source(55, 38) + SourceIndex(0)
|
||||
2 >// CONTEXT: Class property assignment
|
||||
1->Emitted(40, 1) Source(55, 1) + SourceIndex(0)
|
||||
2 >Emitted(40, 38) Source(55, 38) + SourceIndex(0)
|
||||
---
|
||||
>>>var C4T5 = (function () {
|
||||
>>> function C4T5() {
|
||||
1 >^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>class C4T5 {
|
||||
>
|
||||
1 >Emitted(41, 1) Source(56, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function C4T5() {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->class C4T5 {
|
||||
> foo: (i: number, s: string) => string;
|
||||
>
|
||||
1 >Emitted(42, 5) Source(58, 5) + SourceIndex(0) name (C4T5)
|
||||
1->Emitted(42, 5) Source(58, 5) + SourceIndex(0) name (C4T5)
|
||||
---
|
||||
>>> this.foo = function (i, s) {
|
||||
1->^^^^^^^^
|
||||
@@ -1070,17 +1067,13 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Module property assignment
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Module property assignment
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Module property assignment
|
||||
1->Emitted(49, 1) Source(66, 1) + SourceIndex(0)
|
||||
2 >Emitted(49, 1) Source(65, 1) + SourceIndex(0)
|
||||
3 >Emitted(49, 39) Source(65, 39) + SourceIndex(0)
|
||||
2 >// CONTEXT: Module property assignment
|
||||
1->Emitted(49, 1) Source(65, 1) + SourceIndex(0)
|
||||
2 >Emitted(49, 39) Source(65, 39) + SourceIndex(0)
|
||||
---
|
||||
>>>var C5T5;
|
||||
1 >
|
||||
@@ -1209,30 +1202,29 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Variable assignment
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Variable assignment
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Variable assignment
|
||||
1->Emitted(56, 1) Source(74, 1) + SourceIndex(0)
|
||||
2 >Emitted(56, 1) Source(73, 1) + SourceIndex(0)
|
||||
3 >Emitted(56, 32) Source(73, 32) + SourceIndex(0)
|
||||
2 >// CONTEXT: Variable assignment
|
||||
1->Emitted(56, 1) Source(73, 1) + SourceIndex(0)
|
||||
2 >Emitted(56, 32) Source(73, 32) + SourceIndex(0)
|
||||
---
|
||||
>>>var c6t5;
|
||||
1 >^^^^
|
||||
2 > ^^^^
|
||||
3 > ^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^^^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>var
|
||||
2 > c6t5: (n: number) => IFoo
|
||||
3 > ;
|
||||
1 >Emitted(57, 5) Source(74, 5) + SourceIndex(0)
|
||||
2 >Emitted(57, 9) Source(74, 30) + SourceIndex(0)
|
||||
3 >Emitted(57, 10) Source(74, 31) + SourceIndex(0)
|
||||
>
|
||||
2 >var
|
||||
3 > c6t5: (n: number) => IFoo
|
||||
4 > ;
|
||||
1 >Emitted(57, 1) Source(74, 1) + SourceIndex(0)
|
||||
2 >Emitted(57, 5) Source(74, 5) + SourceIndex(0)
|
||||
3 >Emitted(57, 9) Source(74, 30) + SourceIndex(0)
|
||||
4 >Emitted(57, 10) Source(74, 31) + SourceIndex(0)
|
||||
---
|
||||
>>>c6t5 = function (n) { return ({}); };
|
||||
1->
|
||||
@@ -1284,30 +1276,29 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Array index assignment
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1 >
|
||||
>
|
||||
>// CONTEXT: Array index assignment
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Array index assignment
|
||||
1 >Emitted(59, 1) Source(78, 1) + SourceIndex(0)
|
||||
2 >Emitted(59, 1) Source(77, 1) + SourceIndex(0)
|
||||
3 >Emitted(59, 35) Source(77, 35) + SourceIndex(0)
|
||||
2 >// CONTEXT: Array index assignment
|
||||
1 >Emitted(59, 1) Source(77, 1) + SourceIndex(0)
|
||||
2 >Emitted(59, 35) Source(77, 35) + SourceIndex(0)
|
||||
---
|
||||
>>>var c7t2;
|
||||
1 >^^^^
|
||||
2 > ^^^^
|
||||
3 > ^
|
||||
4 > ^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^^^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>var
|
||||
2 > c7t2: IFoo[]
|
||||
3 > ;
|
||||
1 >Emitted(60, 5) Source(78, 5) + SourceIndex(0)
|
||||
2 >Emitted(60, 9) Source(78, 17) + SourceIndex(0)
|
||||
3 >Emitted(60, 10) Source(78, 18) + SourceIndex(0)
|
||||
>
|
||||
2 >var
|
||||
3 > c7t2: IFoo[]
|
||||
4 > ;
|
||||
1 >Emitted(60, 1) Source(78, 1) + SourceIndex(0)
|
||||
2 >Emitted(60, 5) Source(78, 5) + SourceIndex(0)
|
||||
3 >Emitted(60, 9) Source(78, 17) + SourceIndex(0)
|
||||
4 >Emitted(60, 10) Source(78, 18) + SourceIndex(0)
|
||||
---
|
||||
>>>c7t2[0] = ({ n: 1 });
|
||||
1->
|
||||
@@ -2140,31 +2131,30 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Function call
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
>// CONTEXT: Function call
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Function call
|
||||
1->Emitted(85, 1) Source(146, 1) + SourceIndex(0)
|
||||
2 >Emitted(85, 1) Source(145, 1) + SourceIndex(0)
|
||||
3 >Emitted(85, 26) Source(145, 26) + SourceIndex(0)
|
||||
2 >// CONTEXT: Function call
|
||||
1->Emitted(85, 1) Source(145, 1) + SourceIndex(0)
|
||||
2 >Emitted(85, 26) Source(145, 26) + SourceIndex(0)
|
||||
---
|
||||
>>>function c9t5(f) { }
|
||||
1 >^^^^^^^^^^^^^^
|
||||
2 > ^
|
||||
3 > ^^^^
|
||||
4 > ^
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^^^
|
||||
5 > ^
|
||||
1 >
|
||||
>function c9t5(
|
||||
2 > f: (n: number) => IFoo
|
||||
3 > ) {
|
||||
4 > }
|
||||
1 >Emitted(86, 15) Source(146, 15) + SourceIndex(0)
|
||||
2 >Emitted(86, 16) Source(146, 37) + SourceIndex(0)
|
||||
3 >Emitted(86, 20) Source(146, 40) + SourceIndex(0) name (c9t5)
|
||||
4 >Emitted(86, 21) Source(146, 41) + SourceIndex(0) name (c9t5)
|
||||
>
|
||||
2 >function c9t5(
|
||||
3 > f: (n: number) => IFoo
|
||||
4 > ) {
|
||||
5 > }
|
||||
1 >Emitted(86, 1) Source(146, 1) + SourceIndex(0)
|
||||
2 >Emitted(86, 15) Source(146, 15) + SourceIndex(0)
|
||||
3 >Emitted(86, 16) Source(146, 37) + SourceIndex(0)
|
||||
4 >Emitted(86, 20) Source(146, 40) + SourceIndex(0) name (c9t5)
|
||||
5 >Emitted(86, 21) Source(146, 41) + SourceIndex(0) name (c9t5)
|
||||
---
|
||||
>>>;
|
||||
1 >
|
||||
@@ -2236,107 +2226,107 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Return statement
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
>// CONTEXT: Return statement
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Return statement
|
||||
1->Emitted(91, 1) Source(152, 1) + SourceIndex(0)
|
||||
2 >Emitted(91, 1) Source(151, 1) + SourceIndex(0)
|
||||
3 >Emitted(91, 29) Source(151, 29) + SourceIndex(0)
|
||||
2 >// CONTEXT: Return statement
|
||||
1->Emitted(91, 1) Source(151, 1) + SourceIndex(0)
|
||||
2 >Emitted(91, 29) Source(151, 29) + SourceIndex(0)
|
||||
---
|
||||
>>>var c10t5 = function () { return function (n) { return ({}); }; };
|
||||
1->^^^^
|
||||
2 > ^^^^^
|
||||
3 > ^^^
|
||||
4 > ^^^^^^^^^^^^^^
|
||||
5 > ^^^^^^
|
||||
6 > ^
|
||||
7 > ^^^^^^^^^^
|
||||
8 > ^
|
||||
9 > ^^^^
|
||||
10> ^^^^^^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^^
|
||||
14> ^
|
||||
15> ^
|
||||
16> ^
|
||||
17> ^
|
||||
18> ^
|
||||
19> ^
|
||||
20> ^
|
||||
21> ^
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^^
|
||||
4 > ^^^
|
||||
5 > ^^^^^^^^^^^^^^
|
||||
6 > ^^^^^^
|
||||
7 > ^
|
||||
8 > ^^^^^^^^^^
|
||||
9 > ^
|
||||
10> ^^^^
|
||||
11> ^^^^^^
|
||||
12> ^
|
||||
13> ^
|
||||
14> ^^
|
||||
15> ^
|
||||
16> ^
|
||||
17> ^
|
||||
18> ^
|
||||
19> ^
|
||||
20> ^
|
||||
21> ^
|
||||
22> ^
|
||||
1->
|
||||
>var
|
||||
2 > c10t5
|
||||
3 > : () => (n: number) => IFoo =
|
||||
4 > function() {
|
||||
5 > return
|
||||
6 >
|
||||
7 > function(
|
||||
8 > n
|
||||
9 > ) {
|
||||
10> return
|
||||
11> <IFoo>
|
||||
12> (
|
||||
13> {}
|
||||
14> )
|
||||
15>
|
||||
16>
|
||||
17> }
|
||||
18>
|
||||
19>
|
||||
20> }
|
||||
21> ;
|
||||
1->Emitted(92, 5) Source(152, 5) + SourceIndex(0)
|
||||
2 >Emitted(92, 10) Source(152, 10) + SourceIndex(0)
|
||||
3 >Emitted(92, 13) Source(152, 40) + SourceIndex(0)
|
||||
4 >Emitted(92, 27) Source(152, 53) + SourceIndex(0)
|
||||
5 >Emitted(92, 33) Source(152, 59) + SourceIndex(0)
|
||||
6 >Emitted(92, 34) Source(152, 60) + SourceIndex(0)
|
||||
7 >Emitted(92, 44) Source(152, 69) + SourceIndex(0)
|
||||
8 >Emitted(92, 45) Source(152, 70) + SourceIndex(0)
|
||||
9 >Emitted(92, 49) Source(152, 74) + SourceIndex(0)
|
||||
10>Emitted(92, 55) Source(152, 80) + SourceIndex(0)
|
||||
11>Emitted(92, 56) Source(152, 87) + SourceIndex(0)
|
||||
12>Emitted(92, 57) Source(152, 88) + SourceIndex(0)
|
||||
13>Emitted(92, 59) Source(152, 90) + SourceIndex(0)
|
||||
14>Emitted(92, 60) Source(152, 91) + SourceIndex(0)
|
||||
15>Emitted(92, 61) Source(152, 91) + SourceIndex(0)
|
||||
16>Emitted(92, 62) Source(152, 92) + SourceIndex(0)
|
||||
17>Emitted(92, 63) Source(152, 93) + SourceIndex(0)
|
||||
18>Emitted(92, 64) Source(152, 93) + SourceIndex(0)
|
||||
19>Emitted(92, 65) Source(152, 94) + SourceIndex(0)
|
||||
20>Emitted(92, 66) Source(152, 95) + SourceIndex(0)
|
||||
21>Emitted(92, 67) Source(152, 96) + SourceIndex(0)
|
||||
>
|
||||
2 >var
|
||||
3 > c10t5
|
||||
4 > : () => (n: number) => IFoo =
|
||||
5 > function() {
|
||||
6 > return
|
||||
7 >
|
||||
8 > function(
|
||||
9 > n
|
||||
10> ) {
|
||||
11> return
|
||||
12> <IFoo>
|
||||
13> (
|
||||
14> {}
|
||||
15> )
|
||||
16>
|
||||
17>
|
||||
18> }
|
||||
19>
|
||||
20>
|
||||
21> }
|
||||
22> ;
|
||||
1->Emitted(92, 1) Source(152, 1) + SourceIndex(0)
|
||||
2 >Emitted(92, 5) Source(152, 5) + SourceIndex(0)
|
||||
3 >Emitted(92, 10) Source(152, 10) + SourceIndex(0)
|
||||
4 >Emitted(92, 13) Source(152, 40) + SourceIndex(0)
|
||||
5 >Emitted(92, 27) Source(152, 53) + SourceIndex(0)
|
||||
6 >Emitted(92, 33) Source(152, 59) + SourceIndex(0)
|
||||
7 >Emitted(92, 34) Source(152, 60) + SourceIndex(0)
|
||||
8 >Emitted(92, 44) Source(152, 69) + SourceIndex(0)
|
||||
9 >Emitted(92, 45) Source(152, 70) + SourceIndex(0)
|
||||
10>Emitted(92, 49) Source(152, 74) + SourceIndex(0)
|
||||
11>Emitted(92, 55) Source(152, 80) + SourceIndex(0)
|
||||
12>Emitted(92, 56) Source(152, 87) + SourceIndex(0)
|
||||
13>Emitted(92, 57) Source(152, 88) + SourceIndex(0)
|
||||
14>Emitted(92, 59) Source(152, 90) + SourceIndex(0)
|
||||
15>Emitted(92, 60) Source(152, 91) + SourceIndex(0)
|
||||
16>Emitted(92, 61) Source(152, 91) + SourceIndex(0)
|
||||
17>Emitted(92, 62) Source(152, 92) + SourceIndex(0)
|
||||
18>Emitted(92, 63) Source(152, 93) + SourceIndex(0)
|
||||
19>Emitted(92, 64) Source(152, 93) + SourceIndex(0)
|
||||
20>Emitted(92, 65) Source(152, 94) + SourceIndex(0)
|
||||
21>Emitted(92, 66) Source(152, 95) + SourceIndex(0)
|
||||
22>Emitted(92, 67) Source(152, 96) + SourceIndex(0)
|
||||
---
|
||||
>>>// CONTEXT: Newing a class
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^->
|
||||
1 >
|
||||
>
|
||||
>// CONTEXT: Newing a class
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Newing a class
|
||||
1 >Emitted(93, 1) Source(155, 1) + SourceIndex(0)
|
||||
2 >Emitted(93, 1) Source(154, 1) + SourceIndex(0)
|
||||
3 >Emitted(93, 27) Source(154, 27) + SourceIndex(0)
|
||||
2 >// CONTEXT: Newing a class
|
||||
1 >Emitted(93, 1) Source(154, 1) + SourceIndex(0)
|
||||
2 >Emitted(93, 27) Source(154, 27) + SourceIndex(0)
|
||||
---
|
||||
>>>var C11t5 = (function () {
|
||||
1->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
1->Emitted(94, 1) Source(155, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function C11t5(f) {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^
|
||||
3 > ^
|
||||
1->
|
||||
>class C11t5 {
|
||||
1->class C11t5 {
|
||||
2 > constructor(
|
||||
3 > f: (n: number) => IFoo
|
||||
1->Emitted(95, 5) Source(155, 15) + SourceIndex(0) name (C11t5)
|
||||
@@ -2448,66 +2438,65 @@ sourceFile:contextualTyping.ts
|
||||
---
|
||||
>>>// CONTEXT: Type annotated expression
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^^^^->
|
||||
1 >
|
||||
>
|
||||
>// CONTEXT: Type annotated expression
|
||||
>
|
||||
2 >
|
||||
3 >// CONTEXT: Type annotated expression
|
||||
1 >Emitted(101, 1) Source(159, 1) + SourceIndex(0)
|
||||
2 >Emitted(101, 1) Source(158, 1) + SourceIndex(0)
|
||||
3 >Emitted(101, 38) Source(158, 38) + SourceIndex(0)
|
||||
2 >// CONTEXT: Type annotated expression
|
||||
1 >Emitted(101, 1) Source(158, 1) + SourceIndex(0)
|
||||
2 >Emitted(101, 38) Source(158, 38) + SourceIndex(0)
|
||||
---
|
||||
>>>var c12t1 = (function (s) { return s; });
|
||||
1->^^^^
|
||||
2 > ^^^^^
|
||||
3 > ^^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^
|
||||
6 > ^
|
||||
7 > ^^^^
|
||||
8 > ^^^^^^
|
||||
9 > ^
|
||||
10> ^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^
|
||||
14> ^
|
||||
15> ^
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^^^^^^^^^^
|
||||
7 > ^
|
||||
8 > ^^^^
|
||||
9 > ^^^^^^
|
||||
10> ^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^
|
||||
14> ^
|
||||
15> ^
|
||||
16> ^
|
||||
1->
|
||||
>var
|
||||
2 > c12t1
|
||||
3 > = <(s: string) => string>
|
||||
4 > (
|
||||
5 > function(
|
||||
6 > s
|
||||
7 > ) {
|
||||
8 > return
|
||||
9 >
|
||||
10> s
|
||||
11>
|
||||
12>
|
||||
13> }
|
||||
14> )
|
||||
15> ;
|
||||
1->Emitted(102, 5) Source(159, 5) + SourceIndex(0)
|
||||
2 >Emitted(102, 10) Source(159, 10) + SourceIndex(0)
|
||||
3 >Emitted(102, 13) Source(159, 37) + SourceIndex(0)
|
||||
4 >Emitted(102, 14) Source(159, 38) + SourceIndex(0)
|
||||
5 >Emitted(102, 24) Source(159, 47) + SourceIndex(0)
|
||||
6 >Emitted(102, 25) Source(159, 48) + SourceIndex(0)
|
||||
7 >Emitted(102, 29) Source(159, 52) + SourceIndex(0)
|
||||
8 >Emitted(102, 35) Source(159, 58) + SourceIndex(0)
|
||||
9 >Emitted(102, 36) Source(159, 59) + SourceIndex(0)
|
||||
10>Emitted(102, 37) Source(159, 60) + SourceIndex(0)
|
||||
11>Emitted(102, 38) Source(159, 60) + SourceIndex(0)
|
||||
12>Emitted(102, 39) Source(159, 61) + SourceIndex(0)
|
||||
13>Emitted(102, 40) Source(159, 62) + SourceIndex(0)
|
||||
14>Emitted(102, 41) Source(159, 63) + SourceIndex(0)
|
||||
15>Emitted(102, 42) Source(159, 64) + SourceIndex(0)
|
||||
>
|
||||
2 >var
|
||||
3 > c12t1
|
||||
4 > = <(s: string) => string>
|
||||
5 > (
|
||||
6 > function(
|
||||
7 > s
|
||||
8 > ) {
|
||||
9 > return
|
||||
10>
|
||||
11> s
|
||||
12>
|
||||
13>
|
||||
14> }
|
||||
15> )
|
||||
16> ;
|
||||
1->Emitted(102, 1) Source(159, 1) + SourceIndex(0)
|
||||
2 >Emitted(102, 5) Source(159, 5) + SourceIndex(0)
|
||||
3 >Emitted(102, 10) Source(159, 10) + SourceIndex(0)
|
||||
4 >Emitted(102, 13) Source(159, 37) + SourceIndex(0)
|
||||
5 >Emitted(102, 14) Source(159, 38) + SourceIndex(0)
|
||||
6 >Emitted(102, 24) Source(159, 47) + SourceIndex(0)
|
||||
7 >Emitted(102, 25) Source(159, 48) + SourceIndex(0)
|
||||
8 >Emitted(102, 29) Source(159, 52) + SourceIndex(0)
|
||||
9 >Emitted(102, 35) Source(159, 58) + SourceIndex(0)
|
||||
10>Emitted(102, 36) Source(159, 59) + SourceIndex(0)
|
||||
11>Emitted(102, 37) Source(159, 60) + SourceIndex(0)
|
||||
12>Emitted(102, 38) Source(159, 60) + SourceIndex(0)
|
||||
13>Emitted(102, 39) Source(159, 61) + SourceIndex(0)
|
||||
14>Emitted(102, 40) Source(159, 62) + SourceIndex(0)
|
||||
15>Emitted(102, 41) Source(159, 63) + SourceIndex(0)
|
||||
16>Emitted(102, 42) Source(159, 64) + SourceIndex(0)
|
||||
---
|
||||
>>>var c12t2 = ({
|
||||
1 >
|
||||
|
||||
@@ -20,8 +20,8 @@ function makePoint(x) {
|
||||
};
|
||||
}
|
||||
;
|
||||
var point = makePoint(2);
|
||||
var x = point.x;
|
||||
var /*4*/ point = makePoint(2);
|
||||
var /*2*/ x = point.x;
|
||||
point.x = 30;
|
||||
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ function makePoint(x) {
|
||||
};
|
||||
}
|
||||
;
|
||||
var point = makePoint(2);
|
||||
var x = point.x;
|
||||
var /*4*/ point = makePoint(2);
|
||||
var /*2*/ x = point.x;
|
||||
|
||||
|
||||
//// [declFileObjectLiteralWithOnlyGetter.d.ts]
|
||||
|
||||
@@ -17,7 +17,7 @@ function makePoint(x) {
|
||||
};
|
||||
}
|
||||
;
|
||||
var point = makePoint(2);
|
||||
var /*3*/ point = makePoint(2);
|
||||
point.x = 30;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//// [tests/cases/compiler/declarationEmit_exportAssignment.ts] ////
|
||||
|
||||
//// [utils.ts]
|
||||
|
||||
export function foo() { }
|
||||
export function bar() { }
|
||||
export interface Buzz { }
|
||||
|
||||
//// [index.ts]
|
||||
import {foo} from "utils";
|
||||
export = foo;
|
||||
|
||||
//// [utils.js]
|
||||
function foo() { }
|
||||
exports.foo = foo;
|
||||
function bar() { }
|
||||
exports.bar = bar;
|
||||
//// [index.js]
|
||||
var utils_1 = require("utils");
|
||||
module.exports = utils_1.foo;
|
||||
|
||||
|
||||
//// [utils.d.ts]
|
||||
export declare function foo(): void;
|
||||
export declare function bar(): void;
|
||||
export interface Buzz {
|
||||
}
|
||||
//// [index.d.ts]
|
||||
import { foo } from "utils";
|
||||
export = foo;
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/utils.ts ===
|
||||
|
||||
export function foo() { }
|
||||
>foo : Symbol(foo, Decl(utils.ts, 0, 0))
|
||||
|
||||
export function bar() { }
|
||||
>bar : Symbol(bar, Decl(utils.ts, 1, 25))
|
||||
|
||||
export interface Buzz { }
|
||||
>Buzz : Symbol(Buzz, Decl(utils.ts, 2, 25))
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import {foo} from "utils";
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 8))
|
||||
|
||||
export = foo;
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/utils.ts ===
|
||||
|
||||
export function foo() { }
|
||||
>foo : () => void
|
||||
|
||||
export function bar() { }
|
||||
>bar : () => void
|
||||
|
||||
export interface Buzz { }
|
||||
>Buzz : Buzz
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import {foo} from "utils";
|
||||
>foo : () => void
|
||||
|
||||
export = foo;
|
||||
>foo : () => void
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//// [tests/cases/compiler/declarationEmit_exportDeclaration.ts] ////
|
||||
|
||||
//// [utils.ts]
|
||||
|
||||
export function foo() { }
|
||||
export function bar() { }
|
||||
export interface Buzz { }
|
||||
|
||||
//// [index.ts]
|
||||
import {foo, bar, Buzz} from "utils";
|
||||
|
||||
foo();
|
||||
let obj: Buzz;
|
||||
export {bar};
|
||||
|
||||
//// [utils.js]
|
||||
function foo() { }
|
||||
exports.foo = foo;
|
||||
function bar() { }
|
||||
exports.bar = bar;
|
||||
//// [index.js]
|
||||
var utils_1 = require("utils");
|
||||
exports.bar = utils_1.bar;
|
||||
utils_1.foo();
|
||||
var obj;
|
||||
|
||||
|
||||
//// [utils.d.ts]
|
||||
export declare function foo(): void;
|
||||
export declare function bar(): void;
|
||||
export interface Buzz {
|
||||
}
|
||||
//// [index.d.ts]
|
||||
import { bar } from "utils";
|
||||
export { bar };
|
||||
@@ -0,0 +1,27 @@
|
||||
=== tests/cases/compiler/utils.ts ===
|
||||
|
||||
export function foo() { }
|
||||
>foo : Symbol(foo, Decl(utils.ts, 0, 0))
|
||||
|
||||
export function bar() { }
|
||||
>bar : Symbol(bar, Decl(utils.ts, 1, 25))
|
||||
|
||||
export interface Buzz { }
|
||||
>Buzz : Symbol(Buzz, Decl(utils.ts, 2, 25))
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import {foo, bar, Buzz} from "utils";
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 8))
|
||||
>bar : Symbol(bar, Decl(index.ts, 0, 12))
|
||||
>Buzz : Symbol(Buzz, Decl(index.ts, 0, 17))
|
||||
|
||||
foo();
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 8))
|
||||
|
||||
let obj: Buzz;
|
||||
>obj : Symbol(obj, Decl(index.ts, 3, 3))
|
||||
>Buzz : Symbol(Buzz, Decl(index.ts, 0, 17))
|
||||
|
||||
export {bar};
|
||||
>bar : Symbol(bar, Decl(index.ts, 4, 8))
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
=== tests/cases/compiler/utils.ts ===
|
||||
|
||||
export function foo() { }
|
||||
>foo : () => void
|
||||
|
||||
export function bar() { }
|
||||
>bar : () => void
|
||||
|
||||
export interface Buzz { }
|
||||
>Buzz : Buzz
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import {foo, bar, Buzz} from "utils";
|
||||
>foo : () => void
|
||||
>bar : () => void
|
||||
>Buzz : any
|
||||
|
||||
foo();
|
||||
>foo() : void
|
||||
>foo : () => void
|
||||
|
||||
let obj: Buzz;
|
||||
>obj : Buzz
|
||||
>Buzz : Buzz
|
||||
|
||||
export {bar};
|
||||
>bar : () => void
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
//// [tests/cases/conformance/decorators/decoratorMetadata.ts] ////
|
||||
|
||||
//// [service.ts]
|
||||
export default class Service {
|
||||
}
|
||||
//// [component.ts]
|
||||
import Service from "./service";
|
||||
|
||||
declare var decorator: any;
|
||||
|
||||
@decorator
|
||||
class MyComponent {
|
||||
constructor(public Service: Service) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.js]
|
||||
var Service = (function () {
|
||||
function Service() {
|
||||
}
|
||||
return Service;
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Service;
|
||||
//// [component.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||||
switch (arguments.length) {
|
||||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||||
}
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var MyComponent = (function () {
|
||||
function MyComponent(Service) {
|
||||
this.Service = Service;
|
||||
}
|
||||
MyComponent = __decorate([
|
||||
decorator,
|
||||
__metadata('design:paramtypes', [service_1.default])
|
||||
], MyComponent);
|
||||
return MyComponent;
|
||||
})();
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/conformance/decorators/service.ts ===
|
||||
export default class Service {
|
||||
>Service : Symbol(Service, Decl(service.ts, 0, 0))
|
||||
}
|
||||
=== tests/cases/conformance/decorators/component.ts ===
|
||||
import Service from "./service";
|
||||
>Service : Symbol(Service, Decl(component.ts, 0, 6))
|
||||
|
||||
declare var decorator: any;
|
||||
>decorator : Symbol(decorator, Decl(component.ts, 2, 11))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(component.ts, 2, 11))
|
||||
|
||||
class MyComponent {
|
||||
>MyComponent : Symbol(MyComponent, Decl(component.ts, 2, 27))
|
||||
|
||||
constructor(public Service: Service) {
|
||||
>Service : Symbol(Service, Decl(component.ts, 6, 16))
|
||||
>Service : Symbol(Service, Decl(component.ts, 0, 6))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/conformance/decorators/service.ts ===
|
||||
export default class Service {
|
||||
>Service : Service
|
||||
}
|
||||
=== tests/cases/conformance/decorators/component.ts ===
|
||||
import Service from "./service";
|
||||
>Service : typeof Service
|
||||
|
||||
declare var decorator: any;
|
||||
>decorator : any
|
||||
|
||||
@decorator
|
||||
>decorator : any
|
||||
|
||||
class MyComponent {
|
||||
>MyComponent : MyComponent
|
||||
|
||||
constructor(public Service: Service) {
|
||||
>Service : Service
|
||||
>Service : Service
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [emitBOM.js.map]
|
||||
{"version":3,"file":"emitBOM.js","sourceRoot":"","sources":["emitBOM.ts"],"names":[],"mappings":"AAEA,AADA,6DAA6D;IACzD,CAAC,CAAC"}
|
||||
{"version":3,"file":"emitBOM.js","sourceRoot":"","sources":["emitBOM.ts"],"names":[],"mappings":"AACA,6DAA6D;AAC7D,IAAI,CAAC,CAAC"}
|
||||
@@ -10,28 +10,27 @@ sourceFile:emitBOM.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>// JS and d.ts output should have a BOM but not the sourcemap
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1 >
|
||||
>// JS and d.ts output should have a BOM but not the sourcemap
|
||||
>
|
||||
2 >
|
||||
3 >// JS and d.ts output should have a BOM but not the sourcemap
|
||||
1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
3 >Emitted(1, 62) Source(2, 62) + SourceIndex(0)
|
||||
2 >// JS and d.ts output should have a BOM but not the sourcemap
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 62) Source(2, 62) + SourceIndex(0)
|
||||
---
|
||||
>>>var x;
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>var
|
||||
2 > x
|
||||
3 > ;
|
||||
1 >Emitted(2, 5) Source(3, 5) + SourceIndex(0)
|
||||
2 >Emitted(2, 6) Source(3, 6) + SourceIndex(0)
|
||||
3 >Emitted(2, 7) Source(3, 7) + SourceIndex(0)
|
||||
>
|
||||
2 >var
|
||||
3 > x
|
||||
4 > ;
|
||||
1 >Emitted(2, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(2, 5) Source(3, 5) + SourceIndex(0)
|
||||
3 >Emitted(2, 6) Source(3, 6) + SourceIndex(0)
|
||||
4 >Emitted(2, 7) Source(3, 7) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=emitBOM.js.map
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [tests/cases/compiler/es6ImportEqualsDeclaration2.ts] ////
|
||||
|
||||
//// [server.d.ts]
|
||||
|
||||
declare module "other" {
|
||||
export class C { }
|
||||
}
|
||||
|
||||
declare module "server" {
|
||||
import events = require("other"); // Ambient declaration, no error expected.
|
||||
|
||||
module S {
|
||||
export var a: number;
|
||||
}
|
||||
|
||||
export = S; // Ambient declaration, no error expected.
|
||||
}
|
||||
|
||||
//// [client.ts]
|
||||
import {a} from "server";
|
||||
|
||||
|
||||
//// [client.js]
|
||||
@@ -0,0 +1,26 @@
|
||||
=== tests/cases/compiler/server.d.ts ===
|
||||
|
||||
declare module "other" {
|
||||
export class C { }
|
||||
>C : Symbol(C, Decl(server.d.ts, 1, 24))
|
||||
}
|
||||
|
||||
declare module "server" {
|
||||
import events = require("other"); // Ambient declaration, no error expected.
|
||||
>events : Symbol(events, Decl(server.d.ts, 5, 25))
|
||||
|
||||
module S {
|
||||
>S : Symbol(S, Decl(server.d.ts, 6, 37))
|
||||
|
||||
export var a: number;
|
||||
>a : Symbol(a, Decl(server.d.ts, 9, 18))
|
||||
}
|
||||
|
||||
export = S; // Ambient declaration, no error expected.
|
||||
>S : Symbol(S, Decl(server.d.ts, 6, 37))
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/client.ts ===
|
||||
import {a} from "server";
|
||||
>a : Symbol(a, Decl(client.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
=== tests/cases/compiler/server.d.ts ===
|
||||
|
||||
declare module "other" {
|
||||
export class C { }
|
||||
>C : C
|
||||
}
|
||||
|
||||
declare module "server" {
|
||||
import events = require("other"); // Ambient declaration, no error expected.
|
||||
>events : typeof events
|
||||
|
||||
module S {
|
||||
>S : typeof S
|
||||
|
||||
export var a: number;
|
||||
>a : number
|
||||
}
|
||||
|
||||
export = S; // Ambient declaration, no error expected.
|
||||
>S : typeof S
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/client.ts ===
|
||||
import {a} from "server";
|
||||
>a : number
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//// [tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts] ////
|
||||
|
||||
//// [foo1.ts]
|
||||
class x{}
|
||||
|
||||
export = x;
|
||||
|
||||
//// [foo2.ts]
|
||||
import foo1 = require('./foo1');
|
||||
var x = foo1;
|
||||
class y extends x {}
|
||||
|
||||
|
||||
//// [foo1.js]
|
||||
var x = (function () {
|
||||
function x() {
|
||||
}
|
||||
return x;
|
||||
})();
|
||||
module.exports = x;
|
||||
//// [foo2.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var foo1 = require('./foo1');
|
||||
var x = foo1;
|
||||
var y = (function (_super) {
|
||||
__extends(y, _super);
|
||||
function y() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return y;
|
||||
})(x);
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/conformance/classes/classExpressions/foo2.ts ===
|
||||
import foo1 = require('./foo1');
|
||||
>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0))
|
||||
|
||||
var x = foo1;
|
||||
>x : Symbol(x, Decl(foo2.ts, 1, 3))
|
||||
>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0))
|
||||
|
||||
class y extends x {}
|
||||
>y : Symbol(y, Decl(foo2.ts, 1, 13))
|
||||
|
||||
=== tests/cases/conformance/classes/classExpressions/foo1.ts ===
|
||||
class x{}
|
||||
>x : Symbol(x, Decl(foo1.ts, 0, 0))
|
||||
|
||||
export = x;
|
||||
>x : Symbol(x, Decl(foo1.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/classes/classExpressions/foo2.ts ===
|
||||
import foo1 = require('./foo1');
|
||||
>foo1 : typeof foo1
|
||||
|
||||
var x = foo1;
|
||||
>x : typeof foo1
|
||||
>foo1 : typeof foo1
|
||||
|
||||
class y extends x {}
|
||||
>y : y
|
||||
>x : foo1
|
||||
|
||||
=== tests/cases/conformance/classes/classExpressions/foo1.ts ===
|
||||
class x{}
|
||||
>x : x
|
||||
|
||||
export = x;
|
||||
>x : x
|
||||
|
||||
@@ -29,21 +29,18 @@ var foo = (function () {
|
||||
return foo;
|
||||
})();
|
||||
var x;
|
||||
x = <any> {test}: <any></any> };
|
||||
x = <any> {test} <any></any> };
|
||||
|
||||
x = <any><any></any>;
|
||||
|
||||
x = <foo>hello {<foo>} </foo>};
|
||||
x = <foo>hello {<foo>} </foo>}
|
||||
|
||||
x = <foo test={<foo>}>hello</foo>}/>;
|
||||
x = <foo test={<foo>}>hello</foo>}/>
|
||||
|
||||
x = <foo test={<foo>}>hello{<foo>}</foo>};
|
||||
x = <foo test={<foo>}>hello{<foo>}</foo>}
|
||||
|
||||
x = <foo>x</foo>, x = <foo />;
|
||||
|
||||
<foo>{<foo><foo>{/foo/.test(x) ? <foo><foo></foo> : <foo><foo></foo>}</foo>}</foo>
|
||||
:
|
||||
}
|
||||
|
||||
|
||||
</></>}</></>}/></></></>;
|
||||
}</></>}</></>}/></></></>;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [jsxHash.tsx]
|
||||
var t02 = <a>{0}#</a>;
|
||||
var t03 = <a>#{0}</a>;
|
||||
var t04 = <a>#{0}#</a>;
|
||||
var t05 = <a>#<i></i></a>;
|
||||
var t06 = <a>#<i></i></a>;
|
||||
var t07 = <a>#<i>#</i></a>;
|
||||
var t08 = <a><i></i>#</a>;
|
||||
var t09 = <a>#<i></i>#</a>;
|
||||
var t10 = <a><i/>#</a>;
|
||||
var t11 = <a>#<i/></a>;
|
||||
var t12 = <a>#</a>;
|
||||
|
||||
|
||||
//// [jsxHash.jsx]
|
||||
var t02 = <a>{0}#</a>;
|
||||
var t03 = <a>#{0}</a>;
|
||||
var t04 = <a>#{0}#</a>;
|
||||
var t05 = <a>#<i></i></a>;
|
||||
var t06 = <a>#<i></i></a>;
|
||||
var t07 = <a>#<i>#</i></a>;
|
||||
var t08 = <a><i></i>#</a>;
|
||||
var t09 = <a>#<i></i>#</a>;
|
||||
var t10 = <a><i />#</a>;
|
||||
var t11 = <a>#<i /></a>;
|
||||
var t12 = <a>#</a>;
|
||||
@@ -0,0 +1,34 @@
|
||||
=== tests/cases/compiler/jsxHash.tsx ===
|
||||
var t02 = <a>{0}#</a>;
|
||||
>t02 : Symbol(t02, Decl(jsxHash.tsx, 0, 3))
|
||||
|
||||
var t03 = <a>#{0}</a>;
|
||||
>t03 : Symbol(t03, Decl(jsxHash.tsx, 1, 3))
|
||||
|
||||
var t04 = <a>#{0}#</a>;
|
||||
>t04 : Symbol(t04, Decl(jsxHash.tsx, 2, 3))
|
||||
|
||||
var t05 = <a>#<i></i></a>;
|
||||
>t05 : Symbol(t05, Decl(jsxHash.tsx, 3, 3))
|
||||
|
||||
var t06 = <a>#<i></i></a>;
|
||||
>t06 : Symbol(t06, Decl(jsxHash.tsx, 4, 3))
|
||||
|
||||
var t07 = <a>#<i>#</i></a>;
|
||||
>t07 : Symbol(t07, Decl(jsxHash.tsx, 5, 3))
|
||||
|
||||
var t08 = <a><i></i>#</a>;
|
||||
>t08 : Symbol(t08, Decl(jsxHash.tsx, 6, 3))
|
||||
|
||||
var t09 = <a>#<i></i>#</a>;
|
||||
>t09 : Symbol(t09, Decl(jsxHash.tsx, 7, 3))
|
||||
|
||||
var t10 = <a><i/>#</a>;
|
||||
>t10 : Symbol(t10, Decl(jsxHash.tsx, 8, 3))
|
||||
|
||||
var t11 = <a>#<i/></a>;
|
||||
>t11 : Symbol(t11, Decl(jsxHash.tsx, 9, 3))
|
||||
|
||||
var t12 = <a>#</a>;
|
||||
>t12 : Symbol(t12, Decl(jsxHash.tsx, 10, 3))
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
=== tests/cases/compiler/jsxHash.tsx ===
|
||||
var t02 = <a>{0}#</a>;
|
||||
>t02 : any
|
||||
><a>{0}#</a> : any
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
var t03 = <a>#{0}</a>;
|
||||
>t03 : any
|
||||
><a>#{0}</a> : any
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
var t04 = <a>#{0}#</a>;
|
||||
>t04 : any
|
||||
><a>#{0}#</a> : any
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
var t05 = <a>#<i></i></a>;
|
||||
>t05 : any
|
||||
><a>#<i></i></a> : any
|
||||
>a : any
|
||||
><i></i> : any
|
||||
>i : any
|
||||
>i : any
|
||||
>a : any
|
||||
|
||||
var t06 = <a>#<i></i></a>;
|
||||
>t06 : any
|
||||
><a>#<i></i></a> : any
|
||||
>a : any
|
||||
><i></i> : any
|
||||
>i : any
|
||||
>i : any
|
||||
>a : any
|
||||
|
||||
var t07 = <a>#<i>#</i></a>;
|
||||
>t07 : any
|
||||
><a>#<i>#</i></a> : any
|
||||
>a : any
|
||||
><i>#</i> : any
|
||||
>i : any
|
||||
>i : any
|
||||
>a : any
|
||||
|
||||
var t08 = <a><i></i>#</a>;
|
||||
>t08 : any
|
||||
><a><i></i>#</a> : any
|
||||
>a : any
|
||||
><i></i> : any
|
||||
>i : any
|
||||
>i : any
|
||||
>a : any
|
||||
|
||||
var t09 = <a>#<i></i>#</a>;
|
||||
>t09 : any
|
||||
><a>#<i></i>#</a> : any
|
||||
>a : any
|
||||
><i></i> : any
|
||||
>i : any
|
||||
>i : any
|
||||
>a : any
|
||||
|
||||
var t10 = <a><i/>#</a>;
|
||||
>t10 : any
|
||||
><a><i/>#</a> : any
|
||||
>a : any
|
||||
><i/> : any
|
||||
>i : any
|
||||
>a : any
|
||||
|
||||
var t11 = <a>#<i/></a>;
|
||||
>t11 : any
|
||||
><a>#<i/></a> : any
|
||||
>a : any
|
||||
><i/> : any
|
||||
>i : any
|
||||
>a : any
|
||||
|
||||
var t12 = <a>#</a>;
|
||||
>t12 : any
|
||||
><a>#</a> : any
|
||||
>a : any
|
||||
>a : any
|
||||
|
||||
@@ -62,10 +62,8 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(24,15): error TS1003:
|
||||
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(25,7): error TS1005: '...' expected.
|
||||
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(25,7): error TS2304: Cannot find name 'props'.
|
||||
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(27,17): error TS1005: '>' expected.
|
||||
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(27,18): error TS1109: Expression expected.
|
||||
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(28,10): error TS2304: Cannot find name 'props'.
|
||||
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(28,28): error TS1005: '>' expected.
|
||||
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(28,29): error TS1109: Expression expected.
|
||||
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(32,6): error TS1005: '{' expected.
|
||||
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(33,6): error TS1005: '{' expected.
|
||||
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(33,7): error TS1109: Expression expected.
|
||||
@@ -73,7 +71,7 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,4): error TS1003:
|
||||
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002: Expected corresponding JSX closing tag for 'a'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx (73 errors) ====
|
||||
==== tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx (71 errors) ====
|
||||
declare var React: any;
|
||||
|
||||
</>;
|
||||
@@ -229,15 +227,11 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
|
||||
<div>stuff</div {...props}>;
|
||||
~
|
||||
!!! error TS1005: '>' expected.
|
||||
~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
<div {...props}>stuff</div {...props}>;
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'props'.
|
||||
~
|
||||
!!! error TS1005: '>' expected.
|
||||
~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
|
||||
<a>></a>;
|
||||
<a> ></a>;
|
||||
|
||||
@@ -65,17 +65,17 @@ a['foo'] > ;
|
||||
<a b=>;
|
||||
var x = <div>one</div><div>two</div>;;
|
||||
var x = <div>one</div> /* intervening comment */ /* intervening comment */ <div>two</div>;;
|
||||
<a>{"str"};}</a>;
|
||||
<span className="a"/>, id="b" />;
|
||||
<div className=/>"app">;
|
||||
<a>{"str"}}</a>;
|
||||
<span className="a"/> id="b" />;
|
||||
<div className=/>>;
|
||||
<div {...props}/>;
|
||||
|
||||
<div>stuff</div> {}...props}>;
|
||||
<div {...props}>stuff</div> {}...props}>;
|
||||
<div>stuff</div>...props}>;
|
||||
<div {...props}>stuff</div>...props}>;
|
||||
|
||||
<a>></a>;
|
||||
<a> ></a>;
|
||||
<a b=>;
|
||||
<a b={ < }>;
|
||||
<a>}</a>;
|
||||
<a /> .../*hai*/asdf/>;</></></></>;
|
||||
<a /> /*hai*//*hai*/asdf/>;</></></></>;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(7,30): error TS2349: Cannot invoke an expression whose type lacks a call signature.
|
||||
tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(10,30): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'.
|
||||
Type 'number | string' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
|
||||
==== tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts (3 errors) ====
|
||||
==== tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts (2 errors) ====
|
||||
function map<T, U>(xs: T[], f: (x: T) => U) {
|
||||
var ys: U[] = [];
|
||||
xs.forEach(x => ys.push(f(x)));
|
||||
@@ -13,8 +12,6 @@ tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): e
|
||||
}
|
||||
|
||||
var r0 = map([1, ""], (x) => x.toString());
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2349: Cannot invoke an expression whose type lacks a call signature.
|
||||
var r5 = map<any, any>([1, ""], (x) => x.toString());
|
||||
var r6 = map<Object, Object>([1, ""], (x) => x.toString());
|
||||
var r7 = map<number, string>([1, ""], (x) => x.toString()); // error
|
||||
|
||||
@@ -42,5 +42,6 @@ var C2 = (function () {
|
||||
return C2;
|
||||
})();
|
||||
var b = {
|
||||
x: function () { }, 1: // error
|
||||
x: function () { }, 1: // error
|
||||
// error
|
||||
};
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [out-flag.js.map]
|
||||
{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count","MyClass.SetCount"],"mappings":"AAAA,eAAe;AAGf,AADA,oBAAoB;;IACpBA;IAYAC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBG,EAAEA;IACNA,CAACA;IACLH,cAACA;AAADA,CAACA,AAZD,IAYC"}
|
||||
{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count","MyClass.SetCount"],"mappings":"AAAA,eAAe;AAEf,oBAAoB;AACpB;IAAAA;IAYAC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBG,EAAEA;IACNA,CAACA;IACLH,cAACA;AAADA,CAACA,AAZD,IAYC"}
|
||||
@@ -19,25 +19,26 @@ sourceFile:out-flag.ts
|
||||
---
|
||||
>>>// my class comments
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^^^^^->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
>// my class comments
|
||||
>
|
||||
2 >
|
||||
3 >// my class comments
|
||||
1->Emitted(2, 1) Source(4, 1) + SourceIndex(0)
|
||||
2 >Emitted(2, 1) Source(3, 1) + SourceIndex(0)
|
||||
3 >Emitted(2, 21) Source(3, 21) + SourceIndex(0)
|
||||
2 >// my class comments
|
||||
1->Emitted(2, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(2, 21) Source(3, 21) + SourceIndex(0)
|
||||
---
|
||||
>>>var MyClass = (function () {
|
||||
1->
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
1->Emitted(3, 1) Source(4, 1) + SourceIndex(0)
|
||||
---
|
||||
>>> function MyClass() {
|
||||
1->^^^^
|
||||
2 > ^^->
|
||||
1->
|
||||
>
|
||||
1->
|
||||
1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (MyClass)
|
||||
---
|
||||
>>> }
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
//// [paramterDestrcuturingDeclaration.ts]
|
||||
|
||||
interface C {
|
||||
({p: name}): any;
|
||||
new ({p: boolean}): any;
|
||||
}
|
||||
|
||||
|
||||
//// [paramterDestrcuturingDeclaration.js]
|
||||
|
||||
|
||||
//// [paramterDestrcuturingDeclaration.d.ts]
|
||||
interface C {
|
||||
({p: name}: {
|
||||
p: any;
|
||||
}): any;
|
||||
new ({p: boolean}: {
|
||||
p: any;
|
||||
}): any;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/compiler/paramterDestrcuturingDeclaration.ts ===
|
||||
|
||||
interface C {
|
||||
>C : Symbol(C, Decl(paramterDestrcuturingDeclaration.ts, 0, 0))
|
||||
|
||||
({p: name}): any;
|
||||
>p : Symbol(p)
|
||||
>name : Symbol(name, Decl(paramterDestrcuturingDeclaration.ts, 2, 6))
|
||||
|
||||
new ({p: boolean}): any;
|
||||
>p : Symbol(p)
|
||||
>boolean : Symbol(boolean, Decl(paramterDestrcuturingDeclaration.ts, 3, 10))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/compiler/paramterDestrcuturingDeclaration.ts ===
|
||||
|
||||
interface C {
|
||||
>C : C
|
||||
|
||||
({p: name}): any;
|
||||
>p : any
|
||||
>name : any
|
||||
|
||||
new ({p: boolean}): any;
|
||||
>p : any
|
||||
>boolean : any
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
tests/cases/conformance/parser/ecmascript5/RegularExpressions/parseRegularExpressionMixedWithComments.ts(5,18): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/parser/ecmascript5/RegularExpressions/parseRegularExpressionMixedWithComments.ts(5,22): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript5/RegularExpressions/parseRegularExpressionMixedWithComments.ts(5,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/parser/ecmascript5/RegularExpressions/parseRegularExpressionMixedWithComments.ts(6,18): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/parser/ecmascript5/RegularExpressions/parseRegularExpressionMixedWithComments.ts(6,26): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript5/RegularExpressions/parseRegularExpressionMixedWithComments.ts(6,27): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/RegularExpressions/parseRegularExpressionMixedWithComments.ts (6 errors) ====
|
||||
var regex1 = / asdf /;
|
||||
var regex2 = /**// asdf /;
|
||||
var regex3 = /**///**/ asdf / // should be a comment line
|
||||
1;
|
||||
var regex4 = /**// /**/asdf /;
|
||||
~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
var regex5 = /**// asdf/**/ /;
|
||||
~~~~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [parseRegularExpressionMixedWithComments.ts]
|
||||
var regex1 = / asdf /;
|
||||
var regex2 = /**// asdf /;
|
||||
var regex3 = /**///**/ asdf / // should be a comment line
|
||||
1;
|
||||
var regex4 = /**// /**/asdf /;
|
||||
var regex5 = /**// asdf/**/ /;
|
||||
|
||||
//// [parseRegularExpressionMixedWithComments.js]
|
||||
var regex1 = / asdf /;
|
||||
var regex2 = / asdf /;
|
||||
var regex3 = 1;
|
||||
var regex4 = / / * * /asdf /;
|
||||
var regex5 = / asdf/ * * / /;
|
||||
@@ -890,7 +890,7 @@ var Formatting;
|
||||
return result;
|
||||
};
|
||||
Indenter.GetIndentSizeFromIndentText = function (indentText, editorOptions) {
|
||||
return GetIndentSizeFromText(indentText, editorOptions, false);
|
||||
return GetIndentSizeFromText(indentText, editorOptions, /*includeNonIndentChars:*/ false);
|
||||
};
|
||||
Indenter.GetIndentSizeFromText = function (text, editorOptions, includeNonIndentChars) {
|
||||
var indentSize = 0;
|
||||
@@ -1174,7 +1174,7 @@ var Formatting;
|
||||
return null;
|
||||
var origIndentText = this.snapshot.GetText(new Span(indentEditInfo.OrigIndentPosition, indentEditInfo.OrigIndentLength()));
|
||||
var newIndentText = indentEditInfo.Indentation();
|
||||
var origIndentSize = Indenter.GetIndentSizeFromText(origIndentText, this.editorOptions, true);
|
||||
var origIndentSize = Indenter.GetIndentSizeFromText(origIndentText, this.editorOptions, /*includeNonIndentChars*/ true);
|
||||
var newIndentSize = Indenter.GetIndentSizeFromIndentText(newIndentText, this.editorOptions);
|
||||
// Check the child's position whether it's before the parent position
|
||||
// if so indent the child based on the first token on the line as opposed to the parent position
|
||||
|
||||
+25
-27
@@ -325,17 +325,12 @@ sourceFile:../test.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>/// <reference path='ref/m1.ts'/>
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^->
|
||||
1 >/// <reference path='ref/m1.ts'/>
|
||||
>/// <reference path='ref/m2.ts'/>
|
||||
>
|
||||
2 >
|
||||
3 >/// <reference path='ref/m1.ts'/>
|
||||
1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0)
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^->
|
||||
1 >
|
||||
2 >/// <reference path='ref/m1.ts'/>
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0)
|
||||
---
|
||||
>>>/// <reference path='ref/m2.ts'/>
|
||||
1->
|
||||
@@ -347,23 +342,26 @@ sourceFile:../test.ts
|
||||
2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0)
|
||||
---
|
||||
>>>var a1 = 10;
|
||||
1 >^^^^
|
||||
2 > ^^
|
||||
3 > ^^^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
6 > ^^^^^^^^^^^^->
|
||||
1 >
|
||||
>var
|
||||
2 > a1
|
||||
3 > =
|
||||
4 > 10
|
||||
5 > ;
|
||||
1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0)
|
||||
2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0)
|
||||
3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0)
|
||||
4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0)
|
||||
5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0)
|
||||
2 >^^^^
|
||||
3 > ^^
|
||||
4 > ^^^
|
||||
5 > ^^
|
||||
6 > ^
|
||||
7 > ^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >var
|
||||
3 > a1
|
||||
4 > =
|
||||
5 > 10
|
||||
6 > ;
|
||||
1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0)
|
||||
3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0)
|
||||
4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0)
|
||||
5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0)
|
||||
6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0)
|
||||
---
|
||||
>>>var c1 = (function () {
|
||||
1->
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
+25
-27
@@ -324,17 +324,12 @@ sourceFile:../test.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>/// <reference path='ref/m1.ts'/>
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^->
|
||||
1 >/// <reference path='ref/m1.ts'/>
|
||||
>/// <reference path='ref/m2.ts'/>
|
||||
>
|
||||
2 >
|
||||
3 >/// <reference path='ref/m1.ts'/>
|
||||
1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0)
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^->
|
||||
1 >
|
||||
2 >/// <reference path='ref/m1.ts'/>
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0)
|
||||
---
|
||||
>>>/// <reference path='ref/m2.ts'/>
|
||||
1->
|
||||
@@ -346,23 +341,26 @@ sourceFile:../test.ts
|
||||
2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0)
|
||||
---
|
||||
>>>var a1 = 10;
|
||||
1 >^^^^
|
||||
2 > ^^
|
||||
3 > ^^^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
6 > ^^^^^^^^^^^^->
|
||||
1 >
|
||||
>var
|
||||
2 > a1
|
||||
3 > =
|
||||
4 > 10
|
||||
5 > ;
|
||||
1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0)
|
||||
2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0)
|
||||
3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0)
|
||||
4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0)
|
||||
5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0)
|
||||
2 >^^^^
|
||||
3 > ^^
|
||||
4 > ^^^
|
||||
5 > ^^
|
||||
6 > ^
|
||||
7 > ^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >var
|
||||
3 > a1
|
||||
4 > =
|
||||
5 > 10
|
||||
6 > ;
|
||||
1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0)
|
||||
3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0)
|
||||
4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0)
|
||||
5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0)
|
||||
6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0)
|
||||
---
|
||||
>>>var c1 = (function () {
|
||||
1->
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
+25
-27
@@ -325,17 +325,12 @@ sourceFile:../test.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>/// <reference path='ref/m1.ts'/>
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^->
|
||||
1 >/// <reference path='ref/m1.ts'/>
|
||||
>/// <reference path='ref/m2.ts'/>
|
||||
>
|
||||
2 >
|
||||
3 >/// <reference path='ref/m1.ts'/>
|
||||
1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0)
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^->
|
||||
1 >
|
||||
2 >/// <reference path='ref/m1.ts'/>
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0)
|
||||
---
|
||||
>>>/// <reference path='ref/m2.ts'/>
|
||||
1->
|
||||
@@ -347,23 +342,26 @@ sourceFile:../test.ts
|
||||
2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0)
|
||||
---
|
||||
>>>var a1 = 10;
|
||||
1 >^^^^
|
||||
2 > ^^
|
||||
3 > ^^^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
6 > ^^^^^^^^^^^^->
|
||||
1 >
|
||||
>var
|
||||
2 > a1
|
||||
3 > =
|
||||
4 > 10
|
||||
5 > ;
|
||||
1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0)
|
||||
2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0)
|
||||
3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0)
|
||||
4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0)
|
||||
5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0)
|
||||
2 >^^^^
|
||||
3 > ^^
|
||||
4 > ^^^
|
||||
5 > ^^
|
||||
6 > ^
|
||||
7 > ^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >var
|
||||
3 > a1
|
||||
4 > =
|
||||
5 > 10
|
||||
6 > ;
|
||||
1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0)
|
||||
3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0)
|
||||
4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0)
|
||||
5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0)
|
||||
6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0)
|
||||
---
|
||||
>>>var c1 = (function () {
|
||||
1->
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
+25
-27
@@ -324,17 +324,12 @@ sourceFile:../test.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>/// <reference path='ref/m1.ts'/>
|
||||
1 >
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^->
|
||||
1 >/// <reference path='ref/m1.ts'/>
|
||||
>/// <reference path='ref/m2.ts'/>
|
||||
>
|
||||
2 >
|
||||
3 >/// <reference path='ref/m1.ts'/>
|
||||
1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0)
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^->
|
||||
1 >
|
||||
2 >/// <reference path='ref/m1.ts'/>
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0)
|
||||
---
|
||||
>>>/// <reference path='ref/m2.ts'/>
|
||||
1->
|
||||
@@ -346,23 +341,26 @@ sourceFile:../test.ts
|
||||
2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0)
|
||||
---
|
||||
>>>var a1 = 10;
|
||||
1 >^^^^
|
||||
2 > ^^
|
||||
3 > ^^^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
6 > ^^^^^^^^^^^^->
|
||||
1 >
|
||||
>var
|
||||
2 > a1
|
||||
3 > =
|
||||
4 > 10
|
||||
5 > ;
|
||||
1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0)
|
||||
2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0)
|
||||
3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0)
|
||||
4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0)
|
||||
5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0)
|
||||
2 >^^^^
|
||||
3 > ^^
|
||||
4 > ^^^
|
||||
5 > ^^
|
||||
6 > ^
|
||||
7 > ^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >var
|
||||
3 > a1
|
||||
4 > =
|
||||
5 > 10
|
||||
6 > ;
|
||||
1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0)
|
||||
3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0)
|
||||
4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0)
|
||||
5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0)
|
||||
6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0)
|
||||
---
|
||||
>>>var c1 = (function () {
|
||||
1->
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
+25
-27
@@ -319,17 +319,12 @@ sourceFile:../test.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>/// <reference path='ref/m1.ts'/>
|
||||
1->
|
||||
2 >
|
||||
3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^->
|
||||
1->/// <reference path='ref/m1.ts'/>
|
||||
>/// <reference path='ref/m2.ts'/>
|
||||
>
|
||||
2 >
|
||||
3 >/// <reference path='ref/m1.ts'/>
|
||||
1->Emitted(11, 1) Source(3, 1) + SourceIndex(1)
|
||||
2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1)
|
||||
3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1)
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^->
|
||||
1->
|
||||
2 >/// <reference path='ref/m1.ts'/>
|
||||
1->Emitted(11, 1) Source(1, 1) + SourceIndex(1)
|
||||
2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1)
|
||||
---
|
||||
>>>/// <reference path='ref/m2.ts'/>
|
||||
1->
|
||||
@@ -341,23 +336,26 @@ sourceFile:../test.ts
|
||||
2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1)
|
||||
---
|
||||
>>>var a1 = 10;
|
||||
1 >^^^^
|
||||
2 > ^^
|
||||
3 > ^^^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
6 > ^^^^^^^^^^^^->
|
||||
1 >
|
||||
>var
|
||||
2 > a1
|
||||
3 > =
|
||||
4 > 10
|
||||
5 > ;
|
||||
1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1)
|
||||
2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1)
|
||||
3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1)
|
||||
4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1)
|
||||
5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1)
|
||||
2 >^^^^
|
||||
3 > ^^
|
||||
4 > ^^^
|
||||
5 > ^^
|
||||
6 > ^
|
||||
7 > ^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >var
|
||||
3 > a1
|
||||
4 > =
|
||||
5 > 10
|
||||
6 > ;
|
||||
1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1)
|
||||
2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1)
|
||||
3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1)
|
||||
4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1)
|
||||
5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1)
|
||||
6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1)
|
||||
---
|
||||
>>>var c1 = (function () {
|
||||
1->
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user