mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master'
This commit is contained in:
+6
-4
@@ -141,7 +141,9 @@ var harnessSources = harnessCoreSources.concat([
|
||||
"session.ts",
|
||||
"versionCache.ts",
|
||||
"convertToBase64.ts",
|
||||
"transpile.ts"
|
||||
"transpile.ts",
|
||||
"reuseProgramStructure.ts",
|
||||
"cachingInServerLSHost.ts"
|
||||
].map(function (f) {
|
||||
return path.join(unittestsDirectory, f);
|
||||
})).concat([
|
||||
@@ -155,10 +157,10 @@ var harnessSources = harnessCoreSources.concat([
|
||||
|
||||
var librarySourceMap = [
|
||||
{ target: "lib.core.d.ts", sources: ["core.d.ts"] },
|
||||
{ target: "lib.dom.d.ts", sources: ["importcore.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts"], },
|
||||
{ target: "lib.webworker.d.ts", sources: ["importcore.d.ts", "extensions.d.ts", "intl.d.ts", "webworker.generated.d.ts"], },
|
||||
{ target: "lib.dom.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "dom.generated.d.ts"], },
|
||||
{ target: "lib.webworker.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "webworker.generated.d.ts"], },
|
||||
{ target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.d.ts", sources: ["core.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.d.ts", sources: ["core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]},
|
||||
{ target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] },
|
||||
];
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
+73
-62
@@ -965,7 +965,9 @@ namespace ts {
|
||||
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
|
||||
let moduleName = escapeIdentifier(moduleReferenceLiteral.text);
|
||||
|
||||
if (!moduleName) return;
|
||||
if (!moduleName) {
|
||||
return;
|
||||
}
|
||||
let isRelative = isExternalModuleNameRelative(moduleName);
|
||||
if (!isRelative) {
|
||||
let symbol = getSymbol(globals, "\"" + moduleName + "\"", SymbolFlags.ValueModule);
|
||||
@@ -973,20 +975,9 @@ namespace ts {
|
||||
return symbol;
|
||||
}
|
||||
}
|
||||
let fileName: string;
|
||||
let sourceFile: SourceFile;
|
||||
while (true) {
|
||||
fileName = normalizePath(combinePaths(searchPath, moduleName));
|
||||
sourceFile = forEach(supportedExtensions, extension => host.getSourceFile(fileName + extension));
|
||||
if (sourceFile || isRelative) {
|
||||
break;
|
||||
}
|
||||
let parentPath = getDirectoryPath(searchPath);
|
||||
if (parentPath === searchPath) {
|
||||
break;
|
||||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
|
||||
let fileName = getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
let sourceFile = fileName && host.getSourceFile(fileName);
|
||||
if (sourceFile) {
|
||||
if (sourceFile.symbol) {
|
||||
return sourceFile.symbol;
|
||||
@@ -2175,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) {
|
||||
@@ -3131,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;
|
||||
@@ -5272,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;
|
||||
}
|
||||
@@ -5402,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) {
|
||||
@@ -5431,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;
|
||||
@@ -6954,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;
|
||||
}
|
||||
@@ -13315,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);
|
||||
}
|
||||
@@ -13838,7 +13845,11 @@ namespace ts {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (introducesArgumentsExoticObject(location)) {
|
||||
copySymbol(argumentsSymbol, meaning);
|
||||
}
|
||||
|
||||
memberFlags = location.flags;
|
||||
location = location.parent;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace ts {
|
||||
set,
|
||||
contains,
|
||||
remove,
|
||||
clear,
|
||||
forEachValue: forEachValueInMap
|
||||
};
|
||||
|
||||
@@ -51,6 +52,10 @@ namespace ts {
|
||||
function normalizeKey(key: string) {
|
||||
return getCanonicalFileName(normalizeSlashes(key));
|
||||
}
|
||||
|
||||
function clear() {
|
||||
files = {};
|
||||
}
|
||||
}
|
||||
|
||||
export const enum Comparison {
|
||||
@@ -716,7 +721,7 @@ namespace ts {
|
||||
/**
|
||||
* List of supported extensions in order of file resolution precedence.
|
||||
*/
|
||||
export const supportedExtensions = [".tsx", ".ts", ".d.ts"];
|
||||
export const supportedExtensions = [".ts", ".tsx", ".d.ts"];
|
||||
|
||||
const extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"];
|
||||
export function removeFileExtension(path: string): string {
|
||||
|
||||
+97
-55
@@ -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;
|
||||
@@ -2126,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) {
|
||||
@@ -2818,7 +2822,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitNodeWithoutSourceMap(counter);
|
||||
write(" < ");
|
||||
|
||||
emitNodeWithoutSourceMap(rhsReference);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(rhsReference);
|
||||
write(".length");
|
||||
|
||||
emitEnd(node.initializer);
|
||||
@@ -2853,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);
|
||||
}
|
||||
@@ -2876,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);
|
||||
@@ -3032,7 +3036,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write("exports.");
|
||||
}
|
||||
}
|
||||
emitNodeWithoutSourceMap(node.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node.name);
|
||||
emitEnd(node.name);
|
||||
}
|
||||
|
||||
@@ -3078,7 +3082,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write("default");
|
||||
}
|
||||
else {
|
||||
emitNodeWithoutSourceMap(node.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node.name);
|
||||
}
|
||||
write(`", `);
|
||||
emitDeclarationName(node);
|
||||
@@ -3116,7 +3120,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitStart(specifier.name);
|
||||
emitContainingModuleName(specifier);
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(specifier.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(specifier.name);
|
||||
emitEnd(specifier.name);
|
||||
write(" = ");
|
||||
emitExpressionIdentifier(name);
|
||||
@@ -3131,7 +3135,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
writeLine();
|
||||
emitStart(specifier.name);
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithoutSourceMap(specifier.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(specifier.name);
|
||||
write(`", `);
|
||||
emitExpressionIdentifier(specifier.propertyName || specifier.name);
|
||||
write(")");
|
||||
@@ -3176,7 +3180,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
if (exportChanged) {
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithoutSourceMap(name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(name);
|
||||
write(`", `);
|
||||
}
|
||||
|
||||
@@ -3408,7 +3412,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
if (exportChanged) {
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithoutSourceMap(node.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(node.name);
|
||||
write(`", `);
|
||||
}
|
||||
|
||||
@@ -3564,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("; }");
|
||||
}
|
||||
@@ -3589,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);
|
||||
@@ -3610,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();
|
||||
@@ -3631,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));
|
||||
@@ -3675,6 +3679,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
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)) {
|
||||
@@ -3700,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);
|
||||
}
|
||||
@@ -4055,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) {
|
||||
@@ -4066,7 +4075,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
else {
|
||||
write(".");
|
||||
emitNodeWithoutSourceMap(memberName);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(memberName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4134,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);
|
||||
}
|
||||
@@ -5343,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 {
|
||||
@@ -5563,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);
|
||||
}
|
||||
@@ -5590,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, ... }
|
||||
@@ -5603,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5620,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;
|
||||
}
|
||||
}
|
||||
@@ -5752,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;
|
||||
@@ -5913,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);
|
||||
@@ -6211,9 +6231,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
let e = (<ExportDeclaration>entry).exportClause.elements[i];
|
||||
write(`"`);
|
||||
emitNodeWithoutSourceMap(e.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(e.name);
|
||||
write(`": ${parameterName}["`);
|
||||
emitNodeWithoutSourceMap(e.propertyName || e.name);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name);
|
||||
write(`"]`);
|
||||
}
|
||||
decreaseIndent();
|
||||
@@ -6317,10 +6337,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
groupIndices[text] = dependencyGroups.length;
|
||||
dependencyGroups.push([externalImports[i]]);
|
||||
}
|
||||
|
||||
|
||||
if (i !== 0) {
|
||||
write(", ");
|
||||
}
|
||||
|
||||
write(text);
|
||||
}
|
||||
write(`], function(${exportFunctionForFile}) {`);
|
||||
@@ -6669,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.
|
||||
@@ -6700,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);
|
||||
|
||||
@@ -6716,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
|
||||
|
||||
+274
-74
@@ -8,6 +8,9 @@ namespace ts {
|
||||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
|
||||
let emptyArray: any[] = [];
|
||||
|
||||
export const version = "1.6.0";
|
||||
|
||||
export function findConfigFile(searchPath: string): string {
|
||||
@@ -25,6 +28,62 @@ namespace ts {
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function resolveTripleslashReference(moduleName: string, containingFile: string): string {
|
||||
let basePath = getDirectoryPath(containingFile);
|
||||
let referencedFileName = isRootedDiskPath(moduleName) ? moduleName : combinePaths(basePath, moduleName);
|
||||
return normalizePath(referencedFileName);
|
||||
}
|
||||
|
||||
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule {
|
||||
// TODO: use different resolution strategy based on compiler options
|
||||
return legacyNameResolver(moduleName, containingFile, compilerOptions, host);
|
||||
}
|
||||
|
||||
function legacyNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule {
|
||||
|
||||
// module names that contain '!' are used to reference resources and are not resolved to actual files on disk
|
||||
if (moduleName.indexOf('!') != -1) {
|
||||
return { resolvedFileName: undefined, failedLookupLocations: [] };
|
||||
}
|
||||
|
||||
let searchPath = getDirectoryPath(containingFile);
|
||||
let searchName: string;
|
||||
|
||||
let failedLookupLocations: string[] = [];
|
||||
|
||||
let referencedSourceFile: string;
|
||||
while (true) {
|
||||
searchName = normalizePath(combinePaths(searchPath, moduleName));
|
||||
referencedSourceFile = forEach(supportedExtensions, extension => {
|
||||
if (extension === ".tsx" && !compilerOptions.jsx) {
|
||||
// resolve .tsx files only if jsx support is enabled
|
||||
// 'logical not' handles both undefined and None cases
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let candidate = searchName + extension;
|
||||
if (host.fileExists(candidate)) {
|
||||
return candidate;
|
||||
}
|
||||
else {
|
||||
failedLookupLocations.push(candidate);
|
||||
}
|
||||
});
|
||||
|
||||
if (referencedSourceFile) {
|
||||
break;
|
||||
}
|
||||
|
||||
let parentPath = getDirectoryPath(searchPath);
|
||||
if (parentPath === searchPath) {
|
||||
break;
|
||||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
|
||||
return { resolvedFileName: referencedSourceFile, failedLookupLocations };
|
||||
}
|
||||
|
||||
export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost {
|
||||
let currentDirectory: string;
|
||||
@@ -92,7 +151,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
const newLine = getNewLineCharacter(options);
|
||||
|
||||
|
||||
|
||||
return {
|
||||
getSourceFile,
|
||||
getDefaultLibFileName: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFileName(options)),
|
||||
@@ -100,7 +160,9 @@ namespace ts {
|
||||
getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()),
|
||||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
|
||||
getCanonicalFileName,
|
||||
getNewLine: () => newLine
|
||||
getNewLine: () => newLine,
|
||||
fileExists: fileName => sys.fileExists(fileName),
|
||||
readFile: fileName => sys.readFile(fileName)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -143,7 +205,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program {
|
||||
export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program {
|
||||
let program: Program;
|
||||
let files: SourceFile[] = [];
|
||||
let diagnostics = createDiagnosticCollection();
|
||||
@@ -158,24 +220,56 @@ namespace ts {
|
||||
let start = new Date().getTime();
|
||||
|
||||
host = host || createCompilerHost(options);
|
||||
|
||||
// initialize resolveModuleNameWorker only if noResolve is false
|
||||
let resolveModuleNamesWorker: (moduleNames: string[], containingFile: string) => string[];
|
||||
if (!options.noResolve) {
|
||||
resolveModuleNamesWorker = host.resolveModuleNames;
|
||||
if (!resolveModuleNamesWorker) {
|
||||
resolveModuleNamesWorker = (moduleNames, containingFile) => {
|
||||
return map(moduleNames, moduleName => {
|
||||
let moduleResolution = resolveModuleName(moduleName, containingFile, options, host);
|
||||
return moduleResolution.resolvedFileName;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let filesByName = createFileMap<SourceFile>(fileName => host.getCanonicalFileName(fileName));
|
||||
|
||||
forEach(rootNames, name => processRootFile(name, /*isDefaultLib:*/ false));
|
||||
|
||||
// Do not process the default library if:
|
||||
// - The '--noLib' flag is used.
|
||||
// - A 'no-default-lib' reference comment is encountered in
|
||||
// processing the root files.
|
||||
if (!skipDefaultLib) {
|
||||
processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib:*/ true);
|
||||
|
||||
if (oldProgram) {
|
||||
// check properties that can affect structure of the program or module resolution strategy
|
||||
// if any of these properties has changed - structure cannot be reused
|
||||
let oldOptions = oldProgram.getCompilerOptions();
|
||||
if ((oldOptions.module !== options.module) ||
|
||||
(oldOptions.noResolve !== options.noResolve) ||
|
||||
(oldOptions.target !== options.target) ||
|
||||
(oldOptions.noLib !== options.noLib) ||
|
||||
(oldOptions.jsx !== options.jsx)) {
|
||||
oldProgram = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tryReuseStructureFromOldProgram()) {
|
||||
forEach(rootNames, name => processRootFile(name, false));
|
||||
// Do not process the default library if:
|
||||
// - The '--noLib' flag is used.
|
||||
// - A 'no-default-lib' reference comment is encountered in
|
||||
// processing the root files.
|
||||
if (!skipDefaultLib) {
|
||||
processRootFile(host.getDefaultLibFileName(options), true);
|
||||
}
|
||||
}
|
||||
|
||||
verifyCompilerOptions();
|
||||
|
||||
// unconditionally set oldProgram to undefined to prevent it from being captured in closure
|
||||
oldProgram = undefined;
|
||||
|
||||
programTime += new Date().getTime() - start;
|
||||
|
||||
program = {
|
||||
getRootFileNames: () => rootNames,
|
||||
getSourceFile: getSourceFile,
|
||||
getSourceFiles: () => files,
|
||||
getCompilerOptions: () => options,
|
||||
@@ -211,6 +305,82 @@ namespace ts {
|
||||
return classifiableNames;
|
||||
}
|
||||
|
||||
function tryReuseStructureFromOldProgram(): boolean {
|
||||
if (!oldProgram) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Debug.assert(!oldProgram.structureIsReused);
|
||||
|
||||
// there is an old program, check if we can reuse its structure
|
||||
let oldRootNames = oldProgram.getRootFileNames();
|
||||
if (!arrayIsEqualTo(oldRootNames, rootNames)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if program source files has changed in the way that can affect structure of the program
|
||||
let newSourceFiles: SourceFile[] = [];
|
||||
for (let oldSourceFile of oldProgram.getSourceFiles()) {
|
||||
let newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target);
|
||||
if (!newSourceFile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (oldSourceFile !== newSourceFile) {
|
||||
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
||||
// value of no-default-lib has changed
|
||||
// this will affect if default library is injected into the list of files
|
||||
return false;
|
||||
}
|
||||
|
||||
// check tripleslash references
|
||||
if (!arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
||||
// tripleslash references has changed
|
||||
return false;
|
||||
}
|
||||
|
||||
// check imports
|
||||
collectExternalModuleReferences(newSourceFile);
|
||||
if (!arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
||||
// imports has changed
|
||||
return false;
|
||||
}
|
||||
|
||||
if (resolveModuleNamesWorker) {
|
||||
let moduleNames = map(newSourceFile.imports, name => name.text);
|
||||
let resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName);
|
||||
// ensure that module resolution results are still correct
|
||||
for (let i = 0; i < moduleNames.length; ++i) {
|
||||
let oldResolution = getResolvedModuleFileName(oldSourceFile, moduleNames[i]);
|
||||
if (oldResolution !== resolutions[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// pass the cache of module resolutions from the old source file
|
||||
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
||||
}
|
||||
else {
|
||||
// file has no changes - use it as is
|
||||
newSourceFile = oldSourceFile;
|
||||
}
|
||||
|
||||
// if file has passed all checks it should be safe to reuse it
|
||||
newSourceFiles.push(newSourceFile);
|
||||
}
|
||||
|
||||
// update fileName -> file mapping
|
||||
for (let file of newSourceFiles) {
|
||||
filesByName.set(file.fileName, file);
|
||||
}
|
||||
|
||||
files = newSourceFiles;
|
||||
|
||||
oldProgram.structureIsReused = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getEmitHost(writeFileCallback?: WriteFileCallback): EmitHost {
|
||||
return {
|
||||
getCanonicalFileName: fileName => host.getCanonicalFileName(fileName),
|
||||
@@ -370,16 +540,66 @@ namespace ts {
|
||||
|
||||
function processRootFile(fileName: string, isDefaultLib: boolean) {
|
||||
processSourceFile(normalizePath(fileName), isDefaultLib);
|
||||
}
|
||||
|
||||
function fileReferenceIsEqualTo(a: FileReference, b: FileReference): boolean {
|
||||
return a.fileName === b.fileName;
|
||||
}
|
||||
|
||||
function moduleNameIsEqualTo(a: LiteralExpression, b: LiteralExpression): boolean {
|
||||
return a.text === b.text;
|
||||
}
|
||||
|
||||
function collectExternalModuleReferences(file: SourceFile): void {
|
||||
if (file.imports) {
|
||||
return;
|
||||
}
|
||||
|
||||
let imports: LiteralExpression[];
|
||||
for (let node of file.statements) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
let moduleNameExpr = getExternalModuleName(node);
|
||||
if (!moduleNameExpr || moduleNameExpr.kind !== SyntaxKind.StringLiteral) {
|
||||
break;
|
||||
}
|
||||
if (!(<LiteralExpression>moduleNameExpr).text) {
|
||||
break;
|
||||
}
|
||||
|
||||
(imports || (imports = [])).push(<LiteralExpression>moduleNameExpr);
|
||||
break;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
if ((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) {
|
||||
// TypeScript 1.0 spec (April 2014): 12.1.6
|
||||
// An AmbientExternalModuleDeclaration declares an external module.
|
||||
// This type of declaration is permitted only in the global module.
|
||||
// The StringLiteral must specify a top - level external module name.
|
||||
// Relative external module names are not permitted
|
||||
forEachChild((<ModuleDeclaration>node).body, node => {
|
||||
if (isExternalModuleImportEqualsDeclaration(node) &&
|
||||
getExternalModuleImportEqualsDeclarationExpression(node).kind === SyntaxKind.StringLiteral) {
|
||||
let moduleName = <LiteralExpression>getExternalModuleImportEqualsDeclarationExpression(node);
|
||||
// TypeScript 1.0 spec (April 2014): 12.1.6
|
||||
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
|
||||
// only through top - level external module names. Relative external module names are not permitted.
|
||||
if (moduleName) {
|
||||
(imports || (imports = [])).push(moduleName);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
file.imports = imports || emptyArray;
|
||||
}
|
||||
|
||||
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))) {
|
||||
@@ -411,8 +631,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));
|
||||
@@ -421,7 +641,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
|
||||
@@ -436,8 +656,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 {
|
||||
@@ -473,8 +693,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;
|
||||
@@ -483,60 +708,35 @@ namespace ts {
|
||||
|
||||
function processReferencedFiles(file: SourceFile, basePath: string) {
|
||||
forEach(file.referencedFiles, ref => {
|
||||
let referencedFileName = isRootedDiskPath(ref.fileName) ? ref.fileName : combinePaths(basePath, ref.fileName);
|
||||
processSourceFile(normalizePath(referencedFileName), /* isDefaultLib */ false, file, ref.pos, ref.end);
|
||||
let referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
|
||||
processSourceFile(referencedFileName, /* isDefaultLib */ false, file, ref.pos, ref.end);
|
||||
});
|
||||
}
|
||||
|
||||
function processImportedModules(file: SourceFile, basePath: string) {
|
||||
forEach(file.statements, node => {
|
||||
if (node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration || node.kind === SyntaxKind.ExportDeclaration) {
|
||||
let moduleNameExpr = getExternalModuleName(node);
|
||||
if (moduleNameExpr && moduleNameExpr.kind === SyntaxKind.StringLiteral) {
|
||||
let moduleNameText = (<LiteralExpression>moduleNameExpr).text;
|
||||
if (moduleNameText) {
|
||||
let searchPath = basePath;
|
||||
let searchName: string;
|
||||
while (true) {
|
||||
searchName = normalizePath(combinePaths(searchPath, moduleNameText));
|
||||
if (forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, moduleNameExpr))) {
|
||||
break;
|
||||
}
|
||||
let parentPath = getDirectoryPath(searchPath);
|
||||
if (parentPath === searchPath) {
|
||||
break;
|
||||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
}
|
||||
|
||||
function processImportedModules(file: SourceFile, basePath: string) {
|
||||
collectExternalModuleReferences(file);
|
||||
if (file.imports.length) {
|
||||
file.resolvedModules = {};
|
||||
let oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
||||
|
||||
let moduleNames = map(file.imports, name => name.text);
|
||||
let resolutions = resolveModuleNamesWorker(moduleNames, file.fileName);
|
||||
for (let i = 0; i < file.imports.length; ++i) {
|
||||
let resolution = resolutions[i];
|
||||
setResolvedModuleName(file, moduleNames[i], resolution);
|
||||
if (resolution) {
|
||||
findModuleSourceFile(resolution, file.imports[i]);
|
||||
}
|
||||
}
|
||||
else if (node.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) {
|
||||
// TypeScript 1.0 spec (April 2014): 12.1.6
|
||||
// An AmbientExternalModuleDeclaration declares an external module.
|
||||
// This type of declaration is permitted only in the global module.
|
||||
// The StringLiteral must specify a top - level external module name.
|
||||
// Relative external module names are not permitted
|
||||
forEachChild((<ModuleDeclaration>node).body, node => {
|
||||
if (isExternalModuleImportEqualsDeclaration(node) &&
|
||||
getExternalModuleImportEqualsDeclarationExpression(node).kind === SyntaxKind.StringLiteral) {
|
||||
|
||||
let nameLiteral = <LiteralExpression>getExternalModuleImportEqualsDeclarationExpression(node);
|
||||
let moduleName = nameLiteral.text;
|
||||
if (moduleName) {
|
||||
// TypeScript 1.0 spec (April 2014): 12.1.6
|
||||
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
|
||||
// only through top - level external module names. Relative external module names are not permitted.
|
||||
let searchName = normalizePath(combinePaths(basePath, moduleName));
|
||||
forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, nameLiteral));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
// no imports - drop cached module resolutions
|
||||
file.resolvedModules = undefined;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -672,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 {
|
||||
|
||||
+44
-3
@@ -9,6 +9,7 @@ namespace ts {
|
||||
contains(fileName: string): boolean;
|
||||
remove(fileName: string): void;
|
||||
forEachValue(f: (v: T) => void): void;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
export interface TextRange {
|
||||
@@ -1243,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
|
||||
@@ -1275,8 +1280,12 @@ namespace ts {
|
||||
// Stores a line map for the file.
|
||||
// This field should never be used directly to obtain line map, use getLineMap function instead.
|
||||
/* @internal */ lineMap: number[];
|
||||
|
||||
/* @internal */ classifiableNames?: Map<string>;
|
||||
// Stores a mapping 'external module reference text' -> 'resolved file name' | undefined
|
||||
// It is used to resolve module names in the checker.
|
||||
// Content of this fiels should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead
|
||||
/* @internal */ resolvedModules: Map<string>;
|
||||
/* @internal */ imports: LiteralExpression[];
|
||||
}
|
||||
|
||||
export interface ScriptReferenceHost {
|
||||
@@ -1285,7 +1294,7 @@ namespace ts {
|
||||
getCurrentDirectory(): string;
|
||||
}
|
||||
|
||||
export interface ParseConfigHost {
|
||||
export interface ParseConfigHost extends ModuleResolutionHost {
|
||||
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
|
||||
}
|
||||
|
||||
@@ -1303,6 +1312,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface Program extends ScriptReferenceHost {
|
||||
|
||||
/**
|
||||
* Get a list of root file names that were passed to a 'createProgram'
|
||||
*/
|
||||
getRootFileNames(): string[]
|
||||
|
||||
/**
|
||||
* Get a list of files in the program
|
||||
*/
|
||||
@@ -1343,6 +1358,9 @@ namespace ts {
|
||||
/* @internal */ getIdentifierCount(): number;
|
||||
/* @internal */ getSymbolCount(): number;
|
||||
/* @internal */ getTypeCount(): number;
|
||||
|
||||
// For testing purposes only.
|
||||
/* @internal */ structureIsReused?: boolean;
|
||||
}
|
||||
|
||||
export interface SourceMapSpan {
|
||||
@@ -2229,9 +2247,23 @@ namespace ts {
|
||||
byteOrderMark = 0xFEFF,
|
||||
tab = 0x09, // \t
|
||||
verticalTab = 0x0B, // \v
|
||||
}
|
||||
|
||||
export interface ModuleResolutionHost {
|
||||
fileExists(fileName: string): boolean;
|
||||
// readFile function is used to read arbitrary text files on disk, i.e. when resolution procedure needs the content of 'package.json'
|
||||
// to determine location of bundled typings for node module
|
||||
readFile(fileName: string): string;
|
||||
}
|
||||
|
||||
export interface ResolvedModule {
|
||||
resolvedFileName: string;
|
||||
failedLookupLocations: string[];
|
||||
}
|
||||
|
||||
export type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
|
||||
|
||||
export interface CompilerHost {
|
||||
export interface CompilerHost extends ModuleResolutionHost {
|
||||
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
@@ -2240,6 +2272,15 @@ namespace ts {
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
getNewLine(): string;
|
||||
|
||||
/*
|
||||
* CompilerHost must either implement resolveModuleNames (in case if it wants to be completely in charge of
|
||||
* module name resolution) or provide implementation for methods from ModuleResolutionHost (in this case compiler
|
||||
* will appply built-in module resolution logic and use members of ModuleResolutionHost to ask host specific questions).
|
||||
* If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just
|
||||
* 'throw new Error("NotImplemented")'
|
||||
*/
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
}
|
||||
|
||||
export interface TextSpan {
|
||||
|
||||
@@ -80,6 +80,41 @@ namespace ts {
|
||||
return node.end - node.pos;
|
||||
}
|
||||
|
||||
export function arrayIsEqualTo<T>(arr1: T[], arr2: T[], comparer?: (a: T, b: T) => boolean): boolean {
|
||||
if (!arr1 || !arr2) {
|
||||
return arr1 === arr2;
|
||||
}
|
||||
|
||||
if (arr1.length !== arr2.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < arr1.length; ++i) {
|
||||
let equals = comparer ? comparer(arr1[i], arr2[i]) : arr1[i] === arr2[i];
|
||||
if (!equals) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function hasResolvedModuleName(sourceFile: SourceFile, moduleNameText: string): boolean {
|
||||
return sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText);
|
||||
}
|
||||
|
||||
export function getResolvedModuleFileName(sourceFile: SourceFile, moduleNameText: string): string {
|
||||
return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
}
|
||||
|
||||
export function setResolvedModuleName(sourceFile: SourceFile, moduleNameText: string, resolvedFileName: string): void {
|
||||
if (!sourceFile.resolvedModules) {
|
||||
sourceFile.resolvedModules = {};
|
||||
}
|
||||
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedFileName;
|
||||
}
|
||||
|
||||
// Returns true if this node contains a parse error anywhere underneath it.
|
||||
export function containsParseError(node: Node): boolean {
|
||||
aggregateChildData(node);
|
||||
@@ -205,7 +240,7 @@ namespace ts {
|
||||
// Make an identifier from an external module name by extracting the string after the last "/" and replacing
|
||||
// all non-alphanumeric characters with underscores
|
||||
export function makeIdentifierFromModuleName(moduleName: string): string {
|
||||
return getBaseFileName(moduleName).replace(/\W/g, "_");
|
||||
return getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_");
|
||||
}
|
||||
|
||||
export function isBlockOrCatchScoped(declaration: Declaration) {
|
||||
@@ -385,7 +420,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function getJsDocComments(node: Node, sourceFileOfNode: SourceFile) {
|
||||
let commentRanges = (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) ?
concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos),
getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) :
getLeadingCommentRangesOfNode(node, sourceFileOfNode);
|
||||
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) {
|
||||
@@ -603,6 +641,20 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function introducesArgumentsExoticObject(node: Node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isFunctionBlock(node: Node) {
|
||||
return node && node.kind === SyntaxKind.Block && isFunctionLike(node.parent);
|
||||
}
|
||||
|
||||
@@ -285,7 +285,9 @@ module FourSlash {
|
||||
case FourSlashTestType.Native:
|
||||
return new Harness.LanguageService.NativeLanugageServiceAdapter(cancellationToken, compilationOptions);
|
||||
case FourSlashTestType.Shims:
|
||||
return new Harness.LanguageService.ShimLanugageServiceAdapter(cancellationToken, compilationOptions);
|
||||
return new Harness.LanguageService.ShimLanugageServiceAdapter(/*preprocessToResolve*/ false, cancellationToken, compilationOptions);
|
||||
case FourSlashTestType.ShimsWithPreprocess:
|
||||
return new Harness.LanguageService.ShimLanugageServiceAdapter(/*preprocessToResolve*/ true, cancellationToken, compilationOptions);
|
||||
case FourSlashTestType.Server:
|
||||
return new Harness.LanguageService.ServerLanugageServiceAdapter(cancellationToken, compilationOptions);
|
||||
default:
|
||||
@@ -364,6 +366,7 @@ module FourSlash {
|
||||
InsertSpaceAfterKeywordsInControlFlowStatements: true,
|
||||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
|
||||
PlaceOpenBraceOnNewLineForFunctions: false,
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: false,
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
const enum FourSlashTestType {
|
||||
Native,
|
||||
Shims,
|
||||
ShimsWithPreprocess,
|
||||
Server
|
||||
}
|
||||
|
||||
@@ -23,6 +24,10 @@ class FourSlashRunner extends RunnerBase {
|
||||
this.basePath = "tests/cases/fourslash/shims";
|
||||
this.testSuiteName = "fourslash-shims";
|
||||
break;
|
||||
case FourSlashTestType.ShimsWithPreprocess:
|
||||
this.basePath = 'tests/cases/fourslash/shims-pp';
|
||||
this.testSuiteName = 'fourslash-shims-pp';
|
||||
break;
|
||||
case FourSlashTestType.Server:
|
||||
this.basePath = "tests/cases/fourslash/server";
|
||||
this.testSuiteName = "fourslash-server";
|
||||
|
||||
+27
-23
@@ -868,6 +868,29 @@ module Harness {
|
||||
}
|
||||
};
|
||||
inputFiles.forEach(register);
|
||||
|
||||
function getSourceFile(fn: string, languageVersion: ts.ScriptTarget) {
|
||||
fn = ts.normalizePath(fn);
|
||||
if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) {
|
||||
return filemap[getCanonicalFileName(fn)];
|
||||
}
|
||||
else if (currentDirectory) {
|
||||
let canonicalAbsolutePath = getCanonicalFileName(ts.getNormalizedAbsolutePath(fn, currentDirectory));
|
||||
return Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(canonicalAbsolutePath)) ? filemap[canonicalAbsolutePath] : undefined;
|
||||
}
|
||||
else if (fn === fourslashFileName) {
|
||||
let tsFn = "tests/cases/fourslash/" + fourslashFileName;
|
||||
fourslashSourceFile = fourslashSourceFile || createSourceFileAndAssertInvariants(tsFn, Harness.IO.readFile(tsFn), scriptTarget);
|
||||
return fourslashSourceFile;
|
||||
}
|
||||
else {
|
||||
if (fn === defaultLibFileName) {
|
||||
return languageVersion === ts.ScriptTarget.ES6 ? defaultES6LibSourceFile : defaultLibSourceFile;
|
||||
}
|
||||
// Don't throw here -- the compiler might be looking for a test that actually doesn't exist as part of the TC
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
let newLine =
|
||||
newLineKind === ts.NewLineKind.CarriageReturnLineFeed ? carriageReturnLineFeed :
|
||||
@@ -876,33 +899,14 @@ module Harness {
|
||||
|
||||
return {
|
||||
getCurrentDirectory,
|
||||
getSourceFile: (fn, languageVersion) => {
|
||||
fn = ts.normalizePath(fn);
|
||||
if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) {
|
||||
return filemap[getCanonicalFileName(fn)];
|
||||
}
|
||||
else if (currentDirectory) {
|
||||
let canonicalAbsolutePath = getCanonicalFileName(ts.getNormalizedAbsolutePath(fn, currentDirectory));
|
||||
return Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(canonicalAbsolutePath)) ? filemap[canonicalAbsolutePath] : undefined;
|
||||
}
|
||||
else if (fn === fourslashFileName) {
|
||||
let tsFn = "tests/cases/fourslash/" + fourslashFileName;
|
||||
fourslashSourceFile = fourslashSourceFile || createSourceFileAndAssertInvariants(tsFn, Harness.IO.readFile(tsFn), scriptTarget);
|
||||
return fourslashSourceFile;
|
||||
}
|
||||
else {
|
||||
if (fn === defaultLibFileName) {
|
||||
return languageVersion === ts.ScriptTarget.ES6 ? defaultES6LibSourceFile : defaultLibSourceFile;
|
||||
}
|
||||
// Don't throw here -- the compiler might be looking for a test that actually doesn't exist as part of the TC
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
getSourceFile,
|
||||
getDefaultLibFileName: options => defaultLibFileName,
|
||||
writeFile,
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
||||
getNewLine: () => newLine
|
||||
getNewLine: () => newLine,
|
||||
fileExists: fileName => getSourceFile(fileName, ts.ScriptTarget.ES5) !== undefined,
|
||||
readFile: (fileName: string): string => { throw new Error("NotYetImplemented"); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -203,9 +203,35 @@ module Harness.LanguageService {
|
||||
/// Shim adapter
|
||||
class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceShimHost, ts.CoreServicesShimHost {
|
||||
private nativeHost: NativeLanguageServiceHost;
|
||||
constructor(cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
|
||||
|
||||
public getModuleResolutionsForFile: (fileName: string)=> string;
|
||||
|
||||
constructor(preprocessToResolve: boolean, cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
|
||||
super(cancellationToken, options);
|
||||
this.nativeHost = new NativeLanguageServiceHost(cancellationToken, options);
|
||||
|
||||
if (preprocessToResolve) {
|
||||
let compilerOptions = this.nativeHost.getCompilationSettings()
|
||||
let moduleResolutionHost: ts.ModuleResolutionHost = {
|
||||
fileExists: fileName => this.getScriptInfo(fileName) !== undefined,
|
||||
readFile: fileName => {
|
||||
let scriptInfo = this.getScriptInfo(fileName);
|
||||
return scriptInfo && scriptInfo.content;
|
||||
}
|
||||
};
|
||||
this.getModuleResolutionsForFile = (fileName) => {
|
||||
let scriptInfo = this.getScriptInfo(fileName);
|
||||
let preprocessInfo = ts.preProcessFile(scriptInfo.content, /*readImportFiles*/ true);
|
||||
let imports: ts.Map<string> = {};
|
||||
for (let module of preprocessInfo.importedFiles) {
|
||||
let resolutionInfo = ts.resolveModuleName(module.fileName, fileName, compilerOptions, moduleResolutionHost);
|
||||
if (resolutionInfo.resolvedFileName) {
|
||||
imports[module.fileName] = resolutionInfo.resolvedFileName;
|
||||
}
|
||||
}
|
||||
return JSON.stringify(imports);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getFilenames(): string[] { return this.nativeHost.getFilenames(); }
|
||||
@@ -229,7 +255,11 @@ module Harness.LanguageService {
|
||||
readDirectory(rootDir: string, extension: string): string {
|
||||
throw new Error("NYI");
|
||||
}
|
||||
|
||||
fileExists(fileName: string) { return this.getScriptInfo(fileName) !== undefined; }
|
||||
readFile(fileName: string) {
|
||||
let snapshot = this.nativeHost.getScriptSnapshot(fileName);
|
||||
return snapshot && snapshot.getText(0, snapshot.getLength());
|
||||
}
|
||||
log(s: string): void { this.nativeHost.log(s); }
|
||||
trace(s: string): void { this.nativeHost.trace(s); }
|
||||
error(s: string): void { this.nativeHost.error(s); }
|
||||
@@ -399,8 +429,8 @@ module Harness.LanguageService {
|
||||
export class ShimLanugageServiceAdapter implements LanguageServiceAdapter {
|
||||
private host: ShimLanguageServiceHost;
|
||||
private factory: ts.TypeScriptServicesFactory;
|
||||
constructor(cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
|
||||
this.host = new ShimLanguageServiceHost(cancellationToken, options);
|
||||
constructor(preprocessToResolve: boolean, cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
|
||||
this.host = new ShimLanguageServiceHost(preprocessToResolve, cancellationToken, options);
|
||||
this.factory = new TypeScript.Services.TypeScriptServicesFactory();
|
||||
}
|
||||
getHost() { return this.host; }
|
||||
@@ -419,6 +449,7 @@ module Harness.LanguageService {
|
||||
let convertResult: ts.PreProcessedFileInfo = {
|
||||
referencedFiles: [],
|
||||
importedFiles: [],
|
||||
ambientExternalModules: [],
|
||||
isLibFile: shimResult.isLibFile
|
||||
};
|
||||
|
||||
|
||||
@@ -191,7 +191,9 @@ class ProjectRunner extends RunnerBase {
|
||||
getCurrentDirectory,
|
||||
getCanonicalFileName: Harness.Compiler.getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,
|
||||
getNewLine: () => ts.sys.newLine
|
||||
getNewLine: () => ts.sys.newLine,
|
||||
fileExists: fileName => getSourceFile(fileName, ts.ScriptTarget.ES5) !== undefined,
|
||||
readFile: fileName => Harness.IO.readFile(fileName)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,10 @@ if (testConfigFile !== "") {
|
||||
case "fourslash-shims":
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Shims));
|
||||
break;
|
||||
case "fourslash-server":
|
||||
case 'fourslash-shims-pp':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.ShimsWithPreprocess));
|
||||
break;
|
||||
case 'fourslash-server':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Server));
|
||||
break;
|
||||
case "fourslash-generated":
|
||||
@@ -98,6 +101,7 @@ if (runners.length === 0) {
|
||||
// language services
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Native));
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Shims));
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.ShimsWithPreprocess));
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Server));
|
||||
// runners.push(new GeneratedFourslashRunner());
|
||||
}
|
||||
|
||||
Vendored
+2645
-4
File diff suppressed because it is too large
Load Diff
Vendored
+13
-7
@@ -2459,7 +2459,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported.
|
||||
* @param replace Specifies whether the existing entry for the document is replaced in the history list.
|
||||
*/
|
||||
open(url?: string, name?: string, features?: string, replace?: boolean): Document | Window;
|
||||
open(url?: string, name?: string, features?: string, replace?: boolean): Document;
|
||||
/**
|
||||
* Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.
|
||||
* @param commandId Specifies a command identifier.
|
||||
@@ -3030,7 +3030,7 @@ interface File extends Blob {
|
||||
|
||||
declare var File: {
|
||||
prototype: File;
|
||||
new(): File;
|
||||
new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;
|
||||
}
|
||||
|
||||
interface FileList {
|
||||
@@ -6865,7 +6865,7 @@ interface IDBDatabase extends EventTarget {
|
||||
createObjectStore(name: string, optionalParameters?: any): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
transaction(storeNames: any, mode?: string): IDBTransaction;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
@@ -6986,7 +6986,7 @@ interface IDBTransaction extends EventTarget {
|
||||
READ_ONLY: string;
|
||||
READ_WRITE: string;
|
||||
VERSION_CHANGE: string;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
@@ -12169,7 +12169,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
LOADING: number;
|
||||
OPENED: number;
|
||||
UNSENT: number;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -12439,7 +12439,7 @@ interface MSBaseReader {
|
||||
DONE: number;
|
||||
EMPTY: number;
|
||||
LOADING: number;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -12595,7 +12595,7 @@ interface XMLHttpRequestEventTarget {
|
||||
onloadstart: (ev: Event) => any;
|
||||
onprogress: (ev: ProgressEvent) => any;
|
||||
ontimeout: (ev: ProgressEvent) => any;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -12612,11 +12612,17 @@ interface NodeListOf<TNode extends Node> extends NodeList {
|
||||
[index: number]: TNode;
|
||||
}
|
||||
|
||||
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
}
|
||||
|
||||
interface FilePropertyBag {
|
||||
type?: string;
|
||||
lastModified?: number;
|
||||
}
|
||||
|
||||
interface EventListenerObject {
|
||||
handleEvent(evt: Event): void;
|
||||
}
|
||||
|
||||
Vendored
+100
-2542
File diff suppressed because it is too large
Load Diff
Vendored
-2305
File diff suppressed because it is too large
Load Diff
Vendored
+120
-17
@@ -3,10 +3,28 @@
|
||||
/// IE Worker APIs
|
||||
/////////////////////////////
|
||||
|
||||
interface EventInit {
|
||||
bubbles?: boolean;
|
||||
cancelable?: boolean;
|
||||
}
|
||||
|
||||
interface EventListener {
|
||||
(evt: Event): void;
|
||||
}
|
||||
|
||||
interface AudioBuffer {
|
||||
duration: number;
|
||||
length: number;
|
||||
numberOfChannels: number;
|
||||
sampleRate: number;
|
||||
getChannelData(channel: number): any;
|
||||
}
|
||||
|
||||
declare var AudioBuffer: {
|
||||
prototype: AudioBuffer;
|
||||
new(): AudioBuffer;
|
||||
}
|
||||
|
||||
interface Blob {
|
||||
size: number;
|
||||
type: string;
|
||||
@@ -60,6 +78,21 @@ declare var Console: {
|
||||
new(): Console;
|
||||
}
|
||||
|
||||
interface Coordinates {
|
||||
accuracy: number;
|
||||
altitude: number;
|
||||
altitudeAccuracy: number;
|
||||
heading: number;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
speed: number;
|
||||
}
|
||||
|
||||
declare var Coordinates: {
|
||||
prototype: Coordinates;
|
||||
new(): Coordinates;
|
||||
}
|
||||
|
||||
interface DOMError {
|
||||
name: string;
|
||||
toString(): string;
|
||||
@@ -210,7 +243,7 @@ interface File extends Blob {
|
||||
|
||||
declare var File: {
|
||||
prototype: File;
|
||||
new(): File;
|
||||
new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;
|
||||
}
|
||||
|
||||
interface FileList {
|
||||
@@ -281,7 +314,7 @@ interface IDBDatabase extends EventTarget {
|
||||
createObjectStore(name: string, optionalParameters?: any): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
transaction(storeNames: any, mode?: string): IDBTransaction;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
@@ -402,7 +435,7 @@ interface IDBTransaction extends EventTarget {
|
||||
READ_ONLY: string;
|
||||
READ_WRITE: string;
|
||||
VERSION_CHANGE: string;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
@@ -460,6 +493,29 @@ interface MSApp {
|
||||
}
|
||||
declare var MSApp: MSApp;
|
||||
|
||||
interface MSAppAsyncOperation extends EventTarget {
|
||||
error: DOMError;
|
||||
oncomplete: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
readyState: number;
|
||||
result: any;
|
||||
start(): void;
|
||||
COMPLETED: number;
|
||||
ERROR: number;
|
||||
STARTED: number;
|
||||
addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
declare var MSAppAsyncOperation: {
|
||||
prototype: MSAppAsyncOperation;
|
||||
new(): MSAppAsyncOperation;
|
||||
COMPLETED: number;
|
||||
ERROR: number;
|
||||
STARTED: number;
|
||||
}
|
||||
|
||||
interface MSBlobBuilder {
|
||||
append(data: any, endings?: string): void;
|
||||
getBlob(contentType?: string): Blob;
|
||||
@@ -496,6 +552,18 @@ declare var MSStreamReader: {
|
||||
new(): MSStreamReader;
|
||||
}
|
||||
|
||||
interface MediaQueryList {
|
||||
matches: boolean;
|
||||
media: string;
|
||||
addListener(listener: MediaQueryListListener): void;
|
||||
removeListener(listener: MediaQueryListListener): void;
|
||||
}
|
||||
|
||||
declare var MediaQueryList: {
|
||||
prototype: MediaQueryList;
|
||||
new(): MediaQueryList;
|
||||
}
|
||||
|
||||
interface MessageChannel {
|
||||
port1: MessagePort;
|
||||
port2: MessagePort;
|
||||
@@ -533,6 +601,33 @@ declare var MessagePort: {
|
||||
new(): MessagePort;
|
||||
}
|
||||
|
||||
interface Position {
|
||||
coords: Coordinates;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
declare var Position: {
|
||||
prototype: Position;
|
||||
new(): Position;
|
||||
}
|
||||
|
||||
interface PositionError {
|
||||
code: number;
|
||||
message: string;
|
||||
toString(): string;
|
||||
PERMISSION_DENIED: number;
|
||||
POSITION_UNAVAILABLE: number;
|
||||
TIMEOUT: number;
|
||||
}
|
||||
|
||||
declare var PositionError: {
|
||||
prototype: PositionError;
|
||||
new(): PositionError;
|
||||
PERMISSION_DENIED: number;
|
||||
POSITION_UNAVAILABLE: number;
|
||||
TIMEOUT: number;
|
||||
}
|
||||
|
||||
interface ProgressEvent extends Event {
|
||||
lengthComputable: boolean;
|
||||
loaded: number;
|
||||
@@ -620,7 +715,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
LOADING: number;
|
||||
OPENED: number;
|
||||
UNSENT: number;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -642,6 +737,15 @@ declare var XMLHttpRequest: {
|
||||
create(): XMLHttpRequest;
|
||||
}
|
||||
|
||||
interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
declare var XMLHttpRequestUpload: {
|
||||
prototype: XMLHttpRequestUpload;
|
||||
new(): XMLHttpRequestUpload;
|
||||
}
|
||||
|
||||
interface AbstractWorker {
|
||||
onerror: (ev: Event) => any;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
@@ -661,7 +765,7 @@ interface MSBaseReader {
|
||||
DONE: number;
|
||||
EMPTY: number;
|
||||
LOADING: number;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -702,7 +806,7 @@ interface XMLHttpRequestEventTarget {
|
||||
onloadstart: (ev: Event) => any;
|
||||
onprogress: (ev: ProgressEvent) => any;
|
||||
ontimeout: (ev: ProgressEvent) => any;
|
||||
addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
@@ -788,17 +892,16 @@ interface WorkerUtils extends Object, WindowBase64 {
|
||||
}
|
||||
|
||||
|
||||
interface NodeListOf<TNode extends Node> extends NodeList {
|
||||
length: number;
|
||||
item(index: number): TNode;
|
||||
[index: number]: TNode;
|
||||
}
|
||||
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
}
|
||||
|
||||
interface FilePropertyBag {
|
||||
type?: string;
|
||||
lastModified?: number;
|
||||
}
|
||||
|
||||
interface EventListenerObject {
|
||||
handleEvent(evt: Event): void;
|
||||
}
|
||||
@@ -820,11 +923,11 @@ interface MediaQueryListListener {
|
||||
interface MSLaunchUriCallback {
|
||||
(): void;
|
||||
}
|
||||
interface FrameRequestCallback {
|
||||
(time: number): void;
|
||||
interface MSUnsafeFunctionCallback {
|
||||
(): any;
|
||||
}
|
||||
interface MutationCallback {
|
||||
(mutations: MutationRecord[], observer: MutationObserver): void;
|
||||
interface MSExecAtPriorityFunctionCallback {
|
||||
(...args: any[]): any;
|
||||
}
|
||||
interface DecodeSuccessCallback {
|
||||
(decodedData: AudioBuffer): void;
|
||||
@@ -861,4 +964,4 @@ declare function postMessage(data: any): void;
|
||||
declare var console: Console;
|
||||
declare function addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
|
||||
@@ -78,15 +78,76 @@ namespace ts.server {
|
||||
return this.snap().getChangeRange(oldSnapshot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface TimestampedResolvedModule extends ResolvedModule {
|
||||
lastCheckTime: number;
|
||||
}
|
||||
|
||||
export class LSHost implements ts.LanguageServiceHost {
|
||||
ls: ts.LanguageService = null;
|
||||
compilationSettings: ts.CompilerOptions;
|
||||
filenameToScript: ts.Map<ScriptInfo> = {};
|
||||
roots: ScriptInfo[] = [];
|
||||
|
||||
private resolvedModuleNames: ts.FileMap<Map<TimestampedResolvedModule>>;
|
||||
private moduleResolutionHost: ts.ModuleResolutionHost;
|
||||
|
||||
constructor(public host: ServerHost, public project: Project) {
|
||||
this.resolvedModuleNames = ts.createFileMap<Map<TimestampedResolvedModule>>(ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames))
|
||||
this.moduleResolutionHost = {
|
||||
fileExists: fileName => this.fileExists(fileName),
|
||||
readFile: fileName => this.host.readFile(fileName)
|
||||
}
|
||||
}
|
||||
|
||||
resolveModuleNames(moduleNames: string[], containingFile: string): string[] {
|
||||
let currentResolutionsInFile = this.resolvedModuleNames.get(containingFile);
|
||||
|
||||
let newResolutions: Map<TimestampedResolvedModule> = {};
|
||||
let resolvedFileNames: string[] = [];
|
||||
|
||||
let compilerOptions = this.getCompilationSettings();
|
||||
|
||||
for (let moduleName of moduleNames) {
|
||||
// check if this is a duplicate entry in the list
|
||||
let resolution = lookUp(newResolutions, moduleName);
|
||||
if (!resolution) {
|
||||
let existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, moduleName);
|
||||
if (moduleResolutionIsValid(existingResolution)) {
|
||||
// ok, it is safe to use existing module resolution results
|
||||
resolution = existingResolution;
|
||||
}
|
||||
else {
|
||||
resolution = <TimestampedResolvedModule>resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost);
|
||||
resolution.lastCheckTime = Date.now();
|
||||
newResolutions[moduleName] = resolution;
|
||||
}
|
||||
}
|
||||
|
||||
ts.Debug.assert(resolution !== undefined);
|
||||
|
||||
resolvedFileNames.push(resolution.resolvedFileName);
|
||||
}
|
||||
|
||||
// replace old results with a new one
|
||||
this.resolvedModuleNames.set(containingFile, newResolutions);
|
||||
return resolvedFileNames;
|
||||
|
||||
function moduleResolutionIsValid(resolution: TimestampedResolvedModule): boolean {
|
||||
if (!resolution) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (resolution.resolvedFileName) {
|
||||
// TODO: consider checking failedLookupLocations
|
||||
// TODO: use lastCheckTime to track expiration for module name resolution
|
||||
return true;
|
||||
}
|
||||
|
||||
// consider situation if we have no candidate locations as valid resolution.
|
||||
// after all there is no point to invalidate it if we have no idea where to look for the module.
|
||||
return resolution.failedLookupLocations.length === 0;
|
||||
}
|
||||
}
|
||||
|
||||
getDefaultLibFileName() {
|
||||
var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath()));
|
||||
@@ -102,6 +163,8 @@ namespace ts.server {
|
||||
|
||||
setCompilationSettings(opt: ts.CompilerOptions) {
|
||||
this.compilationSettings = opt;
|
||||
// conservatively assume that changing compiler options might affect module resolution strategy
|
||||
this.resolvedModuleNames.clear();
|
||||
}
|
||||
|
||||
lineAffectsRefs(filename: string, line: number) {
|
||||
@@ -137,6 +200,7 @@ namespace ts.server {
|
||||
removeReferencedFile(info: ScriptInfo) {
|
||||
if (!info.isOpen) {
|
||||
this.filenameToScript[info.fileName] = undefined;
|
||||
this.resolvedModuleNames.remove(info.fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -990,6 +1054,7 @@ namespace ts.server {
|
||||
InsertSpaceAfterKeywordsInControlFlowStatements: true,
|
||||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
|
||||
PlaceOpenBraceOnNewLineForFunctions: false,
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: false,
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -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;
|
||||
|
||||
@@ -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 {}.
|
||||
@@ -191,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;
|
||||
@@ -232,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;
|
||||
@@ -405,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
|
||||
@@ -451,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));
|
||||
@@ -715,6 +729,7 @@ namespace ts.formatting {
|
||||
case SyntaxKind.TypeReference:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
@@ -725,6 +740,7 @@ namespace ts.formatting {
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+182
-129
@@ -73,7 +73,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an immutable snapshot of a script at a specified time.Once acquired, the
|
||||
* Represents an immutable snapshot of a script at a specified time.Once acquired, the
|
||||
* snapshot is observably immutable. i.e. the same calls with the same parameters will return
|
||||
* the same values.
|
||||
*/
|
||||
@@ -85,9 +85,9 @@ namespace ts {
|
||||
getLength(): number;
|
||||
|
||||
/**
|
||||
* Gets the TextChangeRange that describe how the text changed between this text and
|
||||
* Gets the TextChangeRange that describe how the text changed between this text and
|
||||
* an older version. This information is used by the incremental parser to determine
|
||||
* what sections of the script need to be re-parsed. 'undefined' can be returned if the
|
||||
* what sections of the script need to be re-parsed. 'undefined' can be returned if the
|
||||
* change range cannot be determined. However, in that case, incremental parsing will
|
||||
* not happen and the entire document will be re - parsed.
|
||||
*/
|
||||
@@ -125,6 +125,7 @@ namespace ts {
|
||||
export interface PreProcessedFileInfo {
|
||||
referencedFiles: FileReference[];
|
||||
importedFiles: FileReference[];
|
||||
ambientExternalModules: string[];
|
||||
isLibFile: boolean
|
||||
}
|
||||
|
||||
@@ -275,8 +276,8 @@ namespace ts {
|
||||
let children = this.getChildren(sourceFile);
|
||||
|
||||
let child = lastOrUndefined(children);
|
||||
if (!child) {
|
||||
return undefined;
|
||||
if (!child) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return child.kind < SyntaxKind.FirstNode ? child : child.getLastToken(sourceFile);
|
||||
@@ -336,10 +337,10 @@ namespace ts {
|
||||
|
||||
ts.forEach(declarations, (declaration, indexOfDeclaration) => {
|
||||
// Make sure we are collecting doc comment from declaration once,
|
||||
// In case of union property there might be same declaration multiple times
|
||||
// In case of union property there might be same declaration multiple times
|
||||
// which only varies in type parameter
|
||||
// Eg. let a: Array<string> | Array<number>; a.length
|
||||
// The property length will have two declarations of property length coming
|
||||
// The property length will have two declarations of property length coming
|
||||
// from Array<T> - Array<string> and Array<number>
|
||||
if (indexOf(declarations, declaration) === indexOfDeclaration) {
|
||||
let sourceFileOfDeclaration = getSourceFileOfNode(declaration);
|
||||
@@ -361,7 +362,7 @@ namespace ts {
|
||||
// If this is dotted module name, get the doc comments from the parent
|
||||
while (declaration.kind === SyntaxKind.ModuleDeclaration && declaration.parent.kind === SyntaxKind.ModuleDeclaration) {
|
||||
declaration = <ModuleDeclaration>declaration.parent;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the cleaned js doc comment text from the declaration
|
||||
ts.forEach(getJsDocCommentTextRange(
|
||||
@@ -381,7 +382,7 @@ namespace ts {
|
||||
jsDocComment => {
|
||||
return {
|
||||
pos: jsDocComment.pos + "/*".length, // Consume /* from the comment
|
||||
end: jsDocComment.end - "*/".length // Trim off comment end indicator
|
||||
end: jsDocComment.end - "*/".length // Trim off comment end indicator
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -486,7 +487,7 @@ namespace ts {
|
||||
pushDocCommentLineText(docComments, docCommentTextOfLine, blankLineCount);
|
||||
blankLineCount = 0;
|
||||
}
|
||||
else if (!isInParamTag && docComments.length) {
|
||||
else if (!isInParamTag && docComments.length) {
|
||||
// This is blank line when there is text already parsed
|
||||
blankLineCount++;
|
||||
}
|
||||
@@ -502,7 +503,7 @@ namespace ts {
|
||||
if (isParamTag(pos, end, sourceFile)) {
|
||||
let blankLineCount = 0;
|
||||
let recordedParamTag = false;
|
||||
// Consume leading spaces
|
||||
// Consume leading spaces
|
||||
pos = consumeWhiteSpaces(pos + paramTag.length);
|
||||
if (pos >= end) {
|
||||
break;
|
||||
@@ -560,7 +561,7 @@ namespace ts {
|
||||
while (pos < end) {
|
||||
let ch = sourceFile.text.charCodeAt(pos);
|
||||
|
||||
// at line break, set this comment line text and go to next line
|
||||
// at line break, set this comment line text and go to next line
|
||||
if (isLineBreak(ch)) {
|
||||
if (paramHelpString) {
|
||||
pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount);
|
||||
@@ -626,7 +627,7 @@ namespace ts {
|
||||
paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character;
|
||||
}
|
||||
|
||||
// Now consume white spaces max
|
||||
// Now consume white spaces max
|
||||
let startOfLinePos = pos;
|
||||
pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin);
|
||||
if (pos >= end) {
|
||||
@@ -761,7 +762,8 @@ namespace ts {
|
||||
public languageVariant: LanguageVariant;
|
||||
public identifiers: Map<string>;
|
||||
public nameTable: Map<string>;
|
||||
|
||||
public resolvedModules: Map<string>;
|
||||
public imports: LiteralExpression[];
|
||||
private namedDeclarations: Map<Declaration[]>;
|
||||
|
||||
public update(newText: string, textChangeRange: TextChangeRange): SourceFile {
|
||||
@@ -974,6 +976,13 @@ namespace ts {
|
||||
trace? (s: string): void;
|
||||
error? (s: string): void;
|
||||
useCaseSensitiveFileNames? (): boolean;
|
||||
|
||||
/*
|
||||
* LS host can optionally implement this method if it wants to be completely in charge of module name resolution.
|
||||
* if implementation is omitted then language service will use built-in module resolution logic and get answers to
|
||||
* host specific questions using 'getScriptSnapshot'.
|
||||
*/
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
}
|
||||
|
||||
//
|
||||
@@ -990,17 +999,17 @@ namespace ts {
|
||||
// diagnostics present for the program level, and not just 'options' diagnostics.
|
||||
getCompilerOptionsDiagnostics(): Diagnostic[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* @deprecated Use getEncodedSyntacticClassifications instead.
|
||||
*/
|
||||
getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* @deprecated Use getEncodedSemanticClassifications instead.
|
||||
*/
|
||||
getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
|
||||
// Encoded as triples of [start, length, ClassificationType].
|
||||
// Encoded as triples of [start, length, ClassificationType].
|
||||
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
|
||||
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
|
||||
|
||||
@@ -1149,6 +1158,7 @@ namespace ts {
|
||||
InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
|
||||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
|
||||
PlaceOpenBraceOnNewLineForFunctions: boolean;
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
[s: string]: boolean | number| string;
|
||||
@@ -1227,7 +1237,7 @@ namespace ts {
|
||||
* Represents a single signature to show in signature help.
|
||||
* The id is used for subsequent calls into the language service to ask questions about the
|
||||
* signature help item in the context of any documents that have been updated. i.e. after
|
||||
* an edit has happened, while signature help is still active, the host can ask important
|
||||
* an edit has happened, while signature help is still active, the host can ask important
|
||||
* questions like 'what parameter is the user currently contained within?'.
|
||||
*/
|
||||
export interface SignatureHelpItem {
|
||||
@@ -1281,8 +1291,8 @@ namespace ts {
|
||||
/** The text to display in the editor for the collapsed region. */
|
||||
bannerText: string;
|
||||
|
||||
/**
|
||||
* Whether or not this region should be automatically collapsed when
|
||||
/**
|
||||
* Whether or not this region should be automatically collapsed when
|
||||
* the 'Collapse to Definitions' command is invoked.
|
||||
*/
|
||||
autoCollapse: boolean;
|
||||
@@ -1363,18 +1373,18 @@ namespace ts {
|
||||
}
|
||||
|
||||
/**
|
||||
* The document registry represents a store of SourceFile objects that can be shared between
|
||||
* The document registry represents a store of SourceFile objects that can be shared between
|
||||
* multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST)
|
||||
* of files in the context.
|
||||
* SourceFile objects account for most of the memory usage by the language service. Sharing
|
||||
* the same DocumentRegistry instance between different instances of LanguageService allow
|
||||
* for more efficient memory utilization since all projects will share at least the library
|
||||
* of files in the context.
|
||||
* SourceFile objects account for most of the memory usage by the language service. Sharing
|
||||
* the same DocumentRegistry instance between different instances of LanguageService allow
|
||||
* for more efficient memory utilization since all projects will share at least the library
|
||||
* file (lib.d.ts).
|
||||
*
|
||||
* A more advanced use of the document registry is to serialize sourceFile objects to disk
|
||||
* A more advanced use of the document registry is to serialize sourceFile objects to disk
|
||||
* and re-hydrate them when needed.
|
||||
*
|
||||
* To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it
|
||||
* To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it
|
||||
* to all subsequent createLanguageService calls.
|
||||
*/
|
||||
export interface DocumentRegistry {
|
||||
@@ -1384,7 +1394,7 @@ namespace ts {
|
||||
* the SourceFile if was not found in the registry.
|
||||
*
|
||||
* @param fileName The name of the file requested
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
|
||||
* multiple copies of the same file for different compilation settings.
|
||||
* @parm scriptSnapshot Text of the file. Only used if the file was not found
|
||||
@@ -1404,10 +1414,10 @@ namespace ts {
|
||||
* to get an updated SourceFile.
|
||||
*
|
||||
* @param fileName The name of the file requested
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* @param compilationSettings Some compilation settings like target affects the
|
||||
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
|
||||
* multiple copies of the same file for different compilation settings.
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(
|
||||
@@ -1579,7 +1589,7 @@ namespace ts {
|
||||
sourceFile: SourceFile;
|
||||
|
||||
// The number of language services that this source file is referenced in. When no more
|
||||
// language services are referencing the file, then the file can be removed from the
|
||||
// language services are referencing the file, then the file can be removed from the
|
||||
// registry.
|
||||
languageServiceRefCount: number;
|
||||
owners: string[];
|
||||
@@ -1634,8 +1644,8 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
// Cache host information about scrip Should be refreshed
|
||||
// at each language service public entry point, since we don't know when
|
||||
// Cache host information about scrip Should be refreshed
|
||||
// at each language service public entry point, since we don't know when
|
||||
// set of scripts handled by the host changes.
|
||||
class HostCache {
|
||||
private fileNameToEntry: FileMap<HostFileInformation>;
|
||||
@@ -1714,8 +1724,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
class SyntaxTreeCache {
|
||||
// For our syntactic only features, we also keep a cache of the syntax tree for the
|
||||
// currently edited file.
|
||||
// For our syntactic only features, we also keep a cache of the syntax tree for the
|
||||
// currently edited file.
|
||||
private currentFileName: string;
|
||||
private currentFileVersion: string;
|
||||
private currentFileScriptSnapshot: IScriptSnapshot;
|
||||
@@ -1760,20 +1770,21 @@ namespace ts {
|
||||
sourceFile.version = version;
|
||||
sourceFile.scriptSnapshot = scriptSnapshot;
|
||||
}
|
||||
|
||||
|
||||
export interface TranspileOptions {
|
||||
compilerOptions?: CompilerOptions;
|
||||
fileName?: string;
|
||||
reportDiagnostics?: boolean;
|
||||
moduleName?: string;
|
||||
renamedDependencies?: Map<string>;
|
||||
}
|
||||
|
||||
|
||||
export interface TranspileOutput {
|
||||
outputText: string;
|
||||
diagnostics?: Diagnostic[];
|
||||
sourceMapText?: string;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function will compile source text from 'input' argument using specified compiler options.
|
||||
* If not options are provided - it will use a set of default compiler options.
|
||||
@@ -1783,7 +1794,7 @@ namespace ts {
|
||||
* - 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;
|
||||
@@ -1791,7 +1802,7 @@ namespace ts {
|
||||
// Filename can be non-ts file.
|
||||
options.allowNonTsExtensions = true;
|
||||
|
||||
// We are not returning a sourceFile for lib file when asked by the program,
|
||||
// We are not returning a sourceFile for lib file when asked by the program,
|
||||
// so pass --noLib to avoid reporting a file not found error.
|
||||
options.noLib = true;
|
||||
|
||||
@@ -1806,12 +1817,13 @@ namespace ts {
|
||||
sourceFile.moduleName = transpileOptions.moduleName;
|
||||
}
|
||||
|
||||
sourceFile.renamedDependencies = transpileOptions.renamedDependencies;
|
||||
|
||||
let newLine = getNewLineCharacter(options);
|
||||
|
||||
// Output
|
||||
let outputText: string;
|
||||
let sourceMapText: string;
|
||||
|
||||
// Create a compilerHost object to allow the compiler to read and write files
|
||||
let compilerHost: CompilerHost = {
|
||||
getSourceFile: (fileName, target) => fileName === inputFileName ? sourceFile : undefined,
|
||||
@@ -1829,11 +1841,14 @@ namespace ts {
|
||||
useCaseSensitiveFileNames: () => false,
|
||||
getCanonicalFileName: fileName => fileName,
|
||||
getCurrentDirectory: () => "",
|
||||
getNewLine: () => newLine
|
||||
getNewLine: () => newLine,
|
||||
// these two methods should never be called in transpile scenarios since 'noResolve' is set to 'true'
|
||||
fileExists: (fileName): boolean => { throw new Error("Should never be called."); },
|
||||
readFile: (fileName): string => { throw new Error("Should never be called."); }
|
||||
};
|
||||
|
||||
let program = createProgram([inputFileName], options, compilerHost);
|
||||
|
||||
|
||||
let diagnostics: Diagnostic[];
|
||||
if (transpileOptions.reportDiagnostics) {
|
||||
diagnostics = [];
|
||||
@@ -1845,11 +1860,11 @@ namespace ts {
|
||||
|
||||
Debug.assert(outputText !== undefined, "Output generation failed");
|
||||
|
||||
return { outputText, diagnostics, sourceMapText };
|
||||
return { outputText, diagnostics, sourceMapText };
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a shortcut function for transpileModule - it accepts transpileOptions as parameters and returns only outputText part of the result.
|
||||
* This is a shortcut function for transpileModule - it accepts transpileOptions as parameters and returns only outputText part of the result.
|
||||
*/
|
||||
export function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string {
|
||||
let output = transpileModule(input, { compilerOptions, fileName, reportDiagnostics: !!diagnostics, moduleName });
|
||||
@@ -1870,19 +1885,19 @@ namespace ts {
|
||||
export let disableIncrementalParsing = false;
|
||||
|
||||
export function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile {
|
||||
// If we were given a text change range, and our version or open-ness changed, then
|
||||
// If we were given a text change range, and our version or open-ness changed, then
|
||||
// incrementally parse this file.
|
||||
if (textChangeRange) {
|
||||
if (version !== sourceFile.version) {
|
||||
// Once incremental parsing is ready, then just call into this function.
|
||||
if (!disableIncrementalParsing) {
|
||||
let newText: string;
|
||||
|
||||
|
||||
// grab the fragment from the beginning of the original text to the beginning of the span
|
||||
let prefix = textChangeRange.span.start !== 0
|
||||
? sourceFile.text.substr(0, textChangeRange.span.start)
|
||||
: "";
|
||||
|
||||
|
||||
// grab the fragment from the end of the span till the end of the original text
|
||||
let suffix = textSpanEnd(textChangeRange.span) !== sourceFile.text.length
|
||||
? sourceFile.text.substr(textSpanEnd(textChangeRange.span))
|
||||
@@ -1896,10 +1911,10 @@ namespace ts {
|
||||
// it was actual edit, fetch the fragment of new text that correspond to new span
|
||||
let changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength);
|
||||
// combine prefix, changed text and suffix
|
||||
newText = prefix && suffix
|
||||
newText = prefix && suffix
|
||||
? prefix + changedText + suffix
|
||||
: prefix
|
||||
? (prefix + changedText)
|
||||
? (prefix + changedText)
|
||||
: (changedText + suffix);
|
||||
}
|
||||
|
||||
@@ -1927,7 +1942,7 @@ namespace ts {
|
||||
return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents:*/ true);
|
||||
}
|
||||
|
||||
function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string {
|
||||
export function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string {
|
||||
return useCaseSensitivefileNames
|
||||
? ((fileName) => fileName)
|
||||
: ((fileName) => fileName.toLowerCase());
|
||||
@@ -1941,7 +1956,7 @@ namespace ts {
|
||||
let getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames);
|
||||
|
||||
function getKeyFromCompilationSettings(settings: CompilerOptions): string {
|
||||
return "_" + settings.target; // + "|" + settings.propagateEnumConstantoString()
|
||||
return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx;
|
||||
}
|
||||
|
||||
function getBucketForCompilationSettings(settings: CompilerOptions, createIfMissing: boolean): FileMap<DocumentRegistryEntry> {
|
||||
@@ -2005,7 +2020,7 @@ namespace ts {
|
||||
bucket.set(fileName, entry);
|
||||
}
|
||||
else {
|
||||
// We have an entry for this file. However, it may be for a different version of
|
||||
// We have an entry for this file. However, it may be for a different version of
|
||||
// the script snapshot. If so, update it appropriately. Otherwise, we can just
|
||||
// return it as is.
|
||||
if (entry.sourceFile.version !== version) {
|
||||
@@ -2050,6 +2065,7 @@ namespace ts {
|
||||
export function preProcessFile(sourceText: string, readImportFiles = true): PreProcessedFileInfo {
|
||||
let referencedFiles: FileReference[] = [];
|
||||
let importedFiles: FileReference[] = [];
|
||||
let ambientExternalModules: string[];
|
||||
let isNoDefaultLib = false;
|
||||
|
||||
function processTripleSlashDirectives(): void {
|
||||
@@ -2067,6 +2083,13 @@ namespace ts {
|
||||
});
|
||||
}
|
||||
|
||||
function recordAmbientExternalModule(): void {
|
||||
if (!ambientExternalModules) {
|
||||
ambientExternalModules = [];
|
||||
}
|
||||
ambientExternalModules.push(scanner.getTokenValue());
|
||||
}
|
||||
|
||||
function recordModuleName() {
|
||||
let importPath = scanner.getTokenValue();
|
||||
let pos = scanner.getTokenPos();
|
||||
@@ -2092,7 +2115,18 @@ namespace ts {
|
||||
// export {a as b} from "mod"
|
||||
|
||||
while (token !== SyntaxKind.EndOfFileToken) {
|
||||
if (token === SyntaxKind.ImportKeyword) {
|
||||
if (token === SyntaxKind.DeclareKeyword) {
|
||||
// declare module "mod"
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.ModuleKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
recordAmbientExternalModule();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (token === SyntaxKind.ImportKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
// import "mod";
|
||||
@@ -2100,7 +2134,7 @@ namespace ts {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
if (token === SyntaxKind.Identifier) {
|
||||
if (token === SyntaxKind.Identifier || isKeyword(token)) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.FromKeyword) {
|
||||
token = scanner.scan();
|
||||
@@ -2157,7 +2191,7 @@ namespace ts {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.AsKeyword) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.Identifier) {
|
||||
if (token === SyntaxKind.Identifier || isKeyword(token)) {
|
||||
token = scanner.scan();
|
||||
if (token === SyntaxKind.FromKeyword) {
|
||||
token = scanner.scan();
|
||||
@@ -2213,7 +2247,7 @@ namespace ts {
|
||||
processImport();
|
||||
}
|
||||
processTripleSlashDirectives();
|
||||
return { referencedFiles, importedFiles, isLibFile: isNoDefaultLib };
|
||||
return { referencedFiles, importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules };
|
||||
}
|
||||
|
||||
/// Helpers
|
||||
@@ -2520,18 +2554,22 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
// IMPORTANT - It is critical from this moment onward that we do not check
|
||||
// IMPORTANT - It is critical from this moment onward that we do not check
|
||||
// cancellation tokens. We are about to mutate source files from a previous program
|
||||
// instance. If we cancel midway through, we may end up in an inconsistent state where
|
||||
// the program points to old source files that have been invalidated because of
|
||||
// the program points to old source files that have been invalidated because of
|
||||
// incremental parsing.
|
||||
|
||||
let oldSettings = program && program.getCompilerOptions();
|
||||
let newSettings = hostCache.compilationSettings();
|
||||
let changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target;
|
||||
let changesInCompilationSettingsAffectSyntax = oldSettings &&
|
||||
(oldSettings.target !== newSettings.target ||
|
||||
oldSettings.module !== newSettings.module ||
|
||||
oldSettings.noResolve !== newSettings.noResolve ||
|
||||
oldSettings.jsx !== newSettings.jsx);
|
||||
|
||||
// Now create a new compiler
|
||||
let newProgram = createProgram(hostCache.getRootFileNames(), newSettings, {
|
||||
let compilerHost: CompilerHost = {
|
||||
getSourceFile: getOrCreateSourceFile,
|
||||
getCancellationToken: () => cancellationToken,
|
||||
getCanonicalFileName,
|
||||
@@ -2539,10 +2577,26 @@ namespace ts {
|
||||
getNewLine: () => getNewLineOrDefaultFromHost(host),
|
||||
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
|
||||
writeFile: (fileName, data, writeByteOrderMark) => { },
|
||||
getCurrentDirectory: () => host.getCurrentDirectory()
|
||||
});
|
||||
getCurrentDirectory: () => host.getCurrentDirectory(),
|
||||
fileExists: (fileName): boolean => {
|
||||
// stub missing host functionality
|
||||
Debug.assert(!host.resolveModuleNames);
|
||||
return hostCache.getOrCreateEntry(fileName) !== undefined;
|
||||
},
|
||||
readFile: (fileName): string => {
|
||||
// stub missing host functionality
|
||||
let entry = hostCache.getOrCreateEntry(fileName);
|
||||
return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength());
|
||||
}
|
||||
};
|
||||
|
||||
// Release any files we have acquired in the old program but are
|
||||
if (host.resolveModuleNames) {
|
||||
compilerHost.resolveModuleNames = (moduleNames, containingFile) => host.resolveModuleNames(moduleNames, containingFile)
|
||||
}
|
||||
|
||||
let newProgram = createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program);
|
||||
|
||||
// Release any files we have acquired in the old program but are
|
||||
// not part of the new program.
|
||||
if (program) {
|
||||
let oldSourceFiles = program.getSourceFiles();
|
||||
@@ -2560,7 +2614,7 @@ namespace ts {
|
||||
|
||||
program = newProgram;
|
||||
|
||||
// Make sure all the nodes in the program are both bound, and have their parent
|
||||
// Make sure all the nodes in the program are both bound, and have their parent
|
||||
// pointers set property.
|
||||
program.getTypeChecker();
|
||||
return;
|
||||
@@ -2582,7 +2636,7 @@ namespace ts {
|
||||
// Check if the old program had this file already
|
||||
let oldSourceFile = program && program.getSourceFile(fileName);
|
||||
if (oldSourceFile) {
|
||||
// We already had a source file for this file name. Go to the registry to
|
||||
// We already had a source file for this file name. Go to the registry to
|
||||
// ensure that we get the right up to date version of it. We need this to
|
||||
// address the following 'race'. Specifically, say we have the following:
|
||||
//
|
||||
@@ -2593,15 +2647,15 @@ namespace ts {
|
||||
// LS2
|
||||
//
|
||||
// Each LS has a reference to file 'foo.ts' at version 1. LS2 then updates
|
||||
// it's version of 'foo.ts' to version 2. This will cause LS2 and the
|
||||
// DocumentRegistry to have version 2 of the document. HOwever, LS1 will
|
||||
// it's version of 'foo.ts' to version 2. This will cause LS2 and the
|
||||
// DocumentRegistry to have version 2 of the document. HOwever, LS1 will
|
||||
// have version 1. And *importantly* this source file will be *corrupt*.
|
||||
// The act of creating version 2 of the file irrevocably damages the version
|
||||
// 1 file.
|
||||
//
|
||||
// So, later when we call into LS1, we need to make sure that it doesn't use
|
||||
// it's source file any more, and instead defers to DocumentRegistry to get
|
||||
// either version 1, version 2 (or some other version) depending on what the
|
||||
// either version 1, version 2 (or some other version) depending on what the
|
||||
// host says should be used.
|
||||
return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version);
|
||||
}
|
||||
@@ -2667,7 +2721,7 @@ namespace ts {
|
||||
|
||||
/**
|
||||
* getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors
|
||||
* If '-d' enabled, report both semantic and emitter errors
|
||||
* If '-d' enabled, report both semantic and emitter errors
|
||||
*/
|
||||
function getSemanticDiagnostics(fileName: string): Diagnostic[] {
|
||||
synchronizeHostData();
|
||||
@@ -2675,7 +2729,7 @@ namespace ts {
|
||||
let targetSourceFile = getValidSourceFile(fileName);
|
||||
|
||||
// For JavaScript files, we don't want to report the normal typescript semantic errors.
|
||||
// Instead, we just report errors for using TypeScript-only constructs from within a
|
||||
// Instead, we just report errors for using TypeScript-only constructs from within a
|
||||
// JavaScript file.
|
||||
if (isJavaScript(fileName)) {
|
||||
return getJavaScriptSemanticDiagnostics(targetSourceFile);
|
||||
@@ -3055,7 +3109,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (isJavaScriptFile && type.flags & TypeFlags.Union) {
|
||||
// In javascript files, for union types, we don't just get the members that
|
||||
// In javascript files, for union types, we don't just get the members that
|
||||
// the individual types have in common, we also include all the members that
|
||||
// each individual type has. This is because we're going to add all identifiers
|
||||
// anyways. So we might as well elevate the members that were at least part
|
||||
@@ -3110,10 +3164,10 @@ namespace ts {
|
||||
// aggregating completion candidates. This is achieved in 'getScopeNode'
|
||||
// by finding the first node that encompasses a position, accounting for whether a node
|
||||
// is "complete" to decide whether a position belongs to the node.
|
||||
//
|
||||
//
|
||||
// However, at the end of an identifier, we are interested in the scope of the identifier
|
||||
// itself, but fall outside of the identifier. For instance:
|
||||
//
|
||||
//
|
||||
// xyz => x$
|
||||
//
|
||||
// the cursor is outside of both the 'x' and the arrow function 'xyz => x',
|
||||
@@ -3140,7 +3194,7 @@ namespace ts {
|
||||
/// TODO filter meaning based on the current context
|
||||
let symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias;
|
||||
symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3278,7 +3332,7 @@ namespace ts {
|
||||
|
||||
let rootDeclaration = getRootDeclaration(objectLikeContainer.parent);
|
||||
if (isVariableLike(rootDeclaration)) {
|
||||
// We don't want to complete using the type acquired by the shape
|
||||
// We don't want to complete using the type acquired by the shape
|
||||
// of the binding pattern; we are only interested in types acquired
|
||||
// through type declaration or inference.
|
||||
if (rootDeclaration.initializer || rootDeclaration.type) {
|
||||
@@ -3415,7 +3469,6 @@ namespace ts {
|
||||
parent.kind === SyntaxKind.JsxExpression &&
|
||||
parent.parent &&
|
||||
(parent.parent.kind === SyntaxKind.JsxAttribute)) {
|
||||
|
||||
return <JsxOpeningLikeElement>parent.parent.parent;
|
||||
}
|
||||
|
||||
@@ -3462,16 +3515,16 @@ namespace ts {
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A<T, |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A<T, |
|
||||
containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [x, y|
|
||||
|
||||
|
||||
case SyntaxKind.DotToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [.|
|
||||
|
||||
|
||||
case SyntaxKind.ColonToken:
|
||||
return containingNodeKind === SyntaxKind.BindingElement; // var {x :html|
|
||||
|
||||
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [x|
|
||||
|
||||
|
||||
case SyntaxKind.OpenParenToken:
|
||||
return containingNodeKind === SyntaxKind.CatchClause ||
|
||||
isFunction(containingNodeKind);
|
||||
@@ -3623,7 +3676,7 @@ namespace ts {
|
||||
|
||||
return filter(contextualMemberSymbols, m => !lookUp(existingMemberNames, m.name));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filters out completion suggestions from 'symbols' according to existing JSX attributes.
|
||||
*
|
||||
@@ -3706,7 +3759,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function createCompletionEntry(symbol: Symbol, location: Node): CompletionEntry {
|
||||
// Try to get a valid display name for this symbol, if we could not find one, then ignore it.
|
||||
// Try to get a valid display name for this symbol, if we could not find one, then ignore it.
|
||||
// We would like to only show things that can be added after a dot, so for instance numeric properties can
|
||||
// not be accessed with a dot (a.1 <- invalid)
|
||||
let displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, /*performCharacterChecks:*/ true, location);
|
||||
@@ -3714,10 +3767,10 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
||||
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
||||
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
||||
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
||||
// really we should consider passing the meaning for the node so that we don't report
|
||||
// that a suggestion for a value is an interface. We COULD also just do what
|
||||
// that a suggestion for a value is an interface. We COULD also just do what
|
||||
// 'getSymbolModifiers' does, which is to use the first declaration.
|
||||
|
||||
// Use a 'sortText' of 0' so that all symbol completion entries come before any other
|
||||
@@ -3763,8 +3816,8 @@ namespace ts {
|
||||
|
||||
// Find the symbol with the matching entry name.
|
||||
let target = program.getCompilerOptions().target;
|
||||
// We don't need to perform character checks here because we're only comparing the
|
||||
// name against 'entryName' (which is known to be good), not building a new
|
||||
// We don't need to perform character checks here because we're only comparing the
|
||||
// name against 'entryName' (which is known to be good), not building a new
|
||||
// completion entry.
|
||||
let symbol = forEach(symbols, s => getCompletionEntryDisplayNameForSymbol(s, target, /*performCharacterChecks:*/ false, location) === entryName ? s : undefined);
|
||||
|
||||
@@ -3779,7 +3832,7 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Didn't find a symbol with this name. See if we can find a keyword instead.
|
||||
let keywordCompletion = forEach(keywordCompletions, c => c.name === entryName);
|
||||
if (keywordCompletion) {
|
||||
@@ -3855,7 +3908,7 @@ namespace ts {
|
||||
Debug.assert(!!(rootSymbolFlags & SymbolFlags.Method));
|
||||
});
|
||||
if (!unionPropertyKind) {
|
||||
// If this was union of all methods,
|
||||
// If this was union of all methods,
|
||||
//make sure it has call signatures before we can label it as method
|
||||
let typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
|
||||
if (typeOfUnionProperty.getCallSignatures().length) {
|
||||
@@ -3929,7 +3982,7 @@ namespace ts {
|
||||
let allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
|
||||
|
||||
if (!contains(allSignatures, signature.target || signature)) {
|
||||
// Get the first signature if there
|
||||
// Get the first signature if there
|
||||
signature = allSignatures.length ? allSignatures[0] : undefined;
|
||||
}
|
||||
|
||||
@@ -4305,7 +4358,7 @@ namespace ts {
|
||||
|
||||
if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&
|
||||
!tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
|
||||
// Just add all the declarations.
|
||||
// Just add all the declarations.
|
||||
forEach(declarations, declaration => {
|
||||
result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
|
||||
});
|
||||
@@ -4416,7 +4469,7 @@ namespace ts {
|
||||
|
||||
// Because name in short-hand property assignment has two different meanings: property name and property value,
|
||||
// using go-to-definition at such position should go to the variable declaration of the property value rather than
|
||||
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition
|
||||
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition
|
||||
// is performed at the location of property access, we would like to go to definition of the property in the short-hand
|
||||
// assignment. This case and others are handled by the following code.
|
||||
if (node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
@@ -4482,7 +4535,7 @@ namespace ts {
|
||||
if (results) {
|
||||
let sourceFile = getCanonicalFileName(normalizeSlashes(fileName));
|
||||
|
||||
// Get occurrences only supports reporting occurrences for the file queried. So
|
||||
// Get occurrences only supports reporting occurrences for the file queried. So
|
||||
// filter down to that list.
|
||||
results = filter(results, r => getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile);
|
||||
}
|
||||
@@ -4709,7 +4762,7 @@ namespace ts {
|
||||
if (isFunctionBlock(parent) || parent.kind === SyntaxKind.SourceFile) {
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
// A throw-statement is only owned by a try-statement if the try-statement has
|
||||
// a catch clause, and if the throw-statement occurs within the try block.
|
||||
if (parent.kind === SyntaxKind.TryStatement) {
|
||||
@@ -4803,7 +4856,7 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else {
|
||||
// unsupported modifier
|
||||
return undefined;
|
||||
}
|
||||
@@ -5399,13 +5452,13 @@ namespace ts {
|
||||
// If we are past the end, stop looking
|
||||
if (position > end) break;
|
||||
|
||||
// We found a match. Make sure it's not part of a larger word (i.e. the char
|
||||
// We found a match. Make sure it's not part of a larger word (i.e. the char
|
||||
// before and after it have to be a non-identifier char).
|
||||
let endPosition = position + symbolNameLength;
|
||||
|
||||
if ((position === 0 || !isIdentifierPart(text.charCodeAt(position - 1), ScriptTarget.Latest)) &&
|
||||
(endPosition === sourceLength || !isIdentifierPart(text.charCodeAt(endPosition), ScriptTarget.Latest))) {
|
||||
// Found a real match. Keep searching.
|
||||
// Found a real match. Keep searching.
|
||||
positions.push(position);
|
||||
}
|
||||
position = text.indexOf(symbolName, position + symbolNameLength + 1);
|
||||
@@ -5472,9 +5525,9 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Search within node "container" for references for a search value, where the search value is defined as a
|
||||
/** Search within node "container" for references for a search value, where the search value is defined as a
|
||||
* tuple of(searchSymbol, searchText, searchLocation, and searchMeaning).
|
||||
* searchLocation: a node where the search value
|
||||
* searchLocation: a node where the search value
|
||||
*/
|
||||
function getReferencesInNode(container: Node,
|
||||
searchSymbol: Symbol,
|
||||
@@ -5500,7 +5553,7 @@ namespace ts {
|
||||
|
||||
let referenceLocation = getTouchingPropertyName(sourceFile, position);
|
||||
if (!isValidReferencePosition(referenceLocation, searchText)) {
|
||||
// This wasn't the start of a token. Check to see if it might be a
|
||||
// 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(sourceFile, position)) ||
|
||||
@@ -5825,7 +5878,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
// If the reference location is in an object literal, try to get the contextual type for the
|
||||
// If the reference location is in an object literal, try to get the contextual type for the
|
||||
// object literal, lookup the property symbol in the contextual type, and use this symbol to
|
||||
// compare to our searchSymbol
|
||||
if (isNameOfPropertyAssignment(referenceLocation)) {
|
||||
@@ -5842,7 +5895,7 @@ namespace ts {
|
||||
return rootSymbol;
|
||||
}
|
||||
|
||||
// Finally, try all properties with the same name in any type the containing type extended or implemented, and
|
||||
// Finally, try all properties with the same name in any type the containing type extended or implemented, and
|
||||
// see if any is in the list
|
||||
if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
let result: Symbol[] = [];
|
||||
@@ -6193,7 +6246,7 @@ namespace ts {
|
||||
}
|
||||
else if (isNameOfModuleDeclaration(nodeForStartPos)) {
|
||||
// If this is name of a module declarations, check if this is right side of dotted module name
|
||||
// If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of
|
||||
// If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of
|
||||
// Then this name is name from dotted module
|
||||
if (nodeForStartPos.parent.parent.kind === SyntaxKind.ModuleDeclaration &&
|
||||
(<ModuleDeclaration>nodeForStartPos.parent.parent).body === nodeForStartPos.parent) {
|
||||
@@ -6236,7 +6289,7 @@ namespace ts {
|
||||
// been canceled. That would be an enormous amount of chattyness, along with the all
|
||||
// the overhead of marshalling the data to/from the host. So instead we pick a few
|
||||
// reasonable node kinds to bother checking on. These node kinds represent high level
|
||||
// constructs that we would expect to see commonly, but just at a far less frequent
|
||||
// constructs that we would expect to see commonly, but just at a far less frequent
|
||||
// interval.
|
||||
//
|
||||
// For example, in checker.ts (around 750k) we only have around 600 of these constructs.
|
||||
@@ -6309,7 +6362,7 @@ namespace ts {
|
||||
*/
|
||||
function hasValueSideModule(symbol: Symbol): boolean {
|
||||
return forEach(symbol.declarations, declaration => {
|
||||
return declaration.kind === SyntaxKind.ModuleDeclaration &&
|
||||
return declaration.kind === SyntaxKind.ModuleDeclaration &&
|
||||
getModuleInstanceState(declaration) === ModuleInstanceState.Instantiated;
|
||||
});
|
||||
}
|
||||
@@ -6430,8 +6483,8 @@ namespace ts {
|
||||
// Only bother with the trivia if it at least intersects the span of interest.
|
||||
if (isComment(kind)) {
|
||||
classifyComment(token, kind, start, width);
|
||||
|
||||
// Classifying a comment might cause us to reuse the trivia scanner
|
||||
|
||||
// Classifying a comment might cause us to reuse the trivia scanner
|
||||
// (because of jsdoc comments). So after we classify the comment make
|
||||
// sure we set the scanner position back to where it needs to be.
|
||||
triviaScanner.setTextPos(end);
|
||||
@@ -6482,7 +6535,7 @@ namespace ts {
|
||||
|
||||
for (let tag of docComment.tags) {
|
||||
// As we walk through each tag, classify the portion of text from the end of
|
||||
// the last tag (or the start of the entire doc comment) as 'comment'.
|
||||
// the last tag (or the start of the entire doc comment) as 'comment'.
|
||||
if (tag.pos !== pos) {
|
||||
pushCommentRange(pos, tag.pos - pos);
|
||||
}
|
||||
@@ -6544,7 +6597,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function classifyDisabledMergeCode(text: string, start: number, end: number) {
|
||||
// Classify the line that the ======= marker is on as a comment. Then just lex
|
||||
// Classify the line that the ======= marker is on as a comment. Then just lex
|
||||
// all further tokens and add them to the result.
|
||||
for (var i = start; i < end; i++) {
|
||||
if (isLineBreak(text.charCodeAt(i))) {
|
||||
@@ -6587,7 +6640,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
// for accurate classification, the actual token should be passed in. however, for
|
||||
// for accurate classification, the actual token should be passed in. however, for
|
||||
// cases like 'disabled merge code' classification, we just get the token kind and
|
||||
// classify based on that instead.
|
||||
function classifyTokenType(tokenKind: SyntaxKind, token?: Node): ClassificationType {
|
||||
@@ -6874,11 +6927,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] {
|
||||
// Note: while getting todo comments seems like a syntactic operation, we actually
|
||||
// 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
|
||||
// this on every single file. If we treat this syntactically, then that will cause
|
||||
// us to populate and throw away the tree in our syntax tree cache for each file. By
|
||||
// treating this as a semantic operation, we can access any tree without throwing
|
||||
// treating this as a semantic operation, we can access any tree without throwing
|
||||
// anything away.
|
||||
synchronizeHostData();
|
||||
|
||||
@@ -6908,7 +6961,7 @@ namespace ts {
|
||||
// 0) The full match for the entire regexp.
|
||||
// 1) The preamble to the message portion.
|
||||
// 2) The message portion.
|
||||
// 3...N) The descriptor that was matched - by index. 'undefined' for each
|
||||
// 3...N) The descriptor that was matched - by index. 'undefined' for each
|
||||
// descriptor that didn't match. an actual value if it did match.
|
||||
//
|
||||
// i.e. 'undefined' in position 3 above means TODO(jason) didn't match.
|
||||
@@ -6934,7 +6987,7 @@ namespace ts {
|
||||
}
|
||||
Debug.assert(descriptor !== undefined);
|
||||
|
||||
// We don't want to match something like 'TODOBY', so we make sure a non
|
||||
// We don't want to match something like 'TODOBY', so we make sure a non
|
||||
// letter/digit follows the match.
|
||||
if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) {
|
||||
continue;
|
||||
@@ -6986,11 +7039,11 @@ namespace ts {
|
||||
// (?:(TODO\(jason\))|(HACK))
|
||||
//
|
||||
// Note that the outermost group is *not* a capture group, but the innermost groups
|
||||
// *are* capture groups. By capturing the inner literals we can determine after
|
||||
// *are* capture groups. By capturing the inner literals we can determine after
|
||||
// matching which descriptor we are dealing with.
|
||||
let literals = "(?:" + map(descriptors, d => "(" + escapeRegExp(d.text) + ")").join("|") + ")";
|
||||
|
||||
// After matching a descriptor literal, the following regexp matches the rest of the
|
||||
// After matching a descriptor literal, the following regexp matches the rest of the
|
||||
// text up to the end of the line (or */).
|
||||
let endOfLineOrEndOfComment = /(?:$|\*\/)/.source
|
||||
let messageRemainder = /(?:.*?)/.source
|
||||
@@ -7173,7 +7226,7 @@ namespace ts {
|
||||
|
||||
/// We do not have a full parser support to know when we should parse a regex or not
|
||||
/// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where
|
||||
/// we have a series of divide operator. this list allows us to be more accurate by ruling out
|
||||
/// we have a series of divide operator. this list allows us to be more accurate by ruling out
|
||||
/// locations where a regexp cannot exist.
|
||||
let noRegexTable: boolean[] = [];
|
||||
noRegexTable[SyntaxKind.Identifier] = true;
|
||||
@@ -7219,7 +7272,7 @@ namespace ts {
|
||||
keyword2 === SyntaxKind.ConstructorKeyword ||
|
||||
keyword2 === SyntaxKind.StaticKeyword) {
|
||||
|
||||
// Allow things like "public get", "public constructor" and "public static".
|
||||
// Allow things like "public get", "public constructor" and "public static".
|
||||
// These are all legal.
|
||||
return true;
|
||||
}
|
||||
@@ -7290,7 +7343,7 @@ namespace ts {
|
||||
function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult {
|
||||
return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
|
||||
}
|
||||
|
||||
|
||||
// If there is a syntactic classifier ('syntacticClassifierAbsent' is false),
|
||||
// we will be more conservative in order to avoid conflicting with the syntactic classifier.
|
||||
function getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications {
|
||||
@@ -7352,12 +7405,12 @@ namespace ts {
|
||||
// token. So the classification will go back to being an identifier. The moment the user
|
||||
// types again, number will become a keyword, then an identifier, etc. etc.
|
||||
//
|
||||
// To try to avoid this problem, we avoid classifying contextual keywords as keywords
|
||||
// To try to avoid this problem, we avoid classifying contextual keywords as keywords
|
||||
// when the user is potentially typing something generic. We just can't do a good enough
|
||||
// job at the lexical level, and so well leave it up to the syntactic classifier to make
|
||||
// the determination.
|
||||
//
|
||||
// In order to determine if the user is potentially typing something generic, we use a
|
||||
// In order to determine if the user is potentially typing something generic, we use a
|
||||
// weak heuristic where we track < and > tokens. It's a weak heuristic, but should
|
||||
// work well enough in practice.
|
||||
let angleBracketStack = 0;
|
||||
@@ -7375,7 +7428,7 @@ namespace ts {
|
||||
token = SyntaxKind.Identifier;
|
||||
}
|
||||
else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {
|
||||
// We have two keywords in a row. Only treat the second as a keyword if
|
||||
// We have two keywords in a row. Only treat the second as a keyword if
|
||||
// it's a sequence that could legally occur in the language. Otherwise
|
||||
// treat it as an identifier. This way, if someone writes "private var"
|
||||
// we recognize that 'var' is actually an identifier here.
|
||||
@@ -7383,7 +7436,7 @@ namespace ts {
|
||||
}
|
||||
else if (lastNonTriviaToken === SyntaxKind.Identifier &&
|
||||
token === SyntaxKind.LessThanToken) {
|
||||
// Could be the start of something generic. Keep track of that by bumping
|
||||
// Could be the start of something generic. Keep track of that by bumping
|
||||
// up the current count of generic contexts we may be in.
|
||||
angleBracketStack++;
|
||||
}
|
||||
@@ -7398,7 +7451,7 @@ namespace ts {
|
||||
token === SyntaxKind.BooleanKeyword ||
|
||||
token === SyntaxKind.SymbolKeyword) {
|
||||
if (angleBracketStack > 0 && !syntacticClassifierAbsent) {
|
||||
// If it looks like we're could be in something generic, don't classify this
|
||||
// If it looks like we're could be in something generic, don't classify this
|
||||
// as a keyword. We may just get overwritten by the syntactic classifier,
|
||||
// causing a noisy experience for the user.
|
||||
token = SyntaxKind.Identifier;
|
||||
@@ -7506,8 +7559,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (start === 0 && offset > 0) {
|
||||
// We're classifying the first token, and this was a case where we prepended
|
||||
// text. We should consider the start of this token to be at the start of
|
||||
// We're classifying the first token, and this was a case where we prepended
|
||||
// text. We should consider the start of this token to be at the start of
|
||||
// the original text.
|
||||
start += offset;
|
||||
}
|
||||
@@ -7630,11 +7683,11 @@ namespace ts {
|
||||
|
||||
/// getDefaultLibraryFilePath
|
||||
declare let __dirname: string;
|
||||
|
||||
|
||||
/**
|
||||
* Get the path of the default library files (lib.d.ts) as distributed with the typescript
|
||||
* node package.
|
||||
* The functionality is not supported if the ts module is consumed outside of a node module.
|
||||
* The functionality is not supported if the ts module is consumed outside of a node module.
|
||||
*/
|
||||
export function getDefaultLibFilePath(options: CompilerOptions): string {
|
||||
// Check __dirname is defined and that we are on a node.js system.
|
||||
|
||||
+30
-2
@@ -60,10 +60,12 @@ namespace ts {
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
useCaseSensitiveFileNames?(): boolean;
|
||||
|
||||
getModuleResolutionsForFile?(fileName: string): string;
|
||||
}
|
||||
|
||||
/** Public interface of the the of a config service shim instance.*/
|
||||
export interface CoreServicesShimHost extends Logger {
|
||||
export interface CoreServicesShimHost extends Logger, ModuleResolutionHost {
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type: string[]
|
||||
*
|
||||
@@ -270,8 +272,18 @@ namespace ts {
|
||||
private files: string[];
|
||||
private loggingEnabled = false;
|
||||
private tracingEnabled = false;
|
||||
|
||||
|
||||
public resolveModuleNames: (moduleName: string[], containingFile: string) => string[];
|
||||
|
||||
constructor(private shimHost: LanguageServiceShimHost) {
|
||||
// if shimHost is a COM object then property check will become method call with no arguments.
|
||||
// 'in' does not have this effect.
|
||||
if ("getModuleResolutionsForFile" in this.shimHost) {
|
||||
this.resolveModuleNames = (moduleNames: string[], containingFile: string) => {
|
||||
let resolutionsInFile = <Map<string>>JSON.parse(this.shimHost.getModuleResolutionsForFile(containingFile));
|
||||
return map(moduleNames, name => lookUp(resolutionsInFile, name));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public log(s: string): void {
|
||||
@@ -410,6 +422,14 @@ namespace ts {
|
||||
}
|
||||
return JSON.parse(encoded);
|
||||
}
|
||||
|
||||
public fileExists(fileName: string): boolean {
|
||||
return this.shimHost.fileExists(fileName);
|
||||
}
|
||||
|
||||
public readFile(fileName: string): string {
|
||||
return this.shimHost.readFile(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any, logPerformance: boolean): any {
|
||||
@@ -918,6 +938,13 @@ namespace ts {
|
||||
private forwardJSONCall(actionDescription: string, action: () => any): any {
|
||||
return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance);
|
||||
}
|
||||
|
||||
public resolveModuleName(fileName: string, moduleName: string, compilerOptionsJson: string): string {
|
||||
return this.forwardJSONCall(`resolveModuleName('${fileName}')`, () => {
|
||||
let compilerOptions = <CompilerOptions>JSON.parse(compilerOptionsJson);
|
||||
return resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host);
|
||||
});
|
||||
}
|
||||
|
||||
public getPreProcessedFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string {
|
||||
return this.forwardJSONCall(
|
||||
@@ -927,6 +954,7 @@ namespace ts {
|
||||
var convertResult = {
|
||||
referencedFiles: <IFileReference[]>[],
|
||||
importedFiles: <IFileReference[]>[],
|
||||
ambientExternalModules: result.ambientExternalModules,
|
||||
isLibFile: result.isLibFile
|
||||
};
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
|
||||
let blah = arguments[Symbol.iterator];
|
||||
>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 2, 7))
|
||||
>arguments : Symbol(arguments)
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
|
||||
let result = [];
|
||||
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7))
|
||||
|
||||
@@ -72,14 +72,14 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]];
|
||||
|
||||
interface myArray extends Array<Number> { }
|
||||
>myArray : Symbol(myArray, Decl(arrayLiterals2ES6.ts, 40, 67))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4090, 1))
|
||||
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
|
||||
|
||||
interface myArray2 extends Array<Number|String> { }
|
||||
>myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4090, 1))
|
||||
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4208, 1))
|
||||
|
||||
var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[]
|
||||
>d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3))
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
>foo : Symbol(foo, Decl(asyncArrowFunction1_es6.ts, 1, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
};
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
type MyPromise<T> = Promise<T>;
|
||||
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
|
||||
>T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15))
|
||||
|
||||
declare var MyPromise: typeof Promise;
|
||||
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
declare var p: Promise<number>;
|
||||
>p : Symbol(p, Decl(asyncAwait_es6.ts, 2, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
declare var mp: MyPromise<number>;
|
||||
>mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11))
|
||||
@@ -22,7 +22,7 @@ async function f0() { }
|
||||
|
||||
async function f1(): Promise<void> { }
|
||||
>f1 : Symbol(f1, Decl(asyncAwait_es6.ts, 5, 23))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
async function f3(): MyPromise<void> { }
|
||||
>f3 : Symbol(f3, Decl(asyncAwait_es6.ts, 6, 38))
|
||||
@@ -33,7 +33,7 @@ let f4 = async function() { }
|
||||
|
||||
let f5 = async function(): Promise<void> { }
|
||||
>f5 : Symbol(f5, Decl(asyncAwait_es6.ts, 10, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
let f6 = async function(): MyPromise<void> { }
|
||||
>f6 : Symbol(f6, Decl(asyncAwait_es6.ts, 11, 3))
|
||||
@@ -44,7 +44,7 @@ let f7 = async () => { };
|
||||
|
||||
let f8 = async (): Promise<void> => { };
|
||||
>f8 : Symbol(f8, Decl(asyncAwait_es6.ts, 14, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
let f9 = async (): MyPromise<void> => { };
|
||||
>f9 : Symbol(f9, Decl(asyncAwait_es6.ts, 15, 3))
|
||||
@@ -60,7 +60,7 @@ let f11 = async () => mp;
|
||||
|
||||
let f12 = async (): Promise<number> => mp;
|
||||
>f12 : Symbol(f12, Decl(asyncAwait_es6.ts, 18, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11))
|
||||
|
||||
let f13 = async (): MyPromise<number> => p;
|
||||
@@ -76,7 +76,7 @@ let o = {
|
||||
|
||||
async m2(): Promise<void> { },
|
||||
>m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 22, 16))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 23, 31))
|
||||
@@ -92,7 +92,7 @@ class C {
|
||||
|
||||
async m2(): Promise<void> { }
|
||||
>m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 28, 15))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 29, 30))
|
||||
@@ -103,7 +103,7 @@ class C {
|
||||
|
||||
static async m5(): Promise<void> { }
|
||||
>m5 : Symbol(C.m5, Decl(asyncAwait_es6.ts, 31, 22))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
static async m6(): MyPromise<void> { }
|
||||
>m6 : Symbol(C.m6, Decl(asyncAwait_es6.ts, 32, 37))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts ===
|
||||
async function await(): Promise<void> {
|
||||
>await : Symbol(await, Decl(asyncFunctionDeclaration11_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression1_es6.ts, 1, 32))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = await p || a;
|
||||
|
||||
@@ -4,11 +4,11 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression2_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression2_es6.ts, 1, 32))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = await p && a;
|
||||
|
||||
@@ -4,11 +4,11 @@ declare var a: number;
|
||||
|
||||
declare var p: Promise<number>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression3_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression3_es6.ts, 1, 31))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = await p + a;
|
||||
|
||||
@@ -4,11 +4,11 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression4_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression4_es6.ts, 1, 32))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = await p, a;
|
||||
|
||||
@@ -4,11 +4,11 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression5_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression5_es6.ts, 1, 32))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var o: { a: boolean; };
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression1_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 1, 32))
|
||||
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
|
||||
|
||||
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>pfn : Symbol(pfn, Decl(awaitCallExpression1_es6.ts, 4, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 4, 28))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 4, 42))
|
||||
>arg2 : Symbol(arg2, Decl(awaitCallExpression1_es6.ts, 4, 57))
|
||||
|
||||
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>po : Symbol(po, Decl(awaitCallExpression1_es6.ts, 5, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 5, 25))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 5, 29))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 5, 43))
|
||||
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression1_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = fn(a, a, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression2_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 1, 32))
|
||||
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
|
||||
|
||||
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>pfn : Symbol(pfn, Decl(awaitCallExpression2_es6.ts, 4, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 4, 28))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 4, 42))
|
||||
>arg2 : Symbol(arg2, Decl(awaitCallExpression2_es6.ts, 4, 57))
|
||||
|
||||
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>po : Symbol(po, Decl(awaitCallExpression2_es6.ts, 5, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 5, 25))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 5, 29))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 5, 43))
|
||||
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression2_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = fn(await p, a, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression3_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 1, 32))
|
||||
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
|
||||
|
||||
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>pfn : Symbol(pfn, Decl(awaitCallExpression3_es6.ts, 4, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 4, 28))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 4, 42))
|
||||
>arg2 : Symbol(arg2, Decl(awaitCallExpression3_es6.ts, 4, 57))
|
||||
|
||||
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>po : Symbol(po, Decl(awaitCallExpression3_es6.ts, 5, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 5, 25))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 5, 29))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 5, 43))
|
||||
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression3_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = fn(a, await p, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression4_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 1, 32))
|
||||
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
|
||||
|
||||
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>pfn : Symbol(pfn, Decl(awaitCallExpression4_es6.ts, 4, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 4, 28))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 4, 42))
|
||||
>arg2 : Symbol(arg2, Decl(awaitCallExpression4_es6.ts, 4, 57))
|
||||
|
||||
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>po : Symbol(po, Decl(awaitCallExpression4_es6.ts, 5, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 5, 25))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 5, 29))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 5, 43))
|
||||
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression4_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = (await pfn)(a, a, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression5_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 1, 32))
|
||||
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
|
||||
|
||||
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>pfn : Symbol(pfn, Decl(awaitCallExpression5_es6.ts, 4, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 4, 28))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 4, 42))
|
||||
>arg2 : Symbol(arg2, Decl(awaitCallExpression5_es6.ts, 4, 57))
|
||||
|
||||
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>po : Symbol(po, Decl(awaitCallExpression5_es6.ts, 5, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 5, 25))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 5, 29))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 5, 43))
|
||||
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression5_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = o.fn(a, a, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression6_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 1, 32))
|
||||
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
|
||||
|
||||
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>pfn : Symbol(pfn, Decl(awaitCallExpression6_es6.ts, 4, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 4, 28))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 4, 42))
|
||||
>arg2 : Symbol(arg2, Decl(awaitCallExpression6_es6.ts, 4, 57))
|
||||
|
||||
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>po : Symbol(po, Decl(awaitCallExpression6_es6.ts, 5, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 5, 25))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 5, 29))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 5, 43))
|
||||
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression6_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = o.fn(await p, a, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression7_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 1, 32))
|
||||
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
|
||||
|
||||
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>pfn : Symbol(pfn, Decl(awaitCallExpression7_es6.ts, 4, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 4, 28))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 4, 42))
|
||||
>arg2 : Symbol(arg2, Decl(awaitCallExpression7_es6.ts, 4, 57))
|
||||
|
||||
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>po : Symbol(po, Decl(awaitCallExpression7_es6.ts, 5, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 5, 25))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 5, 29))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 5, 43))
|
||||
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression7_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = o.fn(a, await p, a);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare var a: boolean;
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitCallExpression8_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 1, 32))
|
||||
@@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
|
||||
|
||||
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>pfn : Symbol(pfn, Decl(awaitCallExpression8_es6.ts, 4, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 4, 28))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 4, 42))
|
||||
>arg2 : Symbol(arg2, Decl(awaitCallExpression8_es6.ts, 4, 57))
|
||||
|
||||
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
|
||||
>po : Symbol(po, Decl(awaitCallExpression8_es6.ts, 5, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
>fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 5, 25))
|
||||
>arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 5, 29))
|
||||
>arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 5, 43))
|
||||
@@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitCallExpression8_es6.ts, 5, 84))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4987, 1), Decl(lib.d.ts, 5073, 11))
|
||||
|
||||
"before";
|
||||
var b = (await po).fn(a, a, a);
|
||||
|
||||
@@ -94,7 +94,7 @@ xa[1].foo(1, 2, ...a, "abc");
|
||||
>a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3))
|
||||
|
||||
(<Function>xa[1].foo)(...[1, 2, "abc"]);
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 1368, 1))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 4008, 1))
|
||||
>xa[1].foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13))
|
||||
>xa : Symbol(xa, Decl(callWithSpreadES6.ts, 11, 3))
|
||||
>foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13))
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [tests/cases/compiler/commonjsSafeImport.ts] ////
|
||||
|
||||
//// [10_lib.ts]
|
||||
|
||||
export function Foo() {}
|
||||
|
||||
//// [main.ts]
|
||||
import { Foo } from './10_lib';
|
||||
|
||||
Foo();
|
||||
|
||||
|
||||
//// [10_lib.js]
|
||||
function Foo() { }
|
||||
exports.Foo = Foo;
|
||||
//// [main.js]
|
||||
var _10_lib_1 = require('./10_lib');
|
||||
_10_lib_1.Foo();
|
||||
|
||||
|
||||
//// [10_lib.d.ts]
|
||||
export declare function Foo(): void;
|
||||
//// [main.d.ts]
|
||||
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/compiler/10_lib.ts ===
|
||||
|
||||
export function Foo() {}
|
||||
>Foo : Symbol(Foo, Decl(10_lib.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/main.ts ===
|
||||
import { Foo } from './10_lib';
|
||||
>Foo : Symbol(Foo, Decl(main.ts, 0, 8))
|
||||
|
||||
Foo();
|
||||
>Foo : Symbol(Foo, Decl(main.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/10_lib.ts ===
|
||||
|
||||
export function Foo() {}
|
||||
>Foo : () => void
|
||||
|
||||
=== tests/cases/compiler/main.ts ===
|
||||
import { Foo } from './10_lib';
|
||||
>Foo : () => void
|
||||
|
||||
Foo();
|
||||
>Foo() : void
|
||||
>Foo : () => void
|
||||
|
||||
@@ -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 >
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,18 +8,18 @@
|
||||
|
||||
type arrayString = Array<String>
|
||||
>arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES5.ts, 0, 0))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4090, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4208, 1))
|
||||
|
||||
type someArray = Array<String> | number[];
|
||||
>someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES5.ts, 7, 32))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4090, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4208, 1))
|
||||
|
||||
type stringOrNumArray = Array<String|Number>;
|
||||
>stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES5.ts, 8, 42))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4090, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4208, 1))
|
||||
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
|
||||
|
||||
function a1(...x: (number|string)[]) { }
|
||||
@@ -33,8 +33,8 @@ function a2(...a) { }
|
||||
function a3(...a: Array<String>) { }
|
||||
>a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES5.ts, 12, 21))
|
||||
>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5.ts, 13, 12))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4090, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4208, 1))
|
||||
|
||||
function a4(...a: arrayString) { }
|
||||
>a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES5.ts, 13, 36))
|
||||
|
||||
@@ -8,18 +8,18 @@
|
||||
|
||||
type arrayString = Array<String>
|
||||
>arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES6.ts, 0, 0))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4090, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4208, 1))
|
||||
|
||||
type someArray = Array<String> | number[];
|
||||
>someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES6.ts, 7, 32))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4090, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4208, 1))
|
||||
|
||||
type stringOrNumArray = Array<String|Number>;
|
||||
>stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES6.ts, 8, 42))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4090, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4208, 1))
|
||||
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
|
||||
|
||||
function a1(...x: (number|string)[]) { }
|
||||
@@ -33,8 +33,8 @@ function a2(...a) { }
|
||||
function a3(...a: Array<String>) { }
|
||||
>a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES6.ts, 12, 21))
|
||||
>a : Symbol(a, Decl(destructuringParameterDeclaration3ES6.ts, 13, 12))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4090, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4208, 1))
|
||||
|
||||
function a4(...a: arrayString) { }
|
||||
>a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES6.ts, 13, 36))
|
||||
|
||||
@@ -5,7 +5,7 @@ function f() {
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1704, 60))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4356, 60))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
|
||||
let arguments = 100;
|
||||
|
||||
@@ -8,7 +8,7 @@ function f() {
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1704, 60))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4356, 60))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
|
||||
const arguments = 100;
|
||||
|
||||
@@ -8,7 +8,7 @@ function f() {
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1704, 60))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4356, 60))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
|
||||
return () => arguments[0];
|
||||
|
||||
@@ -9,7 +9,7 @@ function f() {
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1704, 60))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4356, 60))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
|
||||
return () => arguments[0];
|
||||
|
||||
@@ -10,7 +10,7 @@ function f() {
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1704, 60))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4356, 60))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
|
||||
return () => arguments;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,6 +4,6 @@ var v: string;
|
||||
|
||||
for (v of [""].values()) { }
|
||||
>v : Symbol(v, Decl(for-of13.ts, 0, 3))
|
||||
>[""].values : Symbol(Array.values, Decl(lib.d.ts, 1466, 37))
|
||||
>values : Symbol(Array.values, Decl(lib.d.ts, 1466, 37))
|
||||
>[""].values : Symbol(Array.values, Decl(lib.d.ts, 4118, 37))
|
||||
>values : Symbol(Array.values, Decl(lib.d.ts, 4118, 37))
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ class StringIterator {
|
||||
};
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
|
||||
return this;
|
||||
>this : Symbol(StringIterator, Decl(for-of18.ts, 1, 33))
|
||||
|
||||
@@ -27,9 +27,9 @@ class FooIterator {
|
||||
};
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
|
||||
return this;
|
||||
>this : Symbol(FooIterator, Decl(for-of19.ts, 4, 13))
|
||||
|
||||
@@ -27,9 +27,9 @@ class FooIterator {
|
||||
};
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
|
||||
return this;
|
||||
>this : Symbol(FooIterator, Decl(for-of20.ts, 4, 13))
|
||||
|
||||
@@ -27,9 +27,9 @@ class FooIterator {
|
||||
};
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
|
||||
return this;
|
||||
>this : Symbol(FooIterator, Decl(for-of21.ts, 4, 13))
|
||||
|
||||
@@ -28,9 +28,9 @@ class FooIterator {
|
||||
};
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
|
||||
return this;
|
||||
>this : Symbol(FooIterator, Decl(for-of22.ts, 5, 13))
|
||||
|
||||
@@ -27,9 +27,9 @@ class FooIterator {
|
||||
};
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
|
||||
return this;
|
||||
>this : Symbol(FooIterator, Decl(for-of23.ts, 4, 13))
|
||||
|
||||
@@ -10,9 +10,9 @@ class StringIterator {
|
||||
>StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 1, 37))
|
||||
|
||||
[Symbol.iterator]() {
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
|
||||
return x;
|
||||
>x : Symbol(x, Decl(for-of25.ts, 0, 3))
|
||||
|
||||
@@ -16,9 +16,9 @@ class StringIterator {
|
||||
>x : Symbol(x, Decl(for-of26.ts, 0, 3))
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
|
||||
return this;
|
||||
>this : Symbol(StringIterator, Decl(for-of26.ts, 1, 37))
|
||||
|
||||
@@ -7,7 +7,7 @@ class StringIterator {
|
||||
>StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 37))
|
||||
|
||||
[Symbol.iterator]: any;
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ class StringIterator {
|
||||
>next : Symbol(next, Decl(for-of28.ts, 2, 22))
|
||||
|
||||
[Symbol.iterator]() {
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
|
||||
return this;
|
||||
>this : Symbol(StringIterator, Decl(for-of28.ts, 0, 37))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of37.ts ===
|
||||
var map = new Map([["", true]]);
|
||||
>map : Symbol(map, Decl(for-of37.ts, 0, 3))
|
||||
>Map : Symbol(Map, Decl(lib.d.ts, 1877, 1), Decl(lib.d.ts, 1900, 11))
|
||||
>Map : Symbol(Map, Decl(lib.d.ts, 4572, 1), Decl(lib.d.ts, 4595, 11))
|
||||
|
||||
for (var v of map) {
|
||||
>v : Symbol(v, Decl(for-of37.ts, 1, 8))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of38.ts ===
|
||||
var map = new Map([["", true]]);
|
||||
>map : Symbol(map, Decl(for-of38.ts, 0, 3))
|
||||
>Map : Symbol(Map, Decl(lib.d.ts, 1877, 1), Decl(lib.d.ts, 1900, 11))
|
||||
>Map : Symbol(Map, Decl(lib.d.ts, 4572, 1), Decl(lib.d.ts, 4595, 11))
|
||||
|
||||
for (var [k, v] of map) {
|
||||
>k : Symbol(k, Decl(for-of38.ts, 1, 10))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of40.ts ===
|
||||
var map = new Map([["", true]]);
|
||||
>map : Symbol(map, Decl(for-of40.ts, 0, 3))
|
||||
>Map : Symbol(Map, Decl(lib.d.ts, 1877, 1), Decl(lib.d.ts, 1900, 11))
|
||||
>Map : Symbol(Map, Decl(lib.d.ts, 4572, 1), Decl(lib.d.ts, 4595, 11))
|
||||
|
||||
for (var [k = "", v = false] of map) {
|
||||
>k : Symbol(k, Decl(for-of40.ts, 1, 10))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of44.ts ===
|
||||
var array: [number, string | boolean | symbol][] = [[0, ""], [0, true], [1, Symbol()]]
|
||||
>array : Symbol(array, Decl(for-of44.ts, 0, 3))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
|
||||
for (var [num, strBoolSym] of array) {
|
||||
>num : Symbol(num, Decl(for-of44.ts, 1, 10))
|
||||
|
||||
@@ -5,7 +5,7 @@ var k: string, v: boolean;
|
||||
|
||||
var map = new Map([["", true]]);
|
||||
>map : Symbol(map, Decl(for-of45.ts, 1, 3))
|
||||
>Map : Symbol(Map, Decl(lib.d.ts, 1877, 1), Decl(lib.d.ts, 1900, 11))
|
||||
>Map : Symbol(Map, Decl(lib.d.ts, 4572, 1), Decl(lib.d.ts, 4595, 11))
|
||||
|
||||
for ([k = "", v = false] of map) {
|
||||
>k : Symbol(k, Decl(for-of45.ts, 0, 3))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of50.ts ===
|
||||
var map = new Map([["", true]]);
|
||||
>map : Symbol(map, Decl(for-of50.ts, 0, 3))
|
||||
>Map : Symbol(Map, Decl(lib.d.ts, 1877, 1), Decl(lib.d.ts, 1900, 11))
|
||||
>Map : Symbol(Map, Decl(lib.d.ts, 4572, 1), Decl(lib.d.ts, 4595, 11))
|
||||
|
||||
for (const [k, v] of map) {
|
||||
>k : Symbol(k, Decl(for-of50.ts, 1, 12))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of57.ts ===
|
||||
var iter: Iterable<number>;
|
||||
>iter : Symbol(iter, Decl(for-of57.ts, 0, 3))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4333, 1))
|
||||
|
||||
for (let num of iter) { }
|
||||
>num : Symbol(num, Decl(for-of57.ts, 1, 8))
|
||||
|
||||
@@ -3,9 +3,9 @@ class C {
|
||||
>C : Symbol(C, Decl(generatorES6_6.ts, 0, 0))
|
||||
|
||||
*[Symbol.iterator]() {
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3839, 102), Decl(lib.d.ts, 3945, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3889, 31))
|
||||
|
||||
let a = yield 1;
|
||||
>a : Symbol(a, Decl(generatorES6_6.ts, 2, 7))
|
||||
|
||||
@@ -5,15 +5,15 @@ class C {
|
||||
f(s: string): Iterable<any>;
|
||||
>f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32))
|
||||
>s : Symbol(s, Decl(generatorOverloads4.ts, 1, 6))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4333, 1))
|
||||
|
||||
f(s: number): Iterable<any>;
|
||||
>f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32))
|
||||
>s : Symbol(s, Decl(generatorOverloads4.ts, 2, 6))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4333, 1))
|
||||
|
||||
*f(s: any): Iterable<any> { }
|
||||
>f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32))
|
||||
>s : Symbol(s, Decl(generatorOverloads4.ts, 3, 7))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4333, 1))
|
||||
}
|
||||
|
||||
@@ -5,15 +5,15 @@ module M {
|
||||
function f(s: string): Iterable<any>;
|
||||
>f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41))
|
||||
>s : Symbol(s, Decl(generatorOverloads5.ts, 1, 15))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4333, 1))
|
||||
|
||||
function f(s: number): Iterable<any>;
|
||||
>f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41))
|
||||
>s : Symbol(s, Decl(generatorOverloads5.ts, 2, 15))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4333, 1))
|
||||
|
||||
function* f(s: any): Iterable<any> { }
|
||||
>f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41))
|
||||
>s : Symbol(s, Decl(generatorOverloads5.ts, 3, 16))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4333, 1))
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck1.ts ===
|
||||
function* g1(): Iterator<string> { }
|
||||
>g1 : Symbol(g1, Decl(generatorTypeCheck1.ts, 0, 0))
|
||||
>Iterator : Symbol(Iterator, Decl(lib.d.ts, 1675, 1))
|
||||
>Iterator : Symbol(Iterator, Decl(lib.d.ts, 4327, 1))
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck10.ts ===
|
||||
function* g(): IterableIterator<any> {
|
||||
>g : Symbol(g, Decl(generatorTypeCheck10.ts, 0, 0))
|
||||
>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 1685, 1))
|
||||
>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4337, 1))
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user