a4f9bf0fce
* Create type aliases for unresolved type symbols * Accept new baselines * Update fourslash tests * Unresolved import aliases create tagged unresolved symbols * Add comments * Accept new baselines * Add fourslash tests
6269 lines
305 KiB
Plaintext
6269 lines
305 KiB
Plaintext
=== tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts ===
|
||
//
|
||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||
//
|
||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||
// you may not use this file except in compliance with the License.
|
||
// You may obtain a copy of the License at
|
||
// http://www.apache.org/licenses/LICENSE-2.0
|
||
//
|
||
// Unless required by applicable law or agreed to in writing, software
|
||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
// See the License for the specific language governing permissions and
|
||
// limitations under the License.
|
||
//
|
||
|
||
///<reference path='..\compiler\io.ts'/>
|
||
///<reference path='..\compiler\typescript.ts'/>
|
||
///<reference path='..\services\typescriptServices.ts' />
|
||
///<reference path='diff.ts'/>
|
||
|
||
declare var assert: Harness.Assert;
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Assert : Symbol(Harness.Assert)
|
||
|
||
declare var it;
|
||
>it : Symbol(it, Decl(parserharness.ts, 21, 11))
|
||
|
||
declare var describe;
|
||
>describe : Symbol(describe, Decl(parserharness.ts, 22, 11))
|
||
|
||
declare var run;
|
||
>run : Symbol(run, Decl(parserharness.ts, 23, 11))
|
||
|
||
declare var IO: IIO;
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>IIO : Symbol(IIO)
|
||
|
||
declare var __dirname; // Node-specific
|
||
>__dirname : Symbol(__dirname, Decl(parserharness.ts, 25, 11))
|
||
|
||
function switchToForwardSlashes(path: string) {
|
||
>switchToForwardSlashes : Symbol(switchToForwardSlashes, Decl(parserharness.ts, 25, 22))
|
||
>path : Symbol(path, Decl(parserharness.ts, 27, 32))
|
||
|
||
return path.replace(/\\/g, "/");
|
||
>path.replace : Symbol(String.replace, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>path : Symbol(path, Decl(parserharness.ts, 27, 32))
|
||
>replace : Symbol(String.replace, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
function filePath(fullPath: string) {
|
||
>filePath : Symbol(filePath, Decl(parserharness.ts, 29, 1))
|
||
>fullPath : Symbol(fullPath, Decl(parserharness.ts, 31, 18))
|
||
|
||
fullPath = switchToForwardSlashes(fullPath);
|
||
>fullPath : Symbol(fullPath, Decl(parserharness.ts, 31, 18))
|
||
>switchToForwardSlashes : Symbol(switchToForwardSlashes, Decl(parserharness.ts, 25, 22))
|
||
>fullPath : Symbol(fullPath, Decl(parserharness.ts, 31, 18))
|
||
|
||
var components = fullPath.split("/");
|
||
>components : Symbol(components, Decl(parserharness.ts, 33, 7))
|
||
>fullPath.split : Symbol(String.split, Decl(lib.es5.d.ts, --, --))
|
||
>fullPath : Symbol(fullPath, Decl(parserharness.ts, 31, 18))
|
||
>split : Symbol(String.split, Decl(lib.es5.d.ts, --, --))
|
||
|
||
var path: string[] = components.slice(0, components.length - 1);
|
||
>path : Symbol(path, Decl(parserharness.ts, 34, 7))
|
||
>components.slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --))
|
||
>components : Symbol(components, Decl(parserharness.ts, 33, 7))
|
||
>slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --))
|
||
>components.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>components : Symbol(components, Decl(parserharness.ts, 33, 7))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
return path.join("/") + "/";
|
||
>path.join : Symbol(Array.join, Decl(lib.es5.d.ts, --, --))
|
||
>path : Symbol(path, Decl(parserharness.ts, 34, 7))
|
||
>join : Symbol(Array.join, Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
var typescriptServiceFileName = filePath(IO.getExecutingFilePath()) + "typescriptServices.js";
|
||
>typescriptServiceFileName : Symbol(typescriptServiceFileName, Decl(parserharness.ts, 38, 3))
|
||
>filePath : Symbol(filePath, Decl(parserharness.ts, 29, 1))
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
|
||
var typescriptServiceFile = IO.readFile(typescriptServiceFileName);
|
||
>typescriptServiceFile : Symbol(typescriptServiceFile, Decl(parserharness.ts, 39, 3))
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>typescriptServiceFileName : Symbol(typescriptServiceFileName, Decl(parserharness.ts, 38, 3))
|
||
|
||
if (typeof ActiveXObject === "function") {
|
||
eval(typescriptServiceFile);
|
||
>eval : Symbol(eval, Decl(lib.es5.d.ts, --, --))
|
||
>typescriptServiceFile : Symbol(typescriptServiceFile, Decl(parserharness.ts, 39, 3))
|
||
|
||
} else if (typeof require === "function") {
|
||
var vm = require('vm');
|
||
>vm : Symbol(vm, Decl(parserharness.ts, 43, 7))
|
||
|
||
vm.runInThisContext(typescriptServiceFile, 'typescriptServices.js');
|
||
>vm : Symbol(vm, Decl(parserharness.ts, 43, 7))
|
||
>typescriptServiceFile : Symbol(typescriptServiceFile, Decl(parserharness.ts, 39, 3))
|
||
|
||
} else {
|
||
throw new Error('Unknown context');
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
declare module process {
|
||
>process : Symbol(process, Decl(parserharness.ts, 47, 1))
|
||
|
||
export function nextTick(callback: () => any): void;
|
||
>nextTick : Symbol(nextTick, Decl(parserharness.ts, 49, 24))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 50, 29))
|
||
|
||
export function on(event: string, listener: Function);
|
||
>on : Symbol(on, Decl(parserharness.ts, 50, 56))
|
||
>event : Symbol(event, Decl(parserharness.ts, 51, 23))
|
||
>listener : Symbol(listener, Decl(parserharness.ts, 51, 37))
|
||
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
module Harness {
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
|
||
// Settings
|
||
export var userSpecifiedroot = "";
|
||
>userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
|
||
var global = <any>Function("return this").call(null);
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
>Function("return this").call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
|
||
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
|
||
|
||
export var usePull = false;
|
||
>usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
|
||
export interface ITestMetadata {
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
|
||
id: string;
|
||
>id : Symbol(ITestMetadata.id, Decl(parserharness.ts, 60, 36))
|
||
|
||
desc: string;
|
||
>desc : Symbol(ITestMetadata.desc, Decl(parserharness.ts, 61, 19))
|
||
|
||
pass: boolean;
|
||
>pass : Symbol(ITestMetadata.pass, Decl(parserharness.ts, 62, 21))
|
||
|
||
perfResults: {
|
||
>perfResults : Symbol(ITestMetadata.perfResults, Decl(parserharness.ts, 63, 22))
|
||
|
||
mean: number;
|
||
>mean : Symbol(mean, Decl(parserharness.ts, 64, 22))
|
||
|
||
min: number;
|
||
>min : Symbol(min, Decl(parserharness.ts, 65, 25))
|
||
|
||
max: number;
|
||
>max : Symbol(max, Decl(parserharness.ts, 66, 24))
|
||
|
||
stdDev: number;
|
||
>stdDev : Symbol(stdDev, Decl(parserharness.ts, 67, 24))
|
||
|
||
trials: number[];
|
||
>trials : Symbol(trials, Decl(parserharness.ts, 68, 27))
|
||
|
||
};
|
||
}
|
||
export interface IScenarioMetadata {
|
||
>IScenarioMetadata : Symbol(IScenarioMetadata, Decl(parserharness.ts, 71, 5))
|
||
|
||
id: string;
|
||
>id : Symbol(IScenarioMetadata.id, Decl(parserharness.ts, 72, 40))
|
||
|
||
desc: string;
|
||
>desc : Symbol(IScenarioMetadata.desc, Decl(parserharness.ts, 73, 19))
|
||
|
||
pass: boolean;
|
||
>pass : Symbol(IScenarioMetadata.pass, Decl(parserharness.ts, 74, 21))
|
||
|
||
bugs: string[];
|
||
>bugs : Symbol(IScenarioMetadata.bugs, Decl(parserharness.ts, 75, 22))
|
||
}
|
||
|
||
// Assert functions
|
||
export module Assert {
|
||
>Assert : Symbol(Assert, Decl(parserharness.ts, 77, 5))
|
||
|
||
export var bugIds: string[] = [];
|
||
>bugIds : Symbol(bugIds, Decl(parserharness.ts, 81, 18))
|
||
|
||
export var throwAssertError = (error: Error) => {
|
||
>throwAssertError : Symbol(throwAssertError, Decl(parserharness.ts, 82, 18))
|
||
>error : Symbol(error, Decl(parserharness.ts, 82, 39))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
|
||
throw error;
|
||
>error : Symbol(error, Decl(parserharness.ts, 82, 39))
|
||
|
||
};
|
||
|
||
// Marks that the current scenario is impacted by a bug
|
||
export function bug(id: string) {
|
||
>bug : Symbol(bug, Decl(parserharness.ts, 84, 10))
|
||
>id : Symbol(id, Decl(parserharness.ts, 87, 28))
|
||
|
||
if (bugIds.indexOf(id) < 0) {
|
||
>bugIds.indexOf : Symbol(Array.indexOf, Decl(lib.es5.d.ts, --, --))
|
||
>bugIds : Symbol(bugIds, Decl(parserharness.ts, 81, 18))
|
||
>indexOf : Symbol(Array.indexOf, Decl(lib.es5.d.ts, --, --))
|
||
>id : Symbol(id, Decl(parserharness.ts, 87, 28))
|
||
|
||
bugIds.push(id);
|
||
>bugIds.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>bugIds : Symbol(bugIds, Decl(parserharness.ts, 81, 18))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>id : Symbol(id, Decl(parserharness.ts, 87, 28))
|
||
}
|
||
}
|
||
|
||
// If there are any bugs in the test code, mark the scenario as impacted appropriately
|
||
export function bugs(content: string) {
|
||
>bugs : Symbol(bugs, Decl(parserharness.ts, 91, 9))
|
||
>content : Symbol(content, Decl(parserharness.ts, 94, 29))
|
||
|
||
var bugs = content.match(/\bbug (\d+)/i);
|
||
>bugs : Symbol(bugs, Decl(parserharness.ts, 95, 15))
|
||
>content.match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
>content : Symbol(content, Decl(parserharness.ts, 94, 29))
|
||
>match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
|
||
if (bugs) {
|
||
>bugs : Symbol(bugs, Decl(parserharness.ts, 95, 15))
|
||
|
||
bugs.forEach(bug => assert.bug(bug));
|
||
>bugs.forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>bugs : Symbol(bugs, Decl(parserharness.ts, 95, 15))
|
||
>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>bug : Symbol(bug, Decl(parserharness.ts, 97, 29))
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>bug : Symbol(bug, Decl(parserharness.ts, 97, 29))
|
||
}
|
||
}
|
||
|
||
export function is(result: boolean, msg?: string) {
|
||
>is : Symbol(is, Decl(parserharness.ts, 99, 9))
|
||
>result : Symbol(result, Decl(parserharness.ts, 101, 27))
|
||
>msg : Symbol(msg, Decl(parserharness.ts, 101, 43))
|
||
|
||
if (!result) {
|
||
>result : Symbol(result, Decl(parserharness.ts, 101, 27))
|
||
|
||
throwAssertError(new Error(msg || "Expected true, got false."));
|
||
>throwAssertError : Symbol(throwAssertError, Decl(parserharness.ts, 82, 18))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>msg : Symbol(msg, Decl(parserharness.ts, 101, 43))
|
||
}
|
||
}
|
||
|
||
export function arrayLengthIs(arr: any[], length: number) {
|
||
>arrayLengthIs : Symbol(arrayLengthIs, Decl(parserharness.ts, 105, 9))
|
||
>arr : Symbol(arr, Decl(parserharness.ts, 107, 38))
|
||
>length : Symbol(length, Decl(parserharness.ts, 107, 49))
|
||
|
||
if (arr.length != length) {
|
||
>arr.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>arr : Symbol(arr, Decl(parserharness.ts, 107, 38))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>length : Symbol(length, Decl(parserharness.ts, 107, 49))
|
||
|
||
var actual = '';
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 109, 19))
|
||
|
||
arr.forEach(n => actual = actual + '\n ' + n.toString());
|
||
>arr.forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>arr : Symbol(arr, Decl(parserharness.ts, 107, 38))
|
||
>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>n : Symbol(n, Decl(parserharness.ts, 110, 28))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 109, 19))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 109, 19))
|
||
>n : Symbol(n, Decl(parserharness.ts, 110, 28))
|
||
|
||
throwAssertError(new Error('Expected array to have ' + length + ' elements. Actual elements were:' + actual));
|
||
>throwAssertError : Symbol(throwAssertError, Decl(parserharness.ts, 82, 18))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>length : Symbol(length, Decl(parserharness.ts, 107, 49))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 109, 19))
|
||
}
|
||
}
|
||
|
||
export function equal(actual, expected) {
|
||
>equal : Symbol(equal, Decl(parserharness.ts, 113, 9))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 115, 30))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 115, 37))
|
||
|
||
if (actual !== expected) {
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 115, 30))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 115, 37))
|
||
|
||
throwAssertError(new Error("Expected " + actual + " to equal " + expected));
|
||
>throwAssertError : Symbol(throwAssertError, Decl(parserharness.ts, 82, 18))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 115, 30))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 115, 37))
|
||
}
|
||
}
|
||
|
||
export function notEqual(actual, expected) {
|
||
>notEqual : Symbol(notEqual, Decl(parserharness.ts, 119, 9))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 121, 33))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 121, 40))
|
||
|
||
if (actual === expected) {
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 121, 33))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 121, 40))
|
||
|
||
throwAssertError(new Error("Expected " + actual + " to *not* equal " + expected));
|
||
>throwAssertError : Symbol(throwAssertError, Decl(parserharness.ts, 82, 18))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 121, 33))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 121, 40))
|
||
}
|
||
}
|
||
|
||
export function notNull(result) {
|
||
>notNull : Symbol(notNull, Decl(parserharness.ts, 125, 9))
|
||
>result : Symbol(result, Decl(parserharness.ts, 127, 32))
|
||
|
||
if (result === null) {
|
||
>result : Symbol(result, Decl(parserharness.ts, 127, 32))
|
||
|
||
throwAssertError(new Error("Expected " + result + " to *not* be null"));
|
||
>throwAssertError : Symbol(throwAssertError, Decl(parserharness.ts, 82, 18))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>result : Symbol(result, Decl(parserharness.ts, 127, 32))
|
||
}
|
||
}
|
||
|
||
export function compilerWarning(result: Compiler.CompilerResult, line: number, column: number, desc: string) {
|
||
>compilerWarning : Symbol(compilerWarning, Decl(parserharness.ts, 131, 9))
|
||
>result : Symbol(result, Decl(parserharness.ts, 133, 40))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>CompilerResult : Symbol(Compiler.CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>line : Symbol(line, Decl(parserharness.ts, 133, 72))
|
||
>column : Symbol(column, Decl(parserharness.ts, 133, 86))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 133, 102))
|
||
|
||
if (!result.isErrorAt(line, column, desc)) {
|
||
>result.isErrorAt : Symbol(Compiler.CompilerResult.isErrorAt, Decl(parserharness.ts, 1196, 13))
|
||
>result : Symbol(result, Decl(parserharness.ts, 133, 40))
|
||
>isErrorAt : Symbol(Compiler.CompilerResult.isErrorAt, Decl(parserharness.ts, 1196, 13))
|
||
>line : Symbol(line, Decl(parserharness.ts, 133, 72))
|
||
>column : Symbol(column, Decl(parserharness.ts, 133, 86))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 133, 102))
|
||
|
||
var actual = '';
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 135, 19))
|
||
|
||
result.errors.forEach(err => {
|
||
>result.errors.forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>result.errors : Symbol(Compiler.CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>result : Symbol(result, Decl(parserharness.ts, 133, 40))
|
||
>errors : Symbol(Compiler.CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>err : Symbol(err, Decl(parserharness.ts, 136, 38))
|
||
|
||
actual = actual + '\n ' + err.toString();
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 135, 19))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 135, 19))
|
||
>err.toString : Symbol(Compiler.CompilerError.toString, Decl(parserharness.ts, 1213, 47))
|
||
>err : Symbol(err, Decl(parserharness.ts, 136, 38))
|
||
>toString : Symbol(Compiler.CompilerError.toString, Decl(parserharness.ts, 1213, 47))
|
||
|
||
});
|
||
|
||
throwAssertError(new Error("Expected compiler warning at (" + line + ", " + column + "): " + desc + "\nActual errors follow: " + actual));
|
||
>throwAssertError : Symbol(throwAssertError, Decl(parserharness.ts, 82, 18))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>line : Symbol(line, Decl(parserharness.ts, 133, 72))
|
||
>column : Symbol(column, Decl(parserharness.ts, 133, 86))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 133, 102))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 135, 19))
|
||
}
|
||
}
|
||
|
||
export function noDiff(text1, text2) {
|
||
>noDiff : Symbol(noDiff, Decl(parserharness.ts, 142, 9))
|
||
>text1 : Symbol(text1, Decl(parserharness.ts, 144, 31))
|
||
>text2 : Symbol(text2, Decl(parserharness.ts, 144, 37))
|
||
|
||
text1 = text1.replace(/^\s+|\s+$/g, "").replace(/\r\n?/g, "\n");
|
||
>text1 : Symbol(text1, Decl(parserharness.ts, 144, 31))
|
||
>text1 : Symbol(text1, Decl(parserharness.ts, 144, 31))
|
||
|
||
text2 = text2.replace(/^\s+|\s+$/g, "").replace(/\r\n?/g, "\n");
|
||
>text2 : Symbol(text2, Decl(parserharness.ts, 144, 37))
|
||
>text2 : Symbol(text2, Decl(parserharness.ts, 144, 37))
|
||
|
||
if (text1 !== text2) {
|
||
>text1 : Symbol(text1, Decl(parserharness.ts, 144, 31))
|
||
>text2 : Symbol(text2, Decl(parserharness.ts, 144, 37))
|
||
|
||
var errorString = "";
|
||
>errorString : Symbol(errorString, Decl(parserharness.ts, 149, 19))
|
||
|
||
var text1Lines = text1.split(/\n/);
|
||
>text1Lines : Symbol(text1Lines, Decl(parserharness.ts, 150, 19))
|
||
>text1 : Symbol(text1, Decl(parserharness.ts, 144, 31))
|
||
|
||
var text2Lines = text2.split(/\n/);
|
||
>text2Lines : Symbol(text2Lines, Decl(parserharness.ts, 151, 19))
|
||
>text2 : Symbol(text2, Decl(parserharness.ts, 144, 37))
|
||
|
||
for (var i = 0; i < text1Lines.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 152, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 152, 24))
|
||
>text1Lines : Symbol(text1Lines, Decl(parserharness.ts, 150, 19))
|
||
>i : Symbol(i, Decl(parserharness.ts, 152, 24))
|
||
|
||
if (text1Lines[i] !== text2Lines[i]) {
|
||
>text1Lines : Symbol(text1Lines, Decl(parserharness.ts, 150, 19))
|
||
>i : Symbol(i, Decl(parserharness.ts, 152, 24))
|
||
>text2Lines : Symbol(text2Lines, Decl(parserharness.ts, 151, 19))
|
||
>i : Symbol(i, Decl(parserharness.ts, 152, 24))
|
||
|
||
errorString += "Difference at line " + (i + 1) + ":\n";
|
||
>errorString : Symbol(errorString, Decl(parserharness.ts, 149, 19))
|
||
>i : Symbol(i, Decl(parserharness.ts, 152, 24))
|
||
|
||
errorString += " Left File: " + text1Lines[i] + "\n";
|
||
>errorString : Symbol(errorString, Decl(parserharness.ts, 149, 19))
|
||
>text1Lines : Symbol(text1Lines, Decl(parserharness.ts, 150, 19))
|
||
>i : Symbol(i, Decl(parserharness.ts, 152, 24))
|
||
|
||
errorString += " Right File: " + text2Lines[i] + "\n\n";
|
||
>errorString : Symbol(errorString, Decl(parserharness.ts, 149, 19))
|
||
>text2Lines : Symbol(text2Lines, Decl(parserharness.ts, 151, 19))
|
||
>i : Symbol(i, Decl(parserharness.ts, 152, 24))
|
||
}
|
||
}
|
||
throwAssertError(new Error(errorString));
|
||
>throwAssertError : Symbol(throwAssertError, Decl(parserharness.ts, 82, 18))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>errorString : Symbol(errorString, Decl(parserharness.ts, 149, 19))
|
||
}
|
||
}
|
||
|
||
export function arrayContains(arr: any[], contains: any[]) {
|
||
>arrayContains : Symbol(arrayContains, Decl(parserharness.ts, 161, 9))
|
||
>arr : Symbol(arr, Decl(parserharness.ts, 163, 38))
|
||
>contains : Symbol(contains, Decl(parserharness.ts, 163, 49))
|
||
|
||
var found;
|
||
>found : Symbol(found, Decl(parserharness.ts, 164, 15))
|
||
|
||
for (var i = 0; i < contains.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 166, 20))
|
||
>i : Symbol(i, Decl(parserharness.ts, 166, 20))
|
||
>contains.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>contains : Symbol(contains, Decl(parserharness.ts, 163, 49))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 166, 20))
|
||
|
||
found = false;
|
||
>found : Symbol(found, Decl(parserharness.ts, 164, 15))
|
||
|
||
for (var j = 0; j < arr.length; j++) {
|
||
>j : Symbol(j, Decl(parserharness.ts, 169, 24))
|
||
>j : Symbol(j, Decl(parserharness.ts, 169, 24))
|
||
>arr.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>arr : Symbol(arr, Decl(parserharness.ts, 163, 38))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>j : Symbol(j, Decl(parserharness.ts, 169, 24))
|
||
|
||
if (arr[j] === contains[i]) {
|
||
>arr : Symbol(arr, Decl(parserharness.ts, 163, 38))
|
||
>j : Symbol(j, Decl(parserharness.ts, 169, 24))
|
||
>contains : Symbol(contains, Decl(parserharness.ts, 163, 49))
|
||
>i : Symbol(i, Decl(parserharness.ts, 166, 20))
|
||
|
||
found = true;
|
||
>found : Symbol(found, Decl(parserharness.ts, 164, 15))
|
||
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (!found) {
|
||
>found : Symbol(found, Decl(parserharness.ts, 164, 15))
|
||
|
||
throwAssertError(new Error("Expected array to contain \"" + contains[i] + "\""));
|
||
>throwAssertError : Symbol(throwAssertError, Decl(parserharness.ts, 82, 18))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>contains : Symbol(contains, Decl(parserharness.ts, 163, 49))
|
||
>i : Symbol(i, Decl(parserharness.ts, 166, 20))
|
||
}
|
||
}
|
||
}
|
||
|
||
export function arrayContainsOnce(arr: any[], filter: (item: any) => boolean) {
|
||
>arrayContainsOnce : Symbol(arrayContainsOnce, Decl(parserharness.ts, 180, 9))
|
||
>arr : Symbol(arr, Decl(parserharness.ts, 182, 42))
|
||
>filter : Symbol(filter, Decl(parserharness.ts, 182, 53))
|
||
>item : Symbol(item, Decl(parserharness.ts, 182, 63))
|
||
|
||
var foundCount = 0;
|
||
>foundCount : Symbol(foundCount, Decl(parserharness.ts, 183, 15))
|
||
|
||
for (var i = 0; i < arr.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 185, 20))
|
||
>i : Symbol(i, Decl(parserharness.ts, 185, 20))
|
||
>arr.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>arr : Symbol(arr, Decl(parserharness.ts, 182, 42))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 185, 20))
|
||
|
||
if (filter(arr[i])) {
|
||
>filter : Symbol(filter, Decl(parserharness.ts, 182, 53))
|
||
>arr : Symbol(arr, Decl(parserharness.ts, 182, 42))
|
||
>i : Symbol(i, Decl(parserharness.ts, 185, 20))
|
||
|
||
foundCount++;
|
||
>foundCount : Symbol(foundCount, Decl(parserharness.ts, 183, 15))
|
||
}
|
||
}
|
||
|
||
if (foundCount !== 1) {
|
||
>foundCount : Symbol(foundCount, Decl(parserharness.ts, 183, 15))
|
||
|
||
throwAssertError(new Error("Expected array to match element only once (instead of " + foundCount + " times)"));
|
||
>throwAssertError : Symbol(throwAssertError, Decl(parserharness.ts, 82, 18))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>foundCount : Symbol(foundCount, Decl(parserharness.ts, 183, 15))
|
||
}
|
||
}
|
||
}
|
||
|
||
/** Splits the given string on \r\n or on only \n if that fails */
|
||
export function splitContentByNewlines(content: string) {
|
||
>splitContentByNewlines : Symbol(splitContentByNewlines, Decl(parserharness.ts, 195, 5))
|
||
>content : Symbol(content, Decl(parserharness.ts, 198, 43))
|
||
|
||
// Split up the input file by line
|
||
// Note: IE JS engine incorrectly handles consecutive delimiters here when using RegExp split, so
|
||
// we have to string-based splitting instead and try to figure out the delimiting chars
|
||
var lines = content.split('\r\n');
|
||
>lines : Symbol(lines, Decl(parserharness.ts, 202, 11))
|
||
>content.split : Symbol(String.split, Decl(lib.es5.d.ts, --, --))
|
||
>content : Symbol(content, Decl(parserharness.ts, 198, 43))
|
||
>split : Symbol(String.split, Decl(lib.es5.d.ts, --, --))
|
||
|
||
if (lines.length === 1) {
|
||
>lines.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>lines : Symbol(lines, Decl(parserharness.ts, 202, 11))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
lines = content.split('\n');
|
||
>lines : Symbol(lines, Decl(parserharness.ts, 202, 11))
|
||
>content.split : Symbol(String.split, Decl(lib.es5.d.ts, --, --))
|
||
>content : Symbol(content, Decl(parserharness.ts, 198, 43))
|
||
>split : Symbol(String.split, Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
return lines;
|
||
>lines : Symbol(lines, Decl(parserharness.ts, 202, 11))
|
||
}
|
||
|
||
/** Reads a file under /tests */
|
||
export function readFile(path: string) {
|
||
>readFile : Symbol(readFile, Decl(parserharness.ts, 207, 5))
|
||
>path : Symbol(path, Decl(parserharness.ts, 210, 29))
|
||
|
||
if (path.indexOf('tests') < 0) {
|
||
>path.indexOf : Symbol(String.indexOf, Decl(lib.es5.d.ts, --, --))
|
||
>path : Symbol(path, Decl(parserharness.ts, 210, 29))
|
||
>indexOf : Symbol(String.indexOf, Decl(lib.es5.d.ts, --, --))
|
||
|
||
path = "tests/" + path;
|
||
>path : Symbol(path, Decl(parserharness.ts, 210, 29))
|
||
>path : Symbol(path, Decl(parserharness.ts, 210, 29))
|
||
}
|
||
|
||
var content = IO.readFile(Harness.userSpecifiedroot + path);
|
||
>content : Symbol(content, Decl(parserharness.ts, 216, 11))
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>Harness.userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>path : Symbol(path, Decl(parserharness.ts, 210, 29))
|
||
|
||
if (content == null) {
|
||
>content : Symbol(content, Decl(parserharness.ts, 216, 11))
|
||
|
||
throw new Error("failed to read file at: '" + Harness.userSpecifiedroot + path + "'");
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>Harness.userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>path : Symbol(path, Decl(parserharness.ts, 210, 29))
|
||
}
|
||
|
||
return content;
|
||
>content : Symbol(content, Decl(parserharness.ts, 216, 11))
|
||
}
|
||
|
||
// Logger
|
||
export interface ILogger {
|
||
>ILogger : Symbol(ILogger, Decl(parserharness.ts, 222, 5))
|
||
|
||
start: (fileName?: string, priority?: number) => void;
|
||
>start : Symbol(ILogger.start, Decl(parserharness.ts, 225, 30))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 226, 16))
|
||
>priority : Symbol(priority, Decl(parserharness.ts, 226, 34))
|
||
|
||
end: (fileName?: string) => void;
|
||
>end : Symbol(ILogger.end, Decl(parserharness.ts, 226, 62))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 227, 14))
|
||
|
||
scenarioStart: (scenario: IScenarioMetadata) => void;
|
||
>scenarioStart : Symbol(ILogger.scenarioStart, Decl(parserharness.ts, 227, 41))
|
||
>scenario : Symbol(scenario, Decl(parserharness.ts, 228, 24))
|
||
>IScenarioMetadata : Symbol(IScenarioMetadata, Decl(parserharness.ts, 71, 5))
|
||
|
||
scenarioEnd: (scenario: IScenarioMetadata, error?: Error) => void;
|
||
>scenarioEnd : Symbol(ILogger.scenarioEnd, Decl(parserharness.ts, 228, 61))
|
||
>scenario : Symbol(scenario, Decl(parserharness.ts, 229, 22))
|
||
>IScenarioMetadata : Symbol(IScenarioMetadata, Decl(parserharness.ts, 71, 5))
|
||
>error : Symbol(error, Decl(parserharness.ts, 229, 50))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
|
||
testStart: (test: ITestMetadata) => void;
|
||
>testStart : Symbol(ILogger.testStart, Decl(parserharness.ts, 229, 74))
|
||
>test : Symbol(test, Decl(parserharness.ts, 230, 20))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
|
||
pass: (test: ITestMetadata) => void;
|
||
>pass : Symbol(ILogger.pass, Decl(parserharness.ts, 230, 49))
|
||
>test : Symbol(test, Decl(parserharness.ts, 231, 15))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
|
||
bug: (test: ITestMetadata) => void;
|
||
>bug : Symbol(ILogger.bug, Decl(parserharness.ts, 231, 44))
|
||
>test : Symbol(test, Decl(parserharness.ts, 232, 14))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
|
||
fail: (test: ITestMetadata) => void;
|
||
>fail : Symbol(ILogger.fail, Decl(parserharness.ts, 232, 43))
|
||
>test : Symbol(test, Decl(parserharness.ts, 233, 15))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
|
||
error: (test: ITestMetadata, error: Error) => void;
|
||
>error : Symbol(ILogger.error, Decl(parserharness.ts, 233, 44))
|
||
>test : Symbol(test, Decl(parserharness.ts, 234, 16))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
>error : Symbol(error, Decl(parserharness.ts, 234, 36))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
|
||
comment: (comment: string) => void;
|
||
>comment : Symbol(ILogger.comment, Decl(parserharness.ts, 234, 59))
|
||
>comment : Symbol(comment, Decl(parserharness.ts, 235, 18))
|
||
|
||
verify: (test: ITestMetadata, passed: boolean, actual: any, expected: any, message: string) => void;
|
||
>verify : Symbol(ILogger.verify, Decl(parserharness.ts, 235, 43))
|
||
>test : Symbol(test, Decl(parserharness.ts, 236, 17))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
>passed : Symbol(passed, Decl(parserharness.ts, 236, 37))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 236, 54))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 236, 67))
|
||
>message : Symbol(message, Decl(parserharness.ts, 236, 82))
|
||
}
|
||
|
||
export class Logger implements ILogger {
|
||
>Logger : Symbol(Logger, Decl(parserharness.ts, 237, 5))
|
||
>ILogger : Symbol(ILogger, Decl(parserharness.ts, 222, 5))
|
||
|
||
public start(fileName?: string, priority?: number) { }
|
||
>start : Symbol(Logger.start, Decl(parserharness.ts, 239, 44))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 240, 21))
|
||
>priority : Symbol(priority, Decl(parserharness.ts, 240, 39))
|
||
|
||
public end(fileName?: string) { }
|
||
>end : Symbol(Logger.end, Decl(parserharness.ts, 240, 62))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 241, 19))
|
||
|
||
public scenarioStart(scenario: IScenarioMetadata) { }
|
||
>scenarioStart : Symbol(Logger.scenarioStart, Decl(parserharness.ts, 241, 41))
|
||
>scenario : Symbol(scenario, Decl(parserharness.ts, 242, 29))
|
||
>IScenarioMetadata : Symbol(IScenarioMetadata, Decl(parserharness.ts, 71, 5))
|
||
|
||
public scenarioEnd(scenario: IScenarioMetadata, error?: Error) { }
|
||
>scenarioEnd : Symbol(Logger.scenarioEnd, Decl(parserharness.ts, 242, 61))
|
||
>scenario : Symbol(scenario, Decl(parserharness.ts, 243, 27))
|
||
>IScenarioMetadata : Symbol(IScenarioMetadata, Decl(parserharness.ts, 71, 5))
|
||
>error : Symbol(error, Decl(parserharness.ts, 243, 55))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
|
||
public testStart(test: ITestMetadata) { }
|
||
>testStart : Symbol(Logger.testStart, Decl(parserharness.ts, 243, 74))
|
||
>test : Symbol(test, Decl(parserharness.ts, 244, 25))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
|
||
public pass(test: ITestMetadata) { }
|
||
>pass : Symbol(Logger.pass, Decl(parserharness.ts, 244, 49))
|
||
>test : Symbol(test, Decl(parserharness.ts, 245, 20))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
|
||
public bug(test: ITestMetadata) { }
|
||
>bug : Symbol(Logger.bug, Decl(parserharness.ts, 245, 44))
|
||
>test : Symbol(test, Decl(parserharness.ts, 246, 19))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
|
||
public fail(test: ITestMetadata) { }
|
||
>fail : Symbol(Logger.fail, Decl(parserharness.ts, 246, 43))
|
||
>test : Symbol(test, Decl(parserharness.ts, 247, 20))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
|
||
public error(test: ITestMetadata, error: Error) { }
|
||
>error : Symbol(Logger.error, Decl(parserharness.ts, 247, 44))
|
||
>test : Symbol(test, Decl(parserharness.ts, 248, 21))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
>error : Symbol(error, Decl(parserharness.ts, 248, 41))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
|
||
public comment(comment: string) { }
|
||
>comment : Symbol(Logger.comment, Decl(parserharness.ts, 248, 59))
|
||
>comment : Symbol(comment, Decl(parserharness.ts, 249, 23))
|
||
|
||
public verify(test: ITestMetadata, passed: boolean, actual: any, expected: any, message: string) { }
|
||
>verify : Symbol(Logger.verify, Decl(parserharness.ts, 249, 43))
|
||
>test : Symbol(test, Decl(parserharness.ts, 250, 22))
|
||
>ITestMetadata : Symbol(ITestMetadata, Decl(parserharness.ts, 58, 31))
|
||
>passed : Symbol(passed, Decl(parserharness.ts, 250, 42))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 250, 59))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 250, 72))
|
||
>message : Symbol(message, Decl(parserharness.ts, 250, 87))
|
||
}
|
||
|
||
// Logger-related functions
|
||
var loggers: ILogger[] = [];
|
||
>loggers : Symbol(loggers, Decl(parserharness.ts, 254, 7))
|
||
>ILogger : Symbol(ILogger, Decl(parserharness.ts, 222, 5))
|
||
|
||
export function registerLogger(logger: ILogger) {
|
||
>registerLogger : Symbol(registerLogger, Decl(parserharness.ts, 254, 32))
|
||
>logger : Symbol(logger, Decl(parserharness.ts, 255, 35))
|
||
>ILogger : Symbol(ILogger, Decl(parserharness.ts, 222, 5))
|
||
|
||
loggers.push(logger);
|
||
>loggers.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>loggers : Symbol(loggers, Decl(parserharness.ts, 254, 7))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>logger : Symbol(logger, Decl(parserharness.ts, 255, 35))
|
||
}
|
||
export function emitLog(field: string, ...params: any[]) {
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
>field : Symbol(field, Decl(parserharness.ts, 258, 28))
|
||
>params : Symbol(params, Decl(parserharness.ts, 258, 42))
|
||
|
||
for (var i = 0; i < loggers.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 259, 16))
|
||
>i : Symbol(i, Decl(parserharness.ts, 259, 16))
|
||
>loggers.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>loggers : Symbol(loggers, Decl(parserharness.ts, 254, 7))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 259, 16))
|
||
|
||
if (typeof loggers[i][field] === 'function') {
|
||
>loggers : Symbol(loggers, Decl(parserharness.ts, 254, 7))
|
||
>i : Symbol(i, Decl(parserharness.ts, 259, 16))
|
||
>field : Symbol(field, Decl(parserharness.ts, 258, 28))
|
||
|
||
loggers[i][field].apply(loggers[i], params);
|
||
>loggers : Symbol(loggers, Decl(parserharness.ts, 254, 7))
|
||
>i : Symbol(i, Decl(parserharness.ts, 259, 16))
|
||
>field : Symbol(field, Decl(parserharness.ts, 258, 28))
|
||
>loggers : Symbol(loggers, Decl(parserharness.ts, 254, 7))
|
||
>i : Symbol(i, Decl(parserharness.ts, 259, 16))
|
||
>params : Symbol(params, Decl(parserharness.ts, 258, 42))
|
||
}
|
||
}
|
||
}
|
||
|
||
// BDD Framework
|
||
export interface IDone {
|
||
>IDone : Symbol(IDone, Decl(parserharness.ts, 264, 5))
|
||
|
||
(e?: Error): void;
|
||
>e : Symbol(e, Decl(parserharness.ts, 268, 9))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
export class Runnable {
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
|
||
constructor(public description: string, public block: any) { }
|
||
>description : Symbol(Runnable.description, Decl(parserharness.ts, 271, 20))
|
||
>block : Symbol(Runnable.block, Decl(parserharness.ts, 271, 47))
|
||
|
||
// The current stack of Runnable objects
|
||
static currentStack: Runnable[] = [];
|
||
>currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
|
||
// The error, if any, that occurred when running 'block'
|
||
public error: Error = null;
|
||
>error : Symbol(Runnable.error, Decl(parserharness.ts, 274, 45))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
|
||
// Whether or not this object has any failures (including in its descendants)
|
||
public passed = null;
|
||
>passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
|
||
// A list of bugs impacting this object
|
||
public bugs: string[] = [];
|
||
>bugs : Symbol(Runnable.bugs, Decl(parserharness.ts, 280, 29))
|
||
|
||
// A list of all our child Runnables
|
||
public children: Runnable[] = [];
|
||
>children : Symbol(Runnable.children, Decl(parserharness.ts, 283, 35))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
|
||
public addChild(child: Runnable): void {
|
||
>addChild : Symbol(Runnable.addChild, Decl(parserharness.ts, 286, 41))
|
||
>child : Symbol(child, Decl(parserharness.ts, 288, 24))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
|
||
this.children.push(child);
|
||
>this.children.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this.children : Symbol(Runnable.children, Decl(parserharness.ts, 283, 35))
|
||
>this : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>children : Symbol(Runnable.children, Decl(parserharness.ts, 283, 35))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>child : Symbol(child, Decl(parserharness.ts, 288, 24))
|
||
}
|
||
|
||
/** Call function fn, which may take a done function and may possibly execute
|
||
* asynchronously, calling done when finished. Returns true or false depending
|
||
* on whether the function was asynchronous or not.
|
||
*/
|
||
public call(fn: (done?: IDone) => void , done: IDone) {
|
||
>call : Symbol(Runnable.call, Decl(parserharness.ts, 290, 9))
|
||
>fn : Symbol(fn, Decl(parserharness.ts, 296, 20))
|
||
>done : Symbol(done, Decl(parserharness.ts, 296, 25))
|
||
>IDone : Symbol(IDone, Decl(parserharness.ts, 264, 5))
|
||
>done : Symbol(done, Decl(parserharness.ts, 296, 48))
|
||
>IDone : Symbol(IDone, Decl(parserharness.ts, 264, 5))
|
||
|
||
var isAsync = true;
|
||
>isAsync : Symbol(isAsync, Decl(parserharness.ts, 297, 15))
|
||
|
||
try {
|
||
if (fn.length === 0) {
|
||
>fn.length : Symbol(Function.length, Decl(lib.es5.d.ts, --, --))
|
||
>fn : Symbol(fn, Decl(parserharness.ts, 296, 20))
|
||
>length : Symbol(Function.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
// No async.
|
||
fn();
|
||
>fn : Symbol(fn, Decl(parserharness.ts, 296, 20))
|
||
|
||
done();
|
||
>done : Symbol(done, Decl(parserharness.ts, 296, 48))
|
||
|
||
return false;
|
||
} else {
|
||
// Possibly async
|
||
|
||
Runnable.pushGlobalErrorHandler(done);
|
||
>Runnable.pushGlobalErrorHandler : Symbol(Runnable.pushGlobalErrorHandler, Decl(parserharness.ts, 337, 63))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>pushGlobalErrorHandler : Symbol(Runnable.pushGlobalErrorHandler, Decl(parserharness.ts, 337, 63))
|
||
>done : Symbol(done, Decl(parserharness.ts, 296, 48))
|
||
|
||
fn(function () {
|
||
>fn : Symbol(fn, Decl(parserharness.ts, 296, 20))
|
||
|
||
isAsync = false; // If we execute synchronously, this will get called before the return below.
|
||
>isAsync : Symbol(isAsync, Decl(parserharness.ts, 297, 15))
|
||
|
||
Runnable.popGlobalErrorHandler();
|
||
>Runnable.popGlobalErrorHandler : Symbol(Runnable.popGlobalErrorHandler, Decl(parserharness.ts, 343, 9))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>popGlobalErrorHandler : Symbol(Runnable.popGlobalErrorHandler, Decl(parserharness.ts, 343, 9))
|
||
|
||
done();
|
||
>done : Symbol(done, Decl(parserharness.ts, 296, 48))
|
||
|
||
});
|
||
|
||
return isAsync;
|
||
>isAsync : Symbol(isAsync, Decl(parserharness.ts, 297, 15))
|
||
}
|
||
|
||
} catch (e) {
|
||
>e : Symbol(e, Decl(parserharness.ts, 320, 21))
|
||
|
||
done(e);
|
||
>done : Symbol(done, Decl(parserharness.ts, 296, 48))
|
||
>e : Symbol(e, Decl(parserharness.ts, 320, 21))
|
||
|
||
return false;
|
||
}
|
||
}
|
||
|
||
public run(done: IDone) { }
|
||
>run : Symbol(Runnable.run, Decl(parserharness.ts, 325, 9))
|
||
>done : Symbol(done, Decl(parserharness.ts, 327, 19))
|
||
>IDone : Symbol(IDone, Decl(parserharness.ts, 264, 5))
|
||
|
||
public runBlock(done: IDone) {
|
||
>runBlock : Symbol(Runnable.runBlock, Decl(parserharness.ts, 327, 35))
|
||
>done : Symbol(done, Decl(parserharness.ts, 329, 24))
|
||
>IDone : Symbol(IDone, Decl(parserharness.ts, 264, 5))
|
||
|
||
return this.call(this.block, done);
|
||
>this.call : Symbol(Runnable.call, Decl(parserharness.ts, 290, 9))
|
||
>this : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>call : Symbol(Runnable.call, Decl(parserharness.ts, 290, 9))
|
||
>this.block : Symbol(Runnable.block, Decl(parserharness.ts, 271, 47))
|
||
>this : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>block : Symbol(Runnable.block, Decl(parserharness.ts, 271, 47))
|
||
>done : Symbol(done, Decl(parserharness.ts, 329, 24))
|
||
}
|
||
|
||
public runChild(index: number, done: IDone) {
|
||
>runChild : Symbol(Runnable.runChild, Decl(parserharness.ts, 331, 9))
|
||
>index : Symbol(index, Decl(parserharness.ts, 333, 24))
|
||
>done : Symbol(done, Decl(parserharness.ts, 333, 38))
|
||
>IDone : Symbol(IDone, Decl(parserharness.ts, 264, 5))
|
||
|
||
return this.call(<any>((done) => this.children[index].run(done)), done);
|
||
>this.call : Symbol(Runnable.call, Decl(parserharness.ts, 290, 9))
|
||
>this : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>call : Symbol(Runnable.call, Decl(parserharness.ts, 290, 9))
|
||
>done : Symbol(done, Decl(parserharness.ts, 334, 36))
|
||
>this.children[index].run : Symbol(Runnable.run, Decl(parserharness.ts, 325, 9))
|
||
>this.children : Symbol(Runnable.children, Decl(parserharness.ts, 283, 35))
|
||
>this : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>children : Symbol(Runnable.children, Decl(parserharness.ts, 283, 35))
|
||
>index : Symbol(index, Decl(parserharness.ts, 333, 24))
|
||
>run : Symbol(Runnable.run, Decl(parserharness.ts, 325, 9))
|
||
>done : Symbol(done, Decl(parserharness.ts, 334, 36))
|
||
>done : Symbol(done, Decl(parserharness.ts, 333, 38))
|
||
}
|
||
|
||
static errorHandlerStack: { (e: Error): void; }[] = [];
|
||
>errorHandlerStack : Symbol(Runnable.errorHandlerStack, Decl(parserharness.ts, 335, 9))
|
||
>e : Symbol(e, Decl(parserharness.ts, 337, 37))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
|
||
static pushGlobalErrorHandler(done: IDone) {
|
||
>pushGlobalErrorHandler : Symbol(Runnable.pushGlobalErrorHandler, Decl(parserharness.ts, 337, 63))
|
||
>done : Symbol(done, Decl(parserharness.ts, 339, 38))
|
||
>IDone : Symbol(IDone, Decl(parserharness.ts, 264, 5))
|
||
|
||
errorHandlerStack.push(function (e) {
|
||
>e : Symbol(e, Decl(parserharness.ts, 340, 45))
|
||
|
||
done(e);
|
||
>done : Symbol(done, Decl(parserharness.ts, 339, 38))
|
||
>e : Symbol(e, Decl(parserharness.ts, 340, 45))
|
||
|
||
});
|
||
}
|
||
|
||
static popGlobalErrorHandler() {
|
||
>popGlobalErrorHandler : Symbol(Runnable.popGlobalErrorHandler, Decl(parserharness.ts, 343, 9))
|
||
|
||
errorHandlerStack.pop();
|
||
}
|
||
|
||
static handleError(e: Error) {
|
||
>handleError : Symbol(Runnable.handleError, Decl(parserharness.ts, 347, 9))
|
||
>e : Symbol(e, Decl(parserharness.ts, 349, 27))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
|
||
if (errorHandlerStack.length === 0) {
|
||
IO.printLine('Global error: ' + e);
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>e : Symbol(e, Decl(parserharness.ts, 349, 27))
|
||
|
||
} else {
|
||
errorHandlerStack[errorHandlerStack.length - 1](e);
|
||
>e : Symbol(e, Decl(parserharness.ts, 349, 27))
|
||
}
|
||
}
|
||
}
|
||
export class TestCase extends Runnable {
|
||
>TestCase : Symbol(TestCase, Decl(parserharness.ts, 356, 5))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
|
||
public description: string;
|
||
>description : Symbol(TestCase.description, Decl(parserharness.ts, 357, 44))
|
||
|
||
public block;
|
||
>block : Symbol(TestCase.block, Decl(parserharness.ts, 358, 35))
|
||
|
||
constructor(description: string, block: any) {
|
||
>description : Symbol(description, Decl(parserharness.ts, 361, 20))
|
||
>block : Symbol(block, Decl(parserharness.ts, 361, 40))
|
||
|
||
super(description, block);
|
||
>super : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>description : Symbol(description, Decl(parserharness.ts, 361, 20))
|
||
>block : Symbol(block, Decl(parserharness.ts, 361, 40))
|
||
|
||
this.description = description;
|
||
>this.description : Symbol(TestCase.description, Decl(parserharness.ts, 357, 44))
|
||
>this : Symbol(TestCase, Decl(parserharness.ts, 356, 5))
|
||
>description : Symbol(TestCase.description, Decl(parserharness.ts, 357, 44))
|
||
>description : Symbol(description, Decl(parserharness.ts, 361, 20))
|
||
|
||
this.block = block;
|
||
>this.block : Symbol(TestCase.block, Decl(parserharness.ts, 358, 35))
|
||
>this : Symbol(TestCase, Decl(parserharness.ts, 356, 5))
|
||
>block : Symbol(TestCase.block, Decl(parserharness.ts, 358, 35))
|
||
>block : Symbol(block, Decl(parserharness.ts, 361, 40))
|
||
}
|
||
|
||
public addChild(child: Runnable): void {
|
||
>addChild : Symbol(TestCase.addChild, Decl(parserharness.ts, 365, 9))
|
||
>child : Symbol(child, Decl(parserharness.ts, 367, 24))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
|
||
throw new Error("Testcases may not be nested inside other testcases");
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
/** Run the test case block and fail the test if it raised an error. If no error is raised, the test passes. */
|
||
public run(done: IDone) {
|
||
>run : Symbol(TestCase.run, Decl(parserharness.ts, 369, 9))
|
||
>done : Symbol(done, Decl(parserharness.ts, 372, 19))
|
||
>IDone : Symbol(IDone, Decl(parserharness.ts, 264, 5))
|
||
|
||
var that = this;
|
||
>that : Symbol(that, Decl(parserharness.ts, 373, 15))
|
||
>this : Symbol(TestCase, Decl(parserharness.ts, 356, 5))
|
||
|
||
Runnable.currentStack.push(this);
|
||
>Runnable.currentStack.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>Runnable.currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this : Symbol(TestCase, Decl(parserharness.ts, 356, 5))
|
||
|
||
emitLog('testStart', { desc: this.description });
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 377, 34))
|
||
>this.description : Symbol(TestCase.description, Decl(parserharness.ts, 357, 44))
|
||
>this : Symbol(TestCase, Decl(parserharness.ts, 356, 5))
|
||
>description : Symbol(TestCase.description, Decl(parserharness.ts, 357, 44))
|
||
|
||
if (this.block) {
|
||
>this.block : Symbol(TestCase.block, Decl(parserharness.ts, 358, 35))
|
||
>this : Symbol(TestCase, Decl(parserharness.ts, 356, 5))
|
||
>block : Symbol(TestCase.block, Decl(parserharness.ts, 358, 35))
|
||
|
||
var async = this.runBlock(<any>function (e) {
|
||
>async : Symbol(async, Decl(parserharness.ts, 380, 19))
|
||
>this.runBlock : Symbol(Runnable.runBlock, Decl(parserharness.ts, 327, 35))
|
||
>this : Symbol(TestCase, Decl(parserharness.ts, 356, 5))
|
||
>runBlock : Symbol(Runnable.runBlock, Decl(parserharness.ts, 327, 35))
|
||
>e : Symbol(e, Decl(parserharness.ts, 380, 57))
|
||
|
||
if (e) {
|
||
>e : Symbol(e, Decl(parserharness.ts, 380, 57))
|
||
|
||
that.passed = false;
|
||
>that.passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
>that : Symbol(that, Decl(parserharness.ts, 373, 15))
|
||
>passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
|
||
that.error = e;
|
||
>that.error : Symbol(Runnable.error, Decl(parserharness.ts, 274, 45))
|
||
>that : Symbol(that, Decl(parserharness.ts, 373, 15))
|
||
>error : Symbol(Runnable.error, Decl(parserharness.ts, 274, 45))
|
||
>e : Symbol(e, Decl(parserharness.ts, 380, 57))
|
||
|
||
emitLog('error', { desc: this.description, pass: false }, e);
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 384, 42))
|
||
>pass : Symbol(pass, Decl(parserharness.ts, 384, 66))
|
||
>e : Symbol(e, Decl(parserharness.ts, 380, 57))
|
||
|
||
} else {
|
||
that.passed = true;
|
||
>that.passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
>that : Symbol(that, Decl(parserharness.ts, 373, 15))
|
||
>passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
|
||
emitLog('pass', { desc: this.description, pass: true });
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 388, 41))
|
||
>pass : Symbol(pass, Decl(parserharness.ts, 388, 65))
|
||
}
|
||
|
||
Runnable.currentStack.pop();
|
||
>Runnable.currentStack.pop : Symbol(Array.pop, Decl(lib.es5.d.ts, --, --))
|
||
>Runnable.currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>pop : Symbol(Array.pop, Decl(lib.es5.d.ts, --, --))
|
||
|
||
done()
|
||
>done : Symbol(done, Decl(parserharness.ts, 372, 19))
|
||
|
||
});
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
export class Scenario extends Runnable {
|
||
>Scenario : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
|
||
public description: string;
|
||
>description : Symbol(Scenario.description, Decl(parserharness.ts, 400, 44))
|
||
|
||
public block;
|
||
>block : Symbol(Scenario.block, Decl(parserharness.ts, 401, 35))
|
||
|
||
constructor(description: string, block: any) {
|
||
>description : Symbol(description, Decl(parserharness.ts, 404, 20))
|
||
>block : Symbol(block, Decl(parserharness.ts, 404, 40))
|
||
|
||
super(description, block);
|
||
>super : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>description : Symbol(description, Decl(parserharness.ts, 404, 20))
|
||
>block : Symbol(block, Decl(parserharness.ts, 404, 40))
|
||
|
||
this.description = description;
|
||
>this.description : Symbol(Scenario.description, Decl(parserharness.ts, 400, 44))
|
||
>this : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
>description : Symbol(Scenario.description, Decl(parserharness.ts, 400, 44))
|
||
>description : Symbol(description, Decl(parserharness.ts, 404, 20))
|
||
|
||
this.block = block;
|
||
>this.block : Symbol(Scenario.block, Decl(parserharness.ts, 401, 35))
|
||
>this : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
>block : Symbol(Scenario.block, Decl(parserharness.ts, 401, 35))
|
||
>block : Symbol(block, Decl(parserharness.ts, 404, 40))
|
||
}
|
||
|
||
/** Run the block, and if the block doesn't raise an error, run the children. */
|
||
public run(done: IDone) {
|
||
>run : Symbol(Scenario.run, Decl(parserharness.ts, 408, 9))
|
||
>done : Symbol(done, Decl(parserharness.ts, 411, 19))
|
||
>IDone : Symbol(IDone, Decl(parserharness.ts, 264, 5))
|
||
|
||
var that = this;
|
||
>that : Symbol(that, Decl(parserharness.ts, 412, 15))
|
||
>this : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
|
||
Runnable.currentStack.push(this);
|
||
>Runnable.currentStack.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>Runnable.currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
|
||
emitLog('scenarioStart', { desc: this.description });
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 416, 38))
|
||
>this.description : Symbol(Scenario.description, Decl(parserharness.ts, 400, 44))
|
||
>this : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
>description : Symbol(Scenario.description, Decl(parserharness.ts, 400, 44))
|
||
|
||
var async = this.runBlock(<any>function (e) {
|
||
>async : Symbol(async, Decl(parserharness.ts, 418, 15))
|
||
>this.runBlock : Symbol(Runnable.runBlock, Decl(parserharness.ts, 327, 35))
|
||
>this : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
>runBlock : Symbol(Runnable.runBlock, Decl(parserharness.ts, 327, 35))
|
||
>e : Symbol(e, Decl(parserharness.ts, 418, 53))
|
||
|
||
Runnable.currentStack.pop();
|
||
>Runnable.currentStack.pop : Symbol(Array.pop, Decl(lib.es5.d.ts, --, --))
|
||
>Runnable.currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>pop : Symbol(Array.pop, Decl(lib.es5.d.ts, --, --))
|
||
|
||
if (e) {
|
||
>e : Symbol(e, Decl(parserharness.ts, 418, 53))
|
||
|
||
that.passed = false;
|
||
>that.passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
>that : Symbol(that, Decl(parserharness.ts, 412, 15))
|
||
>passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
|
||
that.error = e;
|
||
>that.error : Symbol(Runnable.error, Decl(parserharness.ts, 274, 45))
|
||
>that : Symbol(that, Decl(parserharness.ts, 412, 15))
|
||
>error : Symbol(Runnable.error, Decl(parserharness.ts, 274, 45))
|
||
>e : Symbol(e, Decl(parserharness.ts, 418, 53))
|
||
|
||
var metadata: IScenarioMetadata = { id: undefined, desc: this.description, pass: false, bugs: assert.bugIds };
|
||
>metadata : Symbol(metadata, Decl(parserharness.ts, 423, 23))
|
||
>IScenarioMetadata : Symbol(IScenarioMetadata, Decl(parserharness.ts, 71, 5))
|
||
>id : Symbol(id, Decl(parserharness.ts, 423, 55))
|
||
>undefined : Symbol(undefined)
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 423, 70))
|
||
>pass : Symbol(pass, Decl(parserharness.ts, 423, 94))
|
||
>bugs : Symbol(bugs, Decl(parserharness.ts, 423, 107))
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
|
||
// Report all bugs affecting this scenario
|
||
assert.bugIds.forEach(desc => emitLog('bug', metadata, desc));
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 425, 42))
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
>metadata : Symbol(metadata, Decl(parserharness.ts, 423, 23))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 425, 42))
|
||
|
||
emitLog('scenarioEnd', metadata, e);
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
>metadata : Symbol(metadata, Decl(parserharness.ts, 423, 23))
|
||
>e : Symbol(e, Decl(parserharness.ts, 418, 53))
|
||
|
||
done();
|
||
>done : Symbol(done, Decl(parserharness.ts, 411, 19))
|
||
|
||
} else {
|
||
that.passed = true; // so far so good.
|
||
>that.passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
>that : Symbol(that, Decl(parserharness.ts, 412, 15))
|
||
>passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
|
||
that.runChildren(done);
|
||
>that.runChildren : Symbol(Scenario.runChildren, Decl(parserharness.ts, 433, 9))
|
||
>that : Symbol(that, Decl(parserharness.ts, 412, 15))
|
||
>runChildren : Symbol(Scenario.runChildren, Decl(parserharness.ts, 433, 9))
|
||
>done : Symbol(done, Decl(parserharness.ts, 411, 19))
|
||
}
|
||
});
|
||
}
|
||
|
||
/** Run the children of the scenario (other scenarios and test cases). If any fail,
|
||
* set this scenario to failed. Synchronous tests will run synchronously without
|
||
* adding stack frames.
|
||
*/
|
||
public runChildren(done: IDone, index = 0) {
|
||
>runChildren : Symbol(Scenario.runChildren, Decl(parserharness.ts, 433, 9))
|
||
>done : Symbol(done, Decl(parserharness.ts, 439, 27))
|
||
>IDone : Symbol(IDone, Decl(parserharness.ts, 264, 5))
|
||
>index : Symbol(index, Decl(parserharness.ts, 439, 39))
|
||
|
||
var that = this;
|
||
>that : Symbol(that, Decl(parserharness.ts, 440, 15))
|
||
>this : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
|
||
var async = false;
|
||
>async : Symbol(async, Decl(parserharness.ts, 441, 15))
|
||
|
||
for (; index < this.children.length; index++) {
|
||
>index : Symbol(index, Decl(parserharness.ts, 439, 39))
|
||
>this.children.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.children : Symbol(Runnable.children, Decl(parserharness.ts, 283, 35))
|
||
>this : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
>children : Symbol(Runnable.children, Decl(parserharness.ts, 283, 35))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>index : Symbol(index, Decl(parserharness.ts, 439, 39))
|
||
|
||
async = this.runChild(index, <any>function (e) {
|
||
>async : Symbol(async, Decl(parserharness.ts, 441, 15))
|
||
>this.runChild : Symbol(Runnable.runChild, Decl(parserharness.ts, 331, 9))
|
||
>this : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
>runChild : Symbol(Runnable.runChild, Decl(parserharness.ts, 331, 9))
|
||
>index : Symbol(index, Decl(parserharness.ts, 439, 39))
|
||
>e : Symbol(e, Decl(parserharness.ts, 444, 60))
|
||
|
||
that.passed = that.passed && that.children[index].passed;
|
||
>that.passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
>that : Symbol(that, Decl(parserharness.ts, 440, 15))
|
||
>passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
>that.passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
>that : Symbol(that, Decl(parserharness.ts, 440, 15))
|
||
>passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
>that.children[index].passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
>that.children : Symbol(Runnable.children, Decl(parserharness.ts, 283, 35))
|
||
>that : Symbol(that, Decl(parserharness.ts, 440, 15))
|
||
>children : Symbol(Runnable.children, Decl(parserharness.ts, 283, 35))
|
||
>index : Symbol(index, Decl(parserharness.ts, 439, 39))
|
||
>passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
|
||
if (async)
|
||
>async : Symbol(async, Decl(parserharness.ts, 441, 15))
|
||
|
||
that.runChildren(done, index + 1);
|
||
>that.runChildren : Symbol(Scenario.runChildren, Decl(parserharness.ts, 433, 9))
|
||
>that : Symbol(that, Decl(parserharness.ts, 440, 15))
|
||
>runChildren : Symbol(Scenario.runChildren, Decl(parserharness.ts, 433, 9))
|
||
>done : Symbol(done, Decl(parserharness.ts, 439, 27))
|
||
>index : Symbol(index, Decl(parserharness.ts, 439, 39))
|
||
|
||
});
|
||
|
||
if (async)
|
||
>async : Symbol(async, Decl(parserharness.ts, 441, 15))
|
||
|
||
return;
|
||
}
|
||
|
||
var metadata: IScenarioMetadata = { id: undefined, desc: this.description, pass: this.passed, bugs: assert.bugIds };
|
||
>metadata : Symbol(metadata, Decl(parserharness.ts, 455, 15))
|
||
>IScenarioMetadata : Symbol(IScenarioMetadata, Decl(parserharness.ts, 71, 5))
|
||
>id : Symbol(id, Decl(parserharness.ts, 455, 47))
|
||
>undefined : Symbol(undefined)
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 455, 62))
|
||
>this.description : Symbol(Scenario.description, Decl(parserharness.ts, 400, 44))
|
||
>this : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
>description : Symbol(Scenario.description, Decl(parserharness.ts, 400, 44))
|
||
>pass : Symbol(pass, Decl(parserharness.ts, 455, 86))
|
||
>this.passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
>this : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
>passed : Symbol(Runnable.passed, Decl(parserharness.ts, 277, 35))
|
||
>bugs : Symbol(bugs, Decl(parserharness.ts, 455, 105))
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
|
||
// Report all bugs affecting this scenario
|
||
assert.bugIds.forEach(desc => emitLog('bug', metadata, desc));
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 457, 34))
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
>metadata : Symbol(metadata, Decl(parserharness.ts, 455, 15))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 457, 34))
|
||
|
||
emitLog('scenarioEnd', metadata);
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
>metadata : Symbol(metadata, Decl(parserharness.ts, 455, 15))
|
||
|
||
done();
|
||
>done : Symbol(done, Decl(parserharness.ts, 439, 27))
|
||
}
|
||
}
|
||
export class Run extends Runnable {
|
||
>Run : Symbol(Run, Decl(parserharness.ts, 462, 5))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
|
||
constructor() {
|
||
super('Test Run', null);
|
||
>super : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
}
|
||
|
||
public run() {
|
||
>run : Symbol(Run.run, Decl(parserharness.ts, 466, 9))
|
||
|
||
emitLog('start');
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
|
||
this.runChildren();
|
||
>this.runChildren : Symbol(Run.runChildren, Decl(parserharness.ts, 471, 9))
|
||
>this : Symbol(Run, Decl(parserharness.ts, 462, 5))
|
||
>runChildren : Symbol(Run.runChildren, Decl(parserharness.ts, 471, 9))
|
||
}
|
||
|
||
public runChildren(index = 0) {
|
||
>runChildren : Symbol(Run.runChildren, Decl(parserharness.ts, 471, 9))
|
||
>index : Symbol(index, Decl(parserharness.ts, 473, 27))
|
||
|
||
var async = false;
|
||
>async : Symbol(async, Decl(parserharness.ts, 474, 15))
|
||
|
||
var that = this;
|
||
>that : Symbol(that, Decl(parserharness.ts, 475, 15))
|
||
>this : Symbol(Run, Decl(parserharness.ts, 462, 5))
|
||
|
||
for (; index < this.children.length; index++) {
|
||
>index : Symbol(index, Decl(parserharness.ts, 473, 27))
|
||
>this.children.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.children : Symbol(Runnable.children, Decl(parserharness.ts, 283, 35))
|
||
>this : Symbol(Run, Decl(parserharness.ts, 462, 5))
|
||
>children : Symbol(Runnable.children, Decl(parserharness.ts, 283, 35))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>index : Symbol(index, Decl(parserharness.ts, 473, 27))
|
||
|
||
// Clear out bug descriptions
|
||
assert.bugIds = [];
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
|
||
async = this.runChild(index, <any>function (e) {
|
||
>async : Symbol(async, Decl(parserharness.ts, 474, 15))
|
||
>this.runChild : Symbol(Runnable.runChild, Decl(parserharness.ts, 331, 9))
|
||
>this : Symbol(Run, Decl(parserharness.ts, 462, 5))
|
||
>runChild : Symbol(Runnable.runChild, Decl(parserharness.ts, 331, 9))
|
||
>index : Symbol(index, Decl(parserharness.ts, 473, 27))
|
||
>e : Symbol(e, Decl(parserharness.ts, 481, 60))
|
||
|
||
if (async) {
|
||
>async : Symbol(async, Decl(parserharness.ts, 474, 15))
|
||
|
||
that.runChildren(index + 1);
|
||
>that.runChildren : Symbol(Run.runChildren, Decl(parserharness.ts, 471, 9))
|
||
>that : Symbol(that, Decl(parserharness.ts, 475, 15))
|
||
>runChildren : Symbol(Run.runChildren, Decl(parserharness.ts, 471, 9))
|
||
>index : Symbol(index, Decl(parserharness.ts, 473, 27))
|
||
}
|
||
});
|
||
|
||
if (async) {
|
||
>async : Symbol(async, Decl(parserharness.ts, 474, 15))
|
||
|
||
return;
|
||
}
|
||
}
|
||
|
||
Perf.runBenchmarks();
|
||
>Perf.runBenchmarks : Symbol(Perf.runBenchmarks, Decl(parserharness.ts, 641, 9))
|
||
>Perf : Symbol(Perf, Decl(parserharness.ts, 495, 5))
|
||
>runBenchmarks : Symbol(Perf.runBenchmarks, Decl(parserharness.ts, 641, 9))
|
||
|
||
emitLog('end');
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
}
|
||
}
|
||
|
||
// Performance test
|
||
export module Perf {
|
||
>Perf : Symbol(Perf, Decl(parserharness.ts, 495, 5))
|
||
|
||
export module Clock {
|
||
>Clock : Symbol(Clock, Decl(parserharness.ts, 498, 24))
|
||
|
||
export var now: () => number;
|
||
>now : Symbol(now, Decl(parserharness.ts, 500, 22))
|
||
|
||
export var resolution: number;
|
||
>resolution : Symbol(resolution, Decl(parserharness.ts, 501, 22))
|
||
|
||
declare module WScript {
|
||
>WScript : Symbol(WScript, Decl(parserharness.ts, 501, 42))
|
||
|
||
export function InitializeProjection();
|
||
>InitializeProjection : Symbol(InitializeProjection, Decl(parserharness.ts, 503, 36))
|
||
}
|
||
|
||
declare module TestUtilities {
|
||
>TestUtilities : Symbol(TestUtilities, Decl(parserharness.ts, 505, 13))
|
||
|
||
export function QueryPerformanceCounter(): number;
|
||
>QueryPerformanceCounter : Symbol(QueryPerformanceCounter, Decl(parserharness.ts, 507, 42))
|
||
|
||
export function QueryPerformanceFrequency(): number;
|
||
>QueryPerformanceFrequency : Symbol(QueryPerformanceFrequency, Decl(parserharness.ts, 508, 66))
|
||
}
|
||
|
||
if (typeof WScript !== "undefined" && typeof global['WScript'].InitializeProjection !== "undefined") {
|
||
>WScript : Symbol(WScript, Decl(parserharness.ts, 501, 42))
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
|
||
// Running in JSHost.
|
||
global['WScript'].InitializeProjection();
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
|
||
now = function () {
|
||
>now : Symbol(now, Decl(parserharness.ts, 500, 22))
|
||
|
||
return TestUtilities.QueryPerformanceCounter();
|
||
>TestUtilities.QueryPerformanceCounter : Symbol(TestUtilities.QueryPerformanceCounter, Decl(parserharness.ts, 507, 42))
|
||
>TestUtilities : Symbol(TestUtilities, Decl(parserharness.ts, 505, 13))
|
||
>QueryPerformanceCounter : Symbol(TestUtilities.QueryPerformanceCounter, Decl(parserharness.ts, 507, 42))
|
||
}
|
||
|
||
resolution = TestUtilities.QueryPerformanceFrequency();
|
||
>resolution : Symbol(resolution, Decl(parserharness.ts, 501, 22))
|
||
>TestUtilities.QueryPerformanceFrequency : Symbol(TestUtilities.QueryPerformanceFrequency, Decl(parserharness.ts, 508, 66))
|
||
>TestUtilities : Symbol(TestUtilities, Decl(parserharness.ts, 505, 13))
|
||
>QueryPerformanceFrequency : Symbol(TestUtilities.QueryPerformanceFrequency, Decl(parserharness.ts, 508, 66))
|
||
|
||
} else {
|
||
now = function () {
|
||
>now : Symbol(now, Decl(parserharness.ts, 500, 22))
|
||
|
||
return Date.now();
|
||
>Date.now : Symbol(DateConstructor.now, Decl(lib.es5.d.ts, --, --))
|
||
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>now : Symbol(DateConstructor.now, Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
resolution = 1000;
|
||
>resolution : Symbol(resolution, Decl(parserharness.ts, 501, 22))
|
||
}
|
||
}
|
||
|
||
export class Timer {
|
||
>Timer : Symbol(Timer, Decl(parserharness.ts, 528, 9))
|
||
|
||
public startTime;
|
||
>startTime : Symbol(Timer.startTime, Decl(parserharness.ts, 530, 28))
|
||
|
||
public time = 0;
|
||
>time : Symbol(Timer.time, Decl(parserharness.ts, 531, 29))
|
||
|
||
public start() {
|
||
>start : Symbol(Timer.start, Decl(parserharness.ts, 532, 28))
|
||
|
||
this.time = 0;
|
||
>this.time : Symbol(Timer.time, Decl(parserharness.ts, 531, 29))
|
||
>this : Symbol(Timer, Decl(parserharness.ts, 528, 9))
|
||
>time : Symbol(Timer.time, Decl(parserharness.ts, 531, 29))
|
||
|
||
this.startTime = Clock.now();
|
||
>this.startTime : Symbol(Timer.startTime, Decl(parserharness.ts, 530, 28))
|
||
>this : Symbol(Timer, Decl(parserharness.ts, 528, 9))
|
||
>startTime : Symbol(Timer.startTime, Decl(parserharness.ts, 530, 28))
|
||
>Clock.now : Symbol(Clock.now, Decl(parserharness.ts, 500, 22))
|
||
>Clock : Symbol(Clock, Decl(parserharness.ts, 498, 24))
|
||
>now : Symbol(Clock.now, Decl(parserharness.ts, 500, 22))
|
||
}
|
||
|
||
public end() {
|
||
>end : Symbol(Timer.end, Decl(parserharness.ts, 537, 13))
|
||
|
||
// Set time to MS.
|
||
this.time = (Clock.now() - this.startTime) / Clock.resolution * 1000;
|
||
>this.time : Symbol(Timer.time, Decl(parserharness.ts, 531, 29))
|
||
>this : Symbol(Timer, Decl(parserharness.ts, 528, 9))
|
||
>time : Symbol(Timer.time, Decl(parserharness.ts, 531, 29))
|
||
>Clock.now : Symbol(Clock.now, Decl(parserharness.ts, 500, 22))
|
||
>Clock : Symbol(Clock, Decl(parserharness.ts, 498, 24))
|
||
>now : Symbol(Clock.now, Decl(parserharness.ts, 500, 22))
|
||
>this.startTime : Symbol(Timer.startTime, Decl(parserharness.ts, 530, 28))
|
||
>this : Symbol(Timer, Decl(parserharness.ts, 528, 9))
|
||
>startTime : Symbol(Timer.startTime, Decl(parserharness.ts, 530, 28))
|
||
>Clock.resolution : Symbol(Clock.resolution, Decl(parserharness.ts, 501, 22))
|
||
>Clock : Symbol(Clock, Decl(parserharness.ts, 498, 24))
|
||
>resolution : Symbol(Clock.resolution, Decl(parserharness.ts, 501, 22))
|
||
}
|
||
}
|
||
|
||
export class Dataset {
|
||
>Dataset : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
|
||
public data: number[] = [];
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
|
||
public add(value: number) {
|
||
>add : Symbol(Dataset.add, Decl(parserharness.ts, 546, 39))
|
||
>value : Symbol(value, Decl(parserharness.ts, 548, 23))
|
||
|
||
this.data.push(value);
|
||
>this.data.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>value : Symbol(value, Decl(parserharness.ts, 548, 23))
|
||
}
|
||
|
||
public mean() {
|
||
>mean : Symbol(Dataset.mean, Decl(parserharness.ts, 550, 13))
|
||
|
||
var sum = 0;
|
||
>sum : Symbol(sum, Decl(parserharness.ts, 553, 19))
|
||
|
||
for (var i = 0; i < this.data.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 554, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 554, 24))
|
||
>this.data.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 554, 24))
|
||
|
||
sum += this.data[i];
|
||
>sum : Symbol(sum, Decl(parserharness.ts, 553, 19))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>i : Symbol(i, Decl(parserharness.ts, 554, 24))
|
||
}
|
||
|
||
return sum / this.data.length;
|
||
>sum : Symbol(sum, Decl(parserharness.ts, 553, 19))
|
||
>this.data.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
public min() {
|
||
>min : Symbol(Dataset.min, Decl(parserharness.ts, 559, 13))
|
||
|
||
var min = this.data[0];
|
||
>min : Symbol(min, Decl(parserharness.ts, 562, 19))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
|
||
for (var i = 1; i < this.data.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 564, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 564, 24))
|
||
>this.data.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 564, 24))
|
||
|
||
if (this.data[i] < min) {
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>i : Symbol(i, Decl(parserharness.ts, 564, 24))
|
||
>min : Symbol(min, Decl(parserharness.ts, 562, 19))
|
||
|
||
min = this.data[i];
|
||
>min : Symbol(min, Decl(parserharness.ts, 562, 19))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>i : Symbol(i, Decl(parserharness.ts, 564, 24))
|
||
}
|
||
}
|
||
|
||
return min;
|
||
>min : Symbol(min, Decl(parserharness.ts, 562, 19))
|
||
}
|
||
|
||
public max() {
|
||
>max : Symbol(Dataset.max, Decl(parserharness.ts, 571, 13))
|
||
|
||
var max = this.data[0];
|
||
>max : Symbol(max, Decl(parserharness.ts, 574, 19))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
|
||
for (var i = 1; i < this.data.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 576, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 576, 24))
|
||
>this.data.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 576, 24))
|
||
|
||
if (this.data[i] > max) {
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>i : Symbol(i, Decl(parserharness.ts, 576, 24))
|
||
>max : Symbol(max, Decl(parserharness.ts, 574, 19))
|
||
|
||
max = this.data[i];
|
||
>max : Symbol(max, Decl(parserharness.ts, 574, 19))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>i : Symbol(i, Decl(parserharness.ts, 576, 24))
|
||
}
|
||
}
|
||
|
||
return max;
|
||
>max : Symbol(max, Decl(parserharness.ts, 574, 19))
|
||
}
|
||
|
||
public stdDev() {
|
||
>stdDev : Symbol(Dataset.stdDev, Decl(parserharness.ts, 583, 13))
|
||
|
||
var sampleMean = this.mean();
|
||
>sampleMean : Symbol(sampleMean, Decl(parserharness.ts, 586, 19))
|
||
>this.mean : Symbol(Dataset.mean, Decl(parserharness.ts, 550, 13))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>mean : Symbol(Dataset.mean, Decl(parserharness.ts, 550, 13))
|
||
|
||
var sumOfSquares = 0;
|
||
>sumOfSquares : Symbol(sumOfSquares, Decl(parserharness.ts, 587, 19))
|
||
|
||
for (var i = 0; i < this.data.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 588, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 588, 24))
|
||
>this.data.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 588, 24))
|
||
|
||
sumOfSquares += Math.pow(this.data[i] - sampleMean, 2);
|
||
>sumOfSquares : Symbol(sumOfSquares, Decl(parserharness.ts, 587, 19))
|
||
>Math.pow : Symbol(Math.pow, Decl(lib.es5.d.ts, --, --))
|
||
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>pow : Symbol(Math.pow, Decl(lib.es5.d.ts, --, --))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>i : Symbol(i, Decl(parserharness.ts, 588, 24))
|
||
>sampleMean : Symbol(sampleMean, Decl(parserharness.ts, 586, 19))
|
||
}
|
||
|
||
return Math.sqrt(sumOfSquares / this.data.length);
|
||
>Math.sqrt : Symbol(Math.sqrt, Decl(lib.es5.d.ts, --, --))
|
||
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>sqrt : Symbol(Math.sqrt, Decl(lib.es5.d.ts, --, --))
|
||
>sumOfSquares : Symbol(sumOfSquares, Decl(parserharness.ts, 587, 19))
|
||
>this.data.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>this : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
}
|
||
|
||
// Base benchmark class with some defaults.
|
||
export class Benchmark {
|
||
>Benchmark : Symbol(Benchmark, Decl(parserharness.ts, 594, 9))
|
||
|
||
public iterations = 10;
|
||
>iterations : Symbol(Benchmark.iterations, Decl(parserharness.ts, 597, 32))
|
||
|
||
public description = "";
|
||
>description : Symbol(Benchmark.description, Decl(parserharness.ts, 598, 35))
|
||
|
||
public bench(subBench?: () => void ) { }
|
||
>bench : Symbol(Benchmark.bench, Decl(parserharness.ts, 599, 36))
|
||
>subBench : Symbol(subBench, Decl(parserharness.ts, 600, 25))
|
||
|
||
public before() { }
|
||
>before : Symbol(Benchmark.before, Decl(parserharness.ts, 600, 52))
|
||
|
||
public beforeEach() { }
|
||
>beforeEach : Symbol(Benchmark.beforeEach, Decl(parserharness.ts, 601, 31))
|
||
|
||
public after() { }
|
||
>after : Symbol(Benchmark.after, Decl(parserharness.ts, 602, 35))
|
||
|
||
public afterEach() { }
|
||
>afterEach : Symbol(Benchmark.afterEach, Decl(parserharness.ts, 603, 30))
|
||
|
||
public results: { [x: string]: Dataset; } = <{ [x: string]: Dataset; }>{};
|
||
>results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>x : Symbol(x, Decl(parserharness.ts, 605, 31))
|
||
>Dataset : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
>x : Symbol(x, Decl(parserharness.ts, 605, 60))
|
||
>Dataset : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
|
||
public addTimingFor(name: string, timing: number) {
|
||
>addTimingFor : Symbol(Benchmark.addTimingFor, Decl(parserharness.ts, 605, 86))
|
||
>name : Symbol(name, Decl(parserharness.ts, 607, 32))
|
||
>timing : Symbol(timing, Decl(parserharness.ts, 607, 45))
|
||
|
||
this.results[name] = this.results[name] || new Dataset();
|
||
>this.results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>this : Symbol(Benchmark, Decl(parserharness.ts, 594, 9))
|
||
>results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>name : Symbol(name, Decl(parserharness.ts, 607, 32))
|
||
>this.results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>this : Symbol(Benchmark, Decl(parserharness.ts, 594, 9))
|
||
>results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>name : Symbol(name, Decl(parserharness.ts, 607, 32))
|
||
>Dataset : Symbol(Dataset, Decl(parserharness.ts, 543, 9))
|
||
|
||
this.results[name].add(timing);
|
||
>this.results[name].add : Symbol(Dataset.add, Decl(parserharness.ts, 546, 39))
|
||
>this.results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>this : Symbol(Benchmark, Decl(parserharness.ts, 594, 9))
|
||
>results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>name : Symbol(name, Decl(parserharness.ts, 607, 32))
|
||
>add : Symbol(Dataset.add, Decl(parserharness.ts, 546, 39))
|
||
>timing : Symbol(timing, Decl(parserharness.ts, 607, 45))
|
||
}
|
||
}
|
||
|
||
export var benchmarks: { new (): Benchmark; }[] = [];
|
||
>benchmarks : Symbol(benchmarks, Decl(parserharness.ts, 613, 18))
|
||
>Benchmark : Symbol(Benchmark, Decl(parserharness.ts, 594, 9))
|
||
|
||
var timeFunction: (
|
||
>timeFunction : Symbol(timeFunction, Decl(parserharness.ts, 615, 11))
|
||
|
||
benchmark: Benchmark,
|
||
>benchmark : Symbol(benchmark, Decl(parserharness.ts, 615, 27))
|
||
>Benchmark : Symbol(Benchmark, Decl(parserharness.ts, 594, 9))
|
||
|
||
description?: string,
|
||
>description : Symbol(description, Decl(parserharness.ts, 616, 33))
|
||
|
||
name?: string,
|
||
>name : Symbol(name, Decl(parserharness.ts, 617, 33))
|
||
|
||
f?: (bench?: { (): void; }) => void
|
||
>f : Symbol(f, Decl(parserharness.ts, 618, 26))
|
||
>bench : Symbol(bench, Decl(parserharness.ts, 619, 17))
|
||
|
||
) => void;
|
||
|
||
timeFunction = function (
|
||
>timeFunction : Symbol(timeFunction, Decl(parserharness.ts, 615, 11))
|
||
|
||
benchmark: Benchmark,
|
||
>benchmark : Symbol(benchmark, Decl(parserharness.ts, 622, 33))
|
||
>Benchmark : Symbol(Benchmark, Decl(parserharness.ts, 594, 9))
|
||
|
||
description: string = benchmark.description,
|
||
>description : Symbol(description, Decl(parserharness.ts, 623, 33))
|
||
>benchmark.description : Symbol(Benchmark.description, Decl(parserharness.ts, 598, 35))
|
||
>benchmark : Symbol(benchmark, Decl(parserharness.ts, 622, 33))
|
||
>description : Symbol(Benchmark.description, Decl(parserharness.ts, 598, 35))
|
||
|
||
name: string = '',
|
||
>name : Symbol(name, Decl(parserharness.ts, 624, 56))
|
||
|
||
f = benchmark.bench
|
||
>f : Symbol(f, Decl(parserharness.ts, 625, 30))
|
||
>benchmark.bench : Symbol(Benchmark.bench, Decl(parserharness.ts, 599, 36))
|
||
>benchmark : Symbol(benchmark, Decl(parserharness.ts, 622, 33))
|
||
>bench : Symbol(Benchmark.bench, Decl(parserharness.ts, 599, 36))
|
||
|
||
): void {
|
||
|
||
var t = new Timer();
|
||
>t : Symbol(t, Decl(parserharness.ts, 629, 15))
|
||
>Timer : Symbol(Timer, Decl(parserharness.ts, 528, 9))
|
||
|
||
t.start();
|
||
>t.start : Symbol(Timer.start, Decl(parserharness.ts, 532, 28))
|
||
>t : Symbol(t, Decl(parserharness.ts, 629, 15))
|
||
>start : Symbol(Timer.start, Decl(parserharness.ts, 532, 28))
|
||
|
||
var subBenchmark = function (name, f): void {
|
||
>subBenchmark : Symbol(subBenchmark, Decl(parserharness.ts, 632, 15))
|
||
>name : Symbol(name, Decl(parserharness.ts, 632, 41))
|
||
>f : Symbol(f, Decl(parserharness.ts, 632, 46))
|
||
|
||
timeFunction(benchmark, description, name, f);
|
||
>timeFunction : Symbol(timeFunction, Decl(parserharness.ts, 615, 11))
|
||
>benchmark : Symbol(benchmark, Decl(parserharness.ts, 622, 33))
|
||
>description : Symbol(description, Decl(parserharness.ts, 623, 33))
|
||
>name : Symbol(name, Decl(parserharness.ts, 632, 41))
|
||
>f : Symbol(f, Decl(parserharness.ts, 632, 46))
|
||
}
|
||
|
||
f.call(benchmark, subBenchmark);
|
||
>f.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
|
||
>f : Symbol(f, Decl(parserharness.ts, 625, 30))
|
||
>call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
|
||
>benchmark : Symbol(benchmark, Decl(parserharness.ts, 622, 33))
|
||
>subBenchmark : Symbol(subBenchmark, Decl(parserharness.ts, 632, 15))
|
||
|
||
t.end();
|
||
>t.end : Symbol(Timer.end, Decl(parserharness.ts, 537, 13))
|
||
>t : Symbol(t, Decl(parserharness.ts, 629, 15))
|
||
>end : Symbol(Timer.end, Decl(parserharness.ts, 537, 13))
|
||
|
||
benchmark.addTimingFor(name, t.time);
|
||
>benchmark.addTimingFor : Symbol(Benchmark.addTimingFor, Decl(parserharness.ts, 605, 86))
|
||
>benchmark : Symbol(benchmark, Decl(parserharness.ts, 622, 33))
|
||
>addTimingFor : Symbol(Benchmark.addTimingFor, Decl(parserharness.ts, 605, 86))
|
||
>name : Symbol(name, Decl(parserharness.ts, 624, 56))
|
||
>t.time : Symbol(Timer.time, Decl(parserharness.ts, 531, 29))
|
||
>t : Symbol(t, Decl(parserharness.ts, 629, 15))
|
||
>time : Symbol(Timer.time, Decl(parserharness.ts, 531, 29))
|
||
}
|
||
|
||
export function runBenchmarks() {
|
||
>runBenchmarks : Symbol(runBenchmarks, Decl(parserharness.ts, 641, 9))
|
||
|
||
for (var i = 0; i < benchmarks.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 644, 20))
|
||
>i : Symbol(i, Decl(parserharness.ts, 644, 20))
|
||
>benchmarks.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>benchmarks : Symbol(benchmarks, Decl(parserharness.ts, 613, 18))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 644, 20))
|
||
|
||
var b = new benchmarks[i]();
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>benchmarks : Symbol(benchmarks, Decl(parserharness.ts, 613, 18))
|
||
>i : Symbol(i, Decl(parserharness.ts, 644, 20))
|
||
|
||
|
||
var t = new Timer();
|
||
>t : Symbol(t, Decl(parserharness.ts, 648, 19))
|
||
>Timer : Symbol(Timer, Decl(parserharness.ts, 528, 9))
|
||
|
||
b.before();
|
||
>b.before : Symbol(Benchmark.before, Decl(parserharness.ts, 600, 52))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>before : Symbol(Benchmark.before, Decl(parserharness.ts, 600, 52))
|
||
|
||
for (var j = 0; j < b.iterations; j++) {
|
||
>j : Symbol(j, Decl(parserharness.ts, 650, 24))
|
||
>j : Symbol(j, Decl(parserharness.ts, 650, 24))
|
||
>b.iterations : Symbol(Benchmark.iterations, Decl(parserharness.ts, 597, 32))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>iterations : Symbol(Benchmark.iterations, Decl(parserharness.ts, 597, 32))
|
||
>j : Symbol(j, Decl(parserharness.ts, 650, 24))
|
||
|
||
b.beforeEach();
|
||
>b.beforeEach : Symbol(Benchmark.beforeEach, Decl(parserharness.ts, 601, 31))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>beforeEach : Symbol(Benchmark.beforeEach, Decl(parserharness.ts, 601, 31))
|
||
|
||
timeFunction(b);
|
||
>timeFunction : Symbol(timeFunction, Decl(parserharness.ts, 615, 11))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
|
||
b.afterEach();
|
||
>b.afterEach : Symbol(Benchmark.afterEach, Decl(parserharness.ts, 603, 30))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>afterEach : Symbol(Benchmark.afterEach, Decl(parserharness.ts, 603, 30))
|
||
}
|
||
b.after();
|
||
>b.after : Symbol(Benchmark.after, Decl(parserharness.ts, 602, 35))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>after : Symbol(Benchmark.after, Decl(parserharness.ts, 602, 35))
|
||
|
||
for (var prop in b.results) {
|
||
>prop : Symbol(prop, Decl(parserharness.ts, 657, 24))
|
||
>b.results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
|
||
var description = b.description + (prop ? ": " + prop : '');
|
||
>description : Symbol(description, Decl(parserharness.ts, 658, 23))
|
||
>b.description : Symbol(Benchmark.description, Decl(parserharness.ts, 598, 35))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>description : Symbol(Benchmark.description, Decl(parserharness.ts, 598, 35))
|
||
>prop : Symbol(prop, Decl(parserharness.ts, 657, 24))
|
||
>prop : Symbol(prop, Decl(parserharness.ts, 657, 24))
|
||
|
||
emitLog('testStart', { desc: description });
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 660, 42))
|
||
>description : Symbol(description, Decl(parserharness.ts, 658, 23))
|
||
|
||
emitLog('pass', {
|
||
>emitLog : Symbol(emitLog, Decl(parserharness.ts, 257, 5))
|
||
|
||
desc: description, pass: true, perfResults: {
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 662, 37))
|
||
>description : Symbol(description, Decl(parserharness.ts, 658, 23))
|
||
>pass : Symbol(pass, Decl(parserharness.ts, 663, 42))
|
||
>perfResults : Symbol(perfResults, Decl(parserharness.ts, 663, 54))
|
||
|
||
mean: b.results[prop].mean(),
|
||
>mean : Symbol(mean, Decl(parserharness.ts, 663, 69))
|
||
>b.results[prop].mean : Symbol(Dataset.mean, Decl(parserharness.ts, 550, 13))
|
||
>b.results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>prop : Symbol(prop, Decl(parserharness.ts, 657, 24))
|
||
>mean : Symbol(Dataset.mean, Decl(parserharness.ts, 550, 13))
|
||
|
||
min: b.results[prop].min(),
|
||
>min : Symbol(min, Decl(parserharness.ts, 664, 57))
|
||
>b.results[prop].min : Symbol(Dataset.min, Decl(parserharness.ts, 559, 13))
|
||
>b.results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>prop : Symbol(prop, Decl(parserharness.ts, 657, 24))
|
||
>min : Symbol(Dataset.min, Decl(parserharness.ts, 559, 13))
|
||
|
||
max: b.results[prop].max(),
|
||
>max : Symbol(max, Decl(parserharness.ts, 665, 55))
|
||
>b.results[prop].max : Symbol(Dataset.max, Decl(parserharness.ts, 571, 13))
|
||
>b.results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>prop : Symbol(prop, Decl(parserharness.ts, 657, 24))
|
||
>max : Symbol(Dataset.max, Decl(parserharness.ts, 571, 13))
|
||
|
||
stdDev: b.results[prop].stdDev(),
|
||
>stdDev : Symbol(stdDev, Decl(parserharness.ts, 666, 55))
|
||
>b.results[prop].stdDev : Symbol(Dataset.stdDev, Decl(parserharness.ts, 583, 13))
|
||
>b.results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>prop : Symbol(prop, Decl(parserharness.ts, 657, 24))
|
||
>stdDev : Symbol(Dataset.stdDev, Decl(parserharness.ts, 583, 13))
|
||
|
||
trials: b.results[prop].data
|
||
>trials : Symbol(trials, Decl(parserharness.ts, 667, 61))
|
||
>b.results[prop].data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
>b.results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>b : Symbol(b, Decl(parserharness.ts, 645, 19))
|
||
>results : Symbol(Benchmark.results, Decl(parserharness.ts, 604, 34))
|
||
>prop : Symbol(prop, Decl(parserharness.ts, 657, 24))
|
||
>data : Symbol(Dataset.data, Decl(parserharness.ts, 545, 30))
|
||
}
|
||
});
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
// Replace with better type when classes are assignment compatible with
|
||
// the below type.
|
||
// export function addBenchmark(BenchmarkClass: {new(): Benchmark;}) {
|
||
export function addBenchmark(BenchmarkClass: any) {
|
||
>addBenchmark : Symbol(addBenchmark, Decl(parserharness.ts, 674, 9))
|
||
>BenchmarkClass : Symbol(BenchmarkClass, Decl(parserharness.ts, 679, 37))
|
||
|
||
benchmarks.push(BenchmarkClass);
|
||
>benchmarks.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>benchmarks : Symbol(benchmarks, Decl(parserharness.ts, 613, 18))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>BenchmarkClass : Symbol(BenchmarkClass, Decl(parserharness.ts, 679, 37))
|
||
}
|
||
|
||
}
|
||
|
||
/** Functionality for compiling TypeScript code */
|
||
export module Compiler {
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
|
||
/** Aggregate various writes into a single array of lines. Useful for passing to the
|
||
* TypeScript compiler to fill with source code or errors.
|
||
*/
|
||
export class WriterAggregator implements ITextWriter {
|
||
>WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
|
||
public lines: string[] = [];
|
||
>lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
|
||
public currentLine = "";
|
||
>currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
|
||
public Write(str) {
|
||
>Write : Symbol(WriterAggregator.Write, Decl(parserharness.ts, 692, 36))
|
||
>str : Symbol(str, Decl(parserharness.ts, 694, 25))
|
||
|
||
this.currentLine += str;
|
||
>this.currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
>this : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
>str : Symbol(str, Decl(parserharness.ts, 694, 25))
|
||
}
|
||
|
||
public WriteLine(str) {
|
||
>WriteLine : Symbol(WriterAggregator.WriteLine, Decl(parserharness.ts, 696, 13))
|
||
>str : Symbol(str, Decl(parserharness.ts, 698, 29))
|
||
|
||
this.lines.push(this.currentLine + str);
|
||
>this.lines.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this.lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>this : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this.currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
>this : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
>str : Symbol(str, Decl(parserharness.ts, 698, 29))
|
||
|
||
this.currentLine = "";
|
||
>this.currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
>this : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
}
|
||
|
||
public Close() {
|
||
>Close : Symbol(WriterAggregator.Close, Decl(parserharness.ts, 701, 13))
|
||
|
||
if (this.currentLine.length > 0) { this.lines.push(this.currentLine); }
|
||
>this.currentLine.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
>this : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.lines.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this.lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>this : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this.currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
>this : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
|
||
this.currentLine = "";
|
||
>this.currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
>this : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
}
|
||
|
||
public reset() {
|
||
>reset : Symbol(WriterAggregator.reset, Decl(parserharness.ts, 706, 13))
|
||
|
||
this.lines = [];
|
||
>this.lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>this : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
|
||
this.currentLine = "";
|
||
>this.currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
>this : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>currentLine : Symbol(WriterAggregator.currentLine, Decl(parserharness.ts, 691, 40))
|
||
}
|
||
}
|
||
|
||
/** Mimics having multiple files, later concatenated to a single file. */
|
||
export class EmitterIOHost implements TypeScript.EmitterIOHost {
|
||
>EmitterIOHost : Symbol(EmitterIOHost, Decl(parserharness.ts, 712, 9))
|
||
|
||
private fileCollection = {};
|
||
>fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
|
||
/** create file gets the whole path to create, so this works as expected with the --out parameter */
|
||
public createFile(s: string, useUTF8?: boolean): ITextWriter {
|
||
>createFile : Symbol(EmitterIOHost.createFile, Decl(parserharness.ts, 717, 40))
|
||
>s : Symbol(s, Decl(parserharness.ts, 720, 30))
|
||
>useUTF8 : Symbol(useUTF8, Decl(parserharness.ts, 720, 40))
|
||
>ITextWriter : Symbol(ITextWriter)
|
||
|
||
if (this.fileCollection[s]) {
|
||
>this.fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>this : Symbol(EmitterIOHost, Decl(parserharness.ts, 712, 9))
|
||
>fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>s : Symbol(s, Decl(parserharness.ts, 720, 30))
|
||
|
||
return <ITextWriter>this.fileCollection[s];
|
||
>ITextWriter : Symbol(ITextWriter)
|
||
>this.fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>this : Symbol(EmitterIOHost, Decl(parserharness.ts, 712, 9))
|
||
>fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>s : Symbol(s, Decl(parserharness.ts, 720, 30))
|
||
}
|
||
|
||
var writer = new Harness.Compiler.WriterAggregator();
|
||
>writer : Symbol(writer, Decl(parserharness.ts, 726, 19))
|
||
>Harness.Compiler.WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>Harness.Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
|
||
this.fileCollection[s] = writer;
|
||
>this.fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>this : Symbol(EmitterIOHost, Decl(parserharness.ts, 712, 9))
|
||
>fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>s : Symbol(s, Decl(parserharness.ts, 720, 30))
|
||
>writer : Symbol(writer, Decl(parserharness.ts, 726, 19))
|
||
|
||
return writer;
|
||
>writer : Symbol(writer, Decl(parserharness.ts, 726, 19))
|
||
}
|
||
|
||
public directoryExists(s: string) { return false; }
|
||
>directoryExists : Symbol(EmitterIOHost.directoryExists, Decl(parserharness.ts, 729, 13))
|
||
>s : Symbol(s, Decl(parserharness.ts, 731, 35))
|
||
|
||
public fileExists(s: string) { return typeof this.fileCollection[s] !== 'undefined'; }
|
||
>fileExists : Symbol(EmitterIOHost.fileExists, Decl(parserharness.ts, 731, 63))
|
||
>s : Symbol(s, Decl(parserharness.ts, 732, 30))
|
||
>this.fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>this : Symbol(EmitterIOHost, Decl(parserharness.ts, 712, 9))
|
||
>fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>s : Symbol(s, Decl(parserharness.ts, 732, 30))
|
||
|
||
public resolvePath(s: string) { return s; }
|
||
>resolvePath : Symbol(EmitterIOHost.resolvePath, Decl(parserharness.ts, 732, 98))
|
||
>s : Symbol(s, Decl(parserharness.ts, 733, 31))
|
||
>s : Symbol(s, Decl(parserharness.ts, 733, 31))
|
||
|
||
public reset() { this.fileCollection = {}; }
|
||
>reset : Symbol(EmitterIOHost.reset, Decl(parserharness.ts, 733, 55))
|
||
>this.fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>this : Symbol(EmitterIOHost, Decl(parserharness.ts, 712, 9))
|
||
>fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
|
||
public toArray(): { filename: string; file: WriterAggregator; }[] {
|
||
>toArray : Symbol(EmitterIOHost.toArray, Decl(parserharness.ts, 735, 56))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 737, 31))
|
||
>file : Symbol(file, Decl(parserharness.ts, 737, 49))
|
||
>WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
|
||
var result: { filename: string; file: WriterAggregator; }[] = [];
|
||
>result : Symbol(result, Decl(parserharness.ts, 738, 19))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 738, 29))
|
||
>file : Symbol(file, Decl(parserharness.ts, 738, 47))
|
||
>WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
|
||
for (var p in this.fileCollection) {
|
||
>p : Symbol(p, Decl(parserharness.ts, 740, 24))
|
||
>this.fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>this : Symbol(EmitterIOHost, Decl(parserharness.ts, 712, 9))
|
||
>fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
|
||
if (this.fileCollection.hasOwnProperty(p)) {
|
||
>this.fileCollection.hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es5.d.ts, --, --))
|
||
>this.fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>this : Symbol(EmitterIOHost, Decl(parserharness.ts, 712, 9))
|
||
>fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es5.d.ts, --, --))
|
||
>p : Symbol(p, Decl(parserharness.ts, 740, 24))
|
||
|
||
var current = <Harness.Compiler.WriterAggregator>this.fileCollection[p];
|
||
>current : Symbol(current, Decl(parserharness.ts, 742, 27))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>this.fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>this : Symbol(EmitterIOHost, Decl(parserharness.ts, 712, 9))
|
||
>fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>p : Symbol(p, Decl(parserharness.ts, 740, 24))
|
||
|
||
if (current.lines.length > 0) {
|
||
>current.lines.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>current.lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>current : Symbol(current, Decl(parserharness.ts, 742, 27))
|
||
>lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
if (p !== '0.js') { current.lines.unshift('////[' + p + ']'); }
|
||
>p : Symbol(p, Decl(parserharness.ts, 740, 24))
|
||
>current.lines.unshift : Symbol(Array.unshift, Decl(lib.es5.d.ts, --, --))
|
||
>current.lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>current : Symbol(current, Decl(parserharness.ts, 742, 27))
|
||
>lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>unshift : Symbol(Array.unshift, Decl(lib.es5.d.ts, --, --))
|
||
>p : Symbol(p, Decl(parserharness.ts, 740, 24))
|
||
|
||
result.push({ filename: p, file: this.fileCollection[p] });
|
||
>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>result : Symbol(result, Decl(parserharness.ts, 738, 19))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 745, 41))
|
||
>p : Symbol(p, Decl(parserharness.ts, 740, 24))
|
||
>file : Symbol(file, Decl(parserharness.ts, 745, 54))
|
||
>this.fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>this : Symbol(EmitterIOHost, Decl(parserharness.ts, 712, 9))
|
||
>fileCollection : Symbol(EmitterIOHost.fileCollection, Decl(parserharness.ts, 715, 72))
|
||
>p : Symbol(p, Decl(parserharness.ts, 740, 24))
|
||
}
|
||
}
|
||
}
|
||
return result;
|
||
>result : Symbol(result, Decl(parserharness.ts, 738, 19))
|
||
}
|
||
}
|
||
|
||
var libFolder: string = global['WScript'] ? TypeScript.filePath(global['WScript'].ScriptFullName) : (__dirname + '/');
|
||
>libFolder : Symbol(libFolder, Decl(parserharness.ts, 753, 11))
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
>__dirname : Symbol(__dirname, Decl(parserharness.ts, 25, 11))
|
||
|
||
export var libText = IO ? IO.readFile(libFolder + "lib.d.ts") : '';
|
||
>libText : Symbol(libText, Decl(parserharness.ts, 754, 18))
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>libFolder : Symbol(libFolder, Decl(parserharness.ts, 753, 11))
|
||
|
||
var stdout = new EmitterIOHost();
|
||
>stdout : Symbol(stdout, Decl(parserharness.ts, 756, 11))
|
||
>EmitterIOHost : Symbol(EmitterIOHost, Decl(parserharness.ts, 712, 9))
|
||
|
||
var stderr = new WriterAggregator();
|
||
>stderr : Symbol(stderr, Decl(parserharness.ts, 757, 11))
|
||
>WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
|
||
export function isDeclareFile(filename: string) {
|
||
>isDeclareFile : Symbol(isDeclareFile, Decl(parserharness.ts, 757, 44))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 759, 38))
|
||
|
||
return /\.d\.ts$/.test(filename);
|
||
>/\.d\.ts$/.test : Symbol(RegExp.test, Decl(lib.es5.d.ts, --, --))
|
||
>test : Symbol(RegExp.test, Decl(lib.es5.d.ts, --, --))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 759, 38))
|
||
}
|
||
|
||
export function makeDefaultCompilerForTest(c?: TypeScript.TypeScriptCompiler) {
|
||
>makeDefaultCompilerForTest : Symbol(makeDefaultCompilerForTest, Decl(parserharness.ts, 761, 9))
|
||
>c : Symbol(c, Decl(parserharness.ts, 763, 51))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>TypeScriptCompiler : Symbol(TypeScript.TypeScriptCompiler)
|
||
|
||
var compiler = c || new TypeScript.TypeScriptCompiler(stderr);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 764, 15))
|
||
>c : Symbol(c, Decl(parserharness.ts, 763, 51))
|
||
>stderr : Symbol(stderr, Decl(parserharness.ts, 757, 11))
|
||
|
||
compiler.parser.errorRecovery = true;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 764, 15))
|
||
|
||
compiler.settings.codeGenTarget = TypeScript.CodeGenTarget.ES5;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 764, 15))
|
||
|
||
compiler.settings.controlFlow = true;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 764, 15))
|
||
|
||
compiler.settings.controlFlowUseDef = true;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 764, 15))
|
||
|
||
if (Harness.usePull) {
|
||
>Harness.usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
|
||
compiler.settings.usePull = true;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 764, 15))
|
||
|
||
compiler.settings.useFidelity = true;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 764, 15))
|
||
}
|
||
|
||
compiler.parseEmitOption(stdout);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 764, 15))
|
||
>stdout : Symbol(stdout, Decl(parserharness.ts, 756, 11))
|
||
|
||
TypeScript.moduleGenTarget = TypeScript.ModuleGenTarget.Synchronous;
|
||
compiler.addUnit(Harness.Compiler.libText, "lib.d.ts", true);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 764, 15))
|
||
>Harness.Compiler.libText : Symbol(libText, Decl(parserharness.ts, 754, 18))
|
||
>Harness.Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>libText : Symbol(libText, Decl(parserharness.ts, 754, 18))
|
||
|
||
return compiler;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 764, 15))
|
||
}
|
||
|
||
var compiler: TypeScript.TypeScriptCompiler;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>TypeScriptCompiler : Symbol(TypeScript.TypeScriptCompiler)
|
||
|
||
recreate();
|
||
>recreate : Symbol(recreate, Decl(parserharness.ts, 1218, 9))
|
||
|
||
// pullUpdateUnit is sufficient if an existing unit is updated, if a new unit is added we need to do a full typecheck
|
||
var needsFullTypeCheck = true;
|
||
>needsFullTypeCheck : Symbol(needsFullTypeCheck, Decl(parserharness.ts, 784, 11))
|
||
|
||
export function compile(code?: string, filename?: string) {
|
||
>compile : Symbol(compile, Decl(parserharness.ts, 784, 38))
|
||
>code : Symbol(code, Decl(parserharness.ts, 785, 32))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 785, 46))
|
||
|
||
if (usePull) {
|
||
>usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
|
||
if (needsFullTypeCheck) {
|
||
>needsFullTypeCheck : Symbol(needsFullTypeCheck, Decl(parserharness.ts, 784, 11))
|
||
|
||
compiler.pullTypeCheck(true);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
|
||
needsFullTypeCheck = false;
|
||
>needsFullTypeCheck : Symbol(needsFullTypeCheck, Decl(parserharness.ts, 784, 11))
|
||
}
|
||
else {
|
||
// requires unit to already exist in the compiler
|
||
compiler.pullUpdateUnit(new TypeScript.StringSourceText(""), filename, true);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 785, 46))
|
||
|
||
compiler.pullUpdateUnit(new TypeScript.StringSourceText(code), filename, true);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>code : Symbol(code, Decl(parserharness.ts, 785, 32))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 785, 46))
|
||
}
|
||
}
|
||
else {
|
||
compiler.reTypeCheck();
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
}
|
||
}
|
||
|
||
// Types
|
||
export class Type {
|
||
>Type : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
|
||
constructor(public type, public code, public identifier) { }
|
||
>type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
|
||
public normalizeToArray(arg: any) {
|
||
>normalizeToArray : Symbol(Type.normalizeToArray, Decl(parserharness.ts, 804, 72))
|
||
>arg : Symbol(arg, Decl(parserharness.ts, 806, 36))
|
||
|
||
if ((Array.isArray && Array.isArray(arg)) || arg instanceof Array)
|
||
>Array.isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --))
|
||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --))
|
||
>Array.isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --))
|
||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --))
|
||
>arg : Symbol(arg, Decl(parserharness.ts, 806, 36))
|
||
>arg : Symbol(arg, Decl(parserharness.ts, 806, 36))
|
||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
|
||
return arg;
|
||
>arg : Symbol(arg, Decl(parserharness.ts, 806, 36))
|
||
|
||
return [arg];
|
||
>arg : Symbol(arg, Decl(parserharness.ts, 806, 36))
|
||
}
|
||
|
||
public compilesOk(testCode): boolean {
|
||
>compilesOk : Symbol(Type.compilesOk, Decl(parserharness.ts, 811, 13))
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 813, 30))
|
||
|
||
var errors = null;
|
||
>errors : Symbol(errors, Decl(parserharness.ts, 814, 19))
|
||
|
||
compileString(testCode, 'test.ts', function (compilerResult) {
|
||
>compileString : Symbol(compileString, Decl(parserharness.ts, 1341, 9))
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 813, 30))
|
||
>compilerResult : Symbol(compilerResult, Decl(parserharness.ts, 815, 61))
|
||
|
||
errors = compilerResult.errors;
|
||
>errors : Symbol(errors, Decl(parserharness.ts, 814, 19))
|
||
>compilerResult.errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>compilerResult : Symbol(compilerResult, Decl(parserharness.ts, 815, 61))
|
||
>errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
|
||
})
|
||
|
||
return errors.length === 0;
|
||
>errors : Symbol(errors, Decl(parserharness.ts, 814, 19))
|
||
}
|
||
|
||
public isSubtypeOf(other: Type) {
|
||
>isSubtypeOf : Symbol(Type.isSubtypeOf, Decl(parserharness.ts, 820, 13))
|
||
>other : Symbol(other, Decl(parserharness.ts, 822, 31))
|
||
>Type : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
|
||
var testCode = 'class __test1__ {\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
|
||
testCode += ' public test() {\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
|
||
testCode += ' ' + other.code + ';\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
>other.code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>other : Symbol(other, Decl(parserharness.ts, 822, 31))
|
||
>code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
|
||
testCode += ' return ' + other.identifier + ';\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
>other.identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>other : Symbol(other, Decl(parserharness.ts, 822, 31))
|
||
>identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
|
||
testCode += ' }\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
|
||
testCode += '}\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
|
||
testCode += 'class __test2__ extends __test1__ {\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
|
||
testCode += ' public test() {\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
|
||
testCode += ' ' + this.code + ';\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
>this.code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
|
||
testCode += ' return ' + other.identifier + ';\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
>other.identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>other : Symbol(other, Decl(parserharness.ts, 822, 31))
|
||
>identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
|
||
testCode += ' }\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
|
||
testCode += '}\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
|
||
return this.compilesOk(testCode);
|
||
>this.compilesOk : Symbol(Type.compilesOk, Decl(parserharness.ts, 811, 13))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>compilesOk : Symbol(Type.compilesOk, Decl(parserharness.ts, 811, 13))
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 823, 19))
|
||
}
|
||
|
||
// TODO: Find an implementation of isIdenticalTo that works.
|
||
//public isIdenticalTo(other: Type) {
|
||
// var testCode = 'module __test1__ {\n';
|
||
// testCode += ' ' + this.code + ';\n';
|
||
// testCode += ' export var __val__ = ' + this.identifier + ';\n';
|
||
// testCode += '}\n';
|
||
// testCode += 'var __test1__val__ = __test1__.__val__;\n';
|
||
|
||
// testCode += 'module __test2__ {\n';
|
||
// testCode += ' ' + other.code + ';\n';
|
||
// testCode += ' export var __val__ = ' + other.identifier + ';\n';
|
||
// testCode += '}\n';
|
||
// testCode += 'var __test2__val__ = __test2__.__val__;\n';
|
||
|
||
// testCode += 'function __test__function__() { if(true) { return __test1__val__ }; return __test2__val__; }';
|
||
|
||
// return this.compilesOk(testCode);
|
||
//}
|
||
|
||
public assertSubtypeOf(others: any) {
|
||
>assertSubtypeOf : Symbol(Type.assertSubtypeOf, Decl(parserharness.ts, 837, 13))
|
||
>others : Symbol(others, Decl(parserharness.ts, 858, 35))
|
||
|
||
others = this.normalizeToArray(others);
|
||
>others : Symbol(others, Decl(parserharness.ts, 858, 35))
|
||
>this.normalizeToArray : Symbol(Type.normalizeToArray, Decl(parserharness.ts, 804, 72))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>normalizeToArray : Symbol(Type.normalizeToArray, Decl(parserharness.ts, 804, 72))
|
||
>others : Symbol(others, Decl(parserharness.ts, 858, 35))
|
||
|
||
for (var i = 0; i < others.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 861, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 861, 24))
|
||
>others : Symbol(others, Decl(parserharness.ts, 858, 35))
|
||
>i : Symbol(i, Decl(parserharness.ts, 861, 24))
|
||
|
||
if (!this.isSubtypeOf(others[i])) {
|
||
>this.isSubtypeOf : Symbol(Type.isSubtypeOf, Decl(parserharness.ts, 820, 13))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>isSubtypeOf : Symbol(Type.isSubtypeOf, Decl(parserharness.ts, 820, 13))
|
||
>others : Symbol(others, Decl(parserharness.ts, 858, 35))
|
||
>i : Symbol(i, Decl(parserharness.ts, 861, 24))
|
||
|
||
throw new Error("Expected " + this.type + " to be a subtype of " + others[i].type);
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>this.type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>others : Symbol(others, Decl(parserharness.ts, 858, 35))
|
||
>i : Symbol(i, Decl(parserharness.ts, 861, 24))
|
||
}
|
||
}
|
||
}
|
||
|
||
public assertNotSubtypeOf(others: any) {
|
||
>assertNotSubtypeOf : Symbol(Type.assertNotSubtypeOf, Decl(parserharness.ts, 866, 13))
|
||
>others : Symbol(others, Decl(parserharness.ts, 868, 38))
|
||
|
||
others = this.normalizeToArray(others);
|
||
>others : Symbol(others, Decl(parserharness.ts, 868, 38))
|
||
>this.normalizeToArray : Symbol(Type.normalizeToArray, Decl(parserharness.ts, 804, 72))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>normalizeToArray : Symbol(Type.normalizeToArray, Decl(parserharness.ts, 804, 72))
|
||
>others : Symbol(others, Decl(parserharness.ts, 868, 38))
|
||
|
||
for (var i = 0; i < others.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 871, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 871, 24))
|
||
>others : Symbol(others, Decl(parserharness.ts, 868, 38))
|
||
>i : Symbol(i, Decl(parserharness.ts, 871, 24))
|
||
|
||
if (this.isSubtypeOf(others[i])) {
|
||
>this.isSubtypeOf : Symbol(Type.isSubtypeOf, Decl(parserharness.ts, 820, 13))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>isSubtypeOf : Symbol(Type.isSubtypeOf, Decl(parserharness.ts, 820, 13))
|
||
>others : Symbol(others, Decl(parserharness.ts, 868, 38))
|
||
>i : Symbol(i, Decl(parserharness.ts, 871, 24))
|
||
|
||
throw new Error("Expected " + this.type + " to be a subtype of " + others[i].type);
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>this.type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>others : Symbol(others, Decl(parserharness.ts, 868, 38))
|
||
>i : Symbol(i, Decl(parserharness.ts, 871, 24))
|
||
}
|
||
}
|
||
}
|
||
|
||
//public assertIdenticalTo(other: Type) {
|
||
// if (!this.isIdenticalTo(other)) {
|
||
// throw new Error("Expected " + this.type + " to be identical to " + other.type);
|
||
// }
|
||
//}
|
||
|
||
//public assertNotIdenticalTo(other: Type) {
|
||
// if (!this.isIdenticalTo(other)) {
|
||
// throw new Error("Expected " + this.type + " to not be identical to " + other.type);
|
||
// }
|
||
//}
|
||
|
||
public isAssignmentCompatibleWith(other: Type) {
|
||
>isAssignmentCompatibleWith : Symbol(Type.isAssignmentCompatibleWith, Decl(parserharness.ts, 876, 13))
|
||
>other : Symbol(other, Decl(parserharness.ts, 890, 46))
|
||
>Type : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
|
||
var testCode = 'module __test1__ {\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
|
||
testCode += ' ' + this.code + ';\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
>this.code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
|
||
testCode += ' export var __val__ = ' + this.identifier + ';\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
>this.identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
|
||
testCode += '}\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
|
||
testCode += 'var __test1__val__ = __test1__.__val__;\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
|
||
testCode += 'module __test2__ {\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
|
||
testCode += ' export ' + other.code + ';\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
>other.code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>other : Symbol(other, Decl(parserharness.ts, 890, 46))
|
||
>code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
|
||
testCode += ' export var __val__ = ' + other.identifier + ';\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
>other.identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>other : Symbol(other, Decl(parserharness.ts, 890, 46))
|
||
>identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
|
||
testCode += '}\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
|
||
testCode += 'var __test2__val__ = __test2__.__val__;\n';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
|
||
testCode += '__test2__val__ = __test1__val__;';
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
|
||
return this.compilesOk(testCode);
|
||
>this.compilesOk : Symbol(Type.compilesOk, Decl(parserharness.ts, 811, 13))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>compilesOk : Symbol(Type.compilesOk, Decl(parserharness.ts, 811, 13))
|
||
>testCode : Symbol(testCode, Decl(parserharness.ts, 891, 19))
|
||
}
|
||
|
||
public assertAssignmentCompatibleWith(others: any) {
|
||
>assertAssignmentCompatibleWith : Symbol(Type.assertAssignmentCompatibleWith, Decl(parserharness.ts, 906, 13))
|
||
>others : Symbol(others, Decl(parserharness.ts, 908, 50))
|
||
|
||
others = this.normalizeToArray(others);
|
||
>others : Symbol(others, Decl(parserharness.ts, 908, 50))
|
||
>this.normalizeToArray : Symbol(Type.normalizeToArray, Decl(parserharness.ts, 804, 72))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>normalizeToArray : Symbol(Type.normalizeToArray, Decl(parserharness.ts, 804, 72))
|
||
>others : Symbol(others, Decl(parserharness.ts, 908, 50))
|
||
|
||
for (var i = 0; i < others.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 911, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 911, 24))
|
||
>others : Symbol(others, Decl(parserharness.ts, 908, 50))
|
||
>i : Symbol(i, Decl(parserharness.ts, 911, 24))
|
||
|
||
var other = others[i];
|
||
>other : Symbol(other, Decl(parserharness.ts, 912, 23))
|
||
>others : Symbol(others, Decl(parserharness.ts, 908, 50))
|
||
>i : Symbol(i, Decl(parserharness.ts, 911, 24))
|
||
|
||
if (!this.isAssignmentCompatibleWith(other)) {
|
||
>this.isAssignmentCompatibleWith : Symbol(Type.isAssignmentCompatibleWith, Decl(parserharness.ts, 876, 13))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>isAssignmentCompatibleWith : Symbol(Type.isAssignmentCompatibleWith, Decl(parserharness.ts, 876, 13))
|
||
>other : Symbol(other, Decl(parserharness.ts, 912, 23))
|
||
|
||
throw new Error("Expected " + this.type + " to be assignment compatible with " + other.type);
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>this.type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>other : Symbol(other, Decl(parserharness.ts, 912, 23))
|
||
}
|
||
}
|
||
}
|
||
|
||
public assertNotAssignmentCompatibleWith(others: any) {
|
||
>assertNotAssignmentCompatibleWith : Symbol(Type.assertNotAssignmentCompatibleWith, Decl(parserharness.ts, 918, 13))
|
||
>others : Symbol(others, Decl(parserharness.ts, 920, 53))
|
||
|
||
others = this.normalizeToArray(others);
|
||
>others : Symbol(others, Decl(parserharness.ts, 920, 53))
|
||
>this.normalizeToArray : Symbol(Type.normalizeToArray, Decl(parserharness.ts, 804, 72))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>normalizeToArray : Symbol(Type.normalizeToArray, Decl(parserharness.ts, 804, 72))
|
||
>others : Symbol(others, Decl(parserharness.ts, 920, 53))
|
||
|
||
for (var i = 0; i < others.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 923, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 923, 24))
|
||
>others : Symbol(others, Decl(parserharness.ts, 920, 53))
|
||
>i : Symbol(i, Decl(parserharness.ts, 923, 24))
|
||
|
||
var other = others[i];
|
||
>other : Symbol(other, Decl(parserharness.ts, 924, 23))
|
||
>others : Symbol(others, Decl(parserharness.ts, 920, 53))
|
||
>i : Symbol(i, Decl(parserharness.ts, 923, 24))
|
||
|
||
if (this.isAssignmentCompatibleWith(other)) {
|
||
>this.isAssignmentCompatibleWith : Symbol(Type.isAssignmentCompatibleWith, Decl(parserharness.ts, 876, 13))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>isAssignmentCompatibleWith : Symbol(Type.isAssignmentCompatibleWith, Decl(parserharness.ts, 876, 13))
|
||
>other : Symbol(other, Decl(parserharness.ts, 924, 23))
|
||
|
||
throw new Error("Expected " + this.type + " to not be assignment compatible with " + other.type);
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>this.type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>other : Symbol(other, Decl(parserharness.ts, 924, 23))
|
||
}
|
||
}
|
||
}
|
||
|
||
public assertThisCanBeAssignedTo(desc: string, these: any[], notThese: any[]) {
|
||
>assertThisCanBeAssignedTo : Symbol(Type.assertThisCanBeAssignedTo, Decl(parserharness.ts, 930, 13))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 932, 45))
|
||
>these : Symbol(these, Decl(parserharness.ts, 932, 58))
|
||
>notThese : Symbol(notThese, Decl(parserharness.ts, 932, 72))
|
||
|
||
it(desc + " is assignable to ", () => {
|
||
>it : Symbol(it, Decl(parserharness.ts, 1852, 5))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 932, 45))
|
||
|
||
this.assertAssignmentCompatibleWith(these);
|
||
>this.assertAssignmentCompatibleWith : Symbol(Type.assertAssignmentCompatibleWith, Decl(parserharness.ts, 906, 13))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>assertAssignmentCompatibleWith : Symbol(Type.assertAssignmentCompatibleWith, Decl(parserharness.ts, 906, 13))
|
||
>these : Symbol(these, Decl(parserharness.ts, 932, 58))
|
||
|
||
});
|
||
|
||
it(desc + " not assignable to ", () => {
|
||
>it : Symbol(it, Decl(parserharness.ts, 1852, 5))
|
||
>desc : Symbol(desc, Decl(parserharness.ts, 932, 45))
|
||
|
||
this.assertNotAssignmentCompatibleWith(notThese);
|
||
>this.assertNotAssignmentCompatibleWith : Symbol(Type.assertNotAssignmentCompatibleWith, Decl(parserharness.ts, 918, 13))
|
||
>this : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>assertNotAssignmentCompatibleWith : Symbol(Type.assertNotAssignmentCompatibleWith, Decl(parserharness.ts, 918, 13))
|
||
>notThese : Symbol(notThese, Decl(parserharness.ts, 932, 72))
|
||
|
||
});
|
||
}
|
||
|
||
}
|
||
|
||
export class TypeFactory {
|
||
>TypeFactory : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
|
||
public any: Type;
|
||
>any : Symbol(TypeFactory.any, Decl(parserharness.ts, 944, 34))
|
||
>Type : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
|
||
public number: Type;
|
||
>number : Symbol(TypeFactory.number, Decl(parserharness.ts, 945, 29))
|
||
>Type : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
|
||
public string: Type;
|
||
>string : Symbol(TypeFactory.string, Decl(parserharness.ts, 946, 32))
|
||
>Type : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
|
||
public boolean: Type;
|
||
>boolean : Symbol(TypeFactory.boolean, Decl(parserharness.ts, 947, 32))
|
||
>Type : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
|
||
constructor() {
|
||
this.any = this.get('var x : any', 'x');
|
||
>this.any : Symbol(TypeFactory.any, Decl(parserharness.ts, 944, 34))
|
||
>this : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
>any : Symbol(TypeFactory.any, Decl(parserharness.ts, 944, 34))
|
||
>this.get : Symbol(TypeFactory.get, Decl(parserharness.ts, 955, 13))
|
||
>this : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
>get : Symbol(TypeFactory.get, Decl(parserharness.ts, 955, 13))
|
||
|
||
this.number = this.get('var x : number', 'x');
|
||
>this.number : Symbol(TypeFactory.number, Decl(parserharness.ts, 945, 29))
|
||
>this : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
>number : Symbol(TypeFactory.number, Decl(parserharness.ts, 945, 29))
|
||
>this.get : Symbol(TypeFactory.get, Decl(parserharness.ts, 955, 13))
|
||
>this : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
>get : Symbol(TypeFactory.get, Decl(parserharness.ts, 955, 13))
|
||
|
||
this.string = this.get('var x : string', 'x');
|
||
>this.string : Symbol(TypeFactory.string, Decl(parserharness.ts, 946, 32))
|
||
>this : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
>string : Symbol(TypeFactory.string, Decl(parserharness.ts, 946, 32))
|
||
>this.get : Symbol(TypeFactory.get, Decl(parserharness.ts, 955, 13))
|
||
>this : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
>get : Symbol(TypeFactory.get, Decl(parserharness.ts, 955, 13))
|
||
|
||
this.boolean = this.get('var x : boolean', 'x');
|
||
>this.boolean : Symbol(TypeFactory.boolean, Decl(parserharness.ts, 947, 32))
|
||
>this : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
>boolean : Symbol(TypeFactory.boolean, Decl(parserharness.ts, 947, 32))
|
||
>this.get : Symbol(TypeFactory.get, Decl(parserharness.ts, 955, 13))
|
||
>this : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
>get : Symbol(TypeFactory.get, Decl(parserharness.ts, 955, 13))
|
||
}
|
||
|
||
public get (code: string, target: any) {
|
||
>get : Symbol(TypeFactory.get, Decl(parserharness.ts, 955, 13))
|
||
>code : Symbol(code, Decl(parserharness.ts, 957, 24))
|
||
>target : Symbol(target, Decl(parserharness.ts, 957, 37))
|
||
|
||
var targetIdentifier = '';
|
||
>targetIdentifier : Symbol(targetIdentifier, Decl(parserharness.ts, 958, 19))
|
||
|
||
var targetPosition = -1;
|
||
>targetPosition : Symbol(targetPosition, Decl(parserharness.ts, 959, 19))
|
||
|
||
if (typeof target === "string") {
|
||
>target : Symbol(target, Decl(parserharness.ts, 957, 37))
|
||
|
||
targetIdentifier = target;
|
||
>targetIdentifier : Symbol(targetIdentifier, Decl(parserharness.ts, 958, 19))
|
||
>target : Symbol(target, Decl(parserharness.ts, 957, 37))
|
||
}
|
||
else if (typeof target === "number") {
|
||
>target : Symbol(target, Decl(parserharness.ts, 957, 37))
|
||
|
||
targetPosition = target;
|
||
>targetPosition : Symbol(targetPosition, Decl(parserharness.ts, 959, 19))
|
||
>target : Symbol(target, Decl(parserharness.ts, 957, 37))
|
||
}
|
||
else {
|
||
throw new Error("Expected string or number not " + (typeof target));
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>target : Symbol(target, Decl(parserharness.ts, 957, 37))
|
||
}
|
||
|
||
var errors = null;
|
||
>errors : Symbol(errors, Decl(parserharness.ts, 970, 19))
|
||
|
||
compileString(code, 'test.ts', function (compilerResult) {
|
||
>compileString : Symbol(compileString, Decl(parserharness.ts, 1341, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 957, 24))
|
||
>compilerResult : Symbol(compilerResult, Decl(parserharness.ts, 971, 57))
|
||
|
||
errors = compilerResult.errors;
|
||
>errors : Symbol(errors, Decl(parserharness.ts, 970, 19))
|
||
>compilerResult.errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>compilerResult : Symbol(compilerResult, Decl(parserharness.ts, 971, 57))
|
||
>errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
|
||
})
|
||
|
||
if (errors.length > 0)
|
||
>errors : Symbol(errors, Decl(parserharness.ts, 970, 19))
|
||
|
||
throw new Error("Type definition contains errors: " + errors.join(","));
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>errors : Symbol(errors, Decl(parserharness.ts, 970, 19))
|
||
|
||
var matchingIdentifiers: Type[] = [];
|
||
>matchingIdentifiers : Symbol(matchingIdentifiers, Decl(parserharness.ts, 978, 19))
|
||
>Type : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
|
||
if (!usePull) {
|
||
>usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
|
||
// This will find the requested identifier in the first script where it's present, a naive search of each member in each script,
|
||
// which means this won't play nicely if the same identifier is used in multiple units, but it will enable this to work on multi-file tests.
|
||
// m = 1 because the first script will always be lib.d.ts which we don't want to search.
|
||
for (var m = 1; m < compiler.scripts.members.length; m++) {
|
||
>m : Symbol(m, Decl(parserharness.ts, 984, 28), Decl(parserharness.ts, 997, 28))
|
||
>m : Symbol(m, Decl(parserharness.ts, 984, 28), Decl(parserharness.ts, 997, 28))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>m : Symbol(m, Decl(parserharness.ts, 984, 28), Decl(parserharness.ts, 997, 28))
|
||
|
||
var script = compiler.scripts.members[m];
|
||
>script : Symbol(script, Decl(parserharness.ts, 985, 27))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>m : Symbol(m, Decl(parserharness.ts, 984, 28), Decl(parserharness.ts, 997, 28))
|
||
|
||
var enclosingScopeContext = TypeScript.findEnclosingScopeAt(new TypeScript.NullLogger(), <TypeScript.Script>script, new TypeScript.StringSourceText(code), 0, false);
|
||
>enclosingScopeContext : Symbol(enclosingScopeContext, Decl(parserharness.ts, 986, 27))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>Script : Symbol(TypeScript.Script)
|
||
>script : Symbol(script, Decl(parserharness.ts, 985, 27))
|
||
>code : Symbol(code, Decl(parserharness.ts, 957, 24))
|
||
|
||
var entries = new TypeScript.ScopeTraversal(compiler).getScopeEntries(enclosingScopeContext);
|
||
>entries : Symbol(entries, Decl(parserharness.ts, 987, 27))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>enclosingScopeContext : Symbol(enclosingScopeContext, Decl(parserharness.ts, 986, 27))
|
||
|
||
for (var i = 0; i < entries.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 989, 32))
|
||
>i : Symbol(i, Decl(parserharness.ts, 989, 32))
|
||
>entries : Symbol(entries, Decl(parserharness.ts, 987, 27))
|
||
>i : Symbol(i, Decl(parserharness.ts, 989, 32))
|
||
|
||
if (entries[i].name === targetIdentifier) {
|
||
>entries : Symbol(entries, Decl(parserharness.ts, 987, 27))
|
||
>i : Symbol(i, Decl(parserharness.ts, 989, 32))
|
||
>targetIdentifier : Symbol(targetIdentifier, Decl(parserharness.ts, 958, 19))
|
||
|
||
matchingIdentifiers.push(new Type(entries[i].type, code, targetIdentifier));
|
||
>matchingIdentifiers.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>matchingIdentifiers : Symbol(matchingIdentifiers, Decl(parserharness.ts, 978, 19))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>Type : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>entries : Symbol(entries, Decl(parserharness.ts, 987, 27))
|
||
>i : Symbol(i, Decl(parserharness.ts, 989, 32))
|
||
>code : Symbol(code, Decl(parserharness.ts, 957, 24))
|
||
>targetIdentifier : Symbol(targetIdentifier, Decl(parserharness.ts, 958, 19))
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else {
|
||
for (var m = 0; m < compiler.scripts.members.length; m++) {
|
||
>m : Symbol(m, Decl(parserharness.ts, 984, 28), Decl(parserharness.ts, 997, 28))
|
||
>m : Symbol(m, Decl(parserharness.ts, 984, 28), Decl(parserharness.ts, 997, 28))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>m : Symbol(m, Decl(parserharness.ts, 984, 28), Decl(parserharness.ts, 997, 28))
|
||
|
||
var script2 = <TypeScript.Script>compiler.scripts.members[m];
|
||
>script2 : Symbol(script2, Decl(parserharness.ts, 998, 27))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>Script : Symbol(TypeScript.Script)
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>m : Symbol(m, Decl(parserharness.ts, 984, 28), Decl(parserharness.ts, 997, 28))
|
||
|
||
if (script2.locationInfo.filename !== 'lib.d.ts') {
|
||
>script2 : Symbol(script2, Decl(parserharness.ts, 998, 27))
|
||
|
||
if (targetPosition > -1) {
|
||
>targetPosition : Symbol(targetPosition, Decl(parserharness.ts, 959, 19))
|
||
|
||
var tyInfo = compiler.pullGetTypeInfoAtPosition(targetPosition, script2);
|
||
>tyInfo : Symbol(tyInfo, Decl(parserharness.ts, 1001, 35), Decl(parserharness.ts, 1010, 39))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>targetPosition : Symbol(targetPosition, Decl(parserharness.ts, 959, 19))
|
||
>script2 : Symbol(script2, Decl(parserharness.ts, 998, 27))
|
||
|
||
var name = this.getTypeInfoName(tyInfo.ast);
|
||
>name : Symbol(name, Decl(parserharness.ts, 1002, 35), Decl(parserharness.ts, 1011, 39))
|
||
>this.getTypeInfoName : Symbol(TypeFactory.getTypeInfoName, Decl(parserharness.ts, 1038, 13))
|
||
>this : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
>getTypeInfoName : Symbol(TypeFactory.getTypeInfoName, Decl(parserharness.ts, 1038, 13))
|
||
>tyInfo : Symbol(tyInfo, Decl(parserharness.ts, 1001, 35), Decl(parserharness.ts, 1010, 39))
|
||
|
||
var foundValue = new Type(tyInfo.typeInfo, code, name);
|
||
>foundValue : Symbol(foundValue, Decl(parserharness.ts, 1003, 35), Decl(parserharness.ts, 1013, 43))
|
||
>Type : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>tyInfo : Symbol(tyInfo, Decl(parserharness.ts, 1001, 35), Decl(parserharness.ts, 1010, 39))
|
||
>code : Symbol(code, Decl(parserharness.ts, 957, 24))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1002, 35), Decl(parserharness.ts, 1011, 39))
|
||
|
||
if (!matchingIdentifiers.some(value => (value.identifier === foundValue.identifier) && (value.code === foundValue.code) && (value.type === foundValue.type))) {
|
||
>matchingIdentifiers.some : Symbol(Array.some, Decl(lib.es5.d.ts, --, --))
|
||
>matchingIdentifiers : Symbol(matchingIdentifiers, Decl(parserharness.ts, 978, 19))
|
||
>some : Symbol(Array.some, Decl(lib.es5.d.ts, --, --))
|
||
>value : Symbol(value, Decl(parserharness.ts, 1004, 62))
|
||
>value.identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>value : Symbol(value, Decl(parserharness.ts, 1004, 62))
|
||
>identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>foundValue.identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>foundValue : Symbol(foundValue, Decl(parserharness.ts, 1003, 35), Decl(parserharness.ts, 1013, 43))
|
||
>identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>value.code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>value : Symbol(value, Decl(parserharness.ts, 1004, 62))
|
||
>code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>foundValue.code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>foundValue : Symbol(foundValue, Decl(parserharness.ts, 1003, 35), Decl(parserharness.ts, 1013, 43))
|
||
>code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>value.type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>value : Symbol(value, Decl(parserharness.ts, 1004, 62))
|
||
>type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>foundValue.type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>foundValue : Symbol(foundValue, Decl(parserharness.ts, 1003, 35), Decl(parserharness.ts, 1013, 43))
|
||
>type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
|
||
matchingIdentifiers.push(foundValue);
|
||
>matchingIdentifiers.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>matchingIdentifiers : Symbol(matchingIdentifiers, Decl(parserharness.ts, 978, 19))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>foundValue : Symbol(foundValue, Decl(parserharness.ts, 1003, 35), Decl(parserharness.ts, 1013, 43))
|
||
}
|
||
}
|
||
else {
|
||
for (var pos = 0; pos < code.length; pos++) {
|
||
>pos : Symbol(pos, Decl(parserharness.ts, 1009, 40))
|
||
>pos : Symbol(pos, Decl(parserharness.ts, 1009, 40))
|
||
>code.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||
>code : Symbol(code, Decl(parserharness.ts, 957, 24))
|
||
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||
>pos : Symbol(pos, Decl(parserharness.ts, 1009, 40))
|
||
|
||
var tyInfo = compiler.pullGetTypeInfoAtPosition(pos, script2);
|
||
>tyInfo : Symbol(tyInfo, Decl(parserharness.ts, 1001, 35), Decl(parserharness.ts, 1010, 39))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>pos : Symbol(pos, Decl(parserharness.ts, 1009, 40))
|
||
>script2 : Symbol(script2, Decl(parserharness.ts, 998, 27))
|
||
|
||
var name = this.getTypeInfoName(tyInfo.ast);
|
||
>name : Symbol(name, Decl(parserharness.ts, 1002, 35), Decl(parserharness.ts, 1011, 39))
|
||
>this.getTypeInfoName : Symbol(TypeFactory.getTypeInfoName, Decl(parserharness.ts, 1038, 13))
|
||
>this : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
>getTypeInfoName : Symbol(TypeFactory.getTypeInfoName, Decl(parserharness.ts, 1038, 13))
|
||
>tyInfo : Symbol(tyInfo, Decl(parserharness.ts, 1001, 35), Decl(parserharness.ts, 1010, 39))
|
||
|
||
if (name === targetIdentifier) {
|
||
>name : Symbol(name, Decl(parserharness.ts, 1002, 35), Decl(parserharness.ts, 1011, 39))
|
||
>targetIdentifier : Symbol(targetIdentifier, Decl(parserharness.ts, 958, 19))
|
||
|
||
var foundValue = new Type(tyInfo.typeInfo, code, targetIdentifier);
|
||
>foundValue : Symbol(foundValue, Decl(parserharness.ts, 1003, 35), Decl(parserharness.ts, 1013, 43))
|
||
>Type : Symbol(Type, Decl(parserharness.ts, 800, 9))
|
||
>tyInfo : Symbol(tyInfo, Decl(parserharness.ts, 1001, 35), Decl(parserharness.ts, 1010, 39))
|
||
>code : Symbol(code, Decl(parserharness.ts, 957, 24))
|
||
>targetIdentifier : Symbol(targetIdentifier, Decl(parserharness.ts, 958, 19))
|
||
|
||
if (!matchingIdentifiers.some(value => (value.identifier === foundValue.identifier) && (value.code === foundValue.code) && (value.type === foundValue.type))) {
|
||
>matchingIdentifiers.some : Symbol(Array.some, Decl(lib.es5.d.ts, --, --))
|
||
>matchingIdentifiers : Symbol(matchingIdentifiers, Decl(parserharness.ts, 978, 19))
|
||
>some : Symbol(Array.some, Decl(lib.es5.d.ts, --, --))
|
||
>value : Symbol(value, Decl(parserharness.ts, 1014, 70))
|
||
>value.identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>value : Symbol(value, Decl(parserharness.ts, 1014, 70))
|
||
>identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>foundValue.identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>foundValue : Symbol(foundValue, Decl(parserharness.ts, 1003, 35), Decl(parserharness.ts, 1013, 43))
|
||
>identifier : Symbol(Type.identifier, Decl(parserharness.ts, 804, 49))
|
||
>value.code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>value : Symbol(value, Decl(parserharness.ts, 1014, 70))
|
||
>code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>foundValue.code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>foundValue : Symbol(foundValue, Decl(parserharness.ts, 1003, 35), Decl(parserharness.ts, 1013, 43))
|
||
>code : Symbol(Type.code, Decl(parserharness.ts, 804, 36))
|
||
>value.type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>value : Symbol(value, Decl(parserharness.ts, 1014, 70))
|
||
>type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>foundValue.type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>foundValue : Symbol(foundValue, Decl(parserharness.ts, 1003, 35), Decl(parserharness.ts, 1013, 43))
|
||
>type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
|
||
matchingIdentifiers.push(foundValue);
|
||
>matchingIdentifiers.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>matchingIdentifiers : Symbol(matchingIdentifiers, Decl(parserharness.ts, 978, 19))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>foundValue : Symbol(foundValue, Decl(parserharness.ts, 1003, 35), Decl(parserharness.ts, 1013, 43))
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (matchingIdentifiers.length === 0) {
|
||
>matchingIdentifiers.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>matchingIdentifiers : Symbol(matchingIdentifiers, Decl(parserharness.ts, 978, 19))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
if (targetPosition > -1) {
|
||
>targetPosition : Symbol(targetPosition, Decl(parserharness.ts, 959, 19))
|
||
|
||
throw new Error("Could not find an identifier at position " + targetPosition);
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>targetPosition : Symbol(targetPosition, Decl(parserharness.ts, 959, 19))
|
||
}
|
||
else {
|
||
throw new Error("Could not find an identifier " + targetIdentifier + " in any known scopes");
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>targetIdentifier : Symbol(targetIdentifier, Decl(parserharness.ts, 958, 19))
|
||
}
|
||
}
|
||
else if (matchingIdentifiers.length > 1) {
|
||
>matchingIdentifiers.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>matchingIdentifiers : Symbol(matchingIdentifiers, Decl(parserharness.ts, 978, 19))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
throw new Error("Found multiple matching identifiers for " + target);
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>target : Symbol(target, Decl(parserharness.ts, 957, 37))
|
||
}
|
||
else {
|
||
return matchingIdentifiers[0];
|
||
>matchingIdentifiers : Symbol(matchingIdentifiers, Decl(parserharness.ts, 978, 19))
|
||
}
|
||
}
|
||
|
||
private getTypeInfoName(ast : TypeScript.AST) {
|
||
>getTypeInfoName : Symbol(TypeFactory.getTypeInfoName, Decl(parserharness.ts, 1038, 13))
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>AST : Symbol(TypeScript.AST)
|
||
|
||
var name = '';
|
||
>name : Symbol(name, Decl(parserharness.ts, 1041, 19))
|
||
|
||
switch (ast.nodeType) {
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
|
||
case TypeScript.NodeType.Name: // Type Name?
|
||
case TypeScript.NodeType.Null:
|
||
case TypeScript.NodeType.List:
|
||
case TypeScript.NodeType.Empty:
|
||
case TypeScript.NodeType.EmptyExpr:
|
||
case TypeScript.NodeType.Asg:
|
||
case TypeScript.NodeType.True:
|
||
case TypeScript.NodeType.False:
|
||
case TypeScript.NodeType.ArrayLit:
|
||
case TypeScript.NodeType.TypeRef:
|
||
break;
|
||
case TypeScript.NodeType.Super:
|
||
name = (<any>ast).text;
|
||
>name : Symbol(name, Decl(parserharness.ts, 1041, 19))
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
|
||
break;
|
||
case TypeScript.NodeType.Regex:
|
||
name = (<TypeScript.RegexLiteral>ast).text;
|
||
>name : Symbol(name, Decl(parserharness.ts, 1041, 19))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>RegexLiteral : Symbol(TypeScript.RegexLiteral)
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
|
||
break;
|
||
case TypeScript.NodeType.QString:
|
||
name = (<any>ast).text;
|
||
>name : Symbol(name, Decl(parserharness.ts, 1041, 19))
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
|
||
break;
|
||
case TypeScript.NodeType.NumberLit:
|
||
name = (<TypeScript.NumberLiteral>ast).text;
|
||
>name : Symbol(name, Decl(parserharness.ts, 1041, 19))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>NumberLiteral : Symbol(TypeScript.NumberLiteral)
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
|
||
break;
|
||
case TypeScript.NodeType.Return:
|
||
//name = (<TypeScript.ReturnStatement>tyInfo.ast).returnExpression.actualText; // why is this complaining?
|
||
break;
|
||
case TypeScript.NodeType.InterfaceDeclaration:
|
||
name = (<TypeScript.InterfaceDeclaration>ast).name.actualText;
|
||
>name : Symbol(name, Decl(parserharness.ts, 1041, 19))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>InterfaceDeclaration : Symbol(TypeScript.InterfaceDeclaration)
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
|
||
break;
|
||
case TypeScript.NodeType.ModuleDeclaration:
|
||
name = (<TypeScript.ModuleDeclaration>ast).name.actualText;
|
||
>name : Symbol(name, Decl(parserharness.ts, 1041, 19))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>ModuleDeclaration : Symbol(TypeScript.ModuleDeclaration)
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
|
||
break;
|
||
case TypeScript.NodeType.ClassDeclaration:
|
||
name = (<TypeScript.ClassDeclaration>ast).name.actualText;
|
||
>name : Symbol(name, Decl(parserharness.ts, 1041, 19))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>ClassDeclaration : Symbol(TypeScript.ClassDeclaration)
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
|
||
break;
|
||
case TypeScript.NodeType.FuncDecl:
|
||
name = !(<TypeScript.FuncDecl>ast).name ? "" : (<TypeScript.FuncDecl>ast).name.actualText; // name == null for lambdas
|
||
>name : Symbol(name, Decl(parserharness.ts, 1041, 19))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>FuncDecl : Symbol(TypeScript.FuncDecl)
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>FuncDecl : Symbol(TypeScript.FuncDecl)
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
|
||
break;
|
||
default:
|
||
// TODO: is there a reason to mess with all the special cases above and not just do this (ie take whatever property is there and works?)
|
||
var a = <any>ast;
|
||
>a : Symbol(a, Decl(parserharness.ts, 1083, 27))
|
||
>ast : Symbol(ast, Decl(parserharness.ts, 1040, 36))
|
||
|
||
name = (a.id) ? (a.id.actualText) : (a.name) ? a.name.actualText : (a.text) ? a.text : '';
|
||
>name : Symbol(name, Decl(parserharness.ts, 1041, 19))
|
||
>a : Symbol(a, Decl(parserharness.ts, 1083, 27))
|
||
>a : Symbol(a, Decl(parserharness.ts, 1083, 27))
|
||
>a : Symbol(a, Decl(parserharness.ts, 1083, 27))
|
||
>a : Symbol(a, Decl(parserharness.ts, 1083, 27))
|
||
>a : Symbol(a, Decl(parserharness.ts, 1083, 27))
|
||
>a : Symbol(a, Decl(parserharness.ts, 1083, 27))
|
||
|
||
break;
|
||
}
|
||
|
||
return name;
|
||
>name : Symbol(name, Decl(parserharness.ts, 1041, 19))
|
||
}
|
||
|
||
public isOfType(expr: string, expectedType: string) {
|
||
>isOfType : Symbol(TypeFactory.isOfType, Decl(parserharness.ts, 1089, 13))
|
||
>expr : Symbol(expr, Decl(parserharness.ts, 1091, 28))
|
||
>expectedType : Symbol(expectedType, Decl(parserharness.ts, 1091, 41))
|
||
|
||
var actualType = this.get('var _v_a_r_ = ' + expr, '_v_a_r_');
|
||
>actualType : Symbol(actualType, Decl(parserharness.ts, 1092, 19))
|
||
>this.get : Symbol(TypeFactory.get, Decl(parserharness.ts, 955, 13))
|
||
>this : Symbol(TypeFactory, Decl(parserharness.ts, 942, 9))
|
||
>get : Symbol(TypeFactory.get, Decl(parserharness.ts, 955, 13))
|
||
>expr : Symbol(expr, Decl(parserharness.ts, 1091, 28))
|
||
|
||
it('Expression "' + expr + '" is of type "' + expectedType + '"', function () {
|
||
>it : Symbol(it, Decl(parserharness.ts, 1852, 5))
|
||
>expr : Symbol(expr, Decl(parserharness.ts, 1091, 28))
|
||
>expectedType : Symbol(expectedType, Decl(parserharness.ts, 1091, 41))
|
||
|
||
assert.equal(actualType.type, expectedType);
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>actualType.type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>actualType : Symbol(actualType, Decl(parserharness.ts, 1092, 19))
|
||
>type : Symbol(Type.type, Decl(parserharness.ts, 804, 24))
|
||
>expectedType : Symbol(expectedType, Decl(parserharness.ts, 1091, 41))
|
||
|
||
});
|
||
}
|
||
}
|
||
|
||
/** Generates a .d.ts file for the given code
|
||
* @param verifyNoDeclFile pass true when the given code should generate no decl file, false otherwise
|
||
* @param unitName add the given code under thie name, else use '0.ts'
|
||
* @param compilationContext a set of functions to be run before and after compiling this code for doing things like adding dependencies first
|
||
* @param references the set of referenced files used by the given code
|
||
*/
|
||
export function generateDeclFile(code: string, verifyNoDeclFile: boolean, unitName?: string, compilationContext?: Harness.Compiler.CompilationContext, references?: TypeScript.IFileReference[]): string {
|
||
>generateDeclFile : Symbol(generateDeclFile, Decl(parserharness.ts, 1098, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1106, 41))
|
||
>verifyNoDeclFile : Symbol(verifyNoDeclFile, Decl(parserharness.ts, 1106, 54))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1106, 81))
|
||
>compilationContext : Symbol(compilationContext, Decl(parserharness.ts, 1106, 100))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>CompilationContext : Symbol(CompilationContext, Decl(parserharness.ts, 1245, 9))
|
||
>references : Symbol(references, Decl(parserharness.ts, 1106, 158))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>IFileReference : Symbol(TypeScript.IFileReference)
|
||
|
||
reset();
|
||
>reset : Symbol(reset, Decl(parserharness.ts, 1229, 9))
|
||
|
||
compiler.settings.generateDeclarationFiles = true;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
|
||
var oldOutputOption = compiler.settings.outputOption;
|
||
>oldOutputOption : Symbol(oldOutputOption, Decl(parserharness.ts, 1110, 15))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
|
||
var oldEmitterIOHost = compiler.emitSettings.ioHost;
|
||
>oldEmitterIOHost : Symbol(oldEmitterIOHost, Decl(parserharness.ts, 1111, 15))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
|
||
try {
|
||
if (compilationContext && compilationContext.preCompile) {
|
||
>compilationContext : Symbol(compilationContext, Decl(parserharness.ts, 1106, 100))
|
||
>compilationContext.preCompile : Symbol(CompilationContext.preCompile, Decl(parserharness.ts, 1250, 29))
|
||
>compilationContext : Symbol(compilationContext, Decl(parserharness.ts, 1106, 100))
|
||
>preCompile : Symbol(CompilationContext.preCompile, Decl(parserharness.ts, 1250, 29))
|
||
|
||
compilationContext.preCompile();
|
||
>compilationContext.preCompile : Symbol(CompilationContext.preCompile, Decl(parserharness.ts, 1250, 29))
|
||
>compilationContext : Symbol(compilationContext, Decl(parserharness.ts, 1106, 100))
|
||
>preCompile : Symbol(CompilationContext.preCompile, Decl(parserharness.ts, 1250, 29))
|
||
}
|
||
|
||
addUnit(code, unitName, false, false, references);
|
||
>addUnit : Symbol(addUnit, Decl(parserharness.ts, 1253, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1106, 41))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1106, 81))
|
||
>references : Symbol(references, Decl(parserharness.ts, 1106, 158))
|
||
|
||
compiler.reTypeCheck();
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
|
||
var outputs = {};
|
||
>outputs : Symbol(outputs, Decl(parserharness.ts, 1120, 19))
|
||
|
||
compiler.settings.outputOption = "";
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
|
||
compiler.parseEmitOption(
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
{
|
||
createFile: (fn: string) => {
|
||
>createFile : Symbol(createFile, Decl(parserharness.ts, 1124, 21))
|
||
>fn : Symbol(fn, Decl(parserharness.ts, 1125, 37))
|
||
|
||
outputs[fn] = new Harness.Compiler.WriterAggregator();
|
||
>outputs : Symbol(outputs, Decl(parserharness.ts, 1120, 19))
|
||
>fn : Symbol(fn, Decl(parserharness.ts, 1125, 37))
|
||
>Harness.Compiler.WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>Harness.Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
|
||
return outputs[fn];
|
||
>outputs : Symbol(outputs, Decl(parserharness.ts, 1120, 19))
|
||
>fn : Symbol(fn, Decl(parserharness.ts, 1125, 37))
|
||
|
||
},
|
||
directoryExists: (path: string) => true,
|
||
>directoryExists : Symbol(directoryExists, Decl(parserharness.ts, 1128, 26))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1129, 42))
|
||
|
||
fileExists: (path: string) => true,
|
||
>fileExists : Symbol(fileExists, Decl(parserharness.ts, 1129, 64))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1130, 37))
|
||
|
||
resolvePath: (path: string) => path
|
||
>resolvePath : Symbol(resolvePath, Decl(parserharness.ts, 1130, 59))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1131, 38))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1131, 38))
|
||
|
||
});
|
||
compiler.emitDeclarations();
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
|
||
var results: string = null;
|
||
>results : Symbol(results, Decl(parserharness.ts, 1135, 19))
|
||
|
||
for (var fn in outputs) {
|
||
>fn : Symbol(fn, Decl(parserharness.ts, 1136, 24))
|
||
>outputs : Symbol(outputs, Decl(parserharness.ts, 1120, 19))
|
||
|
||
if (fn.indexOf('.d.ts') >= 0) {
|
||
>fn.indexOf : Symbol(String.indexOf, Decl(lib.es5.d.ts, --, --))
|
||
>fn : Symbol(fn, Decl(parserharness.ts, 1136, 24))
|
||
>indexOf : Symbol(String.indexOf, Decl(lib.es5.d.ts, --, --))
|
||
|
||
var writer = <Harness.Compiler.WriterAggregator>outputs[fn];
|
||
>writer : Symbol(writer, Decl(parserharness.ts, 1138, 27))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>outputs : Symbol(outputs, Decl(parserharness.ts, 1120, 19))
|
||
>fn : Symbol(fn, Decl(parserharness.ts, 1136, 24))
|
||
|
||
writer.Close();
|
||
>writer.Close : Symbol(WriterAggregator.Close, Decl(parserharness.ts, 701, 13))
|
||
>writer : Symbol(writer, Decl(parserharness.ts, 1138, 27))
|
||
>Close : Symbol(WriterAggregator.Close, Decl(parserharness.ts, 701, 13))
|
||
|
||
results = writer.lines.join('\n');
|
||
>results : Symbol(results, Decl(parserharness.ts, 1135, 19))
|
||
>writer.lines.join : Symbol(Array.join, Decl(lib.es5.d.ts, --, --))
|
||
>writer.lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>writer : Symbol(writer, Decl(parserharness.ts, 1138, 27))
|
||
>lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>join : Symbol(Array.join, Decl(lib.es5.d.ts, --, --))
|
||
|
||
if (verifyNoDeclFile && results != "") {
|
||
>verifyNoDeclFile : Symbol(verifyNoDeclFile, Decl(parserharness.ts, 1106, 54))
|
||
>results : Symbol(results, Decl(parserharness.ts, 1135, 19))
|
||
|
||
throw new Error('Compilation should not produce ' + fn);
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>fn : Symbol(fn, Decl(parserharness.ts, 1136, 24))
|
||
}
|
||
}
|
||
}
|
||
|
||
if (results) {
|
||
>results : Symbol(results, Decl(parserharness.ts, 1135, 19))
|
||
|
||
return results;
|
||
>results : Symbol(results, Decl(parserharness.ts, 1135, 19))
|
||
}
|
||
|
||
if (!verifyNoDeclFile) {
|
||
>verifyNoDeclFile : Symbol(verifyNoDeclFile, Decl(parserharness.ts, 1106, 54))
|
||
|
||
throw new Error('Compilation did not produce .d.ts files');
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
} finally {
|
||
compiler.settings.generateDeclarationFiles = false;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
|
||
compiler.settings.outputOption = oldOutputOption;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>oldOutputOption : Symbol(oldOutputOption, Decl(parserharness.ts, 1110, 15))
|
||
|
||
compiler.parseEmitOption(oldEmitterIOHost);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>oldEmitterIOHost : Symbol(oldEmitterIOHost, Decl(parserharness.ts, 1111, 15))
|
||
|
||
if (compilationContext && compilationContext.postCompile) {
|
||
>compilationContext : Symbol(compilationContext, Decl(parserharness.ts, 1106, 100))
|
||
>compilationContext.postCompile : Symbol(CompilationContext.postCompile, Decl(parserharness.ts, 1251, 35))
|
||
>compilationContext : Symbol(compilationContext, Decl(parserharness.ts, 1106, 100))
|
||
>postCompile : Symbol(CompilationContext.postCompile, Decl(parserharness.ts, 1251, 35))
|
||
|
||
compilationContext.postCompile();
|
||
>compilationContext.postCompile : Symbol(CompilationContext.postCompile, Decl(parserharness.ts, 1251, 35))
|
||
>compilationContext : Symbol(compilationContext, Decl(parserharness.ts, 1106, 100))
|
||
>postCompile : Symbol(CompilationContext.postCompile, Decl(parserharness.ts, 1251, 35))
|
||
}
|
||
|
||
var uName = unitName || '0.ts';
|
||
>uName : Symbol(uName, Decl(parserharness.ts, 1162, 19))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1106, 81))
|
||
|
||
updateUnit('', uName);
|
||
>updateUnit : Symbol(updateUnit, Decl(parserharness.ts, 1275, 9))
|
||
>uName : Symbol(uName, Decl(parserharness.ts, 1162, 19))
|
||
}
|
||
|
||
return '';
|
||
}
|
||
|
||
/** Contains the code and errors of a compilation and some helper methods to check its status. */
|
||
export class CompilerResult {
|
||
>CompilerResult : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
|
||
public code: string;
|
||
>code : Symbol(CompilerResult.code, Decl(parserharness.ts, 1170, 37))
|
||
|
||
public errors: CompilerError[];
|
||
>errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>CompilerError : Symbol(CompilerError, Decl(parserharness.ts, 1206, 9))
|
||
|
||
/** @param fileResults an array of strings for the filename and an ITextWriter with its code */
|
||
constructor(public fileResults: { filename: string; file: WriterAggregator; }[], errorLines: string[], public scripts: TypeScript.Script[]) {
|
||
>fileResults : Symbol(CompilerResult.fileResults, Decl(parserharness.ts, 1175, 24))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1175, 45))
|
||
>file : Symbol(file, Decl(parserharness.ts, 1175, 63))
|
||
>WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
>errorLines : Symbol(errorLines, Decl(parserharness.ts, 1175, 92))
|
||
>scripts : Symbol(CompilerResult.scripts, Decl(parserharness.ts, 1175, 114))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>Script : Symbol(TypeScript.Script)
|
||
|
||
var lines = [];
|
||
>lines : Symbol(lines, Decl(parserharness.ts, 1176, 19))
|
||
|
||
fileResults.forEach(v => lines = lines.concat(v.file.lines));
|
||
>fileResults.forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>fileResults : Symbol(fileResults, Decl(parserharness.ts, 1175, 24))
|
||
>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>v : Symbol(v, Decl(parserharness.ts, 1177, 36))
|
||
>lines : Symbol(lines, Decl(parserharness.ts, 1176, 19))
|
||
>lines.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>lines : Symbol(lines, Decl(parserharness.ts, 1176, 19))
|
||
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>v.file.lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>v.file : Symbol(file, Decl(parserharness.ts, 1175, 63))
|
||
>v : Symbol(v, Decl(parserharness.ts, 1177, 36))
|
||
>file : Symbol(file, Decl(parserharness.ts, 1175, 63))
|
||
>lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
|
||
this.code = lines.join("\n")
|
||
>this.code : Symbol(CompilerResult.code, Decl(parserharness.ts, 1170, 37))
|
||
>this : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>code : Symbol(CompilerResult.code, Decl(parserharness.ts, 1170, 37))
|
||
>lines.join : Symbol(Array.join, Decl(lib.es5.d.ts, --, --))
|
||
>lines : Symbol(lines, Decl(parserharness.ts, 1176, 19))
|
||
>join : Symbol(Array.join, Decl(lib.es5.d.ts, --, --))
|
||
|
||
this.errors = [];
|
||
>this.errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>this : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
|
||
for (var i = 0; i < errorLines.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 1182, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1182, 24))
|
||
>errorLines.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>errorLines : Symbol(errorLines, Decl(parserharness.ts, 1175, 92))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1182, 24))
|
||
|
||
if (Harness.usePull) {
|
||
>Harness.usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
|
||
var err = <any>errorLines[i]; // TypeScript.PullError
|
||
>err : Symbol(err, Decl(parserharness.ts, 1184, 27))
|
||
>errorLines : Symbol(errorLines, Decl(parserharness.ts, 1175, 92))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1182, 24))
|
||
|
||
this.errors.push(new CompilerError(err.filename, 0, 0, err.message));
|
||
>this.errors.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this.errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>this : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>CompilerError : Symbol(CompilerError, Decl(parserharness.ts, 1206, 9))
|
||
>err : Symbol(err, Decl(parserharness.ts, 1184, 27))
|
||
>err : Symbol(err, Decl(parserharness.ts, 1184, 27))
|
||
|
||
} else {
|
||
var match = errorLines[i].match(/([^\(]*)\((\d+),(\d+)\):\s+((.*[\s\r\n]*.*)+)\s*$/);
|
||
>match : Symbol(match, Decl(parserharness.ts, 1187, 27))
|
||
>errorLines[i].match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
>errorLines : Symbol(errorLines, Decl(parserharness.ts, 1175, 92))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1182, 24))
|
||
>match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
|
||
if (match) {
|
||
>match : Symbol(match, Decl(parserharness.ts, 1187, 27))
|
||
|
||
this.errors.push(new CompilerError(match[1], parseFloat(match[2]), parseFloat(match[3]), match[4]));
|
||
>this.errors.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this.errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>this : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>CompilerError : Symbol(CompilerError, Decl(parserharness.ts, 1206, 9))
|
||
>match : Symbol(match, Decl(parserharness.ts, 1187, 27))
|
||
>parseFloat : Symbol(parseFloat, Decl(lib.es5.d.ts, --, --))
|
||
>match : Symbol(match, Decl(parserharness.ts, 1187, 27))
|
||
>parseFloat : Symbol(parseFloat, Decl(lib.es5.d.ts, --, --))
|
||
>match : Symbol(match, Decl(parserharness.ts, 1187, 27))
|
||
>match : Symbol(match, Decl(parserharness.ts, 1187, 27))
|
||
}
|
||
else {
|
||
WScript.Echo("non-match on: " + errorLines[i]);
|
||
>errorLines : Symbol(errorLines, Decl(parserharness.ts, 1175, 92))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1182, 24))
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
public isErrorAt(line: number, column: number, message: string) {
|
||
>isErrorAt : Symbol(CompilerResult.isErrorAt, Decl(parserharness.ts, 1196, 13))
|
||
>line : Symbol(line, Decl(parserharness.ts, 1198, 29))
|
||
>column : Symbol(column, Decl(parserharness.ts, 1198, 42))
|
||
>message : Symbol(message, Decl(parserharness.ts, 1198, 58))
|
||
|
||
for (var i = 0; i < this.errors.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 1199, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1199, 24))
|
||
>this.errors.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>this : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1199, 24))
|
||
|
||
if (this.errors[i].line === line && this.errors[i].column === column && this.errors[i].message === message)
|
||
>this.errors[i].line : Symbol(CompilerError.line, Decl(parserharness.ts, 1210, 44))
|
||
>this.errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>this : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1199, 24))
|
||
>line : Symbol(CompilerError.line, Decl(parserharness.ts, 1210, 44))
|
||
>line : Symbol(line, Decl(parserharness.ts, 1198, 29))
|
||
>this.errors[i].column : Symbol(CompilerError.column, Decl(parserharness.ts, 1211, 40))
|
||
>this.errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>this : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1199, 24))
|
||
>column : Symbol(CompilerError.column, Decl(parserharness.ts, 1211, 40))
|
||
>column : Symbol(column, Decl(parserharness.ts, 1198, 42))
|
||
>this.errors[i].message : Symbol(CompilerError.message, Decl(parserharness.ts, 1212, 42))
|
||
>this.errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>this : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>errors : Symbol(CompilerResult.errors, Decl(parserharness.ts, 1171, 32))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1199, 24))
|
||
>message : Symbol(CompilerError.message, Decl(parserharness.ts, 1212, 42))
|
||
>message : Symbol(message, Decl(parserharness.ts, 1198, 58))
|
||
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
}
|
||
|
||
// Compiler Error.
|
||
export class CompilerError {
|
||
>CompilerError : Symbol(CompilerError, Decl(parserharness.ts, 1206, 9))
|
||
|
||
constructor(public file: string,
|
||
>file : Symbol(CompilerError.file, Decl(parserharness.ts, 1210, 24))
|
||
|
||
public line: number,
|
||
>line : Symbol(CompilerError.line, Decl(parserharness.ts, 1210, 44))
|
||
|
||
public column: number,
|
||
>column : Symbol(CompilerError.column, Decl(parserharness.ts, 1211, 40))
|
||
|
||
public message: string) { }
|
||
>message : Symbol(CompilerError.message, Decl(parserharness.ts, 1212, 42))
|
||
|
||
public toString() {
|
||
>toString : Symbol(CompilerError.toString, Decl(parserharness.ts, 1213, 47))
|
||
|
||
return this.file + "(" + this.line + "," + this.column + "): " + this.message;
|
||
>this.file : Symbol(CompilerError.file, Decl(parserharness.ts, 1210, 24))
|
||
>this : Symbol(CompilerError, Decl(parserharness.ts, 1206, 9))
|
||
>file : Symbol(CompilerError.file, Decl(parserharness.ts, 1210, 24))
|
||
>this.line : Symbol(CompilerError.line, Decl(parserharness.ts, 1210, 44))
|
||
>this : Symbol(CompilerError, Decl(parserharness.ts, 1206, 9))
|
||
>line : Symbol(CompilerError.line, Decl(parserharness.ts, 1210, 44))
|
||
>this.column : Symbol(CompilerError.column, Decl(parserharness.ts, 1211, 40))
|
||
>this : Symbol(CompilerError, Decl(parserharness.ts, 1206, 9))
|
||
>column : Symbol(CompilerError.column, Decl(parserharness.ts, 1211, 40))
|
||
>this.message : Symbol(CompilerError.message, Decl(parserharness.ts, 1212, 42))
|
||
>this : Symbol(CompilerError, Decl(parserharness.ts, 1206, 9))
|
||
>message : Symbol(CompilerError.message, Decl(parserharness.ts, 1212, 42))
|
||
}
|
||
}
|
||
|
||
/** Create a new instance of the compiler with default settings and lib.d.ts, then typecheck */
|
||
export function recreate() {
|
||
>recreate : Symbol(recreate, Decl(parserharness.ts, 1218, 9))
|
||
|
||
compiler = makeDefaultCompilerForTest();
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>makeDefaultCompilerForTest : Symbol(makeDefaultCompilerForTest, Decl(parserharness.ts, 761, 9))
|
||
|
||
if (usePull) {
|
||
>usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
|
||
compiler.pullTypeCheck(true);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
}
|
||
else {
|
||
compiler.typeCheck();
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
}
|
||
}
|
||
|
||
export function reset() {
|
||
>reset : Symbol(reset, Decl(parserharness.ts, 1229, 9))
|
||
|
||
stdout.reset();
|
||
>stdout.reset : Symbol(EmitterIOHost.reset, Decl(parserharness.ts, 733, 55))
|
||
>stdout : Symbol(stdout, Decl(parserharness.ts, 756, 11))
|
||
>reset : Symbol(EmitterIOHost.reset, Decl(parserharness.ts, 733, 55))
|
||
|
||
stderr.reset();
|
||
>stderr.reset : Symbol(WriterAggregator.reset, Decl(parserharness.ts, 706, 13))
|
||
>stderr : Symbol(stderr, Decl(parserharness.ts, 757, 11))
|
||
>reset : Symbol(WriterAggregator.reset, Decl(parserharness.ts, 706, 13))
|
||
|
||
var files = compiler.units.map((value) => value.filename);
|
||
>files : Symbol(files, Decl(parserharness.ts, 1235, 15))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>value : Symbol(value, Decl(parserharness.ts, 1235, 44))
|
||
>value : Symbol(value, Decl(parserharness.ts, 1235, 44))
|
||
|
||
for (var i = 0; i < files.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 1237, 20))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1237, 20))
|
||
>files : Symbol(files, Decl(parserharness.ts, 1235, 15))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1237, 20))
|
||
|
||
var fname = files[i];
|
||
>fname : Symbol(fname, Decl(parserharness.ts, 1238, 19))
|
||
>files : Symbol(files, Decl(parserharness.ts, 1235, 15))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1237, 20))
|
||
|
||
if(fname !== 'lib.d.ts') {
|
||
>fname : Symbol(fname, Decl(parserharness.ts, 1238, 19))
|
||
|
||
updateUnit('', fname);
|
||
>updateUnit : Symbol(updateUnit, Decl(parserharness.ts, 1275, 9))
|
||
>fname : Symbol(fname, Decl(parserharness.ts, 1238, 19))
|
||
}
|
||
}
|
||
|
||
compiler.errorReporter.hasErrors = false;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
}
|
||
|
||
// Defines functions to invoke before compiling a piece of code and a post compile action intended to clean up the
|
||
// effects of preCompile, preferably with something lighter weight than a full recreate()
|
||
export interface CompilationContext {
|
||
>CompilationContext : Symbol(CompilationContext, Decl(parserharness.ts, 1245, 9))
|
||
|
||
filename: string;
|
||
>filename : Symbol(CompilationContext.filename, Decl(parserharness.ts, 1249, 45))
|
||
|
||
preCompile: () => void;
|
||
>preCompile : Symbol(CompilationContext.preCompile, Decl(parserharness.ts, 1250, 29))
|
||
|
||
postCompile: () => void;
|
||
>postCompile : Symbol(CompilationContext.postCompile, Decl(parserharness.ts, 1251, 35))
|
||
}
|
||
|
||
export function addUnit(code: string, unitName?: string, isResident?: boolean, isDeclareFile?: boolean, references?: TypeScript.IFileReference[]) {
|
||
>addUnit : Symbol(addUnit, Decl(parserharness.ts, 1253, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1255, 32))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1255, 45))
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1255, 64))
|
||
>isDeclareFile : Symbol(isDeclareFile, Decl(parserharness.ts, 1255, 86))
|
||
>references : Symbol(references, Decl(parserharness.ts, 1255, 111))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>IFileReference : Symbol(TypeScript.IFileReference)
|
||
|
||
var script: TypeScript.Script = null;
|
||
>script : Symbol(script, Decl(parserharness.ts, 1256, 15))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>Script : Symbol(TypeScript.Script)
|
||
|
||
var uName = unitName || '0' + (isDeclareFile ? '.d.ts' : '.ts');
|
||
>uName : Symbol(uName, Decl(parserharness.ts, 1257, 15))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1255, 45))
|
||
>isDeclareFile : Symbol(isDeclareFile, Decl(parserharness.ts, 1255, 86))
|
||
|
||
for (var i = 0; i < compiler.units.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 1259, 20))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1259, 20))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1259, 20))
|
||
|
||
if (compiler.units[i].filename === uName) {
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1259, 20))
|
||
>uName : Symbol(uName, Decl(parserharness.ts, 1257, 15))
|
||
|
||
updateUnit(code, uName);
|
||
>updateUnit : Symbol(updateUnit, Decl(parserharness.ts, 1275, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1255, 32))
|
||
>uName : Symbol(uName, Decl(parserharness.ts, 1257, 15))
|
||
|
||
script = <TypeScript.Script>compiler.scripts.members[i];
|
||
>script : Symbol(script, Decl(parserharness.ts, 1256, 15))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>Script : Symbol(TypeScript.Script)
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1259, 20))
|
||
}
|
||
}
|
||
if (!script) {
|
||
>script : Symbol(script, Decl(parserharness.ts, 1256, 15))
|
||
|
||
// TODO: make this toggleable, shouldn't be necessary once typecheck bugs are cleaned up
|
||
// but without it subsequent tests are treated as edits, making for somewhat useful stress testing
|
||
// of persistent typecheck state
|
||
//compiler.addUnit("", uName, isResident, references); // equivalent to compiler.deleteUnit(...)
|
||
script = compiler.addUnit(code, uName, isResident, references);
|
||
>script : Symbol(script, Decl(parserharness.ts, 1256, 15))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1255, 32))
|
||
>uName : Symbol(uName, Decl(parserharness.ts, 1257, 15))
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1255, 64))
|
||
>references : Symbol(references, Decl(parserharness.ts, 1255, 111))
|
||
|
||
needsFullTypeCheck = true;
|
||
>needsFullTypeCheck : Symbol(needsFullTypeCheck, Decl(parserharness.ts, 784, 11))
|
||
}
|
||
|
||
return script;
|
||
>script : Symbol(script, Decl(parserharness.ts, 1256, 15))
|
||
}
|
||
|
||
export function updateUnit(code: string, unitName: string, setRecovery?: boolean) {
|
||
>updateUnit : Symbol(updateUnit, Decl(parserharness.ts, 1275, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1277, 35))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1277, 48))
|
||
>setRecovery : Symbol(setRecovery, Decl(parserharness.ts, 1277, 66))
|
||
|
||
if (Harness.usePull) {
|
||
>Harness.usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
|
||
compiler.pullUpdateUnit(new TypeScript.StringSourceText(code), unitName, setRecovery);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1277, 35))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1277, 48))
|
||
>setRecovery : Symbol(setRecovery, Decl(parserharness.ts, 1277, 66))
|
||
|
||
} else {
|
||
compiler.updateUnit(code, unitName, setRecovery);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1277, 35))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1277, 48))
|
||
>setRecovery : Symbol(setRecovery, Decl(parserharness.ts, 1277, 66))
|
||
}
|
||
}
|
||
|
||
export function compileFile(path: string, callback: (res: CompilerResult) => void , settingsCallback?: (settings?: TypeScript.CompilationSettings) => void , context?: CompilationContext, references?: TypeScript.IFileReference[]) {
|
||
>compileFile : Symbol(compileFile, Decl(parserharness.ts, 1283, 9))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1285, 36))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1285, 49))
|
||
>res : Symbol(res, Decl(parserharness.ts, 1285, 61))
|
||
>CompilerResult : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>settingsCallback : Symbol(settingsCallback, Decl(parserharness.ts, 1285, 91))
|
||
>settings : Symbol(settings, Decl(parserharness.ts, 1285, 112))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>CompilationSettings : Symbol(TypeScript.CompilationSettings)
|
||
>context : Symbol(context, Decl(parserharness.ts, 1285, 164))
|
||
>CompilationContext : Symbol(CompilationContext, Decl(parserharness.ts, 1245, 9))
|
||
>references : Symbol(references, Decl(parserharness.ts, 1285, 194))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>IFileReference : Symbol(TypeScript.IFileReference)
|
||
|
||
path = switchToForwardSlashes(path);
|
||
>path : Symbol(path, Decl(parserharness.ts, 1285, 36))
|
||
>switchToForwardSlashes : Symbol(switchToForwardSlashes, Decl(parserharness.ts, 25, 22))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1285, 36))
|
||
|
||
var filename = path.match(/[^\/]*$/)[0];
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1287, 15))
|
||
>path.match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1285, 36))
|
||
>match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
|
||
var code = readFile(path);
|
||
>code : Symbol(code, Decl(parserharness.ts, 1288, 15))
|
||
>readFile : Symbol(readFile, Decl(parserharness.ts, 207, 5))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1285, 36))
|
||
|
||
compileUnit(code, filename, callback, settingsCallback, context, references);
|
||
>compileUnit : Symbol(compileUnit, Decl(parserharness.ts, 1291, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1288, 15))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1287, 15))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1285, 49))
|
||
>settingsCallback : Symbol(settingsCallback, Decl(parserharness.ts, 1285, 91))
|
||
>context : Symbol(context, Decl(parserharness.ts, 1285, 164))
|
||
>references : Symbol(references, Decl(parserharness.ts, 1285, 194))
|
||
}
|
||
|
||
export function compileUnit(code: string, filename: string, callback: (res: CompilerResult) => void , settingsCallback?: (settings?: TypeScript.CompilationSettings) => void , context?: CompilationContext, references?: TypeScript.IFileReference[]) {
|
||
>compileUnit : Symbol(compileUnit, Decl(parserharness.ts, 1291, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1293, 36))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1293, 49))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1293, 67))
|
||
>res : Symbol(res, Decl(parserharness.ts, 1293, 79))
|
||
>CompilerResult : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>settingsCallback : Symbol(settingsCallback, Decl(parserharness.ts, 1293, 109))
|
||
>settings : Symbol(settings, Decl(parserharness.ts, 1293, 130))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>CompilationSettings : Symbol(TypeScript.CompilationSettings)
|
||
>context : Symbol(context, Decl(parserharness.ts, 1293, 182))
|
||
>CompilationContext : Symbol(CompilationContext, Decl(parserharness.ts, 1245, 9))
|
||
>references : Symbol(references, Decl(parserharness.ts, 1293, 212))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>IFileReference : Symbol(TypeScript.IFileReference)
|
||
|
||
// not recursive
|
||
function clone/* <T> */(source: any, target: any) {
|
||
>clone : Symbol(clone, Decl(parserharness.ts, 1293, 256))
|
||
>source : Symbol(source, Decl(parserharness.ts, 1295, 36))
|
||
>target : Symbol(target, Decl(parserharness.ts, 1295, 48))
|
||
|
||
for (var prop in source) {
|
||
>prop : Symbol(prop, Decl(parserharness.ts, 1296, 24))
|
||
>source : Symbol(source, Decl(parserharness.ts, 1295, 36))
|
||
|
||
target[prop] = source[prop];
|
||
>target : Symbol(target, Decl(parserharness.ts, 1295, 48))
|
||
>prop : Symbol(prop, Decl(parserharness.ts, 1296, 24))
|
||
>source : Symbol(source, Decl(parserharness.ts, 1295, 36))
|
||
>prop : Symbol(prop, Decl(parserharness.ts, 1296, 24))
|
||
}
|
||
}
|
||
|
||
var oldCompilerSettings = new TypeScript.CompilationSettings();
|
||
>oldCompilerSettings : Symbol(oldCompilerSettings, Decl(parserharness.ts, 1301, 15))
|
||
|
||
clone(compiler.settings, oldCompilerSettings);
|
||
>clone : Symbol(clone, Decl(parserharness.ts, 1293, 256))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>oldCompilerSettings : Symbol(oldCompilerSettings, Decl(parserharness.ts, 1301, 15))
|
||
|
||
var oldEmitSettings = new TypeScript.EmitOptions(compiler.settings);
|
||
>oldEmitSettings : Symbol(oldEmitSettings, Decl(parserharness.ts, 1303, 15))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
|
||
clone(compiler.emitSettings, oldEmitSettings);
|
||
>clone : Symbol(clone, Decl(parserharness.ts, 1293, 256))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>oldEmitSettings : Symbol(oldEmitSettings, Decl(parserharness.ts, 1303, 15))
|
||
|
||
var oldModuleGenTarget = TypeScript.moduleGenTarget;
|
||
>oldModuleGenTarget : Symbol(oldModuleGenTarget, Decl(parserharness.ts, 1306, 15))
|
||
|
||
if (settingsCallback) {
|
||
>settingsCallback : Symbol(settingsCallback, Decl(parserharness.ts, 1293, 109))
|
||
|
||
settingsCallback(compiler.settings);
|
||
>settingsCallback : Symbol(settingsCallback, Decl(parserharness.ts, 1293, 109))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
|
||
compiler.emitSettings = new TypeScript.EmitOptions(compiler.settings);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
}
|
||
try {
|
||
compileString(code, filename, callback, context, references);
|
||
>compileString : Symbol(compileString, Decl(parserharness.ts, 1341, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1293, 36))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1293, 49))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1293, 67))
|
||
>context : Symbol(context, Decl(parserharness.ts, 1293, 182))
|
||
>references : Symbol(references, Decl(parserharness.ts, 1293, 212))
|
||
|
||
} finally {
|
||
// If settingsCallback exists, assume that it modified the global compiler instance's settings in some way.
|
||
// So that a test doesn't have side effects for tests run after it, restore the compiler settings to their previous state.
|
||
if (settingsCallback) {
|
||
>settingsCallback : Symbol(settingsCallback, Decl(parserharness.ts, 1293, 109))
|
||
|
||
compiler.settings = oldCompilerSettings;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>oldCompilerSettings : Symbol(oldCompilerSettings, Decl(parserharness.ts, 1301, 15))
|
||
|
||
compiler.emitSettings = oldEmitSettings;
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>oldEmitSettings : Symbol(oldEmitSettings, Decl(parserharness.ts, 1303, 15))
|
||
|
||
TypeScript.moduleGenTarget = oldModuleGenTarget;
|
||
>oldModuleGenTarget : Symbol(oldModuleGenTarget, Decl(parserharness.ts, 1306, 15))
|
||
}
|
||
}
|
||
}
|
||
|
||
export function compileUnits(units: TestCaseParser.TestUnitData[], callback: (res: Compiler.CompilerResult) => void , settingsCallback?: () => void ) {
|
||
>compileUnits : Symbol(compileUnits, Decl(parserharness.ts, 1323, 9))
|
||
>units : Symbol(units, Decl(parserharness.ts, 1325, 37))
|
||
>TestCaseParser : Symbol(TestCaseParser, Decl(parserharness.ts, 1408, 5))
|
||
>TestUnitData : Symbol(TestCaseParser.TestUnitData, Decl(parserharness.ts, 1418, 9))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1325, 74))
|
||
>res : Symbol(res, Decl(parserharness.ts, 1325, 86))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>CompilerResult : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>settingsCallback : Symbol(settingsCallback, Decl(parserharness.ts, 1325, 125))
|
||
|
||
var lastUnit = units[units.length - 1];
|
||
>lastUnit : Symbol(lastUnit, Decl(parserharness.ts, 1326, 15))
|
||
>units : Symbol(units, Decl(parserharness.ts, 1325, 37))
|
||
>units.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>units : Symbol(units, Decl(parserharness.ts, 1325, 37))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
var unitName = switchToForwardSlashes(lastUnit.name).match(/[^\/]*$/)[0];
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1327, 15))
|
||
>switchToForwardSlashes(lastUnit.name).match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
>switchToForwardSlashes : Symbol(switchToForwardSlashes, Decl(parserharness.ts, 25, 22))
|
||
>lastUnit.name : Symbol(TestCaseParser.TestUnitData.name, Decl(parserharness.ts, 1422, 28))
|
||
>lastUnit : Symbol(lastUnit, Decl(parserharness.ts, 1326, 15))
|
||
>name : Symbol(TestCaseParser.TestUnitData.name, Decl(parserharness.ts, 1422, 28))
|
||
>match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
|
||
var dependencies = units.slice(0, units.length - 1);
|
||
>dependencies : Symbol(dependencies, Decl(parserharness.ts, 1329, 15))
|
||
>units.slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --))
|
||
>units : Symbol(units, Decl(parserharness.ts, 1325, 37))
|
||
>slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --))
|
||
>units.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>units : Symbol(units, Decl(parserharness.ts, 1325, 37))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
var compilationContext = Harness.Compiler.defineCompilationContextForTest(unitName, dependencies);
|
||
>compilationContext : Symbol(compilationContext, Decl(parserharness.ts, 1330, 15))
|
||
>Harness.Compiler.defineCompilationContextForTest : Symbol(defineCompilationContextForTest, Decl(parserharness.ts, 1376, 9))
|
||
>Harness.Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>defineCompilationContextForTest : Symbol(defineCompilationContextForTest, Decl(parserharness.ts, 1376, 9))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1327, 15))
|
||
>dependencies : Symbol(dependencies, Decl(parserharness.ts, 1329, 15))
|
||
|
||
compileUnit(lastUnit.content, unitName, callback, settingsCallback, compilationContext, lastUnit.references);
|
||
>compileUnit : Symbol(compileUnit, Decl(parserharness.ts, 1291, 9))
|
||
>lastUnit.content : Symbol(TestCaseParser.TestUnitData.content, Decl(parserharness.ts, 1421, 39))
|
||
>lastUnit : Symbol(lastUnit, Decl(parserharness.ts, 1326, 15))
|
||
>content : Symbol(TestCaseParser.TestUnitData.content, Decl(parserharness.ts, 1421, 39))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1327, 15))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1325, 74))
|
||
>settingsCallback : Symbol(settingsCallback, Decl(parserharness.ts, 1325, 125))
|
||
>compilationContext : Symbol(compilationContext, Decl(parserharness.ts, 1330, 15))
|
||
>lastUnit.references : Symbol(TestCaseParser.TestUnitData.references, Decl(parserharness.ts, 1424, 37))
|
||
>lastUnit : Symbol(lastUnit, Decl(parserharness.ts, 1326, 15))
|
||
>references : Symbol(TestCaseParser.TestUnitData.references, Decl(parserharness.ts, 1424, 37))
|
||
}
|
||
|
||
export function emitToOutfile(outfile: WriterAggregator) {
|
||
>emitToOutfile : Symbol(emitToOutfile, Decl(parserharness.ts, 1333, 9))
|
||
>outfile : Symbol(outfile, Decl(parserharness.ts, 1335, 38))
|
||
>WriterAggregator : Symbol(WriterAggregator, Decl(parserharness.ts, 686, 28))
|
||
|
||
compiler.emitToOutfile(outfile);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>outfile : Symbol(outfile, Decl(parserharness.ts, 1335, 38))
|
||
}
|
||
|
||
export function emit(ioHost: TypeScript.EmitterIOHost, usePullEmitter?: boolean) {
|
||
>emit : Symbol(emit, Decl(parserharness.ts, 1337, 9))
|
||
>ioHost : Symbol(ioHost, Decl(parserharness.ts, 1339, 29))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>EmitterIOHost : Symbol(TypeScript.EmitterIOHost)
|
||
>usePullEmitter : Symbol(usePullEmitter, Decl(parserharness.ts, 1339, 62))
|
||
|
||
compiler.emit(ioHost, usePullEmitter);
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>ioHost : Symbol(ioHost, Decl(parserharness.ts, 1339, 29))
|
||
>usePullEmitter : Symbol(usePullEmitter, Decl(parserharness.ts, 1339, 62))
|
||
}
|
||
|
||
export function compileString(code: string, unitName: string, callback: (res: Compiler.CompilerResult) => void , context?: CompilationContext, references?: TypeScript.IFileReference[]) {
|
||
>compileString : Symbol(compileString, Decl(parserharness.ts, 1341, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1343, 38))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1343, 51))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1343, 69))
|
||
>res : Symbol(res, Decl(parserharness.ts, 1343, 81))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>CompilerResult : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>context : Symbol(context, Decl(parserharness.ts, 1343, 120))
|
||
>CompilationContext : Symbol(CompilationContext, Decl(parserharness.ts, 1245, 9))
|
||
>references : Symbol(references, Decl(parserharness.ts, 1343, 150))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>IFileReference : Symbol(TypeScript.IFileReference)
|
||
|
||
var scripts: TypeScript.Script[] = [];
|
||
>scripts : Symbol(scripts, Decl(parserharness.ts, 1344, 15))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>Script : Symbol(TypeScript.Script)
|
||
|
||
reset();
|
||
>reset : Symbol(reset, Decl(parserharness.ts, 1229, 9))
|
||
|
||
if (context) {
|
||
>context : Symbol(context, Decl(parserharness.ts, 1343, 120))
|
||
|
||
context.preCompile();
|
||
>context.preCompile : Symbol(CompilationContext.preCompile, Decl(parserharness.ts, 1250, 29))
|
||
>context : Symbol(context, Decl(parserharness.ts, 1343, 120))
|
||
>preCompile : Symbol(CompilationContext.preCompile, Decl(parserharness.ts, 1250, 29))
|
||
}
|
||
|
||
var isDeclareFile = Harness.Compiler.isDeclareFile(unitName);
|
||
>isDeclareFile : Symbol(isDeclareFile, Decl(parserharness.ts, 1352, 15))
|
||
>Harness.Compiler.isDeclareFile : Symbol(isDeclareFile, Decl(parserharness.ts, 757, 44))
|
||
>Harness.Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>isDeclareFile : Symbol(isDeclareFile, Decl(parserharness.ts, 757, 44))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1343, 51))
|
||
|
||
// for single file tests just add them as using the old '0.ts' naming scheme
|
||
var uName = context ? unitName : ((isDeclareFile) ? '0.d.ts' : '0.ts');
|
||
>uName : Symbol(uName, Decl(parserharness.ts, 1354, 15))
|
||
>context : Symbol(context, Decl(parserharness.ts, 1343, 120))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1343, 51))
|
||
>isDeclareFile : Symbol(isDeclareFile, Decl(parserharness.ts, 1352, 15))
|
||
|
||
scripts.push(addUnit(code, uName, false, isDeclareFile, references));
|
||
>scripts.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>scripts : Symbol(scripts, Decl(parserharness.ts, 1344, 15))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>addUnit : Symbol(addUnit, Decl(parserharness.ts, 1253, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1343, 38))
|
||
>uName : Symbol(uName, Decl(parserharness.ts, 1354, 15))
|
||
>isDeclareFile : Symbol(isDeclareFile, Decl(parserharness.ts, 1352, 15))
|
||
>references : Symbol(references, Decl(parserharness.ts, 1343, 150))
|
||
|
||
compile(code, uName);
|
||
>compile : Symbol(compile, Decl(parserharness.ts, 784, 38))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1343, 38))
|
||
>uName : Symbol(uName, Decl(parserharness.ts, 1354, 15))
|
||
|
||
var errors;
|
||
>errors : Symbol(errors, Decl(parserharness.ts, 1358, 15))
|
||
|
||
if (usePull) {
|
||
>usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
|
||
// TODO: no emit support with pull yet
|
||
errors = compiler.pullGetErrorsForFile(uName);
|
||
>errors : Symbol(errors, Decl(parserharness.ts, 1358, 15))
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
>uName : Symbol(uName, Decl(parserharness.ts, 1354, 15))
|
||
|
||
emit(stdout, true);
|
||
>emit : Symbol(emit, Decl(parserharness.ts, 1337, 9))
|
||
>stdout : Symbol(stdout, Decl(parserharness.ts, 756, 11))
|
||
}
|
||
else {
|
||
errors = stderr.lines;
|
||
>errors : Symbol(errors, Decl(parserharness.ts, 1358, 15))
|
||
>stderr.lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
>stderr : Symbol(stderr, Decl(parserharness.ts, 757, 11))
|
||
>lines : Symbol(WriterAggregator.lines, Decl(parserharness.ts, 690, 62))
|
||
|
||
emit(stdout, false);
|
||
>emit : Symbol(emit, Decl(parserharness.ts, 1337, 9))
|
||
>stdout : Symbol(stdout, Decl(parserharness.ts, 756, 11))
|
||
|
||
//output decl file
|
||
compiler.emitDeclarations();
|
||
>compiler : Symbol(compiler, Decl(parserharness.ts, 780, 11))
|
||
}
|
||
|
||
if (context) {
|
||
>context : Symbol(context, Decl(parserharness.ts, 1343, 120))
|
||
|
||
context.postCompile();
|
||
>context.postCompile : Symbol(CompilationContext.postCompile, Decl(parserharness.ts, 1251, 35))
|
||
>context : Symbol(context, Decl(parserharness.ts, 1343, 120))
|
||
>postCompile : Symbol(CompilationContext.postCompile, Decl(parserharness.ts, 1251, 35))
|
||
}
|
||
|
||
callback(new CompilerResult(stdout.toArray(), errors, scripts));
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1343, 69))
|
||
>CompilerResult : Symbol(CompilerResult, Decl(parserharness.ts, 1167, 9))
|
||
>stdout.toArray : Symbol(EmitterIOHost.toArray, Decl(parserharness.ts, 735, 56))
|
||
>stdout : Symbol(stdout, Decl(parserharness.ts, 756, 11))
|
||
>toArray : Symbol(EmitterIOHost.toArray, Decl(parserharness.ts, 735, 56))
|
||
>errors : Symbol(errors, Decl(parserharness.ts, 1358, 15))
|
||
>scripts : Symbol(scripts, Decl(parserharness.ts, 1344, 15))
|
||
}
|
||
|
||
/** Returns a set of functions which can be later executed to add and remove given dependencies to the compiler so that
|
||
* a file can be successfully compiled. These functions will add/remove named units and code to the compiler for each dependency.
|
||
*/
|
||
export function defineCompilationContextForTest(filename: string, dependencies: TestCaseParser.TestUnitData[]): CompilationContext {
|
||
>defineCompilationContextForTest : Symbol(defineCompilationContextForTest, Decl(parserharness.ts, 1376, 9))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1381, 56))
|
||
>dependencies : Symbol(dependencies, Decl(parserharness.ts, 1381, 73))
|
||
>TestCaseParser : Symbol(TestCaseParser, Decl(parserharness.ts, 1408, 5))
|
||
>TestUnitData : Symbol(TestCaseParser.TestUnitData, Decl(parserharness.ts, 1418, 9))
|
||
>CompilationContext : Symbol(CompilationContext, Decl(parserharness.ts, 1245, 9))
|
||
|
||
// if the given file has no dependencies, there is no context to return, it can be compiled without additional work
|
||
if (dependencies.length == 0) {
|
||
>dependencies.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>dependencies : Symbol(dependencies, Decl(parserharness.ts, 1381, 73))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
return null;
|
||
} else {
|
||
var addedFiles = [];
|
||
>addedFiles : Symbol(addedFiles, Decl(parserharness.ts, 1386, 19))
|
||
|
||
var precompile = () => {
|
||
>precompile : Symbol(precompile, Decl(parserharness.ts, 1387, 19))
|
||
|
||
// REVIEW: if any dependency has a triple slash reference then does postCompile potentially have to do a recreate since we can't update references with updateUnit?
|
||
// easy enough to do if so, prefer to avoid the recreate cost until it proves to be an issue
|
||
dependencies.forEach(dep => {
|
||
>dependencies.forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>dependencies : Symbol(dependencies, Decl(parserharness.ts, 1381, 73))
|
||
>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>dep : Symbol(dep, Decl(parserharness.ts, 1390, 41))
|
||
|
||
addUnit(dep.content, dep.name, false, Harness.Compiler.isDeclareFile(dep.name));
|
||
>addUnit : Symbol(addUnit, Decl(parserharness.ts, 1253, 9))
|
||
>dep.content : Symbol(TestCaseParser.TestUnitData.content, Decl(parserharness.ts, 1421, 39))
|
||
>dep : Symbol(dep, Decl(parserharness.ts, 1390, 41))
|
||
>content : Symbol(TestCaseParser.TestUnitData.content, Decl(parserharness.ts, 1421, 39))
|
||
>dep.name : Symbol(TestCaseParser.TestUnitData.name, Decl(parserharness.ts, 1422, 28))
|
||
>dep : Symbol(dep, Decl(parserharness.ts, 1390, 41))
|
||
>name : Symbol(TestCaseParser.TestUnitData.name, Decl(parserharness.ts, 1422, 28))
|
||
>Harness.Compiler.isDeclareFile : Symbol(isDeclareFile, Decl(parserharness.ts, 757, 44))
|
||
>Harness.Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>isDeclareFile : Symbol(isDeclareFile, Decl(parserharness.ts, 757, 44))
|
||
>dep.name : Symbol(TestCaseParser.TestUnitData.name, Decl(parserharness.ts, 1422, 28))
|
||
>dep : Symbol(dep, Decl(parserharness.ts, 1390, 41))
|
||
>name : Symbol(TestCaseParser.TestUnitData.name, Decl(parserharness.ts, 1422, 28))
|
||
|
||
addedFiles.push(dep.name);
|
||
>addedFiles.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>addedFiles : Symbol(addedFiles, Decl(parserharness.ts, 1386, 19))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>dep.name : Symbol(TestCaseParser.TestUnitData.name, Decl(parserharness.ts, 1422, 28))
|
||
>dep : Symbol(dep, Decl(parserharness.ts, 1390, 41))
|
||
>name : Symbol(TestCaseParser.TestUnitData.name, Decl(parserharness.ts, 1422, 28))
|
||
|
||
});
|
||
};
|
||
var postcompile = () => {
|
||
>postcompile : Symbol(postcompile, Decl(parserharness.ts, 1395, 19))
|
||
|
||
addedFiles.forEach(file => {
|
||
>addedFiles.forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>addedFiles : Symbol(addedFiles, Decl(parserharness.ts, 1386, 19))
|
||
>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
||
>file : Symbol(file, Decl(parserharness.ts, 1396, 39))
|
||
|
||
updateUnit('', file);
|
||
>updateUnit : Symbol(updateUnit, Decl(parserharness.ts, 1275, 9))
|
||
>file : Symbol(file, Decl(parserharness.ts, 1396, 39))
|
||
|
||
});
|
||
};
|
||
var context = {
|
||
>context : Symbol(context, Decl(parserharness.ts, 1400, 19))
|
||
|
||
filename: filename,
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1400, 31))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1381, 56))
|
||
|
||
preCompile: precompile,
|
||
>preCompile : Symbol(preCompile, Decl(parserharness.ts, 1401, 39))
|
||
>precompile : Symbol(precompile, Decl(parserharness.ts, 1387, 19))
|
||
|
||
postCompile: postcompile
|
||
>postCompile : Symbol(postCompile, Decl(parserharness.ts, 1402, 43))
|
||
>postcompile : Symbol(postcompile, Decl(parserharness.ts, 1395, 19))
|
||
|
||
};
|
||
return context;
|
||
>context : Symbol(context, Decl(parserharness.ts, 1400, 19))
|
||
}
|
||
}
|
||
}
|
||
|
||
/** Parses the test cases files
|
||
* extracts options and individual files in a multifile test
|
||
*/
|
||
export module TestCaseParser {
|
||
>TestCaseParser : Symbol(TestCaseParser, Decl(parserharness.ts, 1408, 5))
|
||
|
||
/** all the necesarry information to set the right compiler settings */
|
||
export interface CompilerSetting {
|
||
>CompilerSetting : Symbol(CompilerSetting, Decl(parserharness.ts, 1413, 34))
|
||
|
||
flag: string;
|
||
>flag : Symbol(CompilerSetting.flag, Decl(parserharness.ts, 1415, 42))
|
||
|
||
value: string;
|
||
>value : Symbol(CompilerSetting.value, Decl(parserharness.ts, 1416, 25))
|
||
}
|
||
|
||
/** All the necessary information to turn a multi file test into useful units for later compilation */
|
||
export interface TestUnitData {
|
||
>TestUnitData : Symbol(TestUnitData, Decl(parserharness.ts, 1418, 9))
|
||
|
||
content: string;
|
||
>content : Symbol(TestUnitData.content, Decl(parserharness.ts, 1421, 39))
|
||
|
||
name: string;
|
||
>name : Symbol(TestUnitData.name, Decl(parserharness.ts, 1422, 28))
|
||
|
||
originalFilePath: string;
|
||
>originalFilePath : Symbol(TestUnitData.originalFilePath, Decl(parserharness.ts, 1423, 25))
|
||
|
||
references: TypeScript.IFileReference[];
|
||
>references : Symbol(TestUnitData.references, Decl(parserharness.ts, 1424, 37))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>IFileReference : Symbol(TypeScript.IFileReference)
|
||
}
|
||
|
||
// Regex for parsing options in the format "@Alpha: Value of any sort"
|
||
private optionRegex = /^[\/]{2}\s*@(\w+):\s*(\S*)/gm; // multiple matches on multiple lines
|
||
|
||
// List of allowed metadata names
|
||
var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out"];
|
||
>fileMetadataNames : Symbol(fileMetadataNames, Decl(parserharness.ts, 1432, 11))
|
||
|
||
function extractCompilerSettings(content: string): CompilerSetting[] {
|
||
>extractCompilerSettings : Symbol(extractCompilerSettings, Decl(parserharness.ts, 1432, 121))
|
||
>content : Symbol(content, Decl(parserharness.ts, 1434, 41))
|
||
>CompilerSetting : Symbol(CompilerSetting, Decl(parserharness.ts, 1413, 34))
|
||
|
||
var opts = [];
|
||
>opts : Symbol(opts, Decl(parserharness.ts, 1436, 15))
|
||
|
||
var match;
|
||
>match : Symbol(match, Decl(parserharness.ts, 1438, 15))
|
||
|
||
while ((match = optionRegex.exec(content)) != null) {
|
||
>match : Symbol(match, Decl(parserharness.ts, 1438, 15))
|
||
>content : Symbol(content, Decl(parserharness.ts, 1434, 41))
|
||
|
||
opts.push({ flag: match[1], value: match[2] });
|
||
>opts.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>opts : Symbol(opts, Decl(parserharness.ts, 1436, 15))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>flag : Symbol(flag, Decl(parserharness.ts, 1440, 27))
|
||
>match : Symbol(match, Decl(parserharness.ts, 1438, 15))
|
||
>value : Symbol(value, Decl(parserharness.ts, 1440, 43))
|
||
>match : Symbol(match, Decl(parserharness.ts, 1438, 15))
|
||
}
|
||
|
||
return opts;
|
||
>opts : Symbol(opts, Decl(parserharness.ts, 1436, 15))
|
||
}
|
||
|
||
/** Given a test file containing // @Filename directives, return an array of named units of code to be added to an existing compiler instance */
|
||
export function makeUnitsFromTest(code: string, filename: string): { settings: CompilerSetting[]; testUnitData: TestUnitData[]; } {
|
||
>makeUnitsFromTest : Symbol(makeUnitsFromTest, Decl(parserharness.ts, 1444, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1447, 42))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1447, 55))
|
||
>settings : Symbol(settings, Decl(parserharness.ts, 1447, 76))
|
||
>CompilerSetting : Symbol(CompilerSetting, Decl(parserharness.ts, 1413, 34))
|
||
>testUnitData : Symbol(testUnitData, Decl(parserharness.ts, 1447, 105))
|
||
>TestUnitData : Symbol(TestUnitData, Decl(parserharness.ts, 1418, 9))
|
||
|
||
var settings = extractCompilerSettings(code);
|
||
>settings : Symbol(settings, Decl(parserharness.ts, 1449, 15))
|
||
>extractCompilerSettings : Symbol(extractCompilerSettings, Decl(parserharness.ts, 1432, 121))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1447, 42))
|
||
|
||
// List of all the subfiles we've parsed out
|
||
var files: TestUnitData[] = [];
|
||
>files : Symbol(files, Decl(parserharness.ts, 1452, 15))
|
||
>TestUnitData : Symbol(TestUnitData, Decl(parserharness.ts, 1418, 9))
|
||
|
||
var lines = splitContentByNewlines(code);
|
||
>lines : Symbol(lines, Decl(parserharness.ts, 1454, 15))
|
||
>splitContentByNewlines : Symbol(splitContentByNewlines, Decl(parserharness.ts, 195, 5))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1447, 42))
|
||
|
||
// Stuff related to the subfile we're parsing
|
||
var currentFileContent: string = null;
|
||
>currentFileContent : Symbol(currentFileContent, Decl(parserharness.ts, 1457, 15))
|
||
|
||
var currentFileOptions = {};
|
||
>currentFileOptions : Symbol(currentFileOptions, Decl(parserharness.ts, 1458, 15))
|
||
|
||
var currentFileName = null;
|
||
>currentFileName : Symbol(currentFileName, Decl(parserharness.ts, 1459, 15))
|
||
|
||
var refs: TypeScript.IFileReference[] = [];
|
||
>refs : Symbol(refs, Decl(parserharness.ts, 1460, 15))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>IFileReference : Symbol(TypeScript.IFileReference)
|
||
|
||
for (var i = 0; i < lines.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 1462, 20))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1462, 20))
|
||
>lines.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>lines : Symbol(lines, Decl(parserharness.ts, 1454, 15))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1462, 20))
|
||
|
||
var line = lines[i];
|
||
>line : Symbol(line, Decl(parserharness.ts, 1463, 19))
|
||
>lines : Symbol(lines, Decl(parserharness.ts, 1454, 15))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1462, 20))
|
||
|
||
var isTripleSlashReference = /[\/]{3}\s*<reference path/.test(line);
|
||
>isTripleSlashReference : Symbol(isTripleSlashReference, Decl(parserharness.ts, 1464, 19))
|
||
>/[\/]{3}\s*<reference path/.test : Symbol(RegExp.test, Decl(lib.es5.d.ts, --, --))
|
||
>test : Symbol(RegExp.test, Decl(lib.es5.d.ts, --, --))
|
||
>line : Symbol(line, Decl(parserharness.ts, 1463, 19))
|
||
|
||
var testMetaData = optionRegex.exec(line);
|
||
>testMetaData : Symbol(testMetaData, Decl(parserharness.ts, 1465, 19))
|
||
>line : Symbol(line, Decl(parserharness.ts, 1463, 19))
|
||
|
||
// Triple slash references need to be tracked as they are added to the compiler as an additional parameter to addUnit
|
||
if (isTripleSlashReference) {
|
||
>isTripleSlashReference : Symbol(isTripleSlashReference, Decl(parserharness.ts, 1464, 19))
|
||
|
||
var isRef = line.match(/reference\spath='(\w*_?\w*\.?d?\.ts)'/);
|
||
>isRef : Symbol(isRef, Decl(parserharness.ts, 1468, 23))
|
||
>line.match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
>line : Symbol(line, Decl(parserharness.ts, 1463, 19))
|
||
>match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
|
||
if (isRef) {
|
||
>isRef : Symbol(isRef, Decl(parserharness.ts, 1468, 23))
|
||
|
||
var ref = {
|
||
>ref : Symbol(ref, Decl(parserharness.ts, 1470, 27))
|
||
|
||
minChar: 0,
|
||
>minChar : Symbol(minChar, Decl(parserharness.ts, 1470, 35))
|
||
|
||
limChar: 0,
|
||
>limChar : Symbol(limChar, Decl(parserharness.ts, 1471, 39))
|
||
|
||
startLine:0,
|
||
>startLine : Symbol(startLine, Decl(parserharness.ts, 1472, 39))
|
||
|
||
startCol:0,
|
||
>startCol : Symbol(startCol, Decl(parserharness.ts, 1473, 40))
|
||
|
||
path: isRef[1],
|
||
>path : Symbol(path, Decl(parserharness.ts, 1474, 39))
|
||
>isRef : Symbol(isRef, Decl(parserharness.ts, 1468, 23))
|
||
|
||
isResident: false
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1475, 43))
|
||
|
||
};
|
||
|
||
refs.push(ref);
|
||
>refs.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>refs : Symbol(refs, Decl(parserharness.ts, 1460, 15))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>ref : Symbol(ref, Decl(parserharness.ts, 1470, 27))
|
||
}
|
||
} else if (testMetaData) {
|
||
>testMetaData : Symbol(testMetaData, Decl(parserharness.ts, 1465, 19))
|
||
|
||
// Comment line, check for global/file @options and record them
|
||
optionRegex.lastIndex = 0;
|
||
var fileNameIndex = fileMetadataNames.indexOf(testMetaData[1].toLowerCase());
|
||
>fileNameIndex : Symbol(fileNameIndex, Decl(parserharness.ts, 1484, 23))
|
||
>fileMetadataNames.indexOf : Symbol(Array.indexOf, Decl(lib.es5.d.ts, --, --))
|
||
>fileMetadataNames : Symbol(fileMetadataNames, Decl(parserharness.ts, 1432, 11))
|
||
>indexOf : Symbol(Array.indexOf, Decl(lib.es5.d.ts, --, --))
|
||
>testMetaData : Symbol(testMetaData, Decl(parserharness.ts, 1465, 19))
|
||
|
||
if (fileNameIndex == -1) {
|
||
>fileNameIndex : Symbol(fileNameIndex, Decl(parserharness.ts, 1484, 23))
|
||
|
||
throw new Error('Unrecognized metadata name "' + testMetaData[1] + '". Available file metadata names are: ' + fileMetadataNames.join(', '));
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>testMetaData : Symbol(testMetaData, Decl(parserharness.ts, 1465, 19))
|
||
>fileMetadataNames.join : Symbol(Array.join, Decl(lib.es5.d.ts, --, --))
|
||
>fileMetadataNames : Symbol(fileMetadataNames, Decl(parserharness.ts, 1432, 11))
|
||
>join : Symbol(Array.join, Decl(lib.es5.d.ts, --, --))
|
||
|
||
} else if (fileNameIndex == 0) {
|
||
>fileNameIndex : Symbol(fileNameIndex, Decl(parserharness.ts, 1484, 23))
|
||
|
||
currentFileOptions[testMetaData[1]] = testMetaData[2];
|
||
>currentFileOptions : Symbol(currentFileOptions, Decl(parserharness.ts, 1458, 15))
|
||
>testMetaData : Symbol(testMetaData, Decl(parserharness.ts, 1465, 19))
|
||
>testMetaData : Symbol(testMetaData, Decl(parserharness.ts, 1465, 19))
|
||
|
||
} else {
|
||
continue;
|
||
}
|
||
|
||
// New metadata statement after having collected some code to go with the previous metadata
|
||
if (currentFileName) {
|
||
>currentFileName : Symbol(currentFileName, Decl(parserharness.ts, 1459, 15))
|
||
|
||
// Store result file
|
||
var newTestFile =
|
||
>newTestFile : Symbol(newTestFile, Decl(parserharness.ts, 1496, 27), Decl(parserharness.ts, 1532, 15))
|
||
{
|
||
content: currentFileContent,
|
||
>content : Symbol(content, Decl(parserharness.ts, 1497, 29))
|
||
>currentFileContent : Symbol(currentFileContent, Decl(parserharness.ts, 1457, 15))
|
||
|
||
name: currentFileName,
|
||
>name : Symbol(name, Decl(parserharness.ts, 1498, 60))
|
||
>currentFileName : Symbol(currentFileName, Decl(parserharness.ts, 1459, 15))
|
||
|
||
fileOptions: currentFileOptions,
|
||
>fileOptions : Symbol(fileOptions, Decl(parserharness.ts, 1499, 54))
|
||
>currentFileOptions : Symbol(currentFileOptions, Decl(parserharness.ts, 1458, 15))
|
||
|
||
originalFilePath: filename,
|
||
>originalFilePath : Symbol(originalFilePath, Decl(parserharness.ts, 1500, 64))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1447, 55))
|
||
|
||
references: refs
|
||
>references : Symbol(references, Decl(parserharness.ts, 1501, 59))
|
||
>refs : Symbol(refs, Decl(parserharness.ts, 1460, 15))
|
||
|
||
};
|
||
files.push(newTestFile);
|
||
>files.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>files : Symbol(files, Decl(parserharness.ts, 1452, 15))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>newTestFile : Symbol(newTestFile, Decl(parserharness.ts, 1496, 27), Decl(parserharness.ts, 1532, 15))
|
||
|
||
// Reset local data
|
||
currentFileContent = null;
|
||
>currentFileContent : Symbol(currentFileContent, Decl(parserharness.ts, 1457, 15))
|
||
|
||
currentFileOptions = {};
|
||
>currentFileOptions : Symbol(currentFileOptions, Decl(parserharness.ts, 1458, 15))
|
||
|
||
currentFileName = testMetaData[2];
|
||
>currentFileName : Symbol(currentFileName, Decl(parserharness.ts, 1459, 15))
|
||
>testMetaData : Symbol(testMetaData, Decl(parserharness.ts, 1465, 19))
|
||
|
||
refs = [];
|
||
>refs : Symbol(refs, Decl(parserharness.ts, 1460, 15))
|
||
|
||
} else {
|
||
// First metadata marker in the file
|
||
currentFileName = testMetaData[2];
|
||
>currentFileName : Symbol(currentFileName, Decl(parserharness.ts, 1459, 15))
|
||
>testMetaData : Symbol(testMetaData, Decl(parserharness.ts, 1465, 19))
|
||
}
|
||
} else {
|
||
// Subfile content line
|
||
// Append to the current subfile content, inserting a newline needed
|
||
if (currentFileContent === null) {
|
||
>currentFileContent : Symbol(currentFileContent, Decl(parserharness.ts, 1457, 15))
|
||
|
||
currentFileContent = '';
|
||
>currentFileContent : Symbol(currentFileContent, Decl(parserharness.ts, 1457, 15))
|
||
|
||
} else {
|
||
// End-of-line
|
||
currentFileContent = currentFileContent + '\n';
|
||
>currentFileContent : Symbol(currentFileContent, Decl(parserharness.ts, 1457, 15))
|
||
>currentFileContent : Symbol(currentFileContent, Decl(parserharness.ts, 1457, 15))
|
||
}
|
||
currentFileContent = currentFileContent + line;
|
||
>currentFileContent : Symbol(currentFileContent, Decl(parserharness.ts, 1457, 15))
|
||
>currentFileContent : Symbol(currentFileContent, Decl(parserharness.ts, 1457, 15))
|
||
>line : Symbol(line, Decl(parserharness.ts, 1463, 19))
|
||
}
|
||
}
|
||
|
||
// normalize the filename for the single file case
|
||
currentFileName = files.length > 0 ? currentFileName : '0.ts';
|
||
>currentFileName : Symbol(currentFileName, Decl(parserharness.ts, 1459, 15))
|
||
>files.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>files : Symbol(files, Decl(parserharness.ts, 1452, 15))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>currentFileName : Symbol(currentFileName, Decl(parserharness.ts, 1459, 15))
|
||
|
||
// EOF, push whatever remains
|
||
var newTestFile = {
|
||
>newTestFile : Symbol(newTestFile, Decl(parserharness.ts, 1496, 27), Decl(parserharness.ts, 1532, 15))
|
||
|
||
content: currentFileContent || '',
|
||
>content : Symbol(content, Decl(parserharness.ts, 1532, 31))
|
||
>currentFileContent : Symbol(currentFileContent, Decl(parserharness.ts, 1457, 15))
|
||
|
||
name: currentFileName,
|
||
>name : Symbol(name, Decl(parserharness.ts, 1533, 50))
|
||
>currentFileName : Symbol(currentFileName, Decl(parserharness.ts, 1459, 15))
|
||
|
||
fileOptions: currentFileOptions,
|
||
>fileOptions : Symbol(fileOptions, Decl(parserharness.ts, 1534, 38))
|
||
>currentFileOptions : Symbol(currentFileOptions, Decl(parserharness.ts, 1458, 15))
|
||
|
||
originalFilePath: filename,
|
||
>originalFilePath : Symbol(originalFilePath, Decl(parserharness.ts, 1535, 48))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1447, 55))
|
||
|
||
references: refs
|
||
>references : Symbol(references, Decl(parserharness.ts, 1536, 43))
|
||
>refs : Symbol(refs, Decl(parserharness.ts, 1460, 15))
|
||
|
||
};
|
||
files.push(newTestFile);
|
||
>files.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>files : Symbol(files, Decl(parserharness.ts, 1452, 15))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>newTestFile : Symbol(newTestFile, Decl(parserharness.ts, 1496, 27), Decl(parserharness.ts, 1532, 15))
|
||
|
||
return { settings: settings, testUnitData: files };
|
||
>settings : Symbol(settings, Decl(parserharness.ts, 1541, 20))
|
||
>settings : Symbol(settings, Decl(parserharness.ts, 1449, 15))
|
||
>testUnitData : Symbol(testUnitData, Decl(parserharness.ts, 1541, 40))
|
||
>files : Symbol(files, Decl(parserharness.ts, 1452, 15))
|
||
}
|
||
}
|
||
|
||
export class ScriptInfo {
|
||
>ScriptInfo : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
|
||
public version: number;
|
||
>version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
|
||
public editRanges: { length: number; editRange: TypeScript.ScriptEditRange; }[] = [];
|
||
>editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>length : Symbol(length, Decl(parserharness.ts, 1547, 28))
|
||
>editRange : Symbol(editRange, Decl(parserharness.ts, 1547, 44))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>ScriptEditRange : Symbol(TypeScript.ScriptEditRange)
|
||
|
||
constructor(public name: string, public content: string, public isResident: boolean, public maxScriptVersions: number) {
|
||
>name : Symbol(ScriptInfo.name, Decl(parserharness.ts, 1549, 20))
|
||
>content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>isResident : Symbol(ScriptInfo.isResident, Decl(parserharness.ts, 1549, 64))
|
||
>maxScriptVersions : Symbol(ScriptInfo.maxScriptVersions, Decl(parserharness.ts, 1549, 92))
|
||
|
||
this.version = 1;
|
||
>this.version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
}
|
||
|
||
public updateContent(content: string, isResident: boolean) {
|
||
>updateContent : Symbol(ScriptInfo.updateContent, Decl(parserharness.ts, 1551, 9))
|
||
>content : Symbol(content, Decl(parserharness.ts, 1553, 29))
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1553, 45))
|
||
|
||
this.editRanges = [];
|
||
>this.editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
|
||
this.content = content;
|
||
>this.content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>content : Symbol(content, Decl(parserharness.ts, 1553, 29))
|
||
|
||
this.isResident = isResident;
|
||
>this.isResident : Symbol(ScriptInfo.isResident, Decl(parserharness.ts, 1549, 64))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>isResident : Symbol(ScriptInfo.isResident, Decl(parserharness.ts, 1549, 64))
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1553, 45))
|
||
|
||
this.version++;
|
||
>this.version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
}
|
||
|
||
public editContent(minChar: number, limChar: number, newText: string) {
|
||
>editContent : Symbol(ScriptInfo.editContent, Decl(parserharness.ts, 1558, 9))
|
||
>minChar : Symbol(minChar, Decl(parserharness.ts, 1560, 27))
|
||
>limChar : Symbol(limChar, Decl(parserharness.ts, 1560, 43))
|
||
>newText : Symbol(newText, Decl(parserharness.ts, 1560, 60))
|
||
|
||
// Apply edits
|
||
var prefix = this.content.substring(0, minChar);
|
||
>prefix : Symbol(prefix, Decl(parserharness.ts, 1562, 15))
|
||
>this.content.substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||
>this.content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||
>minChar : Symbol(minChar, Decl(parserharness.ts, 1560, 27))
|
||
|
||
var middle = newText;
|
||
>middle : Symbol(middle, Decl(parserharness.ts, 1563, 15))
|
||
>newText : Symbol(newText, Decl(parserharness.ts, 1560, 60))
|
||
|
||
var suffix = this.content.substring(limChar);
|
||
>suffix : Symbol(suffix, Decl(parserharness.ts, 1564, 15))
|
||
>this.content.substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||
>this.content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||
>limChar : Symbol(limChar, Decl(parserharness.ts, 1560, 43))
|
||
|
||
this.content = prefix + middle + suffix;
|
||
>this.content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>prefix : Symbol(prefix, Decl(parserharness.ts, 1562, 15))
|
||
>middle : Symbol(middle, Decl(parserharness.ts, 1563, 15))
|
||
>suffix : Symbol(suffix, Decl(parserharness.ts, 1564, 15))
|
||
|
||
// Store edit range + new length of script
|
||
this.editRanges.push({
|
||
>this.editRanges.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this.editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
|
||
length: this.content.length,
|
||
>length : Symbol(length, Decl(parserharness.ts, 1568, 34))
|
||
>this.content.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
editRange: new TypeScript.ScriptEditRange(minChar, limChar, (limChar - minChar) + newText.length)
|
||
>editRange : Symbol(editRange, Decl(parserharness.ts, 1569, 44))
|
||
>minChar : Symbol(minChar, Decl(parserharness.ts, 1560, 27))
|
||
>limChar : Symbol(limChar, Decl(parserharness.ts, 1560, 43))
|
||
>limChar : Symbol(limChar, Decl(parserharness.ts, 1560, 43))
|
||
>minChar : Symbol(minChar, Decl(parserharness.ts, 1560, 27))
|
||
>newText.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||
>newText : Symbol(newText, Decl(parserharness.ts, 1560, 60))
|
||
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
});
|
||
|
||
if (this.editRanges.length > this.maxScriptVersions) {
|
||
>this.editRanges.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.maxScriptVersions : Symbol(ScriptInfo.maxScriptVersions, Decl(parserharness.ts, 1549, 92))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>maxScriptVersions : Symbol(ScriptInfo.maxScriptVersions, Decl(parserharness.ts, 1549, 92))
|
||
|
||
this.editRanges.splice(0, this.maxScriptVersions - this.editRanges.length);
|
||
>this.editRanges.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>this.editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>this.maxScriptVersions : Symbol(ScriptInfo.maxScriptVersions, Decl(parserharness.ts, 1549, 92))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>maxScriptVersions : Symbol(ScriptInfo.maxScriptVersions, Decl(parserharness.ts, 1549, 92))
|
||
>this.editRanges.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
// Update version #
|
||
this.version++;
|
||
>this.version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
}
|
||
|
||
public getEditRangeSinceVersion(version: number): TypeScript.ScriptEditRange {
|
||
>getEditRangeSinceVersion : Symbol(ScriptInfo.getEditRangeSinceVersion, Decl(parserharness.ts, 1579, 9))
|
||
>version : Symbol(version, Decl(parserharness.ts, 1581, 40))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>ScriptEditRange : Symbol(TypeScript.ScriptEditRange)
|
||
|
||
if (this.version == version) {
|
||
>this.version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
>version : Symbol(version, Decl(parserharness.ts, 1581, 40))
|
||
|
||
// No edits!
|
||
return null;
|
||
}
|
||
|
||
var initialEditRangeIndex = this.editRanges.length - (this.version - version);
|
||
>initialEditRangeIndex : Symbol(initialEditRangeIndex, Decl(parserharness.ts, 1587, 15))
|
||
>this.editRanges.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
>version : Symbol(version, Decl(parserharness.ts, 1581, 40))
|
||
|
||
if (initialEditRangeIndex < 0 || initialEditRangeIndex >= this.editRanges.length) {
|
||
>initialEditRangeIndex : Symbol(initialEditRangeIndex, Decl(parserharness.ts, 1587, 15))
|
||
>initialEditRangeIndex : Symbol(initialEditRangeIndex, Decl(parserharness.ts, 1587, 15))
|
||
>this.editRanges.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
// Too far away from what we know
|
||
return TypeScript.ScriptEditRange.unknown();
|
||
}
|
||
|
||
var entries = this.editRanges.slice(initialEditRangeIndex);
|
||
>entries : Symbol(entries, Decl(parserharness.ts, 1593, 15))
|
||
>this.editRanges.slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --))
|
||
>this.editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>this : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>editRanges : Symbol(ScriptInfo.editRanges, Decl(parserharness.ts, 1546, 31))
|
||
>slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --))
|
||
>initialEditRangeIndex : Symbol(initialEditRangeIndex, Decl(parserharness.ts, 1587, 15))
|
||
|
||
var minDistFromStart = entries.map(x => x.editRange.minChar).reduce((prev, current) => Math.min(prev, current));
|
||
>minDistFromStart : Symbol(minDistFromStart, Decl(parserharness.ts, 1595, 15))
|
||
>entries.map(x => x.editRange.minChar).reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>entries.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
|
||
>entries : Symbol(entries, Decl(parserharness.ts, 1593, 15))
|
||
>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
|
||
>x : Symbol(x, Decl(parserharness.ts, 1595, 47))
|
||
>x.editRange : Symbol(editRange, Decl(parserharness.ts, 1547, 44))
|
||
>x : Symbol(x, Decl(parserharness.ts, 1595, 47))
|
||
>editRange : Symbol(editRange, Decl(parserharness.ts, 1547, 44))
|
||
>reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>prev : Symbol(prev, Decl(parserharness.ts, 1595, 81))
|
||
>current : Symbol(current, Decl(parserharness.ts, 1595, 86))
|
||
>Math.min : Symbol(Math.min, Decl(lib.es5.d.ts, --, --))
|
||
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>min : Symbol(Math.min, Decl(lib.es5.d.ts, --, --))
|
||
>prev : Symbol(prev, Decl(parserharness.ts, 1595, 81))
|
||
>current : Symbol(current, Decl(parserharness.ts, 1595, 86))
|
||
|
||
var minDistFromEnd = entries.map(x => x.length - x.editRange.limChar).reduce((prev, current) => Math.min(prev, current));
|
||
>minDistFromEnd : Symbol(minDistFromEnd, Decl(parserharness.ts, 1596, 15))
|
||
>entries.map(x => x.length - x.editRange.limChar).reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>entries.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
|
||
>entries : Symbol(entries, Decl(parserharness.ts, 1593, 15))
|
||
>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
|
||
>x : Symbol(x, Decl(parserharness.ts, 1596, 45))
|
||
>x.length : Symbol(length, Decl(parserharness.ts, 1547, 28))
|
||
>x : Symbol(x, Decl(parserharness.ts, 1596, 45))
|
||
>length : Symbol(length, Decl(parserharness.ts, 1547, 28))
|
||
>x.editRange : Symbol(editRange, Decl(parserharness.ts, 1547, 44))
|
||
>x : Symbol(x, Decl(parserharness.ts, 1596, 45))
|
||
>editRange : Symbol(editRange, Decl(parserharness.ts, 1547, 44))
|
||
>reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>prev : Symbol(prev, Decl(parserharness.ts, 1596, 90))
|
||
>current : Symbol(current, Decl(parserharness.ts, 1596, 95))
|
||
>Math.min : Symbol(Math.min, Decl(lib.es5.d.ts, --, --))
|
||
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>min : Symbol(Math.min, Decl(lib.es5.d.ts, --, --))
|
||
>prev : Symbol(prev, Decl(parserharness.ts, 1596, 90))
|
||
>current : Symbol(current, Decl(parserharness.ts, 1596, 95))
|
||
|
||
var aggDelta = entries.map(x => x.editRange.delta).reduce((prev, current) => prev + current);
|
||
>aggDelta : Symbol(aggDelta, Decl(parserharness.ts, 1597, 15))
|
||
>entries.map(x => x.editRange.delta).reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>entries.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
|
||
>entries : Symbol(entries, Decl(parserharness.ts, 1593, 15))
|
||
>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
|
||
>x : Symbol(x, Decl(parserharness.ts, 1597, 39))
|
||
>x.editRange : Symbol(editRange, Decl(parserharness.ts, 1547, 44))
|
||
>x : Symbol(x, Decl(parserharness.ts, 1597, 39))
|
||
>editRange : Symbol(editRange, Decl(parserharness.ts, 1547, 44))
|
||
>reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>prev : Symbol(prev, Decl(parserharness.ts, 1597, 71))
|
||
>current : Symbol(current, Decl(parserharness.ts, 1597, 76))
|
||
>prev : Symbol(prev, Decl(parserharness.ts, 1597, 71))
|
||
>current : Symbol(current, Decl(parserharness.ts, 1597, 76))
|
||
|
||
return new TypeScript.ScriptEditRange(minDistFromStart, entries[0].length - minDistFromEnd, aggDelta);
|
||
>minDistFromStart : Symbol(minDistFromStart, Decl(parserharness.ts, 1595, 15))
|
||
>entries[0].length : Symbol(length, Decl(parserharness.ts, 1547, 28))
|
||
>entries : Symbol(entries, Decl(parserharness.ts, 1593, 15))
|
||
>length : Symbol(length, Decl(parserharness.ts, 1547, 28))
|
||
>minDistFromEnd : Symbol(minDistFromEnd, Decl(parserharness.ts, 1596, 15))
|
||
>aggDelta : Symbol(aggDelta, Decl(parserharness.ts, 1597, 15))
|
||
}
|
||
}
|
||
|
||
export class TypeScriptLS implements Services.ILanguageServiceShimHost {
|
||
>TypeScriptLS : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
|
||
private ls: Services.ILanguageServiceShim = null;
|
||
>ls : Symbol(TypeScriptLS.ls, Decl(parserharness.ts, 1603, 76))
|
||
>Services : Symbol(Services)
|
||
>ILanguageServiceShim : Symbol(Services.ILanguageServiceShim)
|
||
|
||
public scripts: ScriptInfo[] = [];
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>ScriptInfo : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
|
||
public maxScriptVersions = 100;
|
||
>maxScriptVersions : Symbol(TypeScriptLS.maxScriptVersions, Decl(parserharness.ts, 1606, 42))
|
||
|
||
public addDefaultLibrary() {
|
||
>addDefaultLibrary : Symbol(TypeScriptLS.addDefaultLibrary, Decl(parserharness.ts, 1607, 39))
|
||
|
||
this.addScript("lib.d.ts", Harness.Compiler.libText, true);
|
||
>this.addScript : Symbol(TypeScriptLS.addScript, Decl(parserharness.ts, 1616, 9))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>addScript : Symbol(TypeScriptLS.addScript, Decl(parserharness.ts, 1616, 9))
|
||
>Harness.Compiler.libText : Symbol(Compiler.libText, Decl(parserharness.ts, 754, 18))
|
||
>Harness.Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>libText : Symbol(Compiler.libText, Decl(parserharness.ts, 754, 18))
|
||
}
|
||
|
||
public addFile(name: string, isResident = false) {
|
||
>addFile : Symbol(TypeScriptLS.addFile, Decl(parserharness.ts, 1611, 9))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1613, 23))
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1613, 36))
|
||
|
||
var code: string = readFile(name);
|
||
>code : Symbol(code, Decl(parserharness.ts, 1614, 15))
|
||
>readFile : Symbol(readFile, Decl(parserharness.ts, 207, 5))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1613, 23))
|
||
|
||
this.addScript(name, code, isResident);
|
||
>this.addScript : Symbol(TypeScriptLS.addScript, Decl(parserharness.ts, 1616, 9))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>addScript : Symbol(TypeScriptLS.addScript, Decl(parserharness.ts, 1616, 9))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1613, 23))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1614, 15))
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1613, 36))
|
||
}
|
||
|
||
public addScript(name: string, content: string, isResident = false) {
|
||
>addScript : Symbol(TypeScriptLS.addScript, Decl(parserharness.ts, 1616, 9))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1618, 25))
|
||
>content : Symbol(content, Decl(parserharness.ts, 1618, 38))
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1618, 55))
|
||
|
||
var script = new ScriptInfo(name, content, isResident, this.maxScriptVersions);
|
||
>script : Symbol(script, Decl(parserharness.ts, 1619, 15))
|
||
>ScriptInfo : Symbol(ScriptInfo, Decl(parserharness.ts, 1543, 5))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1618, 25))
|
||
>content : Symbol(content, Decl(parserharness.ts, 1618, 38))
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1618, 55))
|
||
>this.maxScriptVersions : Symbol(TypeScriptLS.maxScriptVersions, Decl(parserharness.ts, 1606, 42))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>maxScriptVersions : Symbol(TypeScriptLS.maxScriptVersions, Decl(parserharness.ts, 1606, 42))
|
||
|
||
this.scripts.push(script);
|
||
>this.scripts.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>script : Symbol(script, Decl(parserharness.ts, 1619, 15))
|
||
}
|
||
|
||
public updateScript(name: string, content: string, isResident = false) {
|
||
>updateScript : Symbol(TypeScriptLS.updateScript, Decl(parserharness.ts, 1621, 9))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1623, 28))
|
||
>content : Symbol(content, Decl(parserharness.ts, 1623, 41))
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1623, 58))
|
||
|
||
for (var i = 0; i < this.scripts.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 1624, 20))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1624, 20))
|
||
>this.scripts.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1624, 20))
|
||
|
||
if (this.scripts[i].name == name) {
|
||
>this.scripts[i].name : Symbol(ScriptInfo.name, Decl(parserharness.ts, 1549, 20))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1624, 20))
|
||
>name : Symbol(ScriptInfo.name, Decl(parserharness.ts, 1549, 20))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1623, 28))
|
||
|
||
this.scripts[i].updateContent(content, isResident);
|
||
>this.scripts[i].updateContent : Symbol(ScriptInfo.updateContent, Decl(parserharness.ts, 1551, 9))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1624, 20))
|
||
>updateContent : Symbol(ScriptInfo.updateContent, Decl(parserharness.ts, 1551, 9))
|
||
>content : Symbol(content, Decl(parserharness.ts, 1623, 41))
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1623, 58))
|
||
|
||
return;
|
||
}
|
||
}
|
||
|
||
this.addScript(name, content, isResident);
|
||
>this.addScript : Symbol(TypeScriptLS.addScript, Decl(parserharness.ts, 1616, 9))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>addScript : Symbol(TypeScriptLS.addScript, Decl(parserharness.ts, 1616, 9))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1623, 28))
|
||
>content : Symbol(content, Decl(parserharness.ts, 1623, 41))
|
||
>isResident : Symbol(isResident, Decl(parserharness.ts, 1623, 58))
|
||
}
|
||
|
||
public editScript(name: string, minChar: number, limChar: number, newText: string) {
|
||
>editScript : Symbol(TypeScriptLS.editScript, Decl(parserharness.ts, 1632, 9))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1634, 26))
|
||
>minChar : Symbol(minChar, Decl(parserharness.ts, 1634, 39))
|
||
>limChar : Symbol(limChar, Decl(parserharness.ts, 1634, 56))
|
||
>newText : Symbol(newText, Decl(parserharness.ts, 1634, 73))
|
||
|
||
for (var i = 0; i < this.scripts.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 1635, 20))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1635, 20))
|
||
>this.scripts.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1635, 20))
|
||
|
||
if (this.scripts[i].name == name) {
|
||
>this.scripts[i].name : Symbol(ScriptInfo.name, Decl(parserharness.ts, 1549, 20))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1635, 20))
|
||
>name : Symbol(ScriptInfo.name, Decl(parserharness.ts, 1549, 20))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1634, 26))
|
||
|
||
this.scripts[i].editContent(minChar, limChar, newText);
|
||
>this.scripts[i].editContent : Symbol(ScriptInfo.editContent, Decl(parserharness.ts, 1558, 9))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1635, 20))
|
||
>editContent : Symbol(ScriptInfo.editContent, Decl(parserharness.ts, 1558, 9))
|
||
>minChar : Symbol(minChar, Decl(parserharness.ts, 1634, 39))
|
||
>limChar : Symbol(limChar, Decl(parserharness.ts, 1634, 56))
|
||
>newText : Symbol(newText, Decl(parserharness.ts, 1634, 73))
|
||
|
||
return;
|
||
}
|
||
}
|
||
|
||
throw new Error("No script with name '" + name + "'");
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>name : Symbol(name, Decl(parserharness.ts, 1634, 26))
|
||
}
|
||
|
||
public getScriptContent(scriptIndex: number): string {
|
||
>getScriptContent : Symbol(TypeScriptLS.getScriptContent, Decl(parserharness.ts, 1643, 9))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1645, 32))
|
||
|
||
return this.scripts[scriptIndex].content;
|
||
>this.scripts[scriptIndex].content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1645, 32))
|
||
>content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////
|
||
// ILogger implementation
|
||
//
|
||
public information(): boolean { return false; }
|
||
>information : Symbol(TypeScriptLS.information, Decl(parserharness.ts, 1647, 9))
|
||
|
||
public debug(): boolean { return true; }
|
||
>debug : Symbol(TypeScriptLS.debug, Decl(parserharness.ts, 1652, 55))
|
||
|
||
public warning(): boolean { return true; }
|
||
>warning : Symbol(TypeScriptLS.warning, Decl(parserharness.ts, 1653, 48))
|
||
|
||
public error(): boolean { return true; }
|
||
>error : Symbol(TypeScriptLS.error, Decl(parserharness.ts, 1654, 50))
|
||
|
||
public fatal(): boolean { return true; }
|
||
>fatal : Symbol(TypeScriptLS.fatal, Decl(parserharness.ts, 1655, 48))
|
||
|
||
public log(s: string): void {
|
||
>log : Symbol(TypeScriptLS.log, Decl(parserharness.ts, 1656, 48))
|
||
>s : Symbol(s, Decl(parserharness.ts, 1658, 19))
|
||
|
||
// For debugging...
|
||
//IO.printLine("TypeScriptLS:" + s);
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////
|
||
// ILanguageServiceShimHost implementation
|
||
//
|
||
|
||
public getCompilationSettings(): string/*json for Tools.CompilationSettings*/ {
|
||
>getCompilationSettings : Symbol(TypeScriptLS.getCompilationSettings, Decl(parserharness.ts, 1661, 9))
|
||
|
||
return ""; // i.e. default settings
|
||
}
|
||
|
||
public getScriptCount(): number {
|
||
>getScriptCount : Symbol(TypeScriptLS.getScriptCount, Decl(parserharness.ts, 1669, 9))
|
||
|
||
return this.scripts.length;
|
||
>this.scripts.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
public getScriptSourceText(scriptIndex: number, start: number, end: number): string {
|
||
>getScriptSourceText : Symbol(TypeScriptLS.getScriptSourceText, Decl(parserharness.ts, 1673, 9))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1675, 35))
|
||
>start : Symbol(start, Decl(parserharness.ts, 1675, 55))
|
||
>end : Symbol(end, Decl(parserharness.ts, 1675, 70))
|
||
|
||
return this.scripts[scriptIndex].content.substring(start, end);
|
||
>this.scripts[scriptIndex].content.substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||
>this.scripts[scriptIndex].content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1675, 35))
|
||
>content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||
>start : Symbol(start, Decl(parserharness.ts, 1675, 55))
|
||
>end : Symbol(end, Decl(parserharness.ts, 1675, 70))
|
||
}
|
||
|
||
public getScriptSourceLength(scriptIndex: number): number {
|
||
>getScriptSourceLength : Symbol(TypeScriptLS.getScriptSourceLength, Decl(parserharness.ts, 1677, 9))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1679, 37))
|
||
|
||
return this.scripts[scriptIndex].content.length;
|
||
>this.scripts[scriptIndex].content.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||
>this.scripts[scriptIndex].content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1679, 37))
|
||
>content : Symbol(ScriptInfo.content, Decl(parserharness.ts, 1549, 40))
|
||
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
public getScriptId(scriptIndex: number): string {
|
||
>getScriptId : Symbol(TypeScriptLS.getScriptId, Decl(parserharness.ts, 1681, 9))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1683, 27))
|
||
|
||
return this.scripts[scriptIndex].name;
|
||
>this.scripts[scriptIndex].name : Symbol(ScriptInfo.name, Decl(parserharness.ts, 1549, 20))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1683, 27))
|
||
>name : Symbol(ScriptInfo.name, Decl(parserharness.ts, 1549, 20))
|
||
}
|
||
|
||
public getScriptIsResident(scriptIndex: number): boolean {
|
||
>getScriptIsResident : Symbol(TypeScriptLS.getScriptIsResident, Decl(parserharness.ts, 1685, 9))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1687, 35))
|
||
|
||
return this.scripts[scriptIndex].isResident;
|
||
>this.scripts[scriptIndex].isResident : Symbol(ScriptInfo.isResident, Decl(parserharness.ts, 1549, 64))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1687, 35))
|
||
>isResident : Symbol(ScriptInfo.isResident, Decl(parserharness.ts, 1549, 64))
|
||
}
|
||
|
||
public getScriptVersion(scriptIndex: number): number {
|
||
>getScriptVersion : Symbol(TypeScriptLS.getScriptVersion, Decl(parserharness.ts, 1689, 9))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1691, 32))
|
||
|
||
return this.scripts[scriptIndex].version;
|
||
>this.scripts[scriptIndex].version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1691, 32))
|
||
>version : Symbol(ScriptInfo.version, Decl(parserharness.ts, 1545, 29))
|
||
}
|
||
|
||
public getScriptEditRangeSinceVersion(scriptIndex: number, scriptVersion: number): string {
|
||
>getScriptEditRangeSinceVersion : Symbol(TypeScriptLS.getScriptEditRangeSinceVersion, Decl(parserharness.ts, 1693, 9))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1695, 46))
|
||
>scriptVersion : Symbol(scriptVersion, Decl(parserharness.ts, 1695, 66))
|
||
|
||
var range = this.scripts[scriptIndex].getEditRangeSinceVersion(scriptVersion);
|
||
>range : Symbol(range, Decl(parserharness.ts, 1696, 15))
|
||
>this.scripts[scriptIndex].getEditRangeSinceVersion : Symbol(ScriptInfo.getEditRangeSinceVersion, Decl(parserharness.ts, 1579, 9))
|
||
>this.scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>scripts : Symbol(TypeScriptLS.scripts, Decl(parserharness.ts, 1604, 57))
|
||
>scriptIndex : Symbol(scriptIndex, Decl(parserharness.ts, 1695, 46))
|
||
>getEditRangeSinceVersion : Symbol(ScriptInfo.getEditRangeSinceVersion, Decl(parserharness.ts, 1579, 9))
|
||
>scriptVersion : Symbol(scriptVersion, Decl(parserharness.ts, 1695, 66))
|
||
|
||
var result = (range.minChar + "," + range.limChar + "," + range.delta);
|
||
>result : Symbol(result, Decl(parserharness.ts, 1697, 15))
|
||
>range : Symbol(range, Decl(parserharness.ts, 1696, 15))
|
||
>range : Symbol(range, Decl(parserharness.ts, 1696, 15))
|
||
>range : Symbol(range, Decl(parserharness.ts, 1696, 15))
|
||
|
||
return result;
|
||
>result : Symbol(result, Decl(parserharness.ts, 1697, 15))
|
||
}
|
||
|
||
/** Return a new instance of the language service shim, up-to-date wrt to typecheck.
|
||
* To access the non-shim (i.e. actual) language service, use the "ls.languageService" property.
|
||
*/
|
||
public getLanguageService(): Services.ILanguageServiceShim {
|
||
>getLanguageService : Symbol(TypeScriptLS.getLanguageService, Decl(parserharness.ts, 1699, 9))
|
||
>Services : Symbol(Services)
|
||
>ILanguageServiceShim : Symbol(Services.ILanguageServiceShim)
|
||
|
||
var ls = new Services.TypeScriptServicesFactory().createLanguageServiceShim(this);
|
||
>ls : Symbol(ls, Decl(parserharness.ts, 1705, 15))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
|
||
ls.refresh(true);
|
||
>ls : Symbol(ls, Decl(parserharness.ts, 1705, 15))
|
||
|
||
this.ls = ls;
|
||
>this.ls : Symbol(TypeScriptLS.ls, Decl(parserharness.ts, 1603, 76))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>ls : Symbol(TypeScriptLS.ls, Decl(parserharness.ts, 1603, 76))
|
||
>ls : Symbol(ls, Decl(parserharness.ts, 1705, 15))
|
||
|
||
return ls;
|
||
>ls : Symbol(ls, Decl(parserharness.ts, 1705, 15))
|
||
}
|
||
|
||
/** Parse file given its source text */
|
||
public parseSourceText(fileName: string, sourceText: TypeScript.ISourceText): TypeScript.Script {
|
||
>parseSourceText : Symbol(TypeScriptLS.parseSourceText, Decl(parserharness.ts, 1709, 9))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 1712, 31))
|
||
>sourceText : Symbol(sourceText, Decl(parserharness.ts, 1712, 48))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>ISourceText : Symbol(TypeScript.ISourceText)
|
||
>TypeScript : Symbol(TypeScript)
|
||
>Script : Symbol(TypeScript.Script)
|
||
|
||
var parser = new TypeScript.Parser();
|
||
>parser : Symbol(parser, Decl(parserharness.ts, 1713, 15))
|
||
|
||
parser.setErrorRecovery(null);
|
||
>parser : Symbol(parser, Decl(parserharness.ts, 1713, 15))
|
||
|
||
parser.errorCallback = (a, b, c, d) => { };
|
||
>parser : Symbol(parser, Decl(parserharness.ts, 1713, 15))
|
||
>a : Symbol(a, Decl(parserharness.ts, 1715, 36))
|
||
>b : Symbol(b, Decl(parserharness.ts, 1715, 38))
|
||
>c : Symbol(c, Decl(parserharness.ts, 1715, 41))
|
||
>d : Symbol(d, Decl(parserharness.ts, 1715, 44))
|
||
|
||
var script = parser.parse(sourceText, fileName, 0);
|
||
>script : Symbol(script, Decl(parserharness.ts, 1717, 15))
|
||
>parser : Symbol(parser, Decl(parserharness.ts, 1713, 15))
|
||
>sourceText : Symbol(sourceText, Decl(parserharness.ts, 1712, 48))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 1712, 31))
|
||
|
||
return script;
|
||
>script : Symbol(script, Decl(parserharness.ts, 1717, 15))
|
||
}
|
||
|
||
/** Parse a file on disk given its filename */
|
||
public parseFile(fileName: string) {
|
||
>parseFile : Symbol(TypeScriptLS.parseFile, Decl(parserharness.ts, 1719, 9))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 1722, 25))
|
||
|
||
var sourceText = new TypeScript.StringSourceText(IO.readFile(fileName))
|
||
>sourceText : Symbol(sourceText, Decl(parserharness.ts, 1723, 15))
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 1722, 25))
|
||
|
||
return this.parseSourceText(fileName, sourceText);
|
||
>this.parseSourceText : Symbol(TypeScriptLS.parseSourceText, Decl(parserharness.ts, 1709, 9))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>parseSourceText : Symbol(TypeScriptLS.parseSourceText, Decl(parserharness.ts, 1709, 9))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 1722, 25))
|
||
>sourceText : Symbol(sourceText, Decl(parserharness.ts, 1723, 15))
|
||
}
|
||
|
||
/**
|
||
* @param line 1 based index
|
||
* @param col 1 based index
|
||
*/
|
||
public lineColToPosition(fileName: string, line: number, col: number): number {
|
||
>lineColToPosition : Symbol(TypeScriptLS.lineColToPosition, Decl(parserharness.ts, 1725, 9))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 1731, 33))
|
||
>line : Symbol(line, Decl(parserharness.ts, 1731, 50))
|
||
>col : Symbol(col, Decl(parserharness.ts, 1731, 64))
|
||
|
||
var script = this.ls.languageService.getScriptAST(fileName);
|
||
>script : Symbol(script, Decl(parserharness.ts, 1732, 15))
|
||
>this.ls : Symbol(TypeScriptLS.ls, Decl(parserharness.ts, 1603, 76))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>ls : Symbol(TypeScriptLS.ls, Decl(parserharness.ts, 1603, 76))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 1731, 33))
|
||
|
||
assert.notNull(script);
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>script : Symbol(script, Decl(parserharness.ts, 1732, 15))
|
||
|
||
assert.is(line >= 1);
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>line : Symbol(line, Decl(parserharness.ts, 1731, 50))
|
||
|
||
assert.is(col >= 1);
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>col : Symbol(col, Decl(parserharness.ts, 1731, 64))
|
||
|
||
assert.is(line <= script.locationInfo.lineMap.length);
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>line : Symbol(line, Decl(parserharness.ts, 1731, 50))
|
||
>script : Symbol(script, Decl(parserharness.ts, 1732, 15))
|
||
|
||
return TypeScript.getPositionFromZeroBasedLineColumn(script, line - 1, col - 1);
|
||
>script : Symbol(script, Decl(parserharness.ts, 1732, 15))
|
||
>line : Symbol(line, Decl(parserharness.ts, 1731, 50))
|
||
>col : Symbol(col, Decl(parserharness.ts, 1731, 64))
|
||
}
|
||
|
||
/**
|
||
* @param line 0 based index
|
||
* @param col 0 based index
|
||
*/
|
||
public positionToZeroBasedLineCol(fileName: string, position: number): TypeScript.ILineCol {
|
||
>positionToZeroBasedLineCol : Symbol(TypeScriptLS.positionToZeroBasedLineCol, Decl(parserharness.ts, 1739, 9))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 1745, 42))
|
||
>position : Symbol(position, Decl(parserharness.ts, 1745, 59))
|
||
>TypeScript : Symbol(TypeScript)
|
||
>ILineCol : Symbol(TypeScript.ILineCol)
|
||
|
||
var script = this.ls.languageService.getScriptAST(fileName);
|
||
>script : Symbol(script, Decl(parserharness.ts, 1746, 15))
|
||
>this.ls : Symbol(TypeScriptLS.ls, Decl(parserharness.ts, 1603, 76))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>ls : Symbol(TypeScriptLS.ls, Decl(parserharness.ts, 1603, 76))
|
||
>fileName : Symbol(fileName, Decl(parserharness.ts, 1745, 42))
|
||
|
||
assert.notNull(script);
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>script : Symbol(script, Decl(parserharness.ts, 1746, 15))
|
||
|
||
var result = TypeScript.getZeroBasedLineColumnFromPosition(script, position);
|
||
>result : Symbol(result, Decl(parserharness.ts, 1749, 15))
|
||
>script : Symbol(script, Decl(parserharness.ts, 1746, 15))
|
||
>position : Symbol(position, Decl(parserharness.ts, 1745, 59))
|
||
|
||
assert.is(result.line >= 0);
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>result : Symbol(result, Decl(parserharness.ts, 1749, 15))
|
||
|
||
assert.is(result.col >= 0);
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>result : Symbol(result, Decl(parserharness.ts, 1749, 15))
|
||
|
||
return result;
|
||
>result : Symbol(result, Decl(parserharness.ts, 1749, 15))
|
||
}
|
||
|
||
/** Verify that applying edits to sourceFileName result in the content of the file baselineFileName */
|
||
public checkEdits(sourceFileName: string, baselineFileName: string, edits: Services.TextEdit[]) {
|
||
>checkEdits : Symbol(TypeScriptLS.checkEdits, Decl(parserharness.ts, 1754, 9))
|
||
>sourceFileName : Symbol(sourceFileName, Decl(parserharness.ts, 1757, 26))
|
||
>baselineFileName : Symbol(baselineFileName, Decl(parserharness.ts, 1757, 49))
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1757, 75))
|
||
>Services : Symbol(Services)
|
||
>TextEdit : Symbol(Services.TextEdit)
|
||
|
||
var script = readFile(sourceFileName);
|
||
>script : Symbol(script, Decl(parserharness.ts, 1758, 15))
|
||
>readFile : Symbol(readFile, Decl(parserharness.ts, 207, 5))
|
||
>sourceFileName : Symbol(sourceFileName, Decl(parserharness.ts, 1757, 26))
|
||
|
||
var formattedScript = this.applyEdits(script, edits);
|
||
>formattedScript : Symbol(formattedScript, Decl(parserharness.ts, 1759, 15))
|
||
>this.applyEdits : Symbol(TypeScriptLS.applyEdits, Decl(parserharness.ts, 1764, 9))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>applyEdits : Symbol(TypeScriptLS.applyEdits, Decl(parserharness.ts, 1764, 9))
|
||
>script : Symbol(script, Decl(parserharness.ts, 1758, 15))
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1757, 75))
|
||
|
||
var baseline = readFile(baselineFileName);
|
||
>baseline : Symbol(baseline, Decl(parserharness.ts, 1760, 15))
|
||
>readFile : Symbol(readFile, Decl(parserharness.ts, 207, 5))
|
||
>baselineFileName : Symbol(baselineFileName, Decl(parserharness.ts, 1757, 49))
|
||
|
||
assert.noDiff(formattedScript, baseline);
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>formattedScript : Symbol(formattedScript, Decl(parserharness.ts, 1759, 15))
|
||
>baseline : Symbol(baseline, Decl(parserharness.ts, 1760, 15))
|
||
|
||
assert.equal(formattedScript, baseline);
|
||
>assert : Symbol(assert, Decl(parserharness.ts, 20, 11))
|
||
>formattedScript : Symbol(formattedScript, Decl(parserharness.ts, 1759, 15))
|
||
>baseline : Symbol(baseline, Decl(parserharness.ts, 1760, 15))
|
||
}
|
||
|
||
|
||
/** Apply an array of text edits to a string, and return the resulting string. */
|
||
public applyEdits(content: string, edits: Services.TextEdit[]): string {
|
||
>applyEdits : Symbol(TypeScriptLS.applyEdits, Decl(parserharness.ts, 1764, 9))
|
||
>content : Symbol(content, Decl(parserharness.ts, 1768, 26))
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1768, 42))
|
||
>Services : Symbol(Services)
|
||
>TextEdit : Symbol(Services.TextEdit)
|
||
|
||
var result = content;
|
||
>result : Symbol(result, Decl(parserharness.ts, 1769, 15))
|
||
>content : Symbol(content, Decl(parserharness.ts, 1768, 26))
|
||
|
||
edits = this.normalizeEdits(edits);
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1768, 42))
|
||
>this.normalizeEdits : Symbol(TypeScriptLS.normalizeEdits, Decl(parserharness.ts, 1780, 9))
|
||
>this : Symbol(TypeScriptLS, Decl(parserharness.ts, 1601, 5))
|
||
>normalizeEdits : Symbol(TypeScriptLS.normalizeEdits, Decl(parserharness.ts, 1780, 9))
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1768, 42))
|
||
|
||
for (var i = edits.length - 1; i >= 0; i--) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 1772, 20))
|
||
>edits.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1768, 42))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1772, 20))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1772, 20))
|
||
|
||
var edit = edits[i];
|
||
>edit : Symbol(edit, Decl(parserharness.ts, 1773, 19))
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1768, 42))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1772, 20))
|
||
|
||
var prefix = result.substring(0, edit.minChar);
|
||
>prefix : Symbol(prefix, Decl(parserharness.ts, 1774, 19))
|
||
>result.substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||
>result : Symbol(result, Decl(parserharness.ts, 1769, 15))
|
||
>substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||
>edit : Symbol(edit, Decl(parserharness.ts, 1773, 19))
|
||
|
||
var middle = edit.text;
|
||
>middle : Symbol(middle, Decl(parserharness.ts, 1775, 19))
|
||
>edit : Symbol(edit, Decl(parserharness.ts, 1773, 19))
|
||
|
||
var suffix = result.substring(edit.limChar);
|
||
>suffix : Symbol(suffix, Decl(parserharness.ts, 1776, 19))
|
||
>result.substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||
>result : Symbol(result, Decl(parserharness.ts, 1769, 15))
|
||
>substring : Symbol(String.substring, Decl(lib.es5.d.ts, --, --))
|
||
>edit : Symbol(edit, Decl(parserharness.ts, 1773, 19))
|
||
|
||
result = prefix + middle + suffix;
|
||
>result : Symbol(result, Decl(parserharness.ts, 1769, 15))
|
||
>prefix : Symbol(prefix, Decl(parserharness.ts, 1774, 19))
|
||
>middle : Symbol(middle, Decl(parserharness.ts, 1775, 19))
|
||
>suffix : Symbol(suffix, Decl(parserharness.ts, 1776, 19))
|
||
}
|
||
return result;
|
||
>result : Symbol(result, Decl(parserharness.ts, 1769, 15))
|
||
}
|
||
|
||
/** Normalize an array of edits by removing overlapping entries and sorting entries on the minChar position. */
|
||
private normalizeEdits(edits: Services.TextEdit[]): Services.TextEdit[] {
|
||
>normalizeEdits : Symbol(TypeScriptLS.normalizeEdits, Decl(parserharness.ts, 1780, 9))
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1783, 31))
|
||
>Services : Symbol(Services)
|
||
>TextEdit : Symbol(Services.TextEdit)
|
||
>Services : Symbol(Services)
|
||
>TextEdit : Symbol(Services.TextEdit)
|
||
|
||
var result: Services.TextEdit[] = [];
|
||
>result : Symbol(result, Decl(parserharness.ts, 1784, 15))
|
||
>Services : Symbol(Services)
|
||
>TextEdit : Symbol(Services.TextEdit)
|
||
|
||
function mapEdits(edits: Services.TextEdit[]): { edit: Services.TextEdit; index: number; }[] {
|
||
>mapEdits : Symbol(mapEdits, Decl(parserharness.ts, 1784, 49))
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1786, 30))
|
||
>Services : Symbol(Services)
|
||
>TextEdit : Symbol(Services.TextEdit)
|
||
>edit : Symbol(edit, Decl(parserharness.ts, 1786, 60))
|
||
>Services : Symbol(Services)
|
||
>TextEdit : Symbol(Services.TextEdit)
|
||
>index : Symbol(index, Decl(parserharness.ts, 1786, 85))
|
||
|
||
var result = [];
|
||
>result : Symbol(result, Decl(parserharness.ts, 1787, 19))
|
||
|
||
for (var i = 0; i < edits.length; i++) {
|
||
>i : Symbol(i, Decl(parserharness.ts, 1788, 24))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1788, 24))
|
||
>edits.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1786, 30))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1788, 24))
|
||
|
||
result.push({ edit: edits[i], index: i });
|
||
>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>result : Symbol(result, Decl(parserharness.ts, 1787, 19))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>edit : Symbol(edit, Decl(parserharness.ts, 1789, 33))
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1786, 30))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1788, 24))
|
||
>index : Symbol(index, Decl(parserharness.ts, 1789, 49))
|
||
>i : Symbol(i, Decl(parserharness.ts, 1788, 24))
|
||
}
|
||
return result;
|
||
>result : Symbol(result, Decl(parserharness.ts, 1787, 19))
|
||
}
|
||
|
||
var temp = mapEdits(edits).sort(function (a, b) {
|
||
>temp : Symbol(temp, Decl(parserharness.ts, 1794, 15))
|
||
>mapEdits(edits).sort : Symbol(Array.sort, Decl(lib.es5.d.ts, --, --))
|
||
>mapEdits : Symbol(mapEdits, Decl(parserharness.ts, 1784, 49))
|
||
>edits : Symbol(edits, Decl(parserharness.ts, 1783, 31))
|
||
>sort : Symbol(Array.sort, Decl(lib.es5.d.ts, --, --))
|
||
>a : Symbol(a, Decl(parserharness.ts, 1794, 54))
|
||
>b : Symbol(b, Decl(parserharness.ts, 1794, 56))
|
||
|
||
var result = a.edit.minChar - b.edit.minChar;
|
||
>result : Symbol(result, Decl(parserharness.ts, 1795, 19))
|
||
>a.edit : Symbol(edit, Decl(parserharness.ts, 1786, 60))
|
||
>a : Symbol(a, Decl(parserharness.ts, 1794, 54))
|
||
>edit : Symbol(edit, Decl(parserharness.ts, 1786, 60))
|
||
>b.edit : Symbol(edit, Decl(parserharness.ts, 1786, 60))
|
||
>b : Symbol(b, Decl(parserharness.ts, 1794, 56))
|
||
>edit : Symbol(edit, Decl(parserharness.ts, 1786, 60))
|
||
|
||
if (result == 0)
|
||
>result : Symbol(result, Decl(parserharness.ts, 1795, 19))
|
||
|
||
result = a.index - b.index;
|
||
>result : Symbol(result, Decl(parserharness.ts, 1795, 19))
|
||
>a.index : Symbol(index, Decl(parserharness.ts, 1786, 85))
|
||
>a : Symbol(a, Decl(parserharness.ts, 1794, 54))
|
||
>index : Symbol(index, Decl(parserharness.ts, 1786, 85))
|
||
>b.index : Symbol(index, Decl(parserharness.ts, 1786, 85))
|
||
>b : Symbol(b, Decl(parserharness.ts, 1794, 56))
|
||
>index : Symbol(index, Decl(parserharness.ts, 1786, 85))
|
||
|
||
return result;
|
||
>result : Symbol(result, Decl(parserharness.ts, 1795, 19))
|
||
|
||
});
|
||
|
||
var current = 0;
|
||
>current : Symbol(current, Decl(parserharness.ts, 1801, 15))
|
||
|
||
var next = 1;
|
||
>next : Symbol(next, Decl(parserharness.ts, 1802, 15))
|
||
|
||
while (current < temp.length) {
|
||
>current : Symbol(current, Decl(parserharness.ts, 1801, 15))
|
||
>temp.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>temp : Symbol(temp, Decl(parserharness.ts, 1794, 15))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
var currentEdit = temp[current].edit;
|
||
>currentEdit : Symbol(currentEdit, Decl(parserharness.ts, 1804, 19))
|
||
>temp[current].edit : Symbol(edit, Decl(parserharness.ts, 1786, 60))
|
||
>temp : Symbol(temp, Decl(parserharness.ts, 1794, 15))
|
||
>current : Symbol(current, Decl(parserharness.ts, 1801, 15))
|
||
>edit : Symbol(edit, Decl(parserharness.ts, 1786, 60))
|
||
|
||
// Last edit
|
||
if (next >= temp.length) {
|
||
>next : Symbol(next, Decl(parserharness.ts, 1802, 15))
|
||
>temp.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>temp : Symbol(temp, Decl(parserharness.ts, 1794, 15))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
result.push(currentEdit);
|
||
>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>result : Symbol(result, Decl(parserharness.ts, 1784, 15))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>currentEdit : Symbol(currentEdit, Decl(parserharness.ts, 1804, 19))
|
||
|
||
current++;
|
||
>current : Symbol(current, Decl(parserharness.ts, 1801, 15))
|
||
|
||
continue;
|
||
}
|
||
var nextEdit = temp[next].edit;
|
||
>nextEdit : Symbol(nextEdit, Decl(parserharness.ts, 1812, 19))
|
||
>temp[next].edit : Symbol(edit, Decl(parserharness.ts, 1786, 60))
|
||
>temp : Symbol(temp, Decl(parserharness.ts, 1794, 15))
|
||
>next : Symbol(next, Decl(parserharness.ts, 1802, 15))
|
||
>edit : Symbol(edit, Decl(parserharness.ts, 1786, 60))
|
||
|
||
var gap = nextEdit.minChar - currentEdit.limChar;
|
||
>gap : Symbol(gap, Decl(parserharness.ts, 1814, 19))
|
||
>nextEdit : Symbol(nextEdit, Decl(parserharness.ts, 1812, 19))
|
||
>currentEdit : Symbol(currentEdit, Decl(parserharness.ts, 1804, 19))
|
||
|
||
// non-overlapping edits
|
||
if (gap >= 0) {
|
||
>gap : Symbol(gap, Decl(parserharness.ts, 1814, 19))
|
||
|
||
result.push(currentEdit);
|
||
>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>result : Symbol(result, Decl(parserharness.ts, 1784, 15))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>currentEdit : Symbol(currentEdit, Decl(parserharness.ts, 1804, 19))
|
||
|
||
current = next;
|
||
>current : Symbol(current, Decl(parserharness.ts, 1801, 15))
|
||
>next : Symbol(next, Decl(parserharness.ts, 1802, 15))
|
||
|
||
next++;
|
||
>next : Symbol(next, Decl(parserharness.ts, 1802, 15))
|
||
|
||
continue;
|
||
}
|
||
|
||
// overlapping edits: for now, we only support ignoring an next edit
|
||
// entirely contained in the current edit.
|
||
if (currentEdit.limChar >= nextEdit.limChar) {
|
||
>currentEdit : Symbol(currentEdit, Decl(parserharness.ts, 1804, 19))
|
||
>nextEdit : Symbol(nextEdit, Decl(parserharness.ts, 1812, 19))
|
||
|
||
next++;
|
||
>next : Symbol(next, Decl(parserharness.ts, 1802, 15))
|
||
|
||
continue;
|
||
}
|
||
else {
|
||
throw new Error("Trying to apply overlapping edits");
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
}
|
||
|
||
return result;
|
||
>result : Symbol(result, Decl(parserharness.ts, 1784, 15))
|
||
}
|
||
|
||
public getHostSettings(): string {
|
||
>getHostSettings : Symbol(TypeScriptLS.getHostSettings, Decl(parserharness.ts, 1836, 9))
|
||
|
||
return JSON.stringify({ usePullLanguageService: usePull });
|
||
>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>usePullLanguageService : Symbol(usePullLanguageService, Decl(parserharness.ts, 1839, 35))
|
||
>usePull : Symbol(usePull, Decl(parserharness.ts, 58, 14))
|
||
}
|
||
}
|
||
|
||
// Describe/it definitions
|
||
export function describe(description: string, block: () => any) {
|
||
>describe : Symbol(describe, Decl(parserharness.ts, 1841, 5))
|
||
>description : Symbol(description, Decl(parserharness.ts, 1844, 29))
|
||
>block : Symbol(block, Decl(parserharness.ts, 1844, 49))
|
||
|
||
var newScenario = new Scenario(description, block);
|
||
>newScenario : Symbol(newScenario, Decl(parserharness.ts, 1845, 11))
|
||
>Scenario : Symbol(Scenario, Decl(parserharness.ts, 398, 5))
|
||
>description : Symbol(description, Decl(parserharness.ts, 1844, 29))
|
||
>block : Symbol(block, Decl(parserharness.ts, 1844, 49))
|
||
|
||
if (Runnable.currentStack.length === 0) {
|
||
>Runnable.currentStack.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>Runnable.currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
|
||
Runnable.currentStack.push(currentRun);
|
||
>Runnable.currentStack.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>Runnable.currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
||
>currentRun : Symbol(currentRun, Decl(parserharness.ts, 2073, 7))
|
||
}
|
||
|
||
Runnable.currentStack[Runnable.currentStack.length - 1].addChild(newScenario);
|
||
>Runnable.currentStack[Runnable.currentStack.length - 1].addChild : Symbol(Runnable.addChild, Decl(parserharness.ts, 286, 41))
|
||
>Runnable.currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable.currentStack.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>Runnable.currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>addChild : Symbol(Runnable.addChild, Decl(parserharness.ts, 286, 41))
|
||
>newScenario : Symbol(newScenario, Decl(parserharness.ts, 1845, 11))
|
||
}
|
||
export function it(description: string, block: () => void ) {
|
||
>it : Symbol(it, Decl(parserharness.ts, 1852, 5))
|
||
>description : Symbol(description, Decl(parserharness.ts, 1853, 23))
|
||
>block : Symbol(block, Decl(parserharness.ts, 1853, 43))
|
||
|
||
var testCase = new TestCase(description, block);
|
||
>testCase : Symbol(testCase, Decl(parserharness.ts, 1854, 11))
|
||
>TestCase : Symbol(TestCase, Decl(parserharness.ts, 356, 5))
|
||
>description : Symbol(description, Decl(parserharness.ts, 1853, 23))
|
||
>block : Symbol(block, Decl(parserharness.ts, 1853, 43))
|
||
|
||
Runnable.currentStack[Runnable.currentStack.length - 1].addChild(testCase);
|
||
>Runnable.currentStack[Runnable.currentStack.length - 1].addChild : Symbol(Runnable.addChild, Decl(parserharness.ts, 286, 41))
|
||
>Runnable.currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable.currentStack.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>Runnable.currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>currentStack : Symbol(Runnable.currentStack, Decl(parserharness.ts, 271, 70))
|
||
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
|
||
>addChild : Symbol(Runnable.addChild, Decl(parserharness.ts, 286, 41))
|
||
>testCase : Symbol(testCase, Decl(parserharness.ts, 1854, 11))
|
||
}
|
||
|
||
export function run() {
|
||
>run : Symbol(run, Decl(parserharness.ts, 1856, 5))
|
||
|
||
if (typeof process !== "undefined") {
|
||
>process : Symbol(process, Decl(parserharness.ts, 47, 1))
|
||
|
||
process.on('uncaughtException', Runnable.handleError);
|
||
>process.on : Symbol(process.on, Decl(parserharness.ts, 50, 56))
|
||
>process : Symbol(process, Decl(parserharness.ts, 47, 1))
|
||
>on : Symbol(process.on, Decl(parserharness.ts, 50, 56))
|
||
>Runnable.handleError : Symbol(Runnable.handleError, Decl(parserharness.ts, 347, 9))
|
||
>Runnable : Symbol(Runnable, Decl(parserharness.ts, 269, 5))
|
||
>handleError : Symbol(Runnable.handleError, Decl(parserharness.ts, 347, 9))
|
||
}
|
||
|
||
Baseline.reset();
|
||
>Baseline.reset : Symbol(Baseline.reset, Decl(parserharness.ts, 1946, 9))
|
||
>Baseline : Symbol(Baseline, Decl(parserharness.ts, 1906, 5))
|
||
>reset : Symbol(Baseline.reset, Decl(parserharness.ts, 1946, 9))
|
||
|
||
currentRun.run();
|
||
>currentRun.run : Symbol(Run.run, Decl(parserharness.ts, 466, 9))
|
||
>currentRun : Symbol(currentRun, Decl(parserharness.ts, 2073, 7))
|
||
>run : Symbol(Run.run, Decl(parserharness.ts, 466, 9))
|
||
}
|
||
|
||
/** Runs TypeScript or Javascript code. */
|
||
export module Runner {
|
||
>Runner : Symbol(Runner, Decl(parserharness.ts, 1865, 5))
|
||
|
||
export function runCollateral(path: string, callback: (error: Error, result: any) => void ) {
|
||
>runCollateral : Symbol(runCollateral, Decl(parserharness.ts, 1868, 26))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1869, 38))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1869, 51))
|
||
>error : Symbol(error, Decl(parserharness.ts, 1869, 63))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>result : Symbol(result, Decl(parserharness.ts, 1869, 76))
|
||
|
||
path = switchToForwardSlashes(path);
|
||
>path : Symbol(path, Decl(parserharness.ts, 1869, 38))
|
||
>switchToForwardSlashes : Symbol(switchToForwardSlashes, Decl(parserharness.ts, 25, 22))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1869, 38))
|
||
|
||
runString(readFile(path), path.match(/[^\/]*$/)[0], callback);
|
||
>runString : Symbol(runString, Decl(parserharness.ts, 1899, 9))
|
||
>readFile : Symbol(readFile, Decl(parserharness.ts, 207, 5))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1869, 38))
|
||
>path.match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
>path : Symbol(path, Decl(parserharness.ts, 1869, 38))
|
||
>match : Symbol(String.match, Decl(lib.es5.d.ts, --, --))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1869, 51))
|
||
}
|
||
|
||
export function runJSString(code: string, callback: (error: Error, result: any) => void ) {
|
||
>runJSString : Symbol(runJSString, Decl(parserharness.ts, 1872, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1874, 36))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1874, 49))
|
||
>error : Symbol(error, Decl(parserharness.ts, 1874, 61))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>result : Symbol(result, Decl(parserharness.ts, 1874, 74))
|
||
|
||
// List of names that get overriden by various test code we eval
|
||
var dangerNames: any = ['Array'];
|
||
>dangerNames : Symbol(dangerNames, Decl(parserharness.ts, 1876, 15))
|
||
|
||
var globalBackup: any = {};
|
||
>globalBackup : Symbol(globalBackup, Decl(parserharness.ts, 1878, 15))
|
||
|
||
var n: string = null;
|
||
>n : Symbol(n, Decl(parserharness.ts, 1879, 15))
|
||
|
||
for (n in dangerNames) {
|
||
>n : Symbol(n, Decl(parserharness.ts, 1879, 15))
|
||
>dangerNames : Symbol(dangerNames, Decl(parserharness.ts, 1876, 15))
|
||
|
||
globalBackup[dangerNames[n]] = global[dangerNames[n]];
|
||
>globalBackup : Symbol(globalBackup, Decl(parserharness.ts, 1878, 15))
|
||
>dangerNames : Symbol(dangerNames, Decl(parserharness.ts, 1876, 15))
|
||
>n : Symbol(n, Decl(parserharness.ts, 1879, 15))
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
>dangerNames : Symbol(dangerNames, Decl(parserharness.ts, 1876, 15))
|
||
>n : Symbol(n, Decl(parserharness.ts, 1879, 15))
|
||
}
|
||
|
||
try {
|
||
var res = eval(code);
|
||
>res : Symbol(res, Decl(parserharness.ts, 1885, 19))
|
||
>eval : Symbol(eval, Decl(lib.es5.d.ts, --, --))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1874, 36))
|
||
|
||
for (n in dangerNames) {
|
||
>n : Symbol(n, Decl(parserharness.ts, 1879, 15))
|
||
>dangerNames : Symbol(dangerNames, Decl(parserharness.ts, 1876, 15))
|
||
|
||
global[dangerNames[n]] = globalBackup[dangerNames[n]];
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
>dangerNames : Symbol(dangerNames, Decl(parserharness.ts, 1876, 15))
|
||
>n : Symbol(n, Decl(parserharness.ts, 1879, 15))
|
||
>globalBackup : Symbol(globalBackup, Decl(parserharness.ts, 1878, 15))
|
||
>dangerNames : Symbol(dangerNames, Decl(parserharness.ts, 1876, 15))
|
||
>n : Symbol(n, Decl(parserharness.ts, 1879, 15))
|
||
}
|
||
|
||
callback(null, res);
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1874, 49))
|
||
>res : Symbol(res, Decl(parserharness.ts, 1885, 19))
|
||
|
||
} catch (e) {
|
||
>e : Symbol(e, Decl(parserharness.ts, 1892, 21))
|
||
|
||
for (n in dangerNames) {
|
||
>n : Symbol(n, Decl(parserharness.ts, 1879, 15))
|
||
>dangerNames : Symbol(dangerNames, Decl(parserharness.ts, 1876, 15))
|
||
|
||
global[dangerNames[n]] = globalBackup[dangerNames[n]];
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
>dangerNames : Symbol(dangerNames, Decl(parserharness.ts, 1876, 15))
|
||
>n : Symbol(n, Decl(parserharness.ts, 1879, 15))
|
||
>globalBackup : Symbol(globalBackup, Decl(parserharness.ts, 1878, 15))
|
||
>dangerNames : Symbol(dangerNames, Decl(parserharness.ts, 1876, 15))
|
||
>n : Symbol(n, Decl(parserharness.ts, 1879, 15))
|
||
}
|
||
|
||
callback(e, null);
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1874, 49))
|
||
>e : Symbol(e, Decl(parserharness.ts, 1892, 21))
|
||
}
|
||
}
|
||
|
||
export function runString(code: string, unitName: string, callback: (error: Error, result: any) => void ) {
|
||
>runString : Symbol(runString, Decl(parserharness.ts, 1899, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1901, 34))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1901, 47))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1901, 65))
|
||
>error : Symbol(error, Decl(parserharness.ts, 1901, 77))
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>result : Symbol(result, Decl(parserharness.ts, 1901, 90))
|
||
|
||
Compiler.compileString(code, unitName, function (res) {
|
||
>Compiler.compileString : Symbol(Compiler.compileString, Decl(parserharness.ts, 1341, 9))
|
||
>Compiler : Symbol(Compiler, Decl(parserharness.ts, 683, 5))
|
||
>compileString : Symbol(Compiler.compileString, Decl(parserharness.ts, 1341, 9))
|
||
>code : Symbol(code, Decl(parserharness.ts, 1901, 34))
|
||
>unitName : Symbol(unitName, Decl(parserharness.ts, 1901, 47))
|
||
>res : Symbol(res, Decl(parserharness.ts, 1902, 61))
|
||
|
||
runJSString(res.code, callback);
|
||
>runJSString : Symbol(runJSString, Decl(parserharness.ts, 1872, 9))
|
||
>res.code : Symbol(Compiler.CompilerResult.code, Decl(parserharness.ts, 1170, 37))
|
||
>res : Symbol(res, Decl(parserharness.ts, 1902, 61))
|
||
>code : Symbol(Compiler.CompilerResult.code, Decl(parserharness.ts, 1170, 37))
|
||
>callback : Symbol(callback, Decl(parserharness.ts, 1901, 65))
|
||
|
||
});
|
||
}
|
||
}
|
||
|
||
/** Support class for baseline files */
|
||
export module Baseline {
|
||
>Baseline : Symbol(Baseline, Decl(parserharness.ts, 1906, 5))
|
||
|
||
var reportFilename = 'baseline-report.html';
|
||
>reportFilename : Symbol(reportFilename, Decl(parserharness.ts, 1910, 11))
|
||
|
||
var firstRun = true;
|
||
>firstRun : Symbol(firstRun, Decl(parserharness.ts, 1912, 11))
|
||
|
||
var htmlTrailer = '</body></html>';
|
||
>htmlTrailer : Symbol(htmlTrailer, Decl(parserharness.ts, 1913, 11))
|
||
|
||
var htmlLeader = '<html><head><title>Baseline Report</title>';
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
htmlLeader += ("<style>");
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
htmlLeader += '\r\n' + (".code { font: 9pt 'Courier New'; }");
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
htmlLeader += '\r\n' + (".old { background-color: #EE1111; }");
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
htmlLeader += '\r\n' + (".new { background-color: #FFFF11; }");
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
htmlLeader += '\r\n' + (".from { background-color: #EE1111; color: #1111EE; }");
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
htmlLeader += '\r\n' + (".to { background-color: #EEEE11; color: #1111EE; }");
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
htmlLeader += '\r\n' + ("h2 { margin-bottom: 0px; }");
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
htmlLeader += '\r\n' + ("h2 { padding-bottom: 0px; }");
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
htmlLeader += '\r\n' + ("h4 { font-weight: normal; }");
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
htmlLeader += '\r\n' + ("</style>");
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
export interface BaselineOptions {
|
||
>BaselineOptions : Symbol(BaselineOptions, Decl(parserharness.ts, 1924, 44))
|
||
|
||
LineEndingSensitive?: boolean;
|
||
>LineEndingSensitive : Symbol(BaselineOptions.LineEndingSensitive, Decl(parserharness.ts, 1926, 42))
|
||
}
|
||
|
||
function localPath(filename: string) {
|
||
>localPath : Symbol(localPath, Decl(parserharness.ts, 1928, 9))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1930, 27))
|
||
|
||
if (global.runners[0].testType === 'prototyping') {
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
|
||
return Harness.userSpecifiedroot + 'tests/baselines/prototyping/local/' + filename;
|
||
>Harness.userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1930, 27))
|
||
}
|
||
else {
|
||
return Harness.userSpecifiedroot + 'tests/baselines/local/' + filename;
|
||
>Harness.userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1930, 27))
|
||
}
|
||
}
|
||
|
||
function referencePath(filename: string) {
|
||
>referencePath : Symbol(referencePath, Decl(parserharness.ts, 1937, 9))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1939, 31))
|
||
|
||
if (global.runners[0].testType === 'prototyping') {
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
|
||
return Harness.userSpecifiedroot + 'tests/baselines/prototyping/reference/' + filename;
|
||
>Harness.userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1939, 31))
|
||
}
|
||
else {
|
||
return Harness.userSpecifiedroot + 'tests/baselines/reference/' + filename;
|
||
>Harness.userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>userSpecifiedroot : Symbol(userSpecifiedroot, Decl(parserharness.ts, 56, 14))
|
||
>filename : Symbol(filename, Decl(parserharness.ts, 1939, 31))
|
||
}
|
||
}
|
||
|
||
export function reset() {
|
||
>reset : Symbol(reset, Decl(parserharness.ts, 1946, 9))
|
||
|
||
if (IO.fileExists(reportFilename)) {
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>reportFilename : Symbol(reportFilename, Decl(parserharness.ts, 1910, 11))
|
||
|
||
IO.deleteFile(reportFilename);
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>reportFilename : Symbol(reportFilename, Decl(parserharness.ts, 1910, 11))
|
||
}
|
||
}
|
||
|
||
function prepareBaselineReport(): string {
|
||
>prepareBaselineReport : Symbol(prepareBaselineReport, Decl(parserharness.ts, 1952, 9))
|
||
|
||
var reportContent = htmlLeader;
|
||
>reportContent : Symbol(reportContent, Decl(parserharness.ts, 1955, 15))
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
|
||
// Delete the baseline-report.html file if needed
|
||
if (IO.fileExists(reportFilename)) {
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>reportFilename : Symbol(reportFilename, Decl(parserharness.ts, 1910, 11))
|
||
|
||
reportContent = IO.readFile(reportFilename);
|
||
>reportContent : Symbol(reportContent, Decl(parserharness.ts, 1955, 15))
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>reportFilename : Symbol(reportFilename, Decl(parserharness.ts, 1910, 11))
|
||
|
||
reportContent = reportContent.replace(htmlTrailer, '');
|
||
>reportContent : Symbol(reportContent, Decl(parserharness.ts, 1955, 15))
|
||
>reportContent.replace : Symbol(String.replace, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>reportContent : Symbol(reportContent, Decl(parserharness.ts, 1955, 15))
|
||
>replace : Symbol(String.replace, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>htmlTrailer : Symbol(htmlTrailer, Decl(parserharness.ts, 1913, 11))
|
||
|
||
} else {
|
||
reportContent = htmlLeader;
|
||
>reportContent : Symbol(reportContent, Decl(parserharness.ts, 1955, 15))
|
||
>htmlLeader : Symbol(htmlLeader, Decl(parserharness.ts, 1914, 11))
|
||
}
|
||
return reportContent;
|
||
>reportContent : Symbol(reportContent, Decl(parserharness.ts, 1955, 15))
|
||
}
|
||
|
||
function generateActual(actualFilename: string, generateContent: () => string): string {
|
||
>generateActual : Symbol(generateActual, Decl(parserharness.ts, 1964, 9))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 1966, 32))
|
||
>generateContent : Symbol(generateContent, Decl(parserharness.ts, 1966, 55))
|
||
|
||
// Create folders if needed
|
||
IO.createDirectory(IO.dirName(IO.dirName(actualFilename)));
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 1966, 32))
|
||
|
||
IO.createDirectory(IO.dirName(actualFilename));
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 1966, 32))
|
||
|
||
// Delete the actual file in case it fails
|
||
if (IO.fileExists(actualFilename)) {
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 1966, 32))
|
||
|
||
IO.deleteFile(actualFilename);
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 1966, 32))
|
||
}
|
||
|
||
var actual = generateContent();
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1976, 15))
|
||
>generateContent : Symbol(generateContent, Decl(parserharness.ts, 1966, 55))
|
||
|
||
if (actual === undefined) {
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1976, 15))
|
||
>undefined : Symbol(undefined)
|
||
|
||
throw new Error('The generated content was "undefined". Return "null" if no baselining is required."');
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
// Store the content in the 'local' folder so we
|
||
// can accept it later (manually)
|
||
if (actual !== null) {
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1976, 15))
|
||
|
||
IO.writeFile(actualFilename, actual);
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 1966, 32))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1976, 15))
|
||
}
|
||
|
||
return actual;
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1976, 15))
|
||
}
|
||
|
||
function compareToBaseline(actual: string, relativeFilename: string, opts: BaselineOptions) {
|
||
>compareToBaseline : Symbol(compareToBaseline, Decl(parserharness.ts, 1989, 9))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1991, 35))
|
||
>relativeFilename : Symbol(relativeFilename, Decl(parserharness.ts, 1991, 50))
|
||
>opts : Symbol(opts, Decl(parserharness.ts, 1991, 76))
|
||
>BaselineOptions : Symbol(BaselineOptions, Decl(parserharness.ts, 1924, 44))
|
||
|
||
// actual is now either undefined (the generator had an error), null (no file requested),
|
||
// or some real output of the function
|
||
if (actual === undefined) {
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1991, 35))
|
||
>undefined : Symbol(undefined)
|
||
|
||
// Nothing to do
|
||
return;
|
||
}
|
||
|
||
var refFilename = referencePath(relativeFilename);
|
||
>refFilename : Symbol(refFilename, Decl(parserharness.ts, 1999, 15))
|
||
>referencePath : Symbol(referencePath, Decl(parserharness.ts, 1937, 9))
|
||
>relativeFilename : Symbol(relativeFilename, Decl(parserharness.ts, 1991, 50))
|
||
|
||
if (actual === null) {
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1991, 35))
|
||
|
||
actual = '<no content>';
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1991, 35))
|
||
}
|
||
|
||
var expected = '<no content>';
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 2005, 15))
|
||
|
||
if (IO.fileExists(refFilename)) {
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>refFilename : Symbol(refFilename, Decl(parserharness.ts, 1999, 15))
|
||
|
||
expected = IO.readFile(refFilename);
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 2005, 15))
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>refFilename : Symbol(refFilename, Decl(parserharness.ts, 1999, 15))
|
||
}
|
||
|
||
var lineEndingSensitive = opts && opts.LineEndingSensitive;
|
||
>lineEndingSensitive : Symbol(lineEndingSensitive, Decl(parserharness.ts, 2010, 15))
|
||
>opts : Symbol(opts, Decl(parserharness.ts, 1991, 76))
|
||
>opts.LineEndingSensitive : Symbol(BaselineOptions.LineEndingSensitive, Decl(parserharness.ts, 1926, 42))
|
||
>opts : Symbol(opts, Decl(parserharness.ts, 1991, 76))
|
||
>LineEndingSensitive : Symbol(BaselineOptions.LineEndingSensitive, Decl(parserharness.ts, 1926, 42))
|
||
|
||
if (!lineEndingSensitive) {
|
||
>lineEndingSensitive : Symbol(lineEndingSensitive, Decl(parserharness.ts, 2010, 15))
|
||
|
||
expected = expected.replace(/\r\n?/g, '\n')
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 2005, 15))
|
||
>expected.replace : Symbol(String.replace, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 2005, 15))
|
||
>replace : Symbol(String.replace, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
|
||
actual = actual.replace(/\r\n?/g, '\n')
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1991, 35))
|
||
>actual.replace : Symbol(String.replace, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1991, 35))
|
||
>replace : Symbol(String.replace, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
}
|
||
|
||
return { expected: expected, actual: actual };
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 2017, 20))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 2005, 15))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2017, 40))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 1991, 35))
|
||
}
|
||
|
||
function writeComparison(expected: string, actual: string, relativeFilename: string, actualFilename: string, descriptionForDescribe: string) {
|
||
>writeComparison : Symbol(writeComparison, Decl(parserharness.ts, 2018, 9))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 2020, 33))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2020, 50))
|
||
>relativeFilename : Symbol(relativeFilename, Decl(parserharness.ts, 2020, 66))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 2020, 92))
|
||
>descriptionForDescribe : Symbol(descriptionForDescribe, Decl(parserharness.ts, 2020, 116))
|
||
|
||
if (expected != actual) {
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 2020, 33))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2020, 50))
|
||
|
||
// Overwrite & issue error
|
||
var errMsg = 'The baseline file ' + relativeFilename + ' has changed. Please refer to baseline-report.html and ';
|
||
>errMsg : Symbol(errMsg, Decl(parserharness.ts, 2023, 19))
|
||
>relativeFilename : Symbol(relativeFilename, Decl(parserharness.ts, 2020, 66))
|
||
|
||
errMsg += 'either fix the regression (if unintended) or run nmake baseline-accept (if intended).'
|
||
>errMsg : Symbol(errMsg, Decl(parserharness.ts, 2023, 19))
|
||
|
||
var refFilename = referencePath(relativeFilename);
|
||
>refFilename : Symbol(refFilename, Decl(parserharness.ts, 2026, 19))
|
||
>referencePath : Symbol(referencePath, Decl(parserharness.ts, 1937, 9))
|
||
>relativeFilename : Symbol(relativeFilename, Decl(parserharness.ts, 2020, 66))
|
||
|
||
// Append diff to the report
|
||
var diff = new Diff.StringDiff(expected, actual);
|
||
>diff : Symbol(diff, Decl(parserharness.ts, 2029, 19))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 2020, 33))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2020, 50))
|
||
|
||
var header = '<h2>' + descriptionForDescribe + '</h2>';
|
||
>header : Symbol(header, Decl(parserharness.ts, 2030, 19))
|
||
>descriptionForDescribe : Symbol(descriptionForDescribe, Decl(parserharness.ts, 2020, 116))
|
||
|
||
header += '<h4>Left file: ' + actualFilename + '; Right file: ' + refFilename + '</h4>';
|
||
>header : Symbol(header, Decl(parserharness.ts, 2030, 19))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 2020, 92))
|
||
>refFilename : Symbol(refFilename, Decl(parserharness.ts, 2026, 19))
|
||
|
||
var trailer = '<hr>';
|
||
>trailer : Symbol(trailer, Decl(parserharness.ts, 2032, 19))
|
||
|
||
var reportContentSoFar = prepareBaselineReport();
|
||
>reportContentSoFar : Symbol(reportContentSoFar, Decl(parserharness.ts, 2034, 19))
|
||
>prepareBaselineReport : Symbol(prepareBaselineReport, Decl(parserharness.ts, 1952, 9))
|
||
|
||
reportContentSoFar = reportContentSoFar + header + '<div class="code">' + diff.mergedHtml + '</div>' + trailer + htmlTrailer;
|
||
>reportContentSoFar : Symbol(reportContentSoFar, Decl(parserharness.ts, 2034, 19))
|
||
>reportContentSoFar : Symbol(reportContentSoFar, Decl(parserharness.ts, 2034, 19))
|
||
>header : Symbol(header, Decl(parserharness.ts, 2030, 19))
|
||
>diff : Symbol(diff, Decl(parserharness.ts, 2029, 19))
|
||
>trailer : Symbol(trailer, Decl(parserharness.ts, 2032, 19))
|
||
>htmlTrailer : Symbol(htmlTrailer, Decl(parserharness.ts, 1913, 11))
|
||
|
||
IO.writeFile(reportFilename, reportContentSoFar);
|
||
>IO : Symbol(IO, Decl(parserharness.ts, 24, 11))
|
||
>reportFilename : Symbol(reportFilename, Decl(parserharness.ts, 1910, 11))
|
||
>reportContentSoFar : Symbol(reportContentSoFar, Decl(parserharness.ts, 2034, 19))
|
||
|
||
throw new Error(errMsg);
|
||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||
>errMsg : Symbol(errMsg, Decl(parserharness.ts, 2023, 19))
|
||
}
|
||
}
|
||
|
||
export function runBaseline(
|
||
>runBaseline : Symbol(runBaseline, Decl(parserharness.ts, 2040, 9))
|
||
|
||
descriptionForDescribe: string,
|
||
>descriptionForDescribe : Symbol(descriptionForDescribe, Decl(parserharness.ts, 2042, 36))
|
||
|
||
relativeFilename: string,
|
||
>relativeFilename : Symbol(relativeFilename, Decl(parserharness.ts, 2043, 43))
|
||
|
||
generateContent: () => string,
|
||
>generateContent : Symbol(generateContent, Decl(parserharness.ts, 2044, 37))
|
||
|
||
runImmediately? = false,
|
||
>runImmediately : Symbol(runImmediately, Decl(parserharness.ts, 2045, 42))
|
||
|
||
opts?: BaselineOptions) {
|
||
>opts : Symbol(opts, Decl(parserharness.ts, 2046, 36))
|
||
>BaselineOptions : Symbol(BaselineOptions, Decl(parserharness.ts, 1924, 44))
|
||
|
||
var actual = <string>undefined;
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2049, 15), Decl(parserharness.ts, 2053, 19))
|
||
>undefined : Symbol(undefined)
|
||
|
||
var actualFilename = localPath(relativeFilename);
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 2050, 15))
|
||
>localPath : Symbol(localPath, Decl(parserharness.ts, 1928, 9))
|
||
>relativeFilename : Symbol(relativeFilename, Decl(parserharness.ts, 2043, 43))
|
||
|
||
if (runImmediately) {
|
||
>runImmediately : Symbol(runImmediately, Decl(parserharness.ts, 2045, 42))
|
||
|
||
var actual = generateActual(actualFilename, generateContent);
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2049, 15), Decl(parserharness.ts, 2053, 19))
|
||
>generateActual : Symbol(generateActual, Decl(parserharness.ts, 1964, 9))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 2050, 15))
|
||
>generateContent : Symbol(generateContent, Decl(parserharness.ts, 2044, 37))
|
||
|
||
var comparison = compareToBaseline(actual, relativeFilename, opts);
|
||
>comparison : Symbol(comparison, Decl(parserharness.ts, 2054, 19))
|
||
>compareToBaseline : Symbol(compareToBaseline, Decl(parserharness.ts, 1989, 9))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2049, 15), Decl(parserharness.ts, 2053, 19))
|
||
>relativeFilename : Symbol(relativeFilename, Decl(parserharness.ts, 2043, 43))
|
||
>opts : Symbol(opts, Decl(parserharness.ts, 2046, 36))
|
||
|
||
writeComparison(comparison.expected, comparison.actual, relativeFilename, actualFilename, descriptionForDescribe);
|
||
>writeComparison : Symbol(writeComparison, Decl(parserharness.ts, 2018, 9))
|
||
>comparison.expected : Symbol(expected, Decl(parserharness.ts, 2017, 20))
|
||
>comparison : Symbol(comparison, Decl(parserharness.ts, 2054, 19))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 2017, 20))
|
||
>comparison.actual : Symbol(actual, Decl(parserharness.ts, 2017, 40))
|
||
>comparison : Symbol(comparison, Decl(parserharness.ts, 2054, 19))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2017, 40))
|
||
>relativeFilename : Symbol(relativeFilename, Decl(parserharness.ts, 2043, 43))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 2050, 15))
|
||
>descriptionForDescribe : Symbol(descriptionForDescribe, Decl(parserharness.ts, 2042, 36))
|
||
|
||
} else {
|
||
describe(descriptionForDescribe, () => {
|
||
>describe : Symbol(describe, Decl(parserharness.ts, 1841, 5))
|
||
>descriptionForDescribe : Symbol(descriptionForDescribe, Decl(parserharness.ts, 2042, 36))
|
||
|
||
var actual: string;
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2058, 23))
|
||
|
||
it('Can generate the content without error', () => {
|
||
>it : Symbol(it, Decl(parserharness.ts, 1852, 5))
|
||
|
||
actual = generateActual(actualFilename, generateContent);
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2058, 23))
|
||
>generateActual : Symbol(generateActual, Decl(parserharness.ts, 1964, 9))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 2050, 15))
|
||
>generateContent : Symbol(generateContent, Decl(parserharness.ts, 2044, 37))
|
||
|
||
});
|
||
|
||
it('Matches the baseline file', () => {
|
||
>it : Symbol(it, Decl(parserharness.ts, 1852, 5))
|
||
|
||
var comparison = compareToBaseline(actual, relativeFilename, opts);
|
||
>comparison : Symbol(comparison, Decl(parserharness.ts, 2065, 27))
|
||
>compareToBaseline : Symbol(compareToBaseline, Decl(parserharness.ts, 1989, 9))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2058, 23))
|
||
>relativeFilename : Symbol(relativeFilename, Decl(parserharness.ts, 2043, 43))
|
||
>opts : Symbol(opts, Decl(parserharness.ts, 2046, 36))
|
||
|
||
writeComparison(comparison.expected, comparison.actual, relativeFilename, actualFilename, descriptionForDescribe);
|
||
>writeComparison : Symbol(writeComparison, Decl(parserharness.ts, 2018, 9))
|
||
>comparison.expected : Symbol(expected, Decl(parserharness.ts, 2017, 20))
|
||
>comparison : Symbol(comparison, Decl(parserharness.ts, 2065, 27))
|
||
>expected : Symbol(expected, Decl(parserharness.ts, 2017, 20))
|
||
>comparison.actual : Symbol(actual, Decl(parserharness.ts, 2017, 40))
|
||
>comparison : Symbol(comparison, Decl(parserharness.ts, 2065, 27))
|
||
>actual : Symbol(actual, Decl(parserharness.ts, 2017, 40))
|
||
>relativeFilename : Symbol(relativeFilename, Decl(parserharness.ts, 2043, 43))
|
||
>actualFilename : Symbol(actualFilename, Decl(parserharness.ts, 2050, 15))
|
||
>descriptionForDescribe : Symbol(descriptionForDescribe, Decl(parserharness.ts, 2042, 36))
|
||
|
||
});
|
||
});
|
||
}
|
||
}
|
||
}
|
||
|
||
var currentRun = new Run();
|
||
>currentRun : Symbol(currentRun, Decl(parserharness.ts, 2073, 7))
|
||
>Run : Symbol(Run, Decl(parserharness.ts, 462, 5))
|
||
|
||
global.describe = describe;
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
>describe : Symbol(describe, Decl(parserharness.ts, 1841, 5))
|
||
|
||
global.run = run;
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
>run : Symbol(run, Decl(parserharness.ts, 1856, 5))
|
||
|
||
global.it = it;
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
>it : Symbol(it, Decl(parserharness.ts, 1852, 5))
|
||
|
||
global.assert = Harness.Assert;
|
||
>global : Symbol(global, Decl(parserharness.ts, 57, 7))
|
||
>Harness.Assert : Symbol(Assert, Decl(parserharness.ts, 77, 5))
|
||
>Harness : Symbol(Harness, Decl(parserharness.ts, 52, 1))
|
||
>Assert : Symbol(Assert, Decl(parserharness.ts, 77, 5))
|
||
}
|
||
|