Merge branch 'master' into publicTransformers

This commit is contained in:
Ron Buckton 2017-02-09 15:44:51 -08:00
commit cd22d81c67
239 changed files with 2400 additions and 839 deletions

View File

@ -37,7 +37,6 @@ if (process.env.path !== undefined) {
}
function filesFromConfig(configPath) {
console.log(configPath);
var configText = fs.readFileSync(configPath).toString();
var config = ts.parseConfigFileTextToJson(configPath, configText, /*stripComments*/ true);
if (config.error) {

View File

@ -3322,7 +3322,7 @@ namespace ts {
type;
}
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration: VariableLikeDeclaration) {
function getTypeForDeclarationFromJSDocComment(declaration: Node ) {
const jsdocType = getJSDocType(declaration);
if (jsdocType) {
return getTypeFromTypeNode(jsdocType);
@ -3350,7 +3350,7 @@ namespace ts {
// If this is a variable in a JavaScript file, then use the JSDoc type (if it has
// one as its type), otherwise fallback to the below standard TS codepaths to
// try to figure it out.
const type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration);
const type = getTypeForDeclarationFromJSDocComment(declaration);
if (type && type !== unknownType) {
return type;
}
@ -3445,6 +3445,27 @@ namespace ts {
return undefined;
}
// Return the inferred type for a variable, parameter, or property declaration
function getTypeForJSSpecialPropertyDeclaration(declaration: Declaration): Type {
const expression = declaration.kind === SyntaxKind.BinaryExpression ? <BinaryExpression>declaration :
declaration.kind === SyntaxKind.PropertyAccessExpression ? <BinaryExpression>getAncestor(declaration, SyntaxKind.BinaryExpression) :
undefined;
if (!expression) {
return unknownType;
}
if (expression.flags & NodeFlags.JavaScriptFile) {
// If there is a JSDoc type, use it
const type = getTypeForDeclarationFromJSDocComment(expression.parent);
if (type && type !== unknownType) {
return getWidenedType(type);
}
}
return getWidenedLiteralType(checkExpressionCached(expression.right));
}
// Return the type implied by a binding pattern element. This is the type of the initializer of the element if
// one is present. Otherwise, if the element is itself a binding pattern, it is the type implied by the binding
// pattern. Otherwise, it is the type any.
@ -3599,18 +3620,7 @@ namespace ts {
// * className.prototype.method = expr
if (declaration.kind === SyntaxKind.BinaryExpression ||
declaration.kind === SyntaxKind.PropertyAccessExpression && declaration.parent.kind === SyntaxKind.BinaryExpression) {
// Use JS Doc type if present on parent expression statement
if (declaration.flags & NodeFlags.JavaScriptFile) {
const jsdocType = getJSDocType(declaration.parent);
if (jsdocType) {
return links.type = getTypeFromTypeNode(jsdocType);
}
}
const declaredTypes = map(symbol.declarations,
decl => decl.kind === SyntaxKind.BinaryExpression ?
checkExpressionCached((<BinaryExpression>decl).right) :
checkExpressionCached((<BinaryExpression>decl.parent).right));
type = getUnionType(declaredTypes, /*subtypeReduction*/ true);
type = getWidenedType(getUnionType(map(symbol.declarations, getTypeForJSSpecialPropertyDeclaration), /*subtypeReduction*/ true));
}
else {
type = getWidenedTypeForVariableLikeDeclaration(<VariableLikeDeclaration>declaration, /*reportErrors*/ true);
@ -3653,7 +3663,7 @@ namespace ts {
const setter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.SetAccessor);
if (getter && getter.flags & NodeFlags.JavaScriptFile) {
const jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter);
const jsDocType = getTypeForDeclarationFromJSDocComment(getter);
if (jsDocType) {
return links.type = jsDocType;
}
@ -9535,11 +9545,19 @@ namespace ts {
}
function getAssignedTypeOfBinaryExpression(node: BinaryExpression): Type {
return node.parent.kind === SyntaxKind.ArrayLiteralExpression || node.parent.kind === SyntaxKind.PropertyAssignment ?
const isDestructuringDefaultAssignment =
node.parent.kind === SyntaxKind.ArrayLiteralExpression && isDestructuringAssignmentTarget(node.parent) ||
node.parent.kind === SyntaxKind.PropertyAssignment && isDestructuringAssignmentTarget(node.parent.parent);
return isDestructuringDefaultAssignment ?
getTypeWithDefault(getAssignedType(node), node.right) :
getTypeOfExpression(node.right);
}
function isDestructuringAssignmentTarget(parent: Node) {
return parent.parent.kind === SyntaxKind.BinaryExpression && (parent.parent as BinaryExpression).left === parent ||
parent.parent.kind === SyntaxKind.ForOfStatement && (parent.parent as ForOfStatement).initializer === parent;
}
function getAssignedTypeOfArrayLiteralElement(node: ArrayLiteralExpression, element: Expression): Type {
return getTypeOfDestructuredArrayElement(getAssignedType(node), indexOf(node.elements, element));
}

View File

@ -9,6 +9,7 @@ namespace ts {
emitNodeWithComments(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void;
emitBodyWithDetachedComments(node: Node, detachedRange: TextRange, emitCallback: (node: Node) => void): void;
emitTrailingCommentsOfPosition(pos: number): void;
emitLeadingCommentsOfPosition(pos: number): void;
}
export function createCommentWriter(printerOptions: PrinterOptions, emitPos: ((pos: number) => void) | undefined): CommentWriter {
@ -32,6 +33,7 @@ namespace ts {
emitNodeWithComments,
emitBodyWithDetachedComments,
emitTrailingCommentsOfPosition,
emitLeadingCommentsOfPosition,
};
function emitNodeWithComments(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) {
@ -275,6 +277,14 @@ namespace ts {
}
}
function emitLeadingCommentsOfPosition(pos: number) {
if (disabled || pos === -1) {
return;
}
emitLeadingComments(pos, /*isEmittedNode*/ true);
}
function emitTrailingComments(pos: number) {
forEachTrailingCommentToEmit(pos, emitTrailingComment);
}

View File

@ -1,4 +1,4 @@
/// <reference path="checker.ts" />
/// <reference path="checker.ts" />
/// <reference path="transformer.ts" />
/// <reference path="declarationEmitter.ts" />
/// <reference path="sourcemap.ts" />
@ -208,6 +208,7 @@ namespace ts {
emitNodeWithComments,
emitBodyWithDetachedComments,
emitTrailingCommentsOfPosition,
emitLeadingCommentsOfPosition,
} = comments;
let currentSourceFile: SourceFile;
@ -1336,6 +1337,10 @@ namespace ts {
else {
writeToken(SyntaxKind.OpenBraceToken, node.pos, /*contextNode*/ node);
emitBlockStatements(node);
// We have to call emitLeadingComments explicitly here because otherwise leading comments of the close brace token will not be emitted
increaseIndent();
emitLeadingCommentsOfPosition(node.statements.end);
decreaseIndent();
writeToken(SyntaxKind.CloseBraceToken, node.statements.end, /*contextNode*/ node);
}
}
@ -2218,6 +2223,15 @@ namespace ts {
// Write the delimiter if this is not the first node.
if (previousSibling) {
// i.e
// function commentedParameters(
// /* Parameter a */
// a
// /* End of parameter a */ -> this comment isn't considered to be trailing comment of parameter "a" due to newline
// ,
if (delimiter && previousSibling.end !== parentNode.end) {
emitLeadingCommentsOfPosition(previousSibling.end);
}
write(delimiter);
// Write either a line terminator or whitespace to separate the elements.
@ -2264,6 +2278,17 @@ namespace ts {
write(",");
}
// Emit any trailing comment of the last element in the list
// i.e
// var array = [...
// 2
// /* end of element 2 */
// ];
if (previousSibling && delimiter && previousSibling.end !== parentNode.end) {
emitLeadingCommentsOfPosition(previousSibling.end);
}
// Decrease the indent, if requested.
if (format & ListFormat.Indented) {
decreaseIndent();

View File

@ -486,7 +486,7 @@ namespace ts {
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
let options: any;
if (!directoryExists(directoryName) || (isUNCPath(directoryName) && process.platform === "win32")) {
// do nothing if either
// do nothing if either
// - target folder does not exist
// - this is UNC path on Windows (https://github.com/Microsoft/TypeScript/issues/13874)
return noOpFileWatcher;

View File

@ -183,7 +183,7 @@ namespace FourSlash {
// The current caret position in the active file
public currentCaretPosition = 0;
public lastKnownMarker: string = "";
public lastKnownMarker = "";
// The file that's currently 'opened'
public activeFile: FourSlashFile;
@ -452,7 +452,8 @@ namespace FourSlash {
}
private messageAtLastKnownMarker(message: string) {
return "Marker: " + this.lastKnownMarker + "\n" + message;
const locationDescription = this.lastKnownMarker ? this.lastKnownMarker : this.getLineColStringAtPosition(this.currentCaretPosition);
return `At ${locationDescription}: ${message}`;
}
private assertionMessageAtLastKnownMarker(msg: string) {
@ -562,7 +563,7 @@ namespace FourSlash {
}
public verifyGoToDefinitionIs(endMarker: string | string[]) {
this.verifyGoToXWorker(endMarker instanceof Array ? endMarker : [endMarker], () => this.getGoToDefinition());
this.verifyGoToXWorker(toArray(endMarker), () => this.getGoToDefinition());
}
public verifyGoToDefinition(arg0: any, endMarkerNames?: string | string[]) {
@ -582,7 +583,7 @@ namespace FourSlash {
if (endMarkerNames) {
this.verifyGoToXPlain(arg0, endMarkerNames, getDefs);
}
else if (arg0 instanceof Array) {
else if (ts.isArray(arg0)) {
const pairs: [string | string[], string | string[]][] = arg0;
for (const [start, end] of pairs) {
this.verifyGoToXPlain(start, end, getDefs);
@ -599,13 +600,8 @@ namespace FourSlash {
}
private verifyGoToXPlain(startMarkerNames: string | string[], endMarkerNames: string | string[], getDefs: () => ts.DefinitionInfo[] | undefined) {
if (startMarkerNames instanceof Array) {
for (const start of startMarkerNames) {
this.verifyGoToXSingle(start, endMarkerNames, getDefs);
}
}
else {
this.verifyGoToXSingle(startMarkerNames, endMarkerNames, getDefs);
for (const start of toArray(startMarkerNames)) {
this.verifyGoToXSingle(start, endMarkerNames, getDefs);
}
}
@ -617,7 +613,7 @@ namespace FourSlash {
private verifyGoToXSingle(startMarkerName: string, endMarkerNames: string | string[], getDefs: () => ts.DefinitionInfo[] | undefined) {
this.goToMarker(startMarkerName);
this.verifyGoToXWorker(endMarkerNames instanceof Array ? endMarkerNames : [endMarkerNames], getDefs);
this.verifyGoToXWorker(toArray(endMarkerNames), getDefs);
}
private verifyGoToXWorker(endMarkers: string[], getDefs: () => ts.DefinitionInfo[] | undefined) {
@ -899,8 +895,74 @@ namespace FourSlash {
}
}
public verifyRangesWithSameTextReferenceEachOther() {
this.rangesByText().forEach(ranges => this.verifyRangesReferenceEachOther(ranges));
public verifyReferenceGroups(startRanges: Range | Range[], parts: Array<{ definition: string, ranges: Range[] }>): void {
interface ReferenceJson { definition: string; ranges: ts.ReferenceEntry[]; }
type ReferencesJson = ReferenceJson[];
const fullExpected = parts.map<ReferenceJson>(({ definition, ranges }) => ({ definition, ranges: ranges.map(rangeToReferenceEntry) }));
for (const startRange of toArray(startRanges)) {
this.goToRangeStart(startRange);
const fullActual = this.findReferencesAtCaret().map<ReferenceJson>(({ definition, references }) => ({
definition: definition.displayParts.map(d => d.text).join(""),
ranges: references
}));
this.assertObjectsEqual<ReferencesJson>(fullActual, fullExpected);
}
function rangeToReferenceEntry(r: Range) {
let { isWriteAccess, isDefinition } = (r.marker && r.marker.data) || { isWriteAccess: false, isDefinition: false };
isWriteAccess = !!isWriteAccess; isDefinition = !!isDefinition;
return { fileName: r.fileName, textSpan: { start: r.start, length: r.end - r.start }, isWriteAccess, isDefinition }
}
}
public verifyNoReferences(markerNameOrRange?: string | Range) {
if (markerNameOrRange) {
if (typeof markerNameOrRange === "string") {
this.goToMarker(markerNameOrRange);
}
else {
this.goToRangeStart(markerNameOrRange);
}
}
const refs = this.getReferencesAtCaret();
if (refs && refs.length) {
console.log(refs);
this.raiseError("Expected getReferences to fail");
}
}
public verifySingleReferenceGroup(definition: string, ranges?: Range[]) {
ranges = ranges || this.getRanges();
this.verifyReferenceGroups(ranges, [{ definition, ranges }]);
}
private assertObjectsEqual<T>(fullActual: T, fullExpected: T, msgPrefix = ""): void {
const recur = <U>(actual: U, expected: U, path: string) => {
const fail = (msg: string) => {
console.log("Expected:", stringify(fullExpected));
console.log("Actual: ", stringify(fullActual));
this.raiseError(`${msgPrefix}At ${path}: ${msg}`);
};
for (const key in actual) if (ts.hasProperty(actual as any, key)) {
const ak = actual[key], ek = expected[key];
if (typeof ak === "object" && typeof ek === "object") {
recur(ak, ek, path ? path + "." + key : key);
}
else if (ak !== ek) {
fail(`Expected '${key}' to be '${ek}', got '${ak}'`);
}
}
for (const key in expected) if (ts.hasProperty(expected as any, key)) {
if (!ts.hasProperty(actual as any, key)) {
fail(`${msgPrefix}Missing property '${key}'`);
}
}
};
recur(fullActual, fullExpected, "");
}
public verifyDisplayPartsOfReferencedSymbol(expected: ts.SymbolDisplayPart[]) {
@ -974,7 +1036,7 @@ namespace FourSlash {
public verifyQuickInfos(namesAndTexts: { [name: string]: string | [string, string] }) {
for (const name in namesAndTexts) if (ts.hasProperty(namesAndTexts, name)) {
const text = namesAndTexts[name];
if (text instanceof Array) {
if (ts.isArray(text)) {
assert(text.length === 2);
const [expectedText, expectedDocumentation] = text;
this.verifyQuickInfoAt(name, expectedText, expectedDocumentation);
@ -1411,13 +1473,6 @@ namespace FourSlash {
Harness.IO.log(membersString);
}
public printReferences() {
const references = this.getReferencesAtCaret();
ts.forEach(references, entry => {
Harness.IO.log(stringify(entry));
});
}
public printContext() {
ts.forEach(this.languageServiceAdapterHost.getFilenames(), Harness.IO.log);
}
@ -3082,6 +3137,10 @@ ${code}
}
return ts.arrayFrom(set.keys());
}
function toArray<T>(x: T | T[]): T[] {
return ts.isArray(x) ? x : [x];
}
}
namespace FourSlashInterface {
@ -3346,6 +3405,18 @@ namespace FourSlashInterface {
this.state.verifyReferencesOf(start, references);
}
public referenceGroups(startRanges: FourSlash.Range[], parts: Array<{ definition: string, ranges: FourSlash.Range[] }>) {
this.state.verifyReferenceGroups(startRanges, parts);
}
public noReferences(markerNameOrRange?: string | FourSlash.Range) {
this.state.verifyNoReferences(markerNameOrRange);
}
public singleReferenceGroup(definition: string, ranges?: FourSlash.Range[]) {
this.state.verifySingleReferenceGroup(definition, ranges);
}
public rangesReferenceEachOther(ranges?: FourSlash.Range[]) {
this.state.verifyRangesReferenceEachOther(ranges);
}
@ -3354,10 +3425,6 @@ namespace FourSlashInterface {
this.state.verifyDisplayPartsOfReferencedSymbol(expected);
}
public rangesWithSameTextReferenceEachOther() {
this.state.verifyRangesWithSameTextReferenceEachOther();
}
public currentParameterHelpArgumentNameIs(name: string) {
this.state.verifyCurrentParameterHelpName(name);
}
@ -3660,10 +3727,6 @@ namespace FourSlashInterface {
this.state.printNavigationBar();
}
public printReferences() {
this.state.printReferences();
}
public printContext() {
this.state.printContext();
}

View File

@ -5,7 +5,7 @@
namespace Harness.LanguageService {
export class ScriptInfo {
public version: number = 1;
public version = 1;
public editRanges: { length: number; textChangeRange: ts.TextChangeRange; }[] = [];
private lineMap: number[] = undefined;
@ -594,7 +594,7 @@ namespace Harness.LanguageService {
class SessionServerHost implements ts.server.ServerHost, ts.server.Logger {
args: string[] = [];
newLine: string;
useCaseSensitiveFileNames: boolean = false;
useCaseSensitiveFileNames = false;
constructor(private host: NativeLanguageServiceHost) {
this.newLine = this.host.getNewLine();

View File

@ -3031,6 +3031,54 @@ namespace ts.projectSystem {
});
});
describe("emit with outFile or out setting", () => {
function test(opts: CompilerOptions, expectedUsesOutFile: boolean) {
const f1 = {
path: "/a/a.ts",
content: "let x = 1"
};
const f2 = {
path: "/a/b.ts",
content: "let y = 1"
};
const config = {
path: "/a/tsconfig.json",
content: JSON.stringify({
compilerOptions: opts,
compileOnSave: true
})
};
const host = createServerHost([f1, f2, config]);
const session = createSession(host);
session.executeCommand(<protocol.OpenRequest>{
seq: 1,
type: "request",
command: "open",
arguments: { file: f1.path }
});
checkNumberOfProjects(session.getProjectService(), { configuredProjects: 1 });
const { response } = session.executeCommand(<protocol.CompileOnSaveAffectedFileListRequest>{
seq: 2,
type: "request",
command: "compileOnSaveAffectedFileList",
arguments: { file: f1.path }
});
assert.equal((<protocol.CompileOnSaveAffectedFileListSingleProject[]>response).length, 1, "expected output for 1 project");
assert.equal((<protocol.CompileOnSaveAffectedFileListSingleProject[]>response)[0].fileNames.length, 2, "expected output for 1 project");
assert.equal((<protocol.CompileOnSaveAffectedFileListSingleProject[]>response)[0].projectUsesOutFile, expectedUsesOutFile, "usesOutFile");
}
it ("projectUsesOutFile should not be returned if not set", () => {
test({}, /*expectedUsesOutFile*/ false);
});
it ("projectUsesOutFile should be true if outFile is set", () => {
test({ outFile: "/a/out.js" }, /*expectedUsesOutFile*/ true);
});
it ("projectUsesOutFile should be true if out is set", () => {
test({ out: "/a/out.js" }, /*expectedUsesOutFile*/ true);
});
});
describe("import helpers", () => {
it("should not crash in tsserver", () => {
const f1 = {
@ -3067,7 +3115,7 @@ namespace ts.projectSystem {
let options = project.getCompilerOptions();
assert.isTrue(options.maxNodeModuleJsDepth === 2);
// Assert the option sticks
// Assert the option sticks
projectService.setCompilerOptionsForInferredProjects({ target: ScriptTarget.ES2016 });
project = projectService.inferredProjects[0];
options = project.getCompilerOptions();

View File

@ -46,6 +46,45 @@ namespace ts.projectSystem {
import typingsName = server.typingsInstaller.typingsName;
describe("local module", () => {
it("should not be picked up", () => {
const f1 = {
path: "/a/app.js",
content: "const c = require('./config');"
};
const f2 = {
path: "/a/config.js",
content: "export let x = 1"
};
const typesCache = "/cache"
const typesConfig = {
path: typesCache + "/node_modules/@types/config/index.d.ts",
content: "export let y: number;"
};
const config = {
path: "/a/jsconfig.json",
content: JSON.stringify({
compilerOptions: { moduleResolution: "commonjs" },
typeAcquisition: { enable: true }
})
};
const host = createServerHost([f1, f2, config, typesConfig]);
const installer = new (class extends Installer {
constructor() {
super(host, { typesRegistry: createTypesRegistry("config"), globalTypingsCacheLocation: typesCache });
}
installWorker(_requestId: number, _args: string[], _cwd: string, _cb: server.typingsInstaller.RequestCompletedAction) {
assert(false, "should not be called")
}
})();
const service = createProjectService(host, { typingsInstaller: installer });
service.openClientFile(f1.path);
service.checkNumberOfProjects({ configuredProjects: 1 });
checkProjectActualFiles(service.configuredProjects[0], [f1.path, f2.path]);
installer.installAll(0);
});
});
describe("typingsInstaller", () => {
it("configured projects (typings installed) 1", () => {
const file1 = {

View File

@ -1,7 +1,7 @@
/// <reference types="node" />
// TODO: extract services types
// TODO: extract services types
interface HostCancellationToken {
isCancellationRequested(): boolean;
}

View File

@ -28,7 +28,7 @@ namespace ts.server {
: undefined;
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host);
// return result immediately only if it is .ts, .tsx or .d.ts
if (!(primaryResult.resolvedModule && extensionIsTypeScript(primaryResult.resolvedModule.extension)) && globalCache !== undefined) {
if (moduleHasNonRelativeName(moduleName) && !(primaryResult.resolvedModule && extensionIsTypeScript(primaryResult.resolvedModule.extension)) && globalCache !== undefined) {
// otherwise try to load typings from @types
// create different collection of failed lookup locations for second pass

View File

@ -1239,6 +1239,11 @@ namespace ts.server.protocol {
* List of files names that should be recompiled
*/
fileNames: string[];
/**
* true if project uses outFile or out compiler option
*/
projectUsesOutFile: boolean;
}
/**

View File

@ -1040,7 +1040,8 @@ namespace ts.server {
if (project.compileOnSaveEnabled && project.languageServiceEnabled) {
result.push({
projectFileName: project.getProjectName(),
fileNames: project.getCompileOnSaveAffectedFileList(info)
fileNames: project.getCompileOnSaveAffectedFileList(info),
projectUsesOutFile: !!project.getCompilerOptions().outFile || !!project.getCompilerOptions().out
});
}
}

View File

@ -94,9 +94,9 @@ namespace ts.codefix {
return removeSingleItem(namedImports.elements, token);
}
// handle case where "import d, * as ns from './file'"
// handle case where "import d, * as ns from './file'"
// or "'import {a, b as ns} from './file'"
case SyntaxKind.ImportClause: // this covers both 'import |d|' and 'import |d,| *'
case SyntaxKind.ImportClause: // this covers both 'import |d|' and 'import |d,| *'
const importClause = <ImportClause>token.parent;
if (!importClause.namedBindings) { // |import d from './file'| or |import * as ns from './file'|
const importDecl = findImportDeclaration(importClause);

View File

@ -5,6 +5,10 @@ namespace ts.FindAllReferences {
return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, isForRename);
}
export function convertReferences(referenceSymbols: ReferencedSymbol[]): ReferenceEntry[] {
return referenceSymbols && flatMap(referenceSymbols, r => r.references);
}
export function getReferencedSymbolsForNode(typeChecker: TypeChecker, cancellationToken: CancellationToken, node: Node, sourceFiles: SourceFile[], findInStrings?: boolean, findInComments?: boolean, isForRename?: boolean, implementations?: boolean): ReferencedSymbol[] | undefined {
if (!implementations) {
const special = getReferencedSymbolsSpecial(node, sourceFiles, typeChecker, cancellationToken);
@ -411,7 +415,6 @@ namespace ts.FindAllReferences {
textSpan: createTextSpan(0, 1),
displayParts: [{ text: name, kind: ScriptElementKind.keyword }]
}
const references: ReferenceEntry[] = [];
for (const sourceFile of sourceFiles) {
cancellationToken.throwIfCancellationRequested();
@ -1316,20 +1319,6 @@ namespace ts.FindAllReferences {
return meaning;
}
export function convertReferences(referenceSymbols: ReferencedSymbol[]): ReferenceEntry[] {
if (!referenceSymbols) {
return undefined;
}
const referenceEntries: ReferenceEntry[] = [];
for (const referenceSymbol of referenceSymbols) {
addRange(referenceEntries, referenceSymbol.references);
}
return referenceEntries;
}
function isImplementation(node: Node): boolean {
if (!node) {
return false;

View File

@ -1415,7 +1415,6 @@ namespace ts {
function findReferences(fileName: string, position: number): ReferencedSymbol[] {
const referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false, /*isForRename*/false);
// Only include referenced symbols that have a valid definition.
return filter(referencedSymbols, rs => !!rs.definition);
}
@ -2016,9 +2015,5 @@ namespace ts {
throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. ");
}
function initializeServices() {
objectAllocator = getServicesObjectAllocator();
}
initializeServices();
objectAllocator = getServicesObjectAllocator();
}

View File

@ -26,5 +26,6 @@ define(["require", "exports"], function (require, exports) {
define(["require", "exports", "./foo_0"], function (require, exports, foo) {
"use strict";
if (foo.E1.A === 0) {
// Should cause runtime import - interesting optimization possibility, as gets inlined to 0.
}
});

View File

@ -17,6 +17,7 @@ var C = (function () {
}
C.prototype.P = function (ii, j, k) {
for (var i = 0; i < arguments.length; i++) {
// WScript.Echo("param: " + arguments[i]);
}
};
return C;

View File

@ -83,7 +83,9 @@ f(// comment 1
// comment 2
function () {
// comment 4
});
}
// comment 5
);
// body is not a block
f(function (_) { return 1 +
2; });

View File

@ -0,0 +1,21 @@
//// [assignmentNestedInLiterals.ts]
var target, x, y;
target = [x = 1, y = x];
var aegis, a, b;
aegis = { x: a = 1, y: b = a };
var kowloona, c, d;
for (kowloona of [c = 1, d = c]) {
}
//// [assignmentNestedInLiterals.js]
var target, x, y;
target = [x = 1, y = x];
var aegis, a, b;
aegis = { x: a = 1, y: b = a };
var kowloona, c, d;
for (var _i = 0, _a = [c = 1, d = c]; _i < _a.length; _i++) {
kowloona = _a[_i];
}

View File

@ -0,0 +1,37 @@
=== tests/cases/compiler/assignmentNestedInLiterals.ts ===
var target, x, y;
>target : Symbol(target, Decl(assignmentNestedInLiterals.ts, 0, 3))
>x : Symbol(x, Decl(assignmentNestedInLiterals.ts, 0, 11))
>y : Symbol(y, Decl(assignmentNestedInLiterals.ts, 0, 14))
target = [x = 1, y = x];
>target : Symbol(target, Decl(assignmentNestedInLiterals.ts, 0, 3))
>x : Symbol(x, Decl(assignmentNestedInLiterals.ts, 0, 11))
>y : Symbol(y, Decl(assignmentNestedInLiterals.ts, 0, 14))
>x : Symbol(x, Decl(assignmentNestedInLiterals.ts, 0, 11))
var aegis, a, b;
>aegis : Symbol(aegis, Decl(assignmentNestedInLiterals.ts, 3, 3))
>a : Symbol(a, Decl(assignmentNestedInLiterals.ts, 3, 10))
>b : Symbol(b, Decl(assignmentNestedInLiterals.ts, 3, 13))
aegis = { x: a = 1, y: b = a };
>aegis : Symbol(aegis, Decl(assignmentNestedInLiterals.ts, 3, 3))
>x : Symbol(x, Decl(assignmentNestedInLiterals.ts, 4, 9))
>a : Symbol(a, Decl(assignmentNestedInLiterals.ts, 3, 10))
>y : Symbol(y, Decl(assignmentNestedInLiterals.ts, 4, 19))
>b : Symbol(b, Decl(assignmentNestedInLiterals.ts, 3, 13))
>a : Symbol(a, Decl(assignmentNestedInLiterals.ts, 3, 10))
var kowloona, c, d;
>kowloona : Symbol(kowloona, Decl(assignmentNestedInLiterals.ts, 6, 3))
>c : Symbol(c, Decl(assignmentNestedInLiterals.ts, 6, 13))
>d : Symbol(d, Decl(assignmentNestedInLiterals.ts, 6, 16))
for (kowloona of [c = 1, d = c]) {
>kowloona : Symbol(kowloona, Decl(assignmentNestedInLiterals.ts, 6, 3))
>c : Symbol(c, Decl(assignmentNestedInLiterals.ts, 6, 13))
>d : Symbol(d, Decl(assignmentNestedInLiterals.ts, 6, 16))
>c : Symbol(c, Decl(assignmentNestedInLiterals.ts, 6, 13))
}

View File

@ -0,0 +1,51 @@
=== tests/cases/compiler/assignmentNestedInLiterals.ts ===
var target, x, y;
>target : any
>x : any
>y : any
target = [x = 1, y = x];
>target = [x = 1, y = x] : number[]
>target : any
>[x = 1, y = x] : number[]
>x = 1 : 1
>x : any
>1 : 1
>y = x : number
>y : any
>x : number
var aegis, a, b;
>aegis : any
>a : any
>b : any
aegis = { x: a = 1, y: b = a };
>aegis = { x: a = 1, y: b = a } : { x: number; y: number; }
>aegis : any
>{ x: a = 1, y: b = a } : { x: number; y: number; }
>x : number
>a = 1 : 1
>a : any
>1 : 1
>y : number
>b = a : number
>b : any
>a : number
var kowloona, c, d;
>kowloona : any
>c : any
>d : any
for (kowloona of [c = 1, d = c]) {
>kowloona : any
>[c = 1, d = c] : number[]
>c = 1 : 1
>c : any
>1 : 1
>d = c : number
>d : any
>c : number
}

View File

@ -0,0 +1,52 @@
//// [capturedLetConstInLoop13.ts]
class Main {
constructor() {
this.register("a", "b", "c");
}
private register(...names: string[]): void {
for (let name of names) {
this.bar({
[name + ".a"]: () => { this.foo(name); },
});
}
}
private bar(a: any): void { }
private foo(name: string): void { }
}
new Main();
//// [capturedLetConstInLoop13.js]
var Main = (function () {
function Main() {
this.register("a", "b", "c");
}
Main.prototype.register = function () {
var _this = this;
var names = [];
for (var _i = 0; _i < arguments.length; _i++) {
names[_i] = arguments[_i];
}
var _loop_1 = function (name) {
this_1.bar((_a = {},
_a[name + ".a"] = function () { _this.foo(name); },
_a));
var _a;
};
var this_1 = this;
for (var _a = 0, names_1 = names; _a < names_1.length; _a++) {
var name = names_1[_a];
_loop_1(name);
}
};
Main.prototype.bar = function (a) { };
Main.prototype.foo = function (name) { };
return Main;
}());
new Main();

View File

@ -0,0 +1,48 @@
=== tests/cases/compiler/capturedLetConstInLoop13.ts ===
class Main {
>Main : Symbol(Main, Decl(capturedLetConstInLoop13.ts, 0, 0))
constructor() {
this.register("a", "b", "c");
>this.register : Symbol(Main.register, Decl(capturedLetConstInLoop13.ts, 4, 5))
>this : Symbol(Main, Decl(capturedLetConstInLoop13.ts, 0, 0))
>register : Symbol(Main.register, Decl(capturedLetConstInLoop13.ts, 4, 5))
}
private register(...names: string[]): void {
>register : Symbol(Main.register, Decl(capturedLetConstInLoop13.ts, 4, 5))
>names : Symbol(names, Decl(capturedLetConstInLoop13.ts, 6, 21))
for (let name of names) {
>name : Symbol(name, Decl(capturedLetConstInLoop13.ts, 7, 16))
>names : Symbol(names, Decl(capturedLetConstInLoop13.ts, 6, 21))
this.bar({
>this.bar : Symbol(Main.bar, Decl(capturedLetConstInLoop13.ts, 13, 5))
>this : Symbol(Main, Decl(capturedLetConstInLoop13.ts, 0, 0))
>bar : Symbol(Main.bar, Decl(capturedLetConstInLoop13.ts, 13, 5))
[name + ".a"]: () => { this.foo(name); },
>name : Symbol(name, Decl(capturedLetConstInLoop13.ts, 7, 16))
>this.foo : Symbol(Main.foo, Decl(capturedLetConstInLoop13.ts, 15, 33))
>this : Symbol(Main, Decl(capturedLetConstInLoop13.ts, 0, 0))
>foo : Symbol(Main.foo, Decl(capturedLetConstInLoop13.ts, 15, 33))
>name : Symbol(name, Decl(capturedLetConstInLoop13.ts, 7, 16))
});
}
}
private bar(a: any): void { }
>bar : Symbol(Main.bar, Decl(capturedLetConstInLoop13.ts, 13, 5))
>a : Symbol(a, Decl(capturedLetConstInLoop13.ts, 15, 16))
private foo(name: string): void { }
>foo : Symbol(Main.foo, Decl(capturedLetConstInLoop13.ts, 15, 33))
>name : Symbol(name, Decl(capturedLetConstInLoop13.ts, 17, 16))
}
new Main();
>Main : Symbol(Main, Decl(capturedLetConstInLoop13.ts, 0, 0))

View File

@ -0,0 +1,59 @@
=== tests/cases/compiler/capturedLetConstInLoop13.ts ===
class Main {
>Main : Main
constructor() {
this.register("a", "b", "c");
>this.register("a", "b", "c") : void
>this.register : (...names: string[]) => void
>this : this
>register : (...names: string[]) => void
>"a" : "a"
>"b" : "b"
>"c" : "c"
}
private register(...names: string[]): void {
>register : (...names: string[]) => void
>names : string[]
for (let name of names) {
>name : string
>names : string[]
this.bar({
>this.bar({ [name + ".a"]: () => { this.foo(name); }, }) : void
>this.bar : (a: any) => void
>this : this
>bar : (a: any) => void
>{ [name + ".a"]: () => { this.foo(name); }, } : { [x: string]: () => void; }
[name + ".a"]: () => { this.foo(name); },
>name + ".a" : string
>name : string
>".a" : ".a"
>() => { this.foo(name); } : () => void
>this.foo(name) : void
>this.foo : (name: string) => void
>this : this
>foo : (name: string) => void
>name : string
});
}
}
private bar(a: any): void { }
>bar : (a: any) => void
>a : any
private foo(name: string): void { }
>foo : (name: string) => void
>name : string
}
new Main();
>new Main() : Main
>Main : typeof Main

View File

@ -0,0 +1,24 @@
//// [commentLeadingCloseBrace.ts]
declare function commentedParameters(...args): any;
function ifelse() {
if (commentedParameters(1, 2)) {
/*comment1*/
commentedParameters(3, 4);
/*comment2*/
} else {
commentedParameters(5, 6);
}
}
//// [commentLeadingCloseBrace.js]
function ifelse() {
if (commentedParameters(1, 2)) {
/*comment1*/
commentedParameters(3, 4);
/*comment2*/
}
else {
commentedParameters(5, 6);
}
}

View File

@ -0,0 +1,21 @@
=== tests/cases/compiler/commentLeadingCloseBrace.ts ===
declare function commentedParameters(...args): any;
>commentedParameters : Symbol(commentedParameters, Decl(commentLeadingCloseBrace.ts, 0, 0))
>args : Symbol(args, Decl(commentLeadingCloseBrace.ts, 0, 37))
function ifelse() {
>ifelse : Symbol(ifelse, Decl(commentLeadingCloseBrace.ts, 0, 51))
if (commentedParameters(1, 2)) {
>commentedParameters : Symbol(commentedParameters, Decl(commentLeadingCloseBrace.ts, 0, 0))
/*comment1*/
commentedParameters(3, 4);
>commentedParameters : Symbol(commentedParameters, Decl(commentLeadingCloseBrace.ts, 0, 0))
/*comment2*/
} else {
commentedParameters(5, 6);
>commentedParameters : Symbol(commentedParameters, Decl(commentLeadingCloseBrace.ts, 0, 0))
}
}

View File

@ -0,0 +1,30 @@
=== tests/cases/compiler/commentLeadingCloseBrace.ts ===
declare function commentedParameters(...args): any;
>commentedParameters : (...args: any[]) => any
>args : any[]
function ifelse() {
>ifelse : () => void
if (commentedParameters(1, 2)) {
>commentedParameters(1, 2) : any
>commentedParameters : (...args: any[]) => any
>1 : 1
>2 : 2
/*comment1*/
commentedParameters(3, 4);
>commentedParameters(3, 4) : any
>commentedParameters : (...args: any[]) => any
>3 : 3
>4 : 4
/*comment2*/
} else {
commentedParameters(5, 6);
>commentedParameters(5, 6) : any
>commentedParameters : (...args: any[]) => any
>5 : 5
>6 : 6
}
}

View File

@ -0,0 +1,17 @@
//// [commentOnArrayElement1.ts]
var array = [
/* element 1*/
1
/* end of element 1 */,
2
/* end of element 2 */
];
//// [commentOnArrayElement1.js]
var array = [
/* element 1*/
1
/* end of element 1 */ ,
2
/* end of element 2 */
];

View File

@ -0,0 +1,10 @@
=== tests/cases/compiler/commentOnArrayElement1.ts ===
var array = [
>array : Symbol(array, Decl(commentOnArrayElement1.ts, 0, 3))
/* element 1*/
1
/* end of element 1 */,
2
/* end of element 2 */
];

View File

@ -0,0 +1,15 @@
=== tests/cases/compiler/commentOnArrayElement1.ts ===
var array = [
>array : number[]
>[ /* element 1*/ 1 /* end of element 1 */, 2 /* end of element 2 */] : number[]
/* element 1*/
1
>1 : 1
/* end of element 1 */,
2
>2 : 2
/* end of element 2 */
];

View File

@ -0,0 +1,15 @@
//// [commentOnArrayElement2.ts]
var array = [
/* element 1*/
1 /* end of element 1 */,
2
/* end of element 2 */
];
//// [commentOnArrayElement2.js]
var array = [
/* element 1*/
1 /* end of element 1 */,
2
/* end of element 2 */
];

View File

@ -0,0 +1,9 @@
=== tests/cases/compiler/commentOnArrayElement2.ts ===
var array = [
>array : Symbol(array, Decl(commentOnArrayElement2.ts, 0, 3))
/* element 1*/
1 /* end of element 1 */,
2
/* end of element 2 */
];

View File

@ -0,0 +1,14 @@
=== tests/cases/compiler/commentOnArrayElement2.ts ===
var array = [
>array : number[]
>[ /* element 1*/ 1 /* end of element 1 */, 2 /* end of element 2 */] : number[]
/* element 1*/
1 /* end of element 1 */,
>1 : 1
2
>2 : 2
/* end of element 2 */
];

View File

@ -0,0 +1,19 @@
//// [commentOnArrayElement3.ts]
var array = [
/* element 1*/
1
/* end of element 1 */,
2
/* end of element 2 */, ,
/* extra comment */
];
//// [commentOnArrayElement3.js]
var array = [
/* element 1*/
1
/* end of element 1 */ ,
2
/* end of element 2 */ ,
,
];

View File

@ -0,0 +1,11 @@
=== tests/cases/compiler/commentOnArrayElement3.ts ===
var array = [
>array : Symbol(array, Decl(commentOnArrayElement3.ts, 0, 3))
/* element 1*/
1
/* end of element 1 */,
2
/* end of element 2 */, ,
/* extra comment */
];

View File

@ -0,0 +1,18 @@
=== tests/cases/compiler/commentOnArrayElement3.ts ===
var array = [
>array : number[]
>[ /* element 1*/ 1 /* end of element 1 */, 2 /* end of element 2 */, , /* extra comment */] : number[]
/* element 1*/
1
>1 : 1
/* end of element 1 */,
2
>2 : 2
/* end of element 2 */, ,
> : undefined
/* extra comment */
];

View File

@ -0,0 +1,20 @@
//// [commentOnParameter1.ts]
function commentedParameters(
/* Parameter a */
a
/* End of parameter a */
/* Parameter b */
,
b
/* End of parameter b */
){}
//// [commentOnParameter1.js]
function commentedParameters(
/* Parameter a */
a
/* End of parameter a */
/* Parameter b */
, b
/* End of parameter b */
) { }

View File

@ -0,0 +1,16 @@
=== tests/cases/compiler/commentOnParameter1.ts ===
function commentedParameters(
>commentedParameters : Symbol(commentedParameters, Decl(commentOnParameter1.ts, 0, 0))
/* Parameter a */
a
>a : Symbol(a, Decl(commentOnParameter1.ts, 0, 29))
/* End of parameter a */
/* Parameter b */
,
b
>b : Symbol(b, Decl(commentOnParameter1.ts, 5, 1))
/* End of parameter b */
){}

View File

@ -0,0 +1,16 @@
=== tests/cases/compiler/commentOnParameter1.ts ===
function commentedParameters(
>commentedParameters : (a: any, b: any) => void
/* Parameter a */
a
>a : any
/* End of parameter a */
/* Parameter b */
,
b
>b : any
/* End of parameter b */
){}

View File

@ -0,0 +1,18 @@
//// [commentOnParameter2.ts]
function commentedParameters(
/* Parameter a */
a /* End of parameter a */
/* Parameter b */
,
b
/* End of parameter b */
){}
//// [commentOnParameter2.js]
function commentedParameters(
/* Parameter a */
a /* End of parameter a */
/* Parameter b */
, b
/* End of parameter b */
) { }

View File

@ -0,0 +1,15 @@
=== tests/cases/compiler/commentOnParameter2.ts ===
function commentedParameters(
>commentedParameters : Symbol(commentedParameters, Decl(commentOnParameter2.ts, 0, 0))
/* Parameter a */
a /* End of parameter a */
>a : Symbol(a, Decl(commentOnParameter2.ts, 0, 29))
/* Parameter b */
,
b
>b : Symbol(b, Decl(commentOnParameter2.ts, 4, 1))
/* End of parameter b */
){}

View File

@ -0,0 +1,15 @@
=== tests/cases/compiler/commentOnParameter2.ts ===
function commentedParameters(
>commentedParameters : (a: any, b: any) => void
/* Parameter a */
a /* End of parameter a */
>a : any
/* Parameter b */
,
b
>b : any
/* End of parameter b */
){}

View File

@ -0,0 +1,9 @@
//// [commentOnParameter3.ts]
function commentedParameters(
a /* parameter a */,
b /* parameter b */,
/* extra comment */
) { }
//// [commentOnParameter3.js]
function commentedParameters(a /* parameter a */, b /* parameter b */) { }

View File

@ -0,0 +1,12 @@
=== tests/cases/compiler/commentOnParameter3.ts ===
function commentedParameters(
>commentedParameters : Symbol(commentedParameters, Decl(commentOnParameter3.ts, 0, 0))
a /* parameter a */,
>a : Symbol(a, Decl(commentOnParameter3.ts, 0, 29))
b /* parameter b */,
>b : Symbol(b, Decl(commentOnParameter3.ts, 1, 20))
/* extra comment */
) { }

View File

@ -0,0 +1,12 @@
=== tests/cases/compiler/commentOnParameter3.ts ===
function commentedParameters(
>commentedParameters : (a: any, b: any) => void
a /* parameter a */,
>a : any
b /* parameter b */,
>b : any
/* extra comment */
) { }

View File

@ -27,4 +27,5 @@ exports.C1 = C1;
"use strict";
var foo = require("./foo_0");
if (foo.C1.s1) {
// Should cause runtime import
}

View File

@ -391,6 +391,7 @@ var TestRunner = (function () {
}
}
if (testResult === false) {
//console.log(e.message);
}
}
if ((testcase.errorMessageRegEx !== undefined) && !exception) {

View File

@ -0,0 +1,17 @@
tests/cases/compiler/bar.ts(2,1): error TS2322: Type '"string"' is not assignable to type 'number'.
==== tests/cases/compiler/foo.js (0 errors) ====
class C {
constructor () {
this.p = 0;
}
}
==== tests/cases/compiler/bar.ts (1 errors) ====
(new C()).p = "string";
~~~~~~~~~~~
!!! error TS2322: Type '"string"' is not assignable to type 'number'.

View File

@ -0,0 +1,18 @@
tests/cases/compiler/bar.ts(2,18): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'.
==== tests/cases/compiler/foo.js (0 errors) ====
class C {
constructor() {
/** @type {number[]}*/
this.p = [];
}
}
==== tests/cases/compiler/bar.ts (1 errors) ====
(new C()).p.push("string");
~~~~~~~~
!!! error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'.

View File

@ -0,0 +1,22 @@
tests/cases/compiler/bar.ts(2,1): error TS2322: Type '"string"' is not assignable to type 'number'.
==== tests/cases/compiler/foo.js (0 errors) ====
class C {
constructor() {
if (cond) {
this.p = null;
}
else {
this.p = 0;
}
}
}
==== tests/cases/compiler/bar.ts (1 errors) ====
(new C()).p = "string"; // Error
~~~~~~~~~~~
!!! error TS2322: Type '"string"' is not assignable to type 'number'.

View File

@ -9,5 +9,6 @@ function foo(a) {
//// [out.js]
function foo(a) {
for (var a_1 = 0; a_1 < 10; a_1++) {
// do something
}
}

View File

@ -27,6 +27,7 @@ function tryCatch() {
//// [narrowExceptionVariableInCatchClause.js]
function tryCatch() {
try {
// do stuff...
}
catch (err) {
if (isFooError(err)) {

View File

@ -8,7 +8,9 @@ try {
//// [noCatchBlock.js]
try {
// ...
}
finally {
// N.B. No 'catch' block
}
//# sourceMappingURL=noCatchBlock.js.map

View File

@ -1,2 +1,2 @@
//// [noCatchBlock.js.map]
{"version":3,"file":"noCatchBlock.js","sourceRoot":"","sources":["noCatchBlock.ts"],"names":[],"mappings":"AACA,IAAI,CAAC;AAEL,CAAC;QAAS,CAAC;AAEX,CAAC"}
{"version":3,"file":"noCatchBlock.js","sourceRoot":"","sources":["noCatchBlock.ts"],"names":[],"mappings":"AACA,IAAI,CAAC;IACJ,MAAM;AACP,CAAC;QAAS,CAAC;IACV,wBAAwB;AACzB,CAAC"}

View File

@ -12,6 +12,7 @@ sourceFile:noCatchBlock.ts
1 >
2 >^^^^
3 > ^
4 > ^^^^^^->
1 >
>
2 >try
@ -20,34 +21,51 @@ sourceFile:noCatchBlock.ts
2 >Emitted(1, 5) Source(2, 5) + SourceIndex(0)
3 >Emitted(1, 6) Source(2, 6) + SourceIndex(0)
---
>>> // ...
1->^^^^
2 > ^^^^^^
1->
>
2 > // ...
1->Emitted(2, 5) Source(3, 2) + SourceIndex(0)
2 >Emitted(2, 11) Source(3, 8) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^->
1 >
> // ...
>
2 >}
1 >Emitted(2, 1) Source(4, 1) + SourceIndex(0)
2 >Emitted(2, 2) Source(4, 2) + SourceIndex(0)
1 >Emitted(3, 1) Source(4, 1) + SourceIndex(0)
2 >Emitted(3, 2) Source(4, 2) + SourceIndex(0)
---
>>>finally {
1->^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^->
1-> finally
2 > {
1->Emitted(3, 9) Source(4, 11) + SourceIndex(0)
2 >Emitted(3, 10) Source(4, 12) + SourceIndex(0)
1->Emitted(4, 9) Source(4, 11) + SourceIndex(0)
2 >Emitted(4, 10) Source(4, 12) + SourceIndex(0)
---
>>> // N.B. No 'catch' block
1->^^^^
2 > ^^^^^^^^^^^^^^^^^^^^^^^^
1->
>
2 > // N.B. No 'catch' block
1->Emitted(5, 5) Source(5, 2) + SourceIndex(0)
2 >Emitted(5, 29) Source(5, 26) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
> // N.B. No 'catch' block
>
2 >}
1 >Emitted(4, 1) Source(6, 1) + SourceIndex(0)
2 >Emitted(4, 2) Source(6, 2) + SourceIndex(0)
1 >Emitted(6, 1) Source(6, 1) + SourceIndex(0)
2 >Emitted(6, 2) Source(6, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=noCatchBlock.js.map

View File

@ -37,4 +37,5 @@ for (let _b of array) {
}
for (const norest of array.map(a => (Object.assign({}, a, { x: 'a string' })))) {
[norest.x, norest.y];
// x is now a string. who knows why.
}

View File

@ -1011,6 +1011,7 @@ var TypeScript;
ctx.path.push(cur);
}
else {
//logger.log("TODO: Ignoring node because minChar, limChar not better than previous node in stack");
}
}
// The AST walker skips comments, but we might be in one, so check the pre/post comments for this node manually

View File

@ -23,6 +23,7 @@ function R1() {
function R2() { R2(); }
function R3(n) {
if (n == 0) {
//return;
}
else {
R3(n--);

View File

@ -15,39 +15,39 @@ function MyClass() {
* @returns {MyClass}
*/
MyClass.prototype.optionalParam = function(required, notRequired) {
>MyClass.prototype.optionalParam = function(required, notRequired) { return this;} : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>MyClass.prototype.optionalParam = function(required, notRequired) { return this;} : (required: string, notRequired?: string) => { prop: any; optionalParam: any; }
>MyClass.prototype.optionalParam : any
>MyClass.prototype : any
>MyClass : () => void
>prototype : any
>optionalParam : any
>function(required, notRequired) { return this;} : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>function(required, notRequired) { return this;} : (required: string, notRequired?: string) => { prop: any; optionalParam: any; }
>required : string
>notRequired : string
return this;
>this : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>this : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
};
let pInst = new MyClass();
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>new MyClass() : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>new MyClass() : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>MyClass : () => void
let c1 = pInst.optionalParam('hello')
>c1 : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam('hello') : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>c1 : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam('hello') : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam: any; }
>pInst : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam: any; }
>'hello' : "hello"
let c2 = pInst.optionalParam('hello', null)
>c2 : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam('hello', null) : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>c2 : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam('hello', null) : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam: any; }
>pInst : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam: any; }
>'hello' : "hello"
>null : null

View File

@ -7,7 +7,9 @@ try {
//// [sourceMap-SkippedNode.js]
try {
// ...
}
finally {
// N.B. No 'catch' block
}
//# sourceMappingURL=sourceMap-SkippedNode.js.map

View File

@ -1,2 +1,2 @@
//// [sourceMap-SkippedNode.js.map]
{"version":3,"file":"sourceMap-SkippedNode.js","sourceRoot":"","sources":["sourceMap-SkippedNode.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC;AAEL,CAAC;QAAS,CAAC;AAEX,CAAC"}
{"version":3,"file":"sourceMap-SkippedNode.js","sourceRoot":"","sources":["sourceMap-SkippedNode.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC;IACL,MAAM;AACN,CAAC;QAAS,CAAC;IACX,wBAAwB;AACxB,CAAC"}

View File

@ -12,6 +12,7 @@ sourceFile:sourceMap-SkippedNode.ts
1 >
2 >^^^^
3 > ^
4 > ^^^^^^->
1 >
2 >try
3 > {
@ -19,34 +20,51 @@ sourceFile:sourceMap-SkippedNode.ts
2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0)
---
>>> // ...
1->^^^^
2 > ^^^^^^
1->
>
2 > // ...
1->Emitted(2, 5) Source(2, 1) + SourceIndex(0)
2 >Emitted(2, 11) Source(2, 7) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^->
1 >
>// ...
>
2 >}
1 >Emitted(2, 1) Source(3, 1) + SourceIndex(0)
2 >Emitted(2, 2) Source(3, 2) + SourceIndex(0)
1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0)
2 >Emitted(3, 2) Source(3, 2) + SourceIndex(0)
---
>>>finally {
1->^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^->
1-> finally
2 > {
1->Emitted(3, 9) Source(3, 11) + SourceIndex(0)
2 >Emitted(3, 10) Source(3, 12) + SourceIndex(0)
1->Emitted(4, 9) Source(3, 11) + SourceIndex(0)
2 >Emitted(4, 10) Source(3, 12) + SourceIndex(0)
---
>>> // N.B. No 'catch' block
1->^^^^
2 > ^^^^^^^^^^^^^^^^^^^^^^^^
1->
>
2 > // N.B. No 'catch' block
1->Emitted(5, 5) Source(4, 1) + SourceIndex(0)
2 >Emitted(5, 29) Source(4, 25) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>// N.B. No 'catch' block
>
2 >}
1 >Emitted(4, 1) Source(5, 1) + SourceIndex(0)
2 >Emitted(4, 2) Source(5, 2) + SourceIndex(0)
1 >Emitted(6, 1) Source(5, 1) + SourceIndex(0)
2 >Emitted(6, 2) Source(5, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=sourceMap-SkippedNode.js.map

View File

@ -0,0 +1,10 @@
// @noImplicitAny: true
var target, x, y;
target = [x = 1, y = x];
var aegis, a, b;
aegis = { x: a = 1, y: b = a };
var kowloona, c, d;
for (kowloona of [c = 1, d = c]) {
}

View File

@ -0,0 +1,22 @@
class Main {
constructor() {
this.register("a", "b", "c");
}
private register(...names: string[]): void {
for (let name of names) {
this.bar({
[name + ".a"]: () => { this.foo(name); },
});
}
}
private bar(a: any): void { }
private foo(name: string): void { }
}
new Main();

View File

@ -0,0 +1,11 @@
declare function commentedParameters(...args): any;
function ifelse() {
if (commentedParameters(1, 2)) {
/*comment1*/
commentedParameters(3, 4);
/*comment2*/
} else {
commentedParameters(5, 6);
}
}

View File

@ -0,0 +1,7 @@
var array = [
/* element 1*/
1
/* end of element 1 */,
2
/* end of element 2 */
];

View File

@ -0,0 +1,6 @@
var array = [
/* element 1*/
1 /* end of element 1 */,
2
/* end of element 2 */
];

View File

@ -0,0 +1,8 @@
var array = [
/* element 1*/
1
/* end of element 1 */,
2
/* end of element 2 */, ,
/* extra comment */
];

View File

@ -0,0 +1,9 @@
function commentedParameters(
/* Parameter a */
a
/* End of parameter a */
/* Parameter b */
,
b
/* End of parameter b */
){}

View File

@ -0,0 +1,8 @@
function commentedParameters(
/* Parameter a */
a /* End of parameter a */
/* Parameter b */
,
b
/* End of parameter b */
){}

View File

@ -0,0 +1,5 @@
function commentedParameters(
a /* parameter a */,
b /* parameter b */,
/* extra comment */
) { }

View File

@ -0,0 +1,13 @@
// @allowJs: true
// @noEmit: true
// @filename: foo.js
class C {
constructor () {
this.p = 0;
}
}
// @filename: bar.ts
(new C()).p = "string";

View File

@ -0,0 +1,14 @@
// @allowJs: true
// @noEmit: true
// @filename: foo.js
class C {
constructor() {
/** @type {number[]}*/
this.p = [];
}
}
// @filename: bar.ts
(new C()).p.push("string");

View File

@ -0,0 +1,18 @@
// @allowJs: true
// @noEmit: true
// @filename: foo.js
class C {
constructor() {
if (cond) {
this.p = null;
}
else {
this.p = 0;
}
}
}
// @filename: bar.ts
(new C()).p = "string"; // Error

View File

@ -4,9 +4,18 @@
////declare module "jquery";
// @Filename: user.ts
////import {[|x|]} from "jquery";
////import {[|{| "isWriteAccess": true, "isDefinition": true |}x|]} from "jquery";
// @Filename: user2.ts
////import {[|x|]} from "jquery";
////import {[|{| "isWriteAccess": true, "isDefinition": true |}x|]} from "jquery";
verify.rangesReferenceEachOther();
const ranges = test.ranges();
const [r0, r1] = ranges;
verify.referenceGroups(r0, [
{ definition: "import x", ranges: [r0] },
{ definition: 'module "jquery"', ranges: [r1] }
]);
verify.referenceGroups(r1, [
{ definition: 'module "jquery"', ranges: [r0] },
{ definition: "import x", ranges: [r1] }
]);

View File

@ -7,7 +7,7 @@
////
//// }
////
//// public /**/[|start|](){
//// public /**/[|{| "isWriteAccess": true, "isDefinition": true |}start|](){
//// return this;
//// }
////
@ -23,11 +23,21 @@
////second.[|start|]();
////second.stop();
verify.rangesReferenceEachOther();
checkRefs();
cancellation.setCancelled();
verifyOperationIsCancelled(() => verify.rangesReferenceEachOther());
verifyOperationIsCancelled(checkRefs);
// verify that internal state is still correct
cancellation.resetCancelled();
verify.rangesReferenceEachOther();
checkRefs();
function checkRefs() {
const ranges = test.ranges();
const [r0, r1] = ranges;
verify.referenceGroups(r0, [{ definition: "(method) Test.start(): this", ranges }]);
verify.referenceGroups(r1, [
{ definition: "(method) Second.Test.start(): Second.Test", ranges: [r0] },
{ definition: "(method) Second.Test.start(): Second.Test", ranges: [r1] }
]);
}

View File

@ -41,6 +41,6 @@
////class d extends a.C { constructor() { [|super|](); }
const ranges = test.ranges();
for (const ctr of ranges.slice(0, 3)) {
verify.referencesOf(ctr, ranges);
}
const [r0, r1, r2] = ranges;
verify.referenceGroups([r0, r2], [{ definition: "constructor C(n: number): C (+1 overload)", ranges }]);
verify.referenceGroups(r1, [{ definition: "constructor C(): C (+1 overload)", ranges }]);

View File

@ -5,4 +5,4 @@
//// [|constructor|](){}
////}
verify.rangesReferenceEachOther();
verify.singleReferenceGroup("constructor C(n: number): C");

View File

@ -1,16 +1,26 @@
/// <reference path='fourslash.ts'/>
////interface I {
//// ["[|prop1|]"]: () => void;
//// ["[|{| "isDefinition": true |}prop1|]"]: () => void;
////}
////
////class C implements I {
//// ["[|prop1|]"]: any;
//// ["[|{| "isDefinition": true |}prop1|]"]: any;
////}
////
////var x: I = {
//// ["[|prop1|]"]: function () { },
//// ["[|{| "isDefinition": true |}prop1|]"]: function () { },
////}
verify.rangesReferenceEachOther();
const ranges = test.ranges();
const [r0, r1, r2] = ranges;
verify.referenceGroups(r0, [{ definition: '(property) I[["prop1"]]: () => void', ranges }]);
verify.referenceGroups(r1, [
{ definition: '(property) I[["prop1"]]: () => void', ranges: [r0, r2] },
{ definition: '(property) C[["prop1"]]: any', ranges: [r1] }
]);
verify.referenceGroups(r2, [
{ definition: '(property) I[["prop1"]]: () => void', ranges: [r0, r1] },
{ definition: '(property) ["prop1"]: () => void', ranges: [r2] }
]);

View File

@ -1,15 +1,25 @@
/// <reference path='fourslash.ts'/>
////interface I {
//// [[|42|]](): void;
//// [[|{| "isDefinition": true |}42|]](): void;
////}
////
////class C implements I {
//// [[|42|]]: any;
//// [[|{| "isDefinition": true |}42|]]: any;
////}
////
////var x: I = {
//// ["[|42|]"]: function () { }
//// ["[|{| "isDefinition": true |}42|]"]: function () { }
////}
verify.rangesReferenceEachOther();
const ranges = test.ranges();
const [r0, r1, r2] = ranges;
verify.referenceGroups(r0, [{ definition: "(method) I[[42]](): void", ranges }]);
verify.referenceGroups(r1, [
{ definition: "(method) I[[42]](): void", ranges: [r0, r2] },
{ definition: "(property) C[[42]]: any", ranges: [r1] }
]);
verify.referenceGroups(r2, [
{ definition: "(method) I[[42]](): void", ranges: [r0, r1] },
{ definition: '(property) ["42"]: () => void', ranges: [r2] }
]);

View File

@ -1,11 +1,11 @@
/// <reference path="fourslash.ts" />
// @Filename: a.ts
////export default function /*def*/[|f|]() {}
////export default function /*def*/[|{| "isWriteAccess": true, "isDefinition": true |}f|]() {}
// @Filename: b.ts
////import [|g|] from "./a";
////import [|{| "isWriteAccess": true, "isDefinition": true |}g|] from "./a";
/////*ref*/[|g|]();
verify.rangesReferenceEachOther();
verify.singleReferenceGroup("function f(): void");
verify.goToDefinition("ref", "def");

View File

@ -1,10 +1,13 @@
/// <reference path='fourslash.ts'/>
////export default class [|DefaultExportedClass|] {
////export default class [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedClass|] {
////}
////
////var x: [|DefaultExportedClass|];
////
////var y = new [|DefaultExportedClass|];
verify.rangesReferenceEachOther();
const ranges = test.ranges();
const [r0, r1, r2] = ranges;
verify.referenceGroups([r0, r1], [{ definition: "class DefaultExportedClass", ranges }]);
verify.referenceGroups(r2, [{ definition: "constructor DefaultExportedClass(): DefaultExportedClass", ranges }]);

View File

@ -1,11 +1,22 @@
/// <reference path='fourslash.ts'/>
////export default function [|DefaultExportedFunction|]() {
//// return [|DefaultExportedFunction|]
////export default function [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedFunction|]() {
//// return [|DefaultExportedFunction|];
////}
////
////var x: typeof [|DefaultExportedFunction|];
////
////var y = [|DefaultExportedFunction|]();
////
////namespace [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedFunction|] {
////}
verify.rangesReferenceEachOther();
const ranges = test.ranges();
const [r0, r1, r2, r3, r4] = ranges;
const fnRanges = [r0, r1, r2, r3];
verify.singleReferenceGroup("function DefaultExportedFunction(): () => typeof DefaultExportedFunction", fnRanges);
// The namespace and function do not merge,
// so the namespace should be all alone.
verify.singleReferenceGroup("namespace DefaultExportedFunction", [r4]);

View File

@ -1,6 +1,6 @@
/// <reference path='fourslash.ts'/>
////function [|f|]() {
////function [|{| "isWriteAccess": true, "isDefinition": true |}f|]() {
//// return 100;
////}
////
@ -10,8 +10,11 @@
////
////var y = [|f|]();
////
////namespace [|f|] {
////namespace [|{| "isWriteAccess": true, "isDefinition": true |}f|] {
//// var local = 100;
////}
verify.rangesReferenceEachOther();
const ranges = test.ranges();
const [r0, r1, r2, r3, r4] = ranges;
verify.referenceGroups([r0, r3], [{ definition: "function f(): number\nnamespace f", ranges }]);
verify.referenceGroups([r1, r2, r4], [{ definition: "namespace f\nfunction f(): number", ranges }]);

View File

@ -1,23 +0,0 @@
/// <reference path='fourslash.ts'/>
////function f() {
//// return 100;
////}
////
////export default [|f|];
////
////var x: typeof f;
////
////var y = f();
////
////namespace /**/[|f|] {
////}
// The function 'f' and the namespace 'f' don't get merged,
// but the 'export default' site, includes both meanings.
// Here we are testing whether the 'export default'
// site is included in the references to the namespace.
goTo.marker();
verify.referencesAre(test.ranges());

View File

@ -1,23 +0,0 @@
/// <reference path='fourslash.ts'/>
////function /**/[|f|]() {
//// return 100;
////}
////
////export default [|f|];
////
////var x: typeof [|f|];
////
////var y = [|f|]();
////
////namespace f {
////}
// The function 'f' and the namespace 'f' don't get merged,
// but the 'export default' site, includes both meanings.
// Here we are testing whether the 'export default' site
// and all value-uses of 'f' are included in the references to the function.
goTo.marker();
verify.referencesAre(test.ranges());

View File

@ -1,23 +0,0 @@
/// <reference path='fourslash.ts'/>
////function [|f|]() {
//// return 100;
////}
////
////export default /**/[|f|];
////
////var x: typeof [|f|];
////
////var y = [|f|]();
////
////namespace [|f|] {
////}
// The function 'f' and the namespace 'f' don't get merged,
// but the 'export default' site, includes both meanings.
// Here we are testing whether the 'export default' site
// and all value-uses of 'f' are included in the references to the function.
goTo.marker();
verify.referencesAre(test.ranges());

View File

@ -1,16 +0,0 @@
/// <reference path='fourslash.ts'/>
////export default function DefaultExportedFunction() {
//// return DefaultExportedFunction
////}
////
////var x: typeof DefaultExportedFunction;
////
////var y = DefaultExportedFunction();
////
////namespace [|DefaultExportedFunction|] {
////}
// The namespace and function do not merge,
// so the namespace should be all alone.
verify.rangesReferenceEachOther();

View File

@ -7,10 +7,9 @@
////
////var y = new DefaultExportedClass;
////
////namespace [|DefaultExportedClass|] {
////namespace [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedClass|] {
////}
// The namespace and class do not merge,
// so the namespace should be all alone.
verify.rangesReferenceEachOther();
verify.singleReferenceGroup("namespace DefaultExportedClass");

View File

@ -1,7 +1,7 @@
/// <reference path='fourslash.ts'/>
// @Filename: file1.ts
////var foo = function [|foo|](a = [|foo|](), b = () => [|foo|]) {
////var foo = function [|{| "isWriteAccess": true, "isDefinition": true |}foo|](a = [|foo|](), b = () => [|foo|]) {
//// [|foo|]([|foo|], [|foo|]);
////}
@ -9,4 +9,4 @@
/////// <reference path="file1.ts" />
////foo();
verify.rangesReferenceEachOther();
verify.singleReferenceGroup("(local function) foo(a?: void, b?: () => (a?: void, b?: any) => void): void");

View File

@ -1,9 +1,19 @@
/// <reference path='fourslash.ts'/>
////interface T { [|a|]: number };
////interface T { [|{| "isWriteAccess": true, "isDefinition": true |}a|]: number };
////type U = { [K in keyof T]: string };
////type V = { [K in keyof U]: boolean };
////const u: U = { [|a|]: "" }
////const v: V = { [|a|]: true }
////const u: U = { [|{| "isWriteAccess": true, "isDefinition": true |}a|]: "" }
////const v: V = { [|{| "isWriteAccess": true, "isDefinition": true |}a|]: true }
verify.rangesReferenceEachOther();
const ranges = test.ranges();
const [r0, r1, r2] = ranges;
verify.referenceGroups(r0, [{ definition: "(property) T.a: number", ranges }]);
verify.referenceGroups(r1, [
{ definition: "(property) T.a: number", ranges: [r0, r2] },
{ definition: "(property) a: string", ranges: [r1] }
]);
verify.referenceGroups(r2, [
{ definition: "(property) T.a: number", ranges: [r0, r1] },
{ definition: "(property) a: boolean", ranges: [r2] }
]);

View File

@ -1,11 +1,17 @@
/// <reference path='fourslash.ts'/>
////var x = {
//// [|property|]: {}
//// [|{| "isWriteAccess": true, "isDefinition": true |}property|]: {}
////};
////
////x.[|property|];
////
////let {[|property|]: pVar} = x;
verify.rangesReferenceEachOther();
const ranges = test.ranges();
const [r0, r1, r2] = ranges;
verify.referenceGroups(r0, [{ definition: "(property) property: {}", ranges }]);
verify.referenceGroups([r1, r2], [
{ definition: "(property) property: {}", ranges: [r0] },
{ definition: "(property) property: {}", ranges: [r1, r2] }
]);

View File

@ -1,14 +1,21 @@
/// <reference path='fourslash.ts'/>
////interface A1 { [|a|]: string };
////interface A2 { [|a|]?: number };
////interface A1 { [|{| "isWriteAccess": true, "isDefinition": true |}a|]: string };
////interface A2 { [|{| "isWriteAccess": true, "isDefinition": true |}a|]?: number };
////let a1: A1;
////let a2: A2;
////let a12 = { ...a1, ...a2 };
////a12.[|a|];
const ranges = test.ranges();
const [r0, r1, r2] = ranges;
// members of spread types only refer to themselves and the resulting property
verify.referencesOf(ranges[0], [ranges[0], ranges[2]]);
verify.referencesOf(ranges[1], [ranges[1], ranges[2]]);
verify.referenceGroups(r0, [{ definition: "(property) A1.a: string", ranges: [r0, r2] }]);
verify.referenceGroups(r1, [{ definition: "(property) A2.a: number", ranges: [r1, r2] }]);
// but the resulting property refers to everything
verify.referencesOf(ranges[2], ranges);
verify.referenceGroups(r2, [
{ definition: "(property) A1.a: string", ranges: [r0] },
{ definition: "(property) A2.a: number", ranges: [r1] },
{ definition: "(property) a: string | number", ranges: [r2] }
]);

View File

@ -1,11 +1,11 @@
/// <reference path='fourslash.ts'/>
////interface Gen {
//// x: number
//// [|parent|]: Gen;
//// [|{| "isWriteAccess": true, "isDefinition": true |}parent|]: Gen;
//// millenial: string;
////}
////let t: Gen;
////var { x, ...rest } = t;
////rest.[|parent|];
verify.rangesReferenceEachOther();
verify.singleReferenceGroup("(property) Gen.parent: Gen");

View File

@ -3,4 +3,4 @@
////type Options = "[|option 1|]" | "option 2";
////let myOption: Options = "[|option 1|]";
verify.rangesReferenceEachOther();
verify.singleReferenceGroup('"option 1"');

View File

@ -4,10 +4,10 @@
//// export function doThing(): string;
//// export function doTheOtherThing(): void;
//// export as namespace [|myLib|];
//// export as namespace [|{| "isWriteAccess": true, "isDefinition": true |}myLib|];
// @Filename: 1.ts
//// /// <reference path="0.d.ts" />
//// [|myLib|].doThing();
verify.rangesReferenceEachOther();
verify.singleReferenceGroup("export namespace myLib");

View File

@ -1,6 +1,6 @@
/// <reference path="fourslash.ts"/>
////var [|Base|] = class { };
////var [|{| "isWriteAccess": true, "isDefinition": true |}Base|] = class { };
////class C extends [|Base|] { }
verify.rangesReferenceEachOther();
verify.singleReferenceGroup("var Base: typeof (Anonymous class)");

View File

@ -1,9 +1,9 @@
/// <reference path="fourslash.ts"/>
////interface [|Base|] { }
////interface [|{| "isWriteAccess": true, "isDefinition": true |}Base|] { }
////namespace n {
//// var Base = class { };
//// interface I extends [|Base|] { }
////}
verify.rangesReferenceEachOther();
verify.singleReferenceGroup("interface Base");

View File

@ -3,5 +3,4 @@
////var Base = class { };
////class C extends Base implements /**/Base { }
goTo.marker();
verify.referencesAre([]);
verify.noReferences("");

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