Merge pull request #405 from Microsoft/classifier

Wire the classifier to use the new compiler implementation
This commit is contained in:
Mohamed Hegazy committed 2014-08-18 14:38:05 -07:00
commit 8934e85d44
182 files changed
+1501 -5033

No files matched your search

+1 -3
View File
@@ -750,9 +750,8 @@ module ts {
if (text.charCodeAt(pos + 1) === CharacterCodes.asterisk) {
pos += 2;
var safeLength = len - 1; // For lookahead.
var commentClosed = false;
while (pos < safeLength) {
while (pos < len) {
var ch = text.charCodeAt(pos);
if (ch === CharacterCodes.asterisk && text.charCodeAt(pos + 1) === CharacterCodes.slash) {
@@ -768,7 +767,6 @@ module ts {
}
if (!commentClosed) {
pos++;
error(Diagnostics.Asterisk_Slash_expected);
}
+3 -1
View File
@@ -217,7 +217,9 @@ module ts {
FirstKeyword = BreakKeyword,
LastKeyword = StringKeyword,
FirstFutureReservedWord = ImplementsKeyword,
LastFutureReservedWord = YieldKeyword
LastFutureReservedWord = YieldKeyword,
FirstPunctuation= OpenBraceToken,
LastPunctuation = CaretEqualsToken
}
export enum NodeFlags {
+6 -6
View File
@@ -167,7 +167,6 @@ module Harness.LanguageService {
}
export class TypeScriptLS implements ts.LanguageServiceShimHost {
private ls: ts.LanguageServiceShim = null;
public newLS: ts.LanguageService;
private fileNameToScript: ts.Map<ScriptInfo> = {};
@@ -268,12 +267,13 @@ module Harness.LanguageService {
* To access the non-shim (i.e. actual) language service, use the "ls.languageService" property.
*/
public getLanguageService(): ts.LanguageServiceShim {
var ls = new TypeScript.Services.TypeScriptServicesFactory().createLanguageServiceShim(this);
this.ls = ls;
var hostAdapter = new LanguageServiceShimHostAdapter(this);
this.ls = new TypeScript.Services.TypeScriptServicesFactory().createLanguageServiceShim(this);
return this.ls;
}
this.newLS = ts.createLanguageService(hostAdapter, NonCachingDocumentRegistry.Instance);
return ls;
/** Return a new instance of the classifier service shim */
public getClassifier(): ts.ClassifierShim {
return new TypeScript.Services.TypeScriptServicesFactory().createClassifierShim(this);
}
/** Parse file given its source text */
+5 -8
View File
@@ -68,17 +68,11 @@ if (testConfigFile !== '') {
runners.push(new GeneratedFourslashRunner());
break;
case 'unittests':
runners.push(new UnitTestRunner(UnittestTestType.Compiler));
runners.push(new UnitTestRunner());
break;
case 'rwc':
runners.push(new RWCRunner());
break;
case 'ls':
runners.push(new UnitTestRunner(UnittestTestType.LanguageService));
break;
case 'services':
runners.push(new UnitTestRunner(UnittestTestType.Services));
break;
case 'reverse':
reverse = true;
break;
@@ -96,9 +90,12 @@ if (runners.length === 0) {
runners.push(new ProjectRunner());
}
//// language services
// language services
runners.push(new FourslashRunner());
//runners.push(new GeneratedFourslashRunner());
// unittests
runners.push(new UnitTestRunner());
}
sys.newLine = '\r\n';
+6 -22
View File
@@ -1,31 +1,13 @@
///<reference path="harness.ts" />
///<reference path="runnerbase.ts" />
enum UnittestTestType {
Compiler,
LanguageService,
Services,
}
class UnitTestRunner extends RunnerBase {
constructor(public testType?: UnittestTestType) {
constructor() {
super();
}
public initializeTests() {
switch (this.testType) {
case UnittestTestType.Compiler:
this.tests = this.enumerateFiles('tests/cases/unittests/compiler');
break;
case UnittestTestType.LanguageService:
this.tests = this.enumerateFiles('tests/cases/unittests/ls');
break;
default:
if (this.tests.length === 0) {
throw new Error('Unsupported test cases: ' + this.testType);
}
break;
}
this.tests = this.enumerateFiles('tests/cases/unittests/services');
var outfile = new Harness.Compiler.WriterAggregator()
var outerr = new Harness.Compiler.WriterAggregator();
@@ -38,7 +20,7 @@ class UnitTestRunner extends RunnerBase {
});
harnessCompiler.addInputFiles(toBeAdded);
harnessCompiler.setCompilerOptions({ noResolve: true });
var stdout = new Harness.Compiler.EmitterIOHost();
var emitDiagnostics = harnessCompiler.emitAll(stdout);
var results = stdout.toArray();
@@ -59,7 +41,9 @@ class UnitTestRunner extends RunnerBase {
before: before,
after: after,
Harness: Harness,
IO: Harness.IO
IO: Harness.IO,
ts: ts,
TypeScript: TypeScript
// FourSlash: FourSlash
};
}
+178 -107
View File
@@ -659,6 +659,7 @@ module ts {
InMultiLineCommentTrivia,
InSingleQuoteStringLiteral,
InDoubleQuoteStringLiteral,
EndingWithDotToken,
}
export enum TokenClass {
@@ -693,8 +694,7 @@ module ts {
compilationSettings: CompilerOptions,
scriptSnapshot: TypeScript.IScriptSnapshot,
version: number,
isOpen: boolean,
referencedFiles: string[]): SourceFile;
isOpen: boolean): SourceFile;
updateDocument(
sourceFile: SourceFile,
@@ -1402,7 +1402,7 @@ module ts {
sourceFile = documentRegistry.updateDocument(sourceFile, filename, compilationSettings, scriptSnapshot, version, isOpen, textChangeRange);
}
else {
sourceFile = documentRegistry.acquireDocument(filename, compilationSettings, scriptSnapshot, version, isOpen, []);
sourceFile = documentRegistry.acquireDocument(filename, compilationSettings, scriptSnapshot, version, isOpen);
}
// Remeber the new sourceFile
@@ -2267,50 +2267,41 @@ module ts {
}
/// Classifier
export function createClassifier(host: Logger): Classifier {
var scanner: TypeScript.Scanner.IScanner;
var lastDiagnosticKey: string = null;
var noRegexTable: boolean[];
var reportDiagnostic = (position: number, fullWidth: number, key: string, args: any[]) => {
lastDiagnosticKey = key;
};
if (!noRegexTable) {
noRegexTable = [];
noRegexTable[TypeScript.SyntaxKind.IdentifierName] = true;
noRegexTable[TypeScript.SyntaxKind.StringLiteral] = true;
noRegexTable[TypeScript.SyntaxKind.NumericLiteral] = true;
noRegexTable[TypeScript.SyntaxKind.RegularExpressionLiteral] = true;
noRegexTable[TypeScript.SyntaxKind.ThisKeyword] = true;
noRegexTable[TypeScript.SyntaxKind.PlusPlusToken] = true;
noRegexTable[TypeScript.SyntaxKind.MinusMinusToken] = true;
noRegexTable[TypeScript.SyntaxKind.CloseParenToken] = true;
noRegexTable[TypeScript.SyntaxKind.CloseBracketToken] = true;
noRegexTable[TypeScript.SyntaxKind.CloseBraceToken] = true;
noRegexTable[TypeScript.SyntaxKind.TrueKeyword] = true;
noRegexTable[TypeScript.SyntaxKind.FalseKeyword] = true;
}
var scanner: Scanner;
var noRegexTable: boolean[];␍
/// We do not have a full parser support to know when we should parse a regex or not
/// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where
/// we have a series of divide operator. this list allows us to be more accurate by ruling out
/// locations where a regexp cannot exist.
if (!noRegexTable) {␍ noRegexTable = [];␍ noRegexTable[SyntaxKind.Identifier] = true;␍ noRegexTable[SyntaxKind.StringLiteral] = true;␍ noRegexTable[SyntaxKind.NumericLiteral] = true;␍ noRegexTable[SyntaxKind.RegularExpressionLiteral] = true;␍ noRegexTable[SyntaxKind.ThisKeyword] = true;␍ noRegexTable[SyntaxKind.PlusPlusToken] = true;␍ noRegexTable[SyntaxKind.MinusMinusToken] = true;␍ noRegexTable[SyntaxKind.CloseParenToken] = true;␍ noRegexTable[SyntaxKind.CloseBracketToken] = true;␍ noRegexTable[SyntaxKind.CloseBraceToken] = true;␍ noRegexTable[SyntaxKind.TrueKeyword] = true;␍ noRegexTable[SyntaxKind.FalseKeyword] = true;␍ }␍
function getClassificationsForLine(text: string, lexState: EndOfLineState): ClassificationResult {
var offset = 0;
if (lexState !== EndOfLineState.Start) {
// If we're in a string literal, then prepend: "\
// (and a newline). That way when we lex we'll think we're still in a string literal.
//
// If we're in a multiline comment, then prepend: /*
// (and a newline). That way when we lex we'll think we're still in a multiline comment.
if (lexState === EndOfLineState.InDoubleQuoteStringLiteral) {
text = '"\\\n' + text;
}
else if (lexState === EndOfLineState.InSingleQuoteStringLiteral) {
text = "'\\\n" + text;
}
else if (lexState === EndOfLineState.InMultiLineCommentTrivia) {
text = "/*\n" + text;
}
var lastTokenOrCommentEnd = 0;
var lastToken = SyntaxKind.Unknown;
var inUnterminatedMultiLineComment = false;
offset = 3;
// If we're in a string literal, then prepend: "\
// (and a newline). That way when we lex we'll think we're still in a string literal.
//
// If we're in a multiline comment, then prepend: /*
// (and a newline). That way when we lex we'll think we're still in a multiline comment.
switch (lexState) {
case EndOfLineState.InDoubleQuoteStringLiteral:
text = '"\\\n' + text;
offset = 3;
break;
case EndOfLineState.InSingleQuoteStringLiteral:
text = "'\\\n" + text;
offset = 3;
break;
case EndOfLineState.InMultiLineCommentTrivia:
text = "/*\n" + text;
offset = 3;
break;
case EndOfLineState.EndingWithDotToken:
lastToken = SyntaxKind.DotToken;
break;
}
var result: ClassificationResult = {
@@ -2318,94 +2309,174 @@ module ts {
entries: []
};
var simpleText = TypeScript.SimpleText.fromString(text);
scanner = TypeScript.Scanner.createScanner(ScriptTarget.ES5, simpleText, reportDiagnostic);
scanner = createScanner(ScriptTarget.ES5, text, onError, processComment);
var lastTokenKind = TypeScript.SyntaxKind.None;
var token: TypeScript.ISyntaxToken = null;
var token = SyntaxKind.Unknown;
do {
lastDiagnosticKey = null;
token = scanner.scan();
token = scanner.scan(!noRegexTable[lastTokenKind]);
lastTokenKind = token.kind();
processToken(text, simpleText, offset, token, result);
}
while (token.kind() !== TypeScript.SyntaxKind.EndOfFileToken);
lastDiagnosticKey = null;
return result;
}
function processToken(text: string, simpleText: TypeScript.ISimpleText, offset: number, token: TypeScript.ISyntaxToken, result: ClassificationResult): void {
processTriviaList(text, offset, token.leadingTrivia(simpleText), result);
addResult(text, offset, result, TypeScript.width(token), token.kind());
processTriviaList(text, offset, token.trailingTrivia(simpleText), result);
if (TypeScript.fullEnd(token) >= text.length) {
// We're at the end.
if (lastDiagnosticKey === TypeScript.DiagnosticCode.AsteriskSlash_expected) {
result.finalLexState = EndOfLineState.InMultiLineCommentTrivia;
return;
if ((token === SyntaxKind.SlashToken || token === SyntaxKind.SlashEqualsToken) && !noRegexTable[lastToken]) {
if (scanner.reScanSlashToken() === SyntaxKind.RegularExpressionLiteral) {
token = SyntaxKind.RegularExpressionLiteral;
}
}
else if (lastToken === SyntaxKind.DotToken) {
token = SyntaxKind.Identifier;
}
if (token.kind() === TypeScript.SyntaxKind.StringLiteral) {
var tokenText = token.text();
if (tokenText.length > 0 && tokenText.charCodeAt(tokenText.length - 1) === TypeScript.CharacterCodes.backslash) {
var quoteChar = tokenText.charCodeAt(0);
result.finalLexState = quoteChar === TypeScript.CharacterCodes.doubleQuote
? EndOfLineState.InDoubleQuoteStringLiteral
: EndOfLineState.InSingleQuoteStringLiteral;
return;
lastToken = token;
processToken();
}
while (token !== SyntaxKind.EndOfFileToken);
return result;
function onError(message: DiagnosticMessage): void {
inUnterminatedMultiLineComment = message.key === Diagnostics.Asterisk_Slash_expected.key;
}
function processComment(start: number, end: number) {
// add Leading white spaces
addLeadingWhiteSpace(start, end);
// add the comment
addResult(end - start, TokenClass.Comment);
}
function processToken(): void {
var start = scanner.getTokenPos();
var end = scanner.getTextPos();
// add Leading white spaces
addLeadingWhiteSpace(start, end);
// add the token
addResult(end - start, classFromKind(token));
if (end >= text.length) {
// We're at the end.
if (inUnterminatedMultiLineComment) {
result.finalLexState = EndOfLineState.InMultiLineCommentTrivia;
}
else if (token === SyntaxKind.StringLiteral) {
var tokenText = scanner.getTokenText();
if (tokenText.length > 0 && tokenText.charCodeAt(tokenText.length - 1) === CharacterCodes.backslash) {
var quoteChar = tokenText.charCodeAt(0);
result.finalLexState = quoteChar === CharacterCodes.doubleQuote
? EndOfLineState.InDoubleQuoteStringLiteral
: EndOfLineState.InSingleQuoteStringLiteral;
}
}
else if (token === SyntaxKind.DotToken) {
result.finalLexState = EndOfLineState.EndingWithDotToken;
}
}
}
}
function processTriviaList(text: string, offset: number, triviaList: TypeScript.ISyntaxTriviaList, result: ClassificationResult): void {
for (var i = 0, n = triviaList.count(); i < n; i++) {
var trivia = triviaList.syntaxTriviaAt(i);
addResult(text, offset, result, trivia.fullWidth(), trivia.kind());
}
}
function addResult(text: string, offset: number, result: ClassificationResult, length: number, kind: TypeScript.SyntaxKind): void {
if (length > 0) {
// If this is the first classification we're adding to the list, then remove any
// offset we have if we were continuing a construct from the previous line.
if (result.entries.length === 0) {
length -= offset;
function addLeadingWhiteSpace(start: number, end: number): void {
if (start > lastTokenOrCommentEnd) {
addResult(start - lastTokenOrCommentEnd, TokenClass.Whitespace);
}
result.entries.push({ length: length, classification: classFromKind(kind) });
// Remeber the end of the last token
lastTokenOrCommentEnd = end;
}
function addResult(length: number, classification: TokenClass): void {
if (length > 0) {
// If this is the first classification we're adding to the list, then remove any
// offset we have if we were continuing a construct from the previous line.
if (result.entries.length === 0) {
length -= offset;
}
result.entries.push({ length: length, classification: classification });
}
}
}
function classFromKind(kind: TypeScript.SyntaxKind) {
if (TypeScript.SyntaxFacts.isAnyKeyword(kind)) {
function isBinaryExpressionOperatorToken(token: SyntaxKind): boolean {
switch (token) {
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.InstanceOfKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
case SyntaxKind.ExclamationEqualsEqualsToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandAmpersandToken:
case SyntaxKind.BarBarToken:
case SyntaxKind.BarEqualsToken:
case SyntaxKind.AmpersandEqualsToken:
case SyntaxKind.CaretEqualsToken:
case SyntaxKind.LessThanLessThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
case SyntaxKind.PlusEqualsToken:
case SyntaxKind.MinusEqualsToken:
case SyntaxKind.AsteriskEqualsToken:
case SyntaxKind.SlashEqualsToken:
case SyntaxKind.PercentEqualsToken:
case SyntaxKind.EqualsToken:
case SyntaxKind.CommaToken:
return true;
default: return false;
}
}
function isPrefixUnaryExpressionOperatorToken(token: SyntaxKind): boolean {
switch (token) {
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.TildeToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
return true;
default:
return false;
}
}
function isKeyword(token: SyntaxKind): boolean {
return token >= SyntaxKind.FirstKeyword && token <= SyntaxKind.LastKeyword;
}
function classFromKind(token: SyntaxKind) {
if (isKeyword(token)) {
return TokenClass.Keyword;
}
else if (TypeScript.SyntaxFacts.isBinaryExpressionOperatorToken(kind) ||
TypeScript.SyntaxFacts.isPrefixUnaryExpressionOperatorToken(kind)) {
else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) {
return TokenClass.Operator;
}
else if (TypeScript.SyntaxFacts.isAnyPunctuation(kind)) {
else if (token >= SyntaxKind.FirstPunctuation && token <= SyntaxKind.LastPunctuation) {
return TokenClass.Punctuation;
}
switch (kind) {
case TypeScript.SyntaxKind.WhitespaceTrivia:
return TokenClass.Whitespace;
case TypeScript.SyntaxKind.MultiLineCommentTrivia:
case TypeScript.SyntaxKind.SingleLineCommentTrivia:
return TokenClass.Comment;
case TypeScript.SyntaxKind.NumericLiteral:
switch (token) {
case SyntaxKind.NumericLiteral:
return TokenClass.NumberLiteral;
case TypeScript.SyntaxKind.StringLiteral:
case SyntaxKind.StringLiteral:
return TokenClass.StringLiteral;
case TypeScript.SyntaxKind.RegularExpressionLiteral:
case SyntaxKind.RegularExpressionLiteral:
return TokenClass.RegExpLiteral;
case TypeScript.SyntaxKind.IdentifierName:
case SyntaxKind.Identifier:
default:
return TokenClass.Identifier;
}
+2 -2
View File
@@ -840,8 +840,8 @@ module ts {
public createLanguageServiceShim(host: LanguageServiceShimHost): LanguageServiceShim {
try {
var hostAdapter = new LanguageServiceShimHostAdapter(host);
var pullLanguageService = createLanguageService(hostAdapter, this.documentRegistry);
return new LanguageServiceShimObject(this, host, pullLanguageService);
var languageService = createLanguageService(hostAdapter, this.documentRegistry);
return new LanguageServiceShimObject(this, host, languageService);
}
catch (err) {
logInternalError(host, err);
@@ -1,27 +0,0 @@
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
///<reference path='..\..\..\..\src\harness\harness.ts' />
describe('Compiling unittests\\compiler\\callSignatureTests.ts', function () {
it("If a signature omits a return type annotation, any type is assumed", function () {
var code = 'var foo: {();};';
code += 'var test = foo();'
code += 'test.bar = 2;'
Harness.Compiler.compileString(code, 'call signatures', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("A call signature can have the void return type", function () {
var code = 'var foo: {():void;};';
code += 'var test = foo();'
Harness.Compiler.compileString(code, 'call signatures', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("A call signature can't have the same overload", function () {
var code = 'var foo: { (): string; (): string; };';
Harness.Compiler.compileString(code, 'call signatures', function (result) {
assert.equal(result.errors.length, 0);
});
});
});
@@ -1,128 +0,0 @@
/// <reference path='..\..\..\..\src\compiler\typescript.ts' />
/// <reference path='..\..\..\..\src\harness\harness.ts' />
describe('Compiling unittests\\compiler\\classOverloads.ts', function () {
it("Everytype is a subtype of itself", function () {
var code = 'class foo { public bar: number; }';
code += 'class bar extends foo { public bar: number; }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("All types except the Void type are subtypes of the Any type", function () {
var code = 'class foo { public bar: any; }';
code += 'class bar extends foo { public bar: number; }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("All types are subtypes of the Any type - 2", function () {
var code = 'class baz { public bar(): any { return 1; } }';
code += 'class foo extends baz { public bar(): void {} }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("The Undefined type is a subtype of all types except the Void type", function () {
var code = 'class baz { public bar(): any { return 1 } }';
code += 'class foo extends baz { public bar(){ return undefined} }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("The Undefined type is a subtype of all types except the Void type - 2", function () {
var code = 'class baz { public bar(): void { } }';
code += 'class foo extends baz { public bar(){ return undefined} }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("The Null type is a subtype of all types, except the Undefined and Void types", function () {
var code = 'class baz { public bar:any; }';
code += 'class foo extends baz { public bar = null; }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("The Null type is a subtype of all types, except the Undefined and Void types - 3", function () {
var code = 'class baz { public bar():void { } }';
code += 'class foo extends baz { public bar() { return null; } }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
describe('An object type S is a subtype of an object type T', function () {
it("A property in T is matched by a property in S", function () {
var code = 'class baz { public bar: { a: string; }; }';
code += 'class foo extends baz { public bar: { a: number; }; }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 1);
});
});
it("A property in T is matched by a property in S - 2", function () {
var code = 'class baz { public bar: { a: string; }; }';
code += 'class foo extends baz { public bar: { a: string; }; }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("A property in T is matched by a property in S - 3", function () {
var code = 'class baz { public bar: { a: string; }; }';
code += 'class foo extends baz { public bar: { b: string; }; }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 1);
});
});
it("A call, construct or index signature in T is matched by a call, construct or index signature", function () {
var code = 'class baz { public bar: { (); }; }';
code += 'class foo extends baz { public bar: { (); } ;}';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("A call, construct or index signature in T is matched by a call, construct or index signature - 2", function () {
var code = 'class baz { public bar: { [idx:number]: any; }; }';
code += 'class foo extends baz { public bar: { (); }; }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 1);
});
});
it("A call, construct or index signature in T is matched by a call, construct or index signature - 3", function () {
var code = 'class baz { public bar: { (a: string); }; }';
code += 'class foo extends baz { public bar: { (); }; }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("A call, construct or index signature in T is matched by a call, construct or index signature - 4", function () {
var code = 'class baz { public bar: { (a:string); }; }';
code += 'class foo extends baz { public bar: { (a:string,b:string); }; }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 1);
});
});
it("A call, construct or index signature in T is matched by a call, construct or index signature - 5", function () {
var code = 'class baz { public bar: { ():void; }; }';
code += 'class foo extends baz { public bar: { ():void; }; }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("A call, construct or index signature in T is matched by a call, construct or index signature - 6", function () {
var code = 'class baz { public bar: { (); }; }';
code += 'class foo extends baz { public bar: { ():void; }; }';
Harness.Compiler.compileString(code, 'subtypes', function (result) {
assert.equal(result.errors.length, 0);
});
});
});
});
@@ -1,26 +0,0 @@
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
///<reference path='..\..\..\..\src\harness\harness.ts' />
describe('Compiling tests\\compiler\\constructSignatureTests.ts', function () {
it("If a signature omits a return type annotation, any type is assumed", function () {
var code = 'var foo: {new ();};';
code += 'var test = new foo();'
code += 'test.bar = 2;'
Harness.Compiler.compileString(code, 'construct signatures', function (result) {
assert.equal(result.errors.length, 0);
});
});
it("A call signature can have the void return type", function () {
var code = 'var foo: {new ():void;};';
Harness.Compiler.compileString(code, 'call signatures', function (result) {
assert.equal(result.errors.length, 1);
});
});
it("A construct signature can't have the same overload", function () {
var code = 'var foo: { new (): string; new (): string; };';
Harness.Compiler.compileString(code, 'call signatures', function (result) {
assert.equal(result.errors.length, 0);
});
});
});
@@ -1,52 +0,0 @@
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
///<reference path='..\..\..\..\src\harness\harness.ts' />
//@tags 1.1 Declarations
describe('Compiling unittests\\compiler\\declarationTests.ts', function() {
it("Each internal module’s export declaration spaces are shared with other internal modules that have the same root module and the " +
"same qualified name starting from that root module", function() {
var code = 'module baz{export var foo;}';
code += 'module baz{export var bar;}'
code += 'baz.foo = baz.bar;'
Harness.Compiler.compileString(code, 'declarations', function(result) {
assert.equal(result.errors.length, 0);
});
});
it("Each object type literal has a declaration space for its members", function() {
var code = 'var foo:{a:number;};';
code += 'foo.a = 2;'
Harness.Compiler.compileString(code, 'declarations', function(result) {
assert.equal(result.errors.length, 0);
});
});
it("Each class declaration has a declaration space for members and a declaration space for statics", function() {
var code = 'class foo {';
code += ' static bar;'
code += ' public bar;'
code += '}'
Harness.Compiler.compileString(code, 'declarations', function(result) {
assert.equal(result.errors.length, 0);
});
});
it("Each function declaration (including member function declarations and static function declarations) has a declaration space for " +
"statics and a declaration space for locals (parameters, variables, and functions).", function() {
var code = 'function foo() {';
code += ' static bar;'
code += ' var bar;'
code += '}'
Harness.Compiler.compileString(code, 'declarations', function(result) {
assert.equal(result.errors.length, 1);
});
});
it("Modules contain separate declaration spaces for variables and types.", function() {
var code = 'module M {';
code += ' class bar {};'
code += ' var bar;'
code += '}'
Harness.Compiler.compileString(code, 'declarations', function(result) {
assert.equal(result.errors.length, 1);
});
});
});
@@ -1,25 +0,0 @@
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
///<reference path='..\..\..\..\src\harness\harness.ts' />
describe('Compiling unittests\\compiler\\functionSignatureTests.ts', function() {
it('Check overload with different return types.', function(){
var code = 'var foo: { bar(): string; bar(): number; };\n';
code += 'var bar: { bar: { (): string; (): number; }; };';
code += 'foo = bar;';
Harness.Compiler.compileString(code, 'function signatures', function(result) {
assert.equal(result.errors.length, 0);
});
})
describe('Function Type Literals', function() {
it('Basic sanity check', function() {
var code = 'var foo: { (): string; };';
code += 'var bar: () => string;';
code += 'foo = bar;';
Harness.Compiler.compileString(code, 'function type literal', function(result) {
assert.equal(result.errors.length, 0);
});
});
});
});
@@ -1,13 +0,0 @@
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
///<reference path='..\..\..\..\src\harness\harness.ts' />
describe('Compiling tests\\compiler\\identifiers.ts', function() {
it("Everytype is a subtype of itself", function() {
var code = 'class foo { public bar: number; }';
code += 'class bar extends foo { public bar: number; }';
Harness.Compiler.compileString(code, 'subtypes', function(result) {
assert.equal(result.errors.length, 0);
});
});
});
@@ -1,14 +0,0 @@
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
///<reference path='..\..\..\..\src\harness\harness.ts' />
describe('Compiling unittests\\compiler\\moduleAlias.ts', function() {
describe('Internal module alias test', function() {
it("basic test", function() {
var code = "module A.B.C { import XYZ = X.Y.Z; export function ping(x: number) { if (x > 0) XYZ.pong(x-1);}};";
code += "module X.Y.Z { import ABC = A.B.C; export function pong(x: number) { if (x > 0) ABC.ping(x-1);}};";
Harness.Compiler.compileString(code, 'module alias', function(result) {
assert.equal(result.errors.length, 0);
});
});
});
});
-50
View File
@@ -1,50 +0,0 @@
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
///<reference path='..\..\..\..\src\harness\harness.ts' />
describe('Verifying pathing functions', function () {
it("Normalizes Mac paths", function () {
var result = TypeScript.normalizePath("/Users/Me/somefile.ts");
var expected = "/Users/Me/somefile.ts";
assert.equal(result, expected);
});
it("Normalizes relative Mac paths", function () {
var result = TypeScript.normalizePath("/Users/./Me/../somefile.ts");
var expected = "/Users/somefile.ts";
assert.equal(result, expected);
});
it("Normalizes Windows paths", function () {
var result = TypeScript.normalizePath("C:\\Users\\Me\\somefile.ts");
var expected = "C:/Users/Me/somefile.ts";
assert.equal(result, expected);
});
it("Normalizes relative Windows paths", function () {
var result = TypeScript.normalizePath("C:\\Users\\.\\Me\\..\\somefile.ts");
var expected = "C:/Users/somefile.ts";
assert.equal(result, expected);
});
it("Normalizes . and ..", function () {
var result = TypeScript.normalizePath("..\\Users\\.\\Me\\..\\somefile.ts");
var expected = "../Users/somefile.ts";
assert.equal(result, expected);
});
it("Normalizes UNC paths", function () {
var result = TypeScript.normalizePath("\\\\server\\share\\someFile.ts");
var expected = "file://server/share/someFile.ts";
assert.equal(result, expected);
});
it("Normalizes relative UNC paths with IP addresses", function () {
var result = TypeScript.normalizePath("\\\\127.0.0.1\\share\\..\\elsewhere\\someFile.ts");
var expected = "file://127.0.0.1/elsewhere/someFile.ts";
assert.equal(result, expected);
});
it("Normalizes HTTP paths", function () {
var result = TypeScript.normalizePath("http://www.server.com/share/someFile.ts");
var expected = "http://www.server.com/share/someFile.ts";
assert.equal(result, expected);
});
it("Normalizes relative HTTP paths", function () {
var result = TypeScript.normalizePath("http://www.server.com/share/../someFile.ts");
var expected = "http://www.server.com/someFile.ts";
assert.equal(result, expected);
});
});
@@ -1,19 +0,0 @@
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
///<reference path='..\..\..\..\src\harness\harness.ts' />
describe('Compiling unittests\\compiler\\propertySignatureTests.ts', function() {
it('The Identifier of a property signature must be unique within its containing type. ', function(){
var code = 'var foo: { a:string; a: string; };';
Harness.Compiler.compileString(code, 'property signatures', function(result) {
assert.equal(result.errors.length, 1);
//assert.compilerWarning(result, 1, 9, 'Duplicate identifier a');
});
});
it('If a property signature omits a TypeAnnotation, the Any type is assumed.', function(){
var code = 'var foo: { a; }; foo.a = 2; foo.a = "0";';
Harness.Compiler.compileString(code, 'property signatures', function(result) {
assert.equal(result.errors.length, 0);
});
})
});
@@ -1,172 +0,0 @@
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
///<reference path='..\..\..\..\src\harness\harness.ts' />
///<reference path='..\..\..\..\src\services\typescriptServices.ts' />
class TestSourceFile {
constructor(
public fileName: string,
public version: number,
public scriptSnapshot: TypeScript.IScriptSnapshot,
public isOpen: boolean,
public byteOrderMark: TypeScript.ByteOrderMark = TypeScript.ByteOrderMark.Utf8) {
}
}
class TestHostSettings {
constructor(
public files: TypeScript.StringHashTable<TestSourceFile>,
public compilationSettings: TypeScript.CompilationSettings = TypeScript.ImmutableCompilationSettings.defaultSettings().toCompilationSettings()) {
}
}
describe("testDocumentRetrievalAndUpdate", () => {
function getHost(settings: TestHostSettings): TypeScript.Services.ILanguageServiceHost {
return {
getCompilationSettings(): TypeScript.CompilationSettings {
return settings.compilationSettings;
},
getScriptFileNames(): string[]{
return settings.files.getAllKeys();
},
getScriptVersion(fileName: string): number {
return settings.files.lookup(fileName).version;
},
getScriptIsOpen(fileName: string): boolean {
return settings.files.lookup(fileName).isOpen;
},
getScriptByteOrderMark(fileName: string): TypeScript.ByteOrderMark {
return settings.files.lookup(fileName).byteOrderMark;
},
getScriptSnapshot(fileName: string): TypeScript.IScriptSnapshot {
return settings.files.lookup(fileName).scriptSnapshot;
},
getDiagnosticsObject(): TypeScript.Services.ILanguageServicesDiagnostics {
throw TypeScript.Errors.notYetImplemented();
},
getLocalizedDiagnosticMessages(): any {
return null;
},
information(): boolean {
return false;
},
debug(): boolean {
return false;
},
warning(): boolean {
return false;
},
error(): boolean {
return false;
},
fatal(): boolean {
return false;
},
log(s: string): void {
},
resolveRelativePath(path: string, directory: string): string {
throw TypeScript.Errors.notYetImplemented();
},
fileExists(path: string): boolean {
throw TypeScript.Errors.notYetImplemented();
},
directoryExists(path: string): boolean {
throw TypeScript.Errors.notYetImplemented();
},
getParentDirectory(path: string): string {
throw TypeScript.Errors.notYetImplemented();
},
getCancellationToken(): TypeScript.ICancellationToken {
return TypeScript.CancellationToken.None;
}
}
}
function getLanguageServiceCompiler(ls: TypeScript.Services.ILanguageService): TypeScript.Services.LanguageServiceCompiler {
return <TypeScript.Services.LanguageServiceCompiler>(<any>ls).compiler
}
it("documents are shared between projects", () => {
function ensureDocumentIsShared(prefix: string, ls1: TypeScript.Services.ILanguageService, ls2: TypeScript.Services.ILanguageService, fileName: string): void {
var c1 = getLanguageServiceCompiler(ls1);
var c2 = getLanguageServiceCompiler(ls2);
// getDocument synchronized its internal state with host
var doc1 = c1.getDocument(fileName);
var doc2 = c2.getDocument(fileName);
if (doc1 !== doc2) {
throw new Error(prefix + ":document should be shared between language services");
}
}
var files = new TypeScript.StringHashTable<TestSourceFile>();
var f1 = new TestSourceFile("file1.ts", 1, TypeScript.ScriptSnapshot.fromString("var x = 1;"), false);
files.add(f1.fileName, f1);
var factory = new TypeScript.Services.TypeScriptServicesFactory();
var hostSettings = new TestHostSettings(files);
var ls1 = factory.createPullLanguageService(getHost(hostSettings));
var ls2 = factory.createPullLanguageService(getHost(hostSettings));
ensureDocumentIsShared("==1==", ls1, ls2, f1.fileName);
f1.version = 2;
f1.scriptSnapshot = TypeScript.ScriptSnapshot.fromString("var x = 2;");
ensureDocumentIsShared("==2==", ls1, ls2, f1.fileName);
});
it("documents are refreshed when settings in compilation settings affect syntax", () => {
var files = new TypeScript.StringHashTable<TestSourceFile>();
var f1 = new TestSourceFile("file1.ts", 1, TypeScript.ScriptSnapshot.fromString("var x = 1;"), false);
files.add(f1.fileName, f1);
var factory = new TypeScript.Services.TypeScriptServicesFactory();
var hostSettings = new TestHostSettings(files);
var factory = new TypeScript.Services.TypeScriptServicesFactory();
var ls = factory.createPullLanguageService(getHost(hostSettings));
var compiler = getLanguageServiceCompiler(ls);
var d1 = compiler.getDocument(f1.fileName);
// change compilation setting that doesn't affect parsing - should have the same document
hostSettings.compilationSettings.generateDeclarationFiles = !hostSettings.compilationSettings.generateDeclarationFiles;
var d2 = compiler.getDocument(f1.fileName);
if (d1 !== d2) {
throw new Error("Expected to have the same document instance");
}
// change value of compilation setting that is used during production of AST - new document is required
hostSettings.compilationSettings.codeGenTarget = TypeScript.LanguageVersion.EcmaScript5;
var d3 = compiler.getDocument(f1.fileName);
if (d2 === d3) {
throw new Error("Changed codeGenTarget: Expected to have different instances of document");
}
hostSettings.compilationSettings.propagateEnumConstants = !hostSettings.compilationSettings.propagateEnumConstants;
var d4 = compiler.getDocument(f1.fileName);
if (d3 === d4) {
throw new Error("Changed propagateEnumConstants: Expected to have different instances of document");
}
hostSettings.compilationSettings.allowAutomaticSemicolonInsertion = !hostSettings.compilationSettings.allowAutomaticSemicolonInsertion;
var d5 = compiler.getDocument(f1.fileName);
if (d4 === d5) {
throw new Error("Changed allowAutomaticSemicolonInsertion: Expected to have different instances of document");
}
});
});
@@ -1,4 +0,0 @@
///<reference path='..\..\..\..\src\harness\harness.ts'/>
///<reference path='..\..\..\..\src\compiler\tsc.ts' />
///<reference path='..\..\..\..\src\compiler\typescript.ts' />
///<reference path='..\..\..\..\src\services\typescriptServices.ts' />
@@ -1,20 +0,0 @@
///<reference path='..\..\..\src\harness\harness.ts'/>
///<reference path='..\..\..\src\harness\baselining.ts'/>
declare var JSON: any;
describe('Accepting local files as new reference...', function() {
var localPath = 'tests/services/baselines/local';
var outputPath = 'tests/services/baselines/reference';
// Get a list of all the files in the baseline/inputs folder
var files = IO.dir(localPath);
// Copy them to the output folder
for (var i = 0; i < files.length; i++) {
var filename = files[i].substr(files[i].lastIndexOf('\\'));
if(filename.indexOf('.html') === -1) {
var referenceData = IO.readFile(files[i]);
IO.writeFile(outputPath + '/' + filename, referenceData);
}
}
});
@@ -1,66 +0,0 @@
/// <reference path='..\..\..\src\harness\harness.ts'/>
/// <reference path='..\..\..\src\harness\baselining.ts'/>
/// <reference path='..\..\..\src\harness\external\json2.ts'/>
describe('Baseline files match (intellisense data)', function() {
var inputPath = 'tests/services/baselines/inputs';
var outputPath = 'tests/services/baselines/local';
var referencePath = 'tests/services/baselines/reference';
var i;
// Might need to create this
IO.createDirectory(outputPath);
// Delete any old reports from the local path
var localFiles = IO.dir(outputPath);
for (i = 0; i < localFiles.length; i++) {
var localFilename = localFiles[i];
if(localFilename.indexOf('.html') > 0) {
IO.deleteFile(localFilename);
}
}
// Get a list of all the files in the baseline/inputs folder
var files = IO.dir(inputPath);
var template = IO.readFile('tests/services/baselines/diff-template.html');
// For each file, get data:
// a) Completion
// b) Type signature
// c) etc...
for (i = 0; i < files.length; i++) {
var filename = files[i].substr(files[i].lastIndexOf('\\'));
var scriptText = IO.readFile(files[i]).trim();
var outputAndCheck = function(nameSuffix: string, process: any) {
describe(nameSuffix + ' data for ' + filename + ' matches the baseline', function() {
var data = process(scriptText);
var stringified = JSON.stringify(data).trim();
var baseFilename = filename + '-' + nameSuffix + '.json';
IO.writeFile(outputPath + '/' + baseFilename, stringified);
var referenceFilename = referencePath + '/' + baseFilename;
var reference = IO.fileExists(referenceFilename) ? IO.readFile(referenceFilename) : '[{file: "(no file)"}]';
reference = reference.trim();
if (reference != stringified) {
// Emit a report file in 'local'
var errorReportFile = outputPath + filename + '-' + nameSuffix + '-diff.html';
IO.writeFile(errorReportFile,
template.replace('/**REFERENCE**/', reference).replace('/**ACTUAL**/', stringified));
throw new Error('Data does not match reference. Refer to diff report ' + errorReportFile);
}
});
};
// Write that data out to a JSON file in the 'local' folder
outputAndCheck('signatures', getIntellisenseSignatureRegions);
outputAndCheck('completions', getIntellisenseCompletionListRegions);
outputAndCheck('definitions', getIntellisenseDefinitionRegions);
outputAndCheck('types', getIntellisenseTypeRegions);
outputAndCheck('members', getIntellisenseMemberListRegions);
}
});
@@ -1,23 +0,0 @@
module Foo { var testing = ""; test }
class C1 {
public pubMeth() {this.} // test on 'this.'
private privMeth() {}
public pubProp;
private privProp;
}
var f = new C1();
f. // test on F.
module M {
export class C { public pub; private priv; }
export var V = 0;
}
var c = new M.C();
c. // test on c.
//Test for comment
//c.
@@ -1,215 +0,0 @@
interface IOptions {
name: string;
flag: boolean;
short: string;
usage: string;
set: (s: string) => void;
type: string;
}
class OptionsParser {
private DEFAULT_SHORT_FLAG = "-";
private DEFAULT_LONG_FLAG = "--";
constructor (private host: IIO) { }
// Find the option record for the given string. Returns null if not found.
private findOption(arg: string) {
for (var i = 0; i < this.options.length; i++) {
if (arg === this.options[i].short || arg === this.options[i].name) {
return this.options[i];
}
}
return null;
}
public unnamed: string[] = [];
public options: IOptions[] = [];
public printUsage() {
IO.printLine("Syntax: tsc [options] [file ..]");
IO.printLine("");
IO.printLine("Examples: tsc hello.ts");
IO.printLine(" tsc --out foo.js foo.ts");
IO.printLine(" tsc @args.txt");
IO.printLine("");
IO.printLine("Options:");
var output = [];
var maxLength = 0;
this.options = this.options.sort(function(a, b) {
var aName = a.name.toLowerCase();
var bName = b.name.toLowerCase();
if (aName > bName) {
return 1;
} else if (aName < bName) {
return -1;
} else {
return 0;
}
});
// Build up output array
for (var i = 0; i < this.options.length; i++) {
var option = this.options[i];
if (!option.usage)
break;
var usageString = " ";
var type = option.type ? " " + option.type.toUpperCase() : "";
if (option.short) {
usageString += this.DEFAULT_SHORT_FLAG + option.short + type + ", ";
}
usageString += this.DEFAULT_LONG_FLAG + option.name + type;
output.push([usageString, option.usage]);
if (usageString.length > maxLength) {
maxLength = usageString.length;
}
}
output.push([" @<file>", "Insert command line options and files from a file."]);
// Print padded output
for (var i = 0; i < output.length; i++) {
IO.printLine(output[i][0] + (new Array(maxLength - output[i][0].length + 3)).join(" ") + output[i][1]);
}
}
public option(name: string, config: IOptions);
public option(name: string, config: IOptions, short: string) {
if (!config) {
config = <any>short;
short = null;
}
config.name = name;
config.short = short;
config.flag = false;
this.options.push(config);
}
public flag(name: string, config: IOptions);
public flag(name: string, config: IOptions, short: string) {
if (!config) {
config = <any>short;
short = null;
}
config.name = name;
config.short = short;
config.flag = true
this.options.push(config);
}
// Parse an arguments string
public parseString(argString: string) {
var position = 0;
var tokens = argString.match(/\s+|"|[^\s"]+/g);
function peek() {
return tokens[position];
}
function consume() {
return tokens[position++];
}
function consumeQuotedString() {
var value = '';
consume(); // skip opening quote.
var token = peek();
while (token && token !== '"') {
consume();
value += token;
token = peek();
}
consume(); // skip ending quote;
return value;
}
var args: string[] = [];
var currentArg = '';
while (position < tokens.length) {
var token = peek();
if (token === '"') {
currentArg += consumeQuotedString();
} else if (token.match(/\s/)) {
if (currentArg.length > 0) {
args.push(currentArg);
currentArg = '';
}
consume();
} else {
consume();
currentArg += token;
}
}
if (currentArg.length > 0) {
args.push(currentArg);
}
this.parse(args);
}
// Parse arguments as they come from the platform: split into arguments.
public parse(args: string[]) {
var position = 0;
function consume() {
return args[position++];
}
while (position < args.length) {
var current = consume();
var match = current.match(/^(--?|\/|@)(.*)/);
var value = null;
if (match) {
if (match[1] === '@') {
this.parseString(IO.readFile(match[2]));
} else {
var arg = match[2];
var option = this.findOption(arg);
if (option === null) {
IO.printLine("Unknown option " + arg);
IO.printLine("");
this.printUsage();
} else {
if (!option.flag)
value = consume();
option.set(value);
}
}
} else {
this.unnamed.push(current);
}
}
}
}
@@ -1,2 +0,0 @@
[{"start":7,"end":11,"data":"(empty)"},{"start":11,"end":21,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\ntesting\tstring\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":21,"end":29,"data":"(empty)"},{"start":29,"end":31,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\ntesting\tstring\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":31,"end":34,"data":"(empty)"},{"start":34,"end":46,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\ntesting\tstring\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":46,"end":49,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":49,"end":55,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":55,"end":58,"data":"(empty)"},{"start":58,"end":71,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":71,"end":79,"data":"(empty)"},{"start":79,"end":118,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":118,"end":127,"data":"(empty)"},{"start":127,"end":141,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":141,"end":149,"data":"(empty)"},{"start":149,"end":164,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":164,"end":173,"data":"(empty)"},{"start":173,"end":181,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\narguments\tany\nc\tM.C\nf\tC1\nprivMeth\t() => void\nprivProp\tnumber\nprototype\tC1\npubMeth\t() => void\npubProp\tnumber\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":181,"end":188,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\n(present standard item) any\tany\n(present standard item) bool\tbool\n(present standard item) null\tnull\n(present standard item) number\tnumber\n(present standard item) string\tstring\n(present standard item) undefined\tundefined\n(present standard item) void\tvoid"},{"start":188,"end":190,"data":"(empty)"},{"start":190,"end":207,"data":"C1\tnew() => C1\nFoo\tFoo\nM\tM\nc\tM.C\nf\tC1\n(present standard item) any\tany\n(presenLine truncated
@@ -1,2 +0,0 @@
[{"start":17,"end":31,"data":"0\t17\t34\t\ttesting\t\tFoo"},{"start":33,"end":34,"data":"0\t17\t34\t\ttesting\t\tFoo"},{"start":49,"end":60,"data":"0\t55\t180\t\tC1\t\t__GLO"},{"start":71,"end":79,"data":"0\t64\t88\t\tpubMeth\t\tC1"},{"start":82,"end":87,"data":"0\t55\t180\t\tC1\t\t__GLO"},{"start":118,"end":127,"data":"0\t110\t131\t\tprivMeth\t\tC1"},{"start":134,"end":151,"data":"0\t134\t153\t\tpubProp\t\tC1"},{"start":152,"end":153,"data":"0\t134\t153\t\tpubProp\t\tC1"},{"start":156,"end":175,"data":"0\t156\t177\t\tprivProp\t\tC1"},{"start":176,"end":177,"data":"0\t156\t177\t\tprivProp\t\tC1"},{"start":184,"end":192,"data":"0\t184\t201\t\tf\t\t__GLO"},{"start":192,"end":200,"data":"0\t55\t180\t\tC1\t\t__GLO"},{"start":200,"end":201,"data":"0\t184\t201\t\tf\t\t__GLO"},{"start":203,"end":206,"data":"0\t184\t201\t\tf\t\t__GLO"},{"start":221,"end":230,"data":"0\t221\t315\t\tM\t\t__GLO"},{"start":237,"end":252,"data":"0\t250\t289\t\tC\t\tM"},{"start":254,"end":267,"data":"0\t254\t269\t\tpub\t\tM.C"},{"start":268,"end":269,"data":"0\t254\t269\t\tpub\t\tM.C"},{"start":270,"end":285,"data":"0\t270\t287\t\tpriv\t\tM.C"},{"start":286,"end":287,"data":"0\t270\t287\t\tpriv\t\tM.C"},{"start":295,"end":310,"data":"0\t295\t312\t\tV\t\tM"},{"start":311,"end":312,"data":"0\t295\t312\t\tV\t\tM"},{"start":321,"end":329,"data":"0\t321\t339\t\tc\t\t__GLO"},{"start":329,"end":333,"data":"0\t250\t289\t\tC\t\tM"},{"start":333,"end":335,"data":"0\t221\t315\t\tM\t\t__GLO"},{"start":335,"end":338,"data":"0\t250\t289\t\tC\t\tM"},{"start":338,"end":339,"data":"0\t321\t339\t\tc\t\t__GLO"},{"start":343,"end":346,"data":"0\t321\t339\t\tc\t\t__GLO"}]
@@ -1,2 +0,0 @@
[{"start":87,"end":88,"data":"pubMeth\t() => void\npubProp\tnumber\nprivMeth\t() => void\nprivProp\tnumber\n"},{"start":205,"end":206,"data":"pubMeth\t() => void\npubProp\tnumber\n"},{"start":335,"end":336,"data":"C\tnew() => M.C\nV\tnumber\n"},{"start":345,"end":346,"data":"pub\tnumber\n"}]
@@ -1,2 +0,0 @@
[{"start":192,"end":200,"data":"C1(): C1\n"},{"start":329,"end":338,"data":"C(): C\n"}]
@@ -1,2 +0,0 @@
[{"start":17,"end":34,"data":"string"},{"start":34,"end":39,"data":"Foo"},{"start":39,"end":43,"data":"any"},{"start":43,"end":45,"data":"Foo"},{"start":49,"end":64,"data":"new() => C1"},{"start":64,"end":82,"data":"() => void"},{"start":82,"end":87,"data":"C1"},{"start":87,"end":88,"data":"() => void"},{"start":88,"end":89,"data":"new() => C1"},{"start":108,"end":110,"data":"new() => C1"},{"start":110,"end":131,"data":"() => void"},{"start":131,"end":134,"data":"new() => C1"},{"start":134,"end":153,"data":"number"},{"start":153,"end":156,"data":"new() => C1"},{"start":156,"end":177,"data":"number"},{"start":177,"end":180,"data":"new() => C1"},{"start":184,"end":196,"data":"C1"},{"start":196,"end":198,"data":"new() => C1"},{"start":198,"end":201,"data":"C1"},{"start":203,"end":205,"data":"C1"},{"start":221,"end":237,"data":"M"},{"start":237,"end":254,"data":"new() => C"},{"start":254,"end":269,"data":"number"},{"start":269,"end":270,"data":"new() => C"},{"start":270,"end":287,"data":"number"},{"start":287,"end":289,"data":"new() => C"},{"start":289,"end":295,"data":"M"},{"start":295,"end":312,"data":"number"},{"start":312,"end":315,"data":"M"},{"start":321,"end":333,"data":"M.C"},{"start":333,"end":334,"data":"M"},{"start":334,"end":336,"data":"new() => M.C"},{"start":336,"end":339,"data":"M.C"},{"start":343,"end":345,"data":"M.C"}]
@@ -1 +0,0 @@
[{"start":10,"end":19,"data":"(empty)"},{"start":19,"end":26,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":26,"end":31,"data":"(empty)"},{"start":31,"end":45,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":45,"end":50,"data":"(empty)"},{"start":50,"end":62,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":62,"end":68,"data":"(empty)"},{"start":68,"end":82,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":82,"end":88,"data":"(empty)"},{"start":88,"end":102,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":102,"end":106,"data":"(empty)"},{"start":106,"end":108,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":108,"end":110,"data":"(empty)"},{"start":110,"end":133,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":133,"end":138,"data":"(empty)"},{"start":138,"end":150,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\nflag bool\nname string\nset (s: string) => void\nshort string\ntype string\nusage string\n(standard items)"},{"start":150,"end":159,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":159,"end":173,"data":"(empty)"},{"start":173,"end":180,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":180,"end":186,"data":"(empty)"},{"start":186,"end":188,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":188,"end":207,"data":"(empty)"},{"start":207,"end":209,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":209,"end":213,"data":"(empty)"},{"start":213,"end":219,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":219,"end":225,"data":"(empty)"},{"start":225,"end":227,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":227,"end":245,"data":"(empty)"},{"start":245,"end":247,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":247,"end":252,"data":"(empty)"},{"start":252,"end":260,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":260,"end":296,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\narguments any\nhost any\n(standard items)"},{"start":296,"end":304,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":304,"end":378,"data":"(empty)"},{"start":378,"end":383,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":383,"end":391,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\narg string\narguments any\ni number\n(standard items)"},{"start":391,"end":406,"data":"(empty)"},{"start":406,"end":437,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\narg string\narguments any\ni number\n(standard items)"},{"start":437,"end":439,"data":"(empty)"},{"start":439,"end":658,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\narg string\narguments any\ni number\n(standard items)"},{"start":658,"end":665,"data":"IOptions IOptions\nOptionsParser new(host: any) => OptionsParser\n(standard items)"},{"start":665,"end":6Line truncated
@@ -1 +0,0 @@
[{"start":26,"end":32,"data":"0\t26\t39\t\tname\t\tIOptions"},{"start":45,"end":51,"data":"0\t45\t56\t\tflag\t\tIOptions"},{"start":62,"end":69,"data":"0\t62\t76\t\tshort\t\tIOptions"},{"start":82,"end":89,"data":"0\t82\t96\t\tusage\t\tIOptions"},{"start":102,"end":107,"data":"0\t102\t127\t\tset\t\tIOptions"},{"start":108,"end":111,"data":"0\t108\t117\t\ts\t\t<global>"},{"start":133,"end":139,"data":"0\t133\t146\t\ttype\t\tIOptions"},{"start":153,"end":173,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":180,"end":209,"data":"0\t180\t212\t\tDEFAULT_SHORT_FLAG\t\tOptionsParser"},{"start":219,"end":247,"data":"0\t219\t251\t\tDEFAULT_LONG_FLAG\t\tOptionsParser"},{"start":260,"end":272,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":273,"end":287,"data":"0\t273\t290\t\thost\t\tOptionsParser"},{"start":291,"end":292,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":383,"end":391,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":391,"end":402,"data":"0\t383\t657\t\tfindOption\t\tOptionsParser"},{"start":402,"end":407,"data":"0\t402\t413\t\targ\t\tOptionsParser.findOption"},{"start":414,"end":415,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":433,"end":441,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":444,"end":446,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":448,"end":452,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":452,"end":461,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":469,"end":471,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":495,"end":499,"data":"0\t402\t413\t\targ\t\tOptionsParser.findOption"},{"start":503,"end":507,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":507,"end":516,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":516,"end":518,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":518,"end":525,"data":"0\t62\t76\t\tshort\t\tIOptions"},{"start":528,"end":532,"data":"0\t402\t413\t\targ\t\tOptionsParser.findOption"},{"start":536,"end":540,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":540,"end":549,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":549,"end":551,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":551,"end":557,"data":"0\t26\t39\t\tname\t\tIOptions"},{"start":577,"end":584,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":584,"end":588,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":588,"end":597,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":597,"end":599,"data":"0\t433\t442\t\ti\t\tOptionsParser.findOption"},{"start":599,"end":600,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":665,"end":681,"data":"0\t665\t694\t\tunnamed\t\tOptionsParser"},{"start":689,"end":692,"data":"0\t665\t694\t\tunnamed\t\tOptionsParser"},{"start":703,"end":719,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":719,"end":729,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":729,"end":732,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":732,"end":734,"data":"0\t0\t149\t\tIOptions\t\t__GLO"},{"start":750,"end":761,"data":"0\t743\t2528\t\tprintUsage\t\tOptionsParser"},{"start":1102,"end":1115,"data":"0\t1102\t1118\t\toutput\t\tOptionsParser.printUsage"},{"start":1117,"end":1118,"data":"0\t1102\t1118\t\toutput\t\tOptionsParser.printUsage"},{"start":1128,"end":1144,"data":"0\t1128\t1146\t\tmaxLength\t\tOptionsParser.printUsage"},{"start":1145,"end":1146,"data":"0\t1128\t1146\t\tmaxLength\t\tOptionsParser.printUsage"},{"start":1158,"end":1162,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":1162,"end":1171,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":1173,"end":1177,"data":"0\t260\t295\t\tOptionsParser\t\t__GLO"},{"start":1177,"end":1186,"data":"0\t703\t734\t\toptions\t\tOptionsParser"},{"start":1200,"end":1202,"data":"0\t1200\t1201\t\ta\t\tOptionsParser.printUsage._anonymous"},{"start":1203,"end":1205,"data":"0\t1203\t1204\t\tb\t\tOptionsParser.printUsage._anonymous"},{"start":1221,"end":1233,"data":"0\t1221\t1254\t\taName\t\tOptionsParser.printUsage._anonymous"},{"start":1233,"end":1235,"data":"0\t1200\t1201\t\ta\t\tOptionsParser.printUsage._anonymous"},{"start":1253,"end":1254,"data":"0\t1221\t1254\t\taName\t\tOptionsParser.printUsage._anonymous"},{"start":1268,"end":1280,"data":"0\t1268\t1301\t\tbName\t\tOptionsParser.printUsage._anonymous"},{"start":1280,"end":1282,"data":"0\t1203\t1204\t\tb\t\tOptionsParser.printUsage._anonymous"},{"start":1300,"end":1301,"data":"0\t1268\t1301\t\tbName\t\tOptionsParser.printUsage._anonymous"},{"start":1321,"end":1327,"data":"0\t1221\t1254\t\taName\t\tOptionsParser.printUsage._anonymous"},{"start":1329,"end":1335,"data":"0\t1268\t1301\t\tbName\t\tOptionsParser.printUsage._anonymous"},{"start":1389,"end":1395,"data":"0\t1221\t1254\t\taName\t\tOptionsParser.printUsage._anonymous"},{"start":1397,"end":1403,"data":"0\t1268\t1301\t\tbName\t\tOptionsParser.printUsage._anonymous"},{"start":1561,"end":1569,"data":"0\t1561\t1570\t\ti\t\tOptionsParser.prinLine truncated
@@ -1 +0,0 @@
[{"start":453,"end":454,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":508,"end":509,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":519,"end":520,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":541,"end":542,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":552,"end":553,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":589,"end":590,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1163,"end":1164,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1178,"end":1179,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1581,"end":1582,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1635,"end":1636,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1674,"end":1675,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":1775,"end":1776,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":1795,"end":1796,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":1846,"end":1847,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":1892,"end":1893,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":1920,"end":1921,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":1991,"end":1992,"data":"unnamed\tstring[]\noptions\tIOptions[]\nprintUsage\t() => void\noption\t(name: string,config: IOptions): any; \nflag\t(name: string,config: IOptions): any; \nparseString\t(argString: string) => void\nparse\t(args: string[]) => void\nDEFAULT_SHORT_FLAG\tstring\nDEFAULT_LONG_FLAG\tstring\nhost\tany\nfindOption\t(arg: string) => IOptions\n"},{"start":2018,"end":2019,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":2079,"end":2080,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tstring\nset\t(s: string) => void\ntype\tstring\n"},{"start":2765,"end":2766,"data":"name\tstring\nflag\tbool\nshort\tstring\nusage\tsLine truncated
@@ -1,2 +0,0 @@
[{"start":3649,"end":3659,"data":"consume(): any\n"},{"start":3710,"end":3716,"data":"peek(): any\n"},{"start":3783,"end":3793,"data":"consume(): any\n"},{"start":3856,"end":3862,"data":"peek(): any\n"},{"start":3894,"end":3904,"data":"consume(): any\n"},{"start":4104,"end":4110,"data":"peek(): any\n"},{"start":4179,"end":4200,"data":"consumeQuotedString(): string\n"},{"start":4413,"end":4423,"data":"consume(): any\n"},{"start":4463,"end":4473,"data":"consume(): any\n"},{"start":4636,"end":4653,"data":"parse(args: string[]): void\n"},{"start":4956,"end":4965,"data":"consume(): string\n"},{"start":5147,"end":5164,"data":"parseString(argString: string): void\n"},{"start":5185,"end":5187,"data":"parseString(argString: string): void\n"},{"start":5289,"end":5309,"data":"findOption(arg: string): IOptions\n"},{"start":5489,"end":5507,"data":"printUsage(): void\n"},{"start":5618,"end":5627,"data":"consume(): string\n"},{"start":5656,"end":5674,"data":"set(s: string): void\n"}]
@@ -1 +0,0 @@
[{"start":26,"end":39,"data":"string"},{"start":39,"end":45,"data":"IOptions"},{"start":45,"end":56,"data":"bool"},{"start":56,"end":62,"data":"IOptions"},{"start":62,"end":76,"data":"string"},{"start":76,"end":82,"data":"IOptions"},{"start":82,"end":96,"data":"string"},{"start":96,"end":102,"data":"IOptions"},{"start":102,"end":108,"data":"(s: string) => void"},{"start":108,"end":117,"data":"string"},{"start":117,"end":122,"data":"(s: string) => void"},{"start":122,"end":126,"data":"void"},{"start":126,"end":127,"data":"(s: string) => void"},{"start":127,"end":133,"data":"IOptions"},{"start":133,"end":146,"data":"string"},{"start":146,"end":149,"data":"IOptions"},{"start":153,"end":180,"data":"new(host: any) => OptionsParser"},{"start":180,"end":212,"data":"string"},{"start":212,"end":219,"data":"new(host: any) => OptionsParser"},{"start":219,"end":251,"data":"string"},{"start":251,"end":273,"data":"new(host: any) => OptionsParser"},{"start":273,"end":290,"data":"any"},{"start":290,"end":303,"data":"new(host: any) => OptionsParser"},{"start":378,"end":383,"data":"new(host: any) => OptionsParser"},{"start":383,"end":402,"data":"(arg: string) => IOptions"},{"start":402,"end":413,"data":"string"},{"start":413,"end":428,"data":"(arg: string) => IOptions"},{"start":428,"end":433,"data":"void"},{"start":433,"end":442,"data":"number"},{"start":442,"end":444,"data":"void"},{"start":444,"end":445,"data":"number"},{"start":445,"end":448,"data":"bool"},{"start":448,"end":452,"data":"OptionsParser"},{"start":452,"end":460,"data":"IOptions[]"},{"start":460,"end":467,"data":"any"},{"start":467,"end":469,"data":"void"},{"start":469,"end":472,"data":"number"},{"start":472,"end":495,"data":"void"},{"start":495,"end":498,"data":"string"},{"start":498,"end":503,"data":"bool"},{"start":503,"end":507,"data":"OptionsParser"},{"start":507,"end":515,"data":"IOptions[]"},{"start":515,"end":516,"data":"IOptions"},{"start":516,"end":517,"data":"number"},{"start":517,"end":518,"data":"IOptions"},{"start":518,"end":524,"data":"string"},{"start":524,"end":528,"data":"bool"},{"start":528,"end":531,"data":"string"},{"start":531,"end":536,"data":"bool"},{"start":536,"end":540,"data":"OptionsParser"},{"start":540,"end":548,"data":"IOptions[]"},{"start":548,"end":549,"data":"IOptions"},{"start":549,"end":550,"data":"number"},{"start":550,"end":551,"data":"IOptions"},{"start":551,"end":556,"data":"string"},{"start":556,"end":577,"data":"void"},{"start":577,"end":584,"data":"IOptions"},{"start":584,"end":588,"data":"OptionsParser"},{"start":588,"end":596,"data":"IOptions[]"},{"start":596,"end":597,"data":"IOptions"},{"start":597,"end":598,"data":"number"},{"start":598,"end":600,"data":"IOptions"},{"start":600,"end":626,"data":"void"},{"start":626,"end":638,"data":"(arg: string) => IOptions"},{"start":638,"end":650,"data":"any"},{"start":650,"end":657,"data":"(arg: string) => IOptions"},{"start":657,"end":665,"data":"new(host: any) => OptionsParser"},{"start":665,"end":681,"data":"string[]"},{"start":681,"end":687,"data":"string"},{"start":687,"end":694,"data":"string[]"},{"start":694,"end":703,"data":"new(host: any) => OptionsParser"},{"start":703,"end":719,"data":"IOptions[]"},{"start":719,"end":727,"data":"IOptions"},{"start":727,"end":734,"data":"IOptions[]"},{"start":734,"end":743,"data":"new(host: any) => OptionsParser"},{"start":743,"end":774,"data":"() => void"},{"start":774,"end":787,"data":"any"},{"start":787,"end":826,"data":"string"},{"start":826,"end":828,"data":"any"},{"start":828,"end":838,"data":"() => void"},{"start":838,"end":851,"data":"any"},{"start":851,"end":853,"data":"string"},{"start":853,"end":855,"data":"any"},{"start":855,"end":865,"data":"() => void"},{"start":865,"end":878,"data":"any"},{"start":878,"end":907,"data":"string"},{"start":907,"end":909,"data":"any"},{"start":909,"end":919,"data":"() => void"},{"start":919,"end":932,"data":"any"},{"start":932,"end":972,"data":"string"},{"start":972,"end":974,"data":"any"},{"start":974,"end":984,"data":"() => void"},{"start":984,"end":997,"data":"any"},{"start":997,"end":1026,"data":"string"},{"start":1026,"end":1028,"data":"any"},{"start":1028,"end":1038,"data":"() => void"},{"start":1038,"end":1051,"data":"any"},{"start":1051,"end":1053,"data":"string"},{"start":1053,"end":1055,"data":"any"},{"start":1055,"end":1065,"data":"() => void"},{"start":1065,"end":1078,"data":"any"},{"start":1078,"end":1088,"data":"string"},{"start":1088,"end":1090,"data":"any"},{"start":1090,"end":1102,"data":"() => void"},{"start":1102,"end":1118,"data":"any[]"},{"start":1118,"end":1128,"data":"() => void"},{"start":1128,"end":1146,"data":"number"},{"start":1146,"end":1158,"data":"() => void"},{"start":1158,"end":1162,"data":"OptionsParser"},{"start":1162,"end":1170,"data":"IOptions[]"},{"start":1170,"end":1173,"data":"any"},{"start":1173,"end":1177,"data":"OptionsParser"},{"start":1177,"end":1185,"data":"IOptions[]"},{"start":1185,"end":1190,"data":"any"},{"start":1190,"end":1191,"data":"Line truncated
+132 -152
View File
@@ -1,198 +1,178 @@
///<reference path='_project.ts'/>
interface Classification {
interface Classification {
position: number;
length: number;
class2: TypeScript.TokenClass;
class: ts.TokenClass;
}
interface ClassiferResult {
tuples: Classification[];
finalLexState: TypeScript.LexState;
finalEndOfLineState: ts.EndOfLineState;
}
var TokenClassNames = {};
TokenClassNames[TypeScript.TokenClass.Punctuation] = "Punctuation";
TokenClassNames[TypeScript.TokenClass.Keyword] = "Keyword";
TokenClassNames[TypeScript.TokenClass.Operator] = "Operator";
TokenClassNames[TypeScript.TokenClass.Comment] = "Comment";
TokenClassNames[TypeScript.TokenClass.Whitespace] = "Whitespace";
TokenClassNames[TypeScript.TokenClass.Identifier] = "Identifier";
TokenClassNames[TypeScript.TokenClass.NumberLiteral] = "NumberLiteral";
TokenClassNames[TypeScript.TokenClass.StringLiteral] = "StringLiteral";
TokenClassNames[TypeScript.TokenClass.RegExpLiteral] = "RegExpLiteral";
interface ClassificationEntry {
value: any;
class: ts.TokenClass;
}
describe('Colorization', function () {
var mytypescriptLS = new Harness.LanguageService.TypeScriptLS();
var myclassifier = mytypescriptLS.getClassifier();
describe('Colorization', function() {
var mytypescriptLS = new Harness.TypeScriptLS();
var myls = mytypescriptLS.getLanguageService();
var myclassifier = new Services.ClassifierShim(myls.host);
function getClassifications(code: string, initialLexState?: TypeScript.LexState = TypeScript.LexState.Start): ClassiferResult {
var classResult = myclassifier.getClassificationsForLine(code, initialLexState).split('\n');
function getClassifications(code: string, initialEndOfLineState: ts.EndOfLineState = ts.EndOfLineState.Start): ClassiferResult {
var classResult = myclassifier.getClassificationsForLine(code, initialEndOfLineState).split('\n');
var tuples: Classification[] = [];
var i = 0;
var position = 0;
for (; i < classResult.length - 1; i += 2) {
tuples[i / 2] = {
var t = tuples[i / 2] = {
position: position,
length: parseInt(classResult[i]),
class2: parseInt(classResult[i + 1])
class: parseInt(classResult[i + 1])
};
assert.isTrue(t.length > 0, "Result length should be greater than 0, got :" + t.length);
position += t.length;
}
var finalLexState = classResult[classResult.length - 1];
var finalEndOfLineState = classResult[classResult.length - 1];
assert.equal(position, code.length, "Expected accumilative length of all entries to match the length of the source. expected: " + code.length + ", but got: " + position);
return {
tuples: tuples,
finalLexState: parseInt(finalLexState)
finalEndOfLineState: parseInt(finalEndOfLineState)
};
}
function verifyClassification(classification: Classification, expectedLength: number, expectedClass: number) {
assert.notNull(classification);
assert.is(classification.length === expectedLength, "Classification length does not match expected. Expected: " + expectedLength + ", Actual: " + classification.length);
assert.is(classification.class2 === expectedClass, "Classification class does not match expected. Expected: " + TokenClassNames[expectedClass] + ", Actual: " + TokenClassNames[classification.class2]);
assert.isNotNull(classification);
assert.equal(classification.length, expectedLength, "Classification length does not match expected. Expected: " + expectedLength + ", Actual: " + classification.length);
assert.equal(classification.class, expectedClass, "Classification class does not match expected. Expected: " + ts.TokenClass[expectedClass] + ", Actual: " + ts.TokenClass[classification.class]);
}
describe("test cases for colorization", function() {
var results = getClassifications('var x:string = "foo"; //Hello');
it("checks for a keyword", function() {
verifyClassification(results.tuples[0], 3, TypeScript.TokenClass.Keyword);
function getEntryAtPosistion(result: ClassiferResult, position: number) {
for (var i = 0, n = result.tuples.length; i < n; i++) {
if (result.tuples[i].position === position) return result.tuples[i];
}
return undefined;
}
function punctuation(text: string) { return { value: text, class: ts.TokenClass.Punctuation }; }
function keyword(text: string) { return { value: text, class: ts.TokenClass.Keyword }; }
function operator(text: string) { return { value: text, class: ts.TokenClass.Operator }; }
function comment(text: string) { return { value: text, class: ts.TokenClass.Comment }; }
function whitespace(text: string) { return { value: text, class: ts.TokenClass.Whitespace }; }
function identifier(text: string) { return { value: text, class: ts.TokenClass.Identifier }; }
function numberLiteral(text: string) { return { value: text, class: ts.TokenClass.NumberLiteral }; }
function stringLiteral(text: string) { return { value: text, class: ts.TokenClass.StringLiteral }; }
function regExpLiteral(text: string) { return { value: text, class: ts.TokenClass.RegExpLiteral }; }
function finalEndOfLineState(value: number) { return { value: value, class: undefined }; }
function test(text: string, initialEndOfLineState: ts.EndOfLineState, ...expectedEntries: ClassificationEntry[]): void {
var result = getClassifications(text, initialEndOfLineState);
for (var i = 0, n = expectedEntries.length; i < n; i++) {
var expectedEntry = expectedEntries[i];
if (expectedEntry.class === undefined) {
assert.equal(result.finalEndOfLineState, expectedEntry.value, "final endOfLineState does not match expected.");
}
else {
var actualEntryPosition = text.indexOf(expectedEntry.value);
assert(actualEntryPosition >= 0, "token: '" + expectedEntry.value + "' does not exit in text: '" + text + "'.");
var actualEntry = getEntryAtPosistion(result, actualEntryPosition);
assert(actualEntry, "Could not find classification entry for '" + expectedEntry.value + "' at position: " + actualEntryPosition);
assert.equal(actualEntry.length, expectedEntry.value.length, "Classification class does not match expected.");
assert.equal(actualEntry.class, expectedEntry.class, "Classification class does not match expected.");
}
}
}
describe("test getClassifications", function () {
it("Returns correct token classes", function () {
test("var x: string = \"foo\"; //Hello",
ts.EndOfLineState.Start,
keyword("var"),
whitespace(" "),
identifier("x"),
punctuation(":"),
keyword("string"),
operator("="),
stringLiteral("\"foo\""),
comment("//Hello"),
punctuation(";"));
});
it("checks for a whitespace", function() {
verifyClassification(results.tuples[1], 4, TypeScript.TokenClass.Whitespace);
it("classifies correctelly a comment after a divide operator", function () {
test("1 / 2 // comment",
ts.EndOfLineState.Start,
numberLiteral("1"),
whitespace(" "),
operator("/"),
numberLiteral("2"),
comment("// comment"));
});
it("checks for a identifier", function() {
verifyClassification(results.tuples[2], 5, TypeScript.TokenClass.Identifier);
it("classifies correctelly a literal after a divide operator", function () {
test("1 / 2, 3 / 4",
ts.EndOfLineState.Start,
numberLiteral("1"),
whitespace(" "),
operator("/"),
numberLiteral("2"),
numberLiteral("3"),
numberLiteral("4"),
operator(","));
});
it("checks for an punctuation", function() {
verifyClassification(results.tuples[3], 6, TypeScript.TokenClass.Punctuation);
});
it("checks for a operator", function() {
verifyClassification(results.tuples[6], 14, TypeScript.TokenClass.Operator);
it("classifies correctelly an unterminated multi-line string", function () {
test("'line1\\",
ts.EndOfLineState.Start,
stringLiteral("'line1\\"),
finalEndOfLineState(ts.EndOfLineState.InSingleQuoteStringLiteral));
});
it("checks for a string literal", function() {
verifyClassification(results.tuples[8], 20, TypeScript.TokenClass.StringLiteral);
it("classifies correctelly the second line of an unterminated multi-line string", function () {
test("\\",
ts.EndOfLineState.InDoubleQuoteStringLiteral,
stringLiteral("\\"),
finalEndOfLineState(ts.EndOfLineState.InDoubleQuoteStringLiteral));
});
it("checks for a comment", function() {
verifyClassification(results.tuples[11], 29, TypeScript.TokenClass.Comment);
});
});
describe("test comment colorization after a divide operator", function() {
var results = getClassifications('1 / 1 // comment');
it("checks for a number literal", function() {
verifyClassification(results.tuples[0], 1, TypeScript.TokenClass.NumberLiteral);
it("classifies correctelly the last line of a multi-line string", function () {
test("'",
ts.EndOfLineState.InSingleQuoteStringLiteral,
stringLiteral("'"),
finalEndOfLineState(ts.EndOfLineState.Start));
});
it("checks for a whitespace", function() {
verifyClassification(results.tuples[1], 2, TypeScript.TokenClass.Whitespace);
it("classifies correctelly an unterminated multiline comment", function () {
test("/*",
ts.EndOfLineState.Start,
comment("/*"),
finalEndOfLineState(ts.EndOfLineState.InMultiLineCommentTrivia));
});
it("checks for a operator", function() {
verifyClassification(results.tuples[2], 3, TypeScript.TokenClass.Operator);
it("classifies correctelly an unterminated multiline comment with trailing space", function () {
test("/* ",
ts.EndOfLineState.Start,
comment("/* "),
finalEndOfLineState(ts.EndOfLineState.InMultiLineCommentTrivia));
});
it("checks for a whitespace", function() {
verifyClassification(results.tuples[3], 4, TypeScript.TokenClass.Whitespace);
it("classifies correctelly a keyword after a dot", function () {
test("a.var",
ts.EndOfLineState.Start,
identifier("var"));
});
it("checks for a number literal", function() {
verifyClassification(results.tuples[4], 5, TypeScript.TokenClass.NumberLiteral);
});
it("checks for a whitespace", function() {
verifyClassification(results.tuples[5], 6, TypeScript.TokenClass.Whitespace);
});
it("checks for a comment", function() {
verifyClassification(results.tuples[6], 16, TypeScript.TokenClass.Comment);
});
});
describe("test literal colorization after a divide operator", function() {
var results = getClassifications('1 / 2, 1 / 2');
it("checks for a number literal", function() {
verifyClassification(results.tuples[0], 1, TypeScript.TokenClass.NumberLiteral);
});
it("checks for a whitespace", function() {
verifyClassification(results.tuples[1], 2, TypeScript.TokenClass.Whitespace);
});
it("checks for a operator", function() {
verifyClassification(results.tuples[2], 3, TypeScript.TokenClass.Operator);
});
it("checks for a whitespace", function() {
verifyClassification(results.tuples[3], 4, TypeScript.TokenClass.Whitespace);
});
it("checks for a number literal", function() {
verifyClassification(results.tuples[4], 5, TypeScript.TokenClass.NumberLiteral);
});
it("checks for a operator", function() {
verifyClassification(results.tuples[5], 6, TypeScript.TokenClass.Operator);
});
it("checks for a whitespace", function() {
verifyClassification(results.tuples[6], 7, TypeScript.TokenClass.Whitespace);
});
it("checks for a number literal", function() {
verifyClassification(results.tuples[7], 8, TypeScript.TokenClass.NumberLiteral);
});
it("checks for a whitespace", function() {
verifyClassification(results.tuples[8], 9, TypeScript.TokenClass.Whitespace);
});
it("checks for a operator", function() {
verifyClassification(results.tuples[9], 10, TypeScript.TokenClass.Operator);
});
it("checks for a whitespace", function() {
verifyClassification(results.tuples[10], 11, TypeScript.TokenClass.Whitespace);
});
it("checks for a number literal", function() {
verifyClassification(results.tuples[11], 12, TypeScript.TokenClass.NumberLiteral);
});
});
describe("test cases for colorizing multi-line string", function() {
it("classifies first line correctelly", function() {
var results = getClassifications("'line1\\\n", TypeScript.LexState.Start);
assert.equal(results.tuples.length, 1);
verifyClassification(results.tuples[0], 8, TypeScript.TokenClass.StringLiteral);
assert.equal(results.finalLexState, TypeScript.LexState.InMultilineSingleQuoteString);
});
it("classifies second line correctelly", function() {
var results = getClassifications("\\\n", TypeScript.LexState.InMultilineSingleQuoteString);
assert.equal(results.tuples.length, 1);
verifyClassification(results.tuples[0], 2, TypeScript.TokenClass.StringLiteral);
assert.equal(results.finalLexState, TypeScript.LexState.InMultilineSingleQuoteString);
});
it("classifies third line correctelly", function() {
var results = getClassifications("'", TypeScript.LexState.InMultilineSingleQuoteString);
assert.equal(results.tuples.length, 1);
verifyClassification(results.tuples[0], 1, TypeScript.TokenClass.StringLiteral);
assert.equal(results.finalLexState, TypeScript.LexState.Start);
it("classifies keyword after a dot on previous line", function () {
test("var",
ts.EndOfLineState.EndingWithDotToken,
identifier("var"),
finalEndOfLineState(ts.EndOfLineState.Start));
});
});
});
@@ -0,0 +1,38 @@
///<reference path='..\..\..\..\src\harness\harness.ts' />
describe("DocumentRegistry", () => {
it("documents are shared between projects", () => {
var documentRegistry = ts.createDocumentRegistry();
var defaultCompilerOptions = ts.getDefaultCompilerOptions();
var f1 = documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, TypeScript.ScriptSnapshot.fromString("var x = 1;"), 1, false);
var f2 = documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, TypeScript.ScriptSnapshot.fromString("var x = 1;"), 1, false);
assert(f1 === f2, "DocumentRegistry should return the same document for the same name");
});
it("documents are refreshed when settings in compilation settings affect syntax", () => {
var documentRegistry = ts.createDocumentRegistry();
var compilerOptions: ts.CompilerOptions = { target: ts.ScriptTarget.ES5, module: ts.ModuleKind.AMD };
// change compilation setting that doesn't affect parsing - should have the same document
compilerOptions.declaration = true;
var f1 = documentRegistry.acquireDocument("file1.ts", compilerOptions, TypeScript.ScriptSnapshot.fromString("var x = 1;"), 1, false);
compilerOptions.declaration = false;
var f2 = documentRegistry.acquireDocument("file1.ts", compilerOptions, TypeScript.ScriptSnapshot.fromString("var x = 1;"), 1, false);
assert(f1 === f2, "Expected to have the same document instance");
// change value of compilation setting that is used during production of AST - new document is required
compilerOptions.target = ts.ScriptTarget.ES3;
var f3 = documentRegistry.acquireDocument("file1.ts", compilerOptions, TypeScript.ScriptSnapshot.fromString("var x = 1;"), 1, false);
assert(f1 !== f3, "Changed target: Expected to have different instances of document");
compilerOptions.module = ts.ModuleKind.CommonJS;
var f4 = documentRegistry.acquireDocument("file1.ts", compilerOptions, TypeScript.ScriptSnapshot.fromString("var x = 1;"), 1, false);
assert(f1 !== f4, "Changed module: Expected to have different instances of document");
});
});
@@ -1,3 +0,0 @@
///<reference path='_project.ts'/>
DumpAST.compareDumpFilesWithBaseline();
@@ -1,9 +0,0 @@
///<reference path='..\..\..\harness\dumpAST-baselining.ts'/>
describe('dumpAST-create-baselines', function() {
describe("create test baseline files for AST source locations", function() {
it("create baseline files", function() {
DumpAST.generateBaselineFiles();
});
});
});
@@ -0,0 +1,79 @@
class a {
constructor ( n : number ) ;
constructor ( s : string ) ;
constructor ( ns : any ) {
}
public pgF ( ) { } ;
public pv ;
public get d ( ) {
return 30 ;
}
public set d ( ) {
}
public static get p2 ( ) {
return { x : 30 , y : 40 } ;
}
private static d2 ( ) {
}
private static get p3 ( ) {
return "string" ;
}
private pv3 ;
private foo ( n : number ) : string ;
private foo ( s : string ) : string ;
private foo ( ns : any ) {
return ns.toString ( ) ;
}
}
class b extends a {
}
class m1b {
}
interface m1ib {
}
class c extends m1b {
}
class ib2 implements m1ib {
}
declare class aAmbient {
constructor ( n : number ) ;
constructor ( s : string ) ;
public pgF ( ) : void ;
public pv ;
public d : number ;
static p2 : { x : number ; y : number ; } ;
static d2 ( ) ;
static p3 ;
private pv3 ;
private foo ( s ) ;
}
class d {
private foo ( n : number ) : string ;
private foo ( ns : any ) {
return ns.toString ( ) ;
}
private foo ( s : string ) : string ;
}
class e {
private foo ( ns : any ) {
return ns.toString ( ) ;
}
private foo ( s : string ) : string ;
private foo ( n : number ) : string ;
}
@@ -0,0 +1,79 @@
class a {
constructor(n: number);
constructor(s: string);
constructor(ns: any) {
}
public pgF() { };
public pv;
public get d() {
return 30;
}
public set d() {
}
public static get p2() {
return { x: 30, y: 40 };
}
private static d2() {
}
private static get p3() {
return "string";
}
private pv3;
private foo(n: number): string;
private foo(s: string): string;
private foo(ns: any) {
return ns.toString();
}
}
class b extends a {
}
class m1b {
}
interface m1ib {
}
class c extends m1b {
}
class ib2 implements m1ib {
}
declare class aAmbient {
constructor(n: number);
constructor(s: string);
public pgF(): void;
public pv;
public d: number;
static p2: { x: number; y: number; };
static d2();
static p3;
private pv3;
private foo(s);
}
class d {
private foo(n: number): string;
private foo(ns: any) {
return ns.toString();
}
private foo(s: string): string;
}
class e {
private foo(ns: any) {
return ns.toString();
}
private foo(s: string): string;
private foo(n: number): string;
}
@@ -0,0 +1,4 @@
class foo {
constructor (n?: number, m? = 5, o?: string = "") { }
x:number = 1?2:3;
}
@@ -0,0 +1,4 @@
class foo {
constructor(n?: number, m? = 5, o?: string = "") { }
x: number = 1 ? 2 : 3;
}
@@ -0,0 +1,3 @@
$ ( document ) . ready ( function ( ) {
alert ( 'i am ready' ) ;
} );
@@ -0,0 +1,3 @@
$(document).ready(function() {
alert('i am ready');
});
@@ -0,0 +1,10 @@
function foo ( x : { } ) { }
foo ( { } ) ;
interface bar {
x : { } ;
y : ( ) => { } ;
}
@@ -0,0 +1,10 @@
function foo(x: {}) { }
foo({});
interface bar {
x: {};
y: () => {};
}
@@ -0,0 +1,112 @@
// valid
( ) => 1 ;
( arg ) => 2 ;
arg => 2 ;
( arg = 1 ) => 3 ;
( arg ? ) => 4 ;
( arg : number ) => 5 ;
( arg : number = 0 ) => 6 ;
( arg ? : number ) => 7 ;
( ... arg : number [ ] ) => 8 ;
( arg1 , arg2 ) => 12 ;
( arg1 = 1 , arg2 =3 ) => 13 ;
( arg1 ? , arg2 ? ) => 14 ;
( arg1 : number , arg2 : number ) => 15 ;
( arg1 : number = 0 , arg2 : number = 1 ) => 16 ;
( arg1 ? : number , arg2 ? : number ) => 17 ;
( arg1 , ... arg2 : number [ ] ) => 18 ;
( arg1 , arg2 ? : number ) => 19 ;
// in paren
( ( ) => 21 ) ;
( ( arg ) => 22 ) ;
( ( arg = 1 ) => 23 ) ;
( ( arg ? ) => 24 ) ;
( ( arg : number ) => 25 ) ;
( ( arg : number = 0 ) => 26 ) ;
( ( arg ? : number ) => 27 ) ;
( ( ... arg : number [ ] ) => 28 ) ;
// in multiple paren
( ( ( ( ( arg ) => { return 32 ; } ) ) ) ) ;
// in ternary exression
false ? ( ) => 41 : null ;
false ? ( arg ) => 42 : null ;
false ? ( arg = 1 ) => 43 : null ;
false ? ( arg ? ) => 44 : null ;
false ? ( arg : number ) => 45 : null ;
false ? ( arg ? : number ) => 46 : null ;
false ? ( arg ? : number = 0 ) => 47 : null ;
false ? ( ... arg : number [ ] ) => 48 : null ;
// in ternary exression within paren
false ? ( ( ) => 51 ) : null ;
false ? ( ( arg ) => 52 ) : null ;
false ? ( ( arg = 1 ) => 53 ) : null ;
false ? ( ( arg ? ) => 54 ) : null ;
false ? ( ( arg : number ) => 55 ) : null ;
false ? ( ( arg ? : number ) => 56 ) : null ;
false ? ( ( arg ? : number = 0 ) => 57 ) : null ;
false ? ( ( ... arg : number [ ] ) => 58 ) : null ;
// ternary exression's else clause
false ? null : ( ) => 61 ;
false ? null : ( arg ) => 62 ;
false ? null : ( arg = 1 ) => 63 ;
false ? null : ( arg ? ) => 64 ;
false ? null : ( arg : number ) => 65 ;
false ? null : ( arg ? : number ) => 66 ;
false ? null : ( arg ? : number = 0 ) => 67 ;
false ? null : ( ... arg : number [ ] ) => 68 ;
// nested ternary expressions
( a ? ) => { return a ; } ? ( b ? ) => { return b ; } : ( c ? ) => { return c ; } ;
//multiple levels
( a ? ) => { return a ; } ? ( b ) => ( c ) => 81 : ( c ) => ( d ) => 82 ;
// In Expressions
( ( arg ) => 90 ) instanceof Function ;
( ( arg = 1 ) => 91 ) instanceof Function ;
( ( arg ? ) => 92 ) instanceof Function ;
( ( arg : number ) => 93 ) instanceof Function ;
( ( arg : number = 1 ) => 94 ) instanceof Function ;
( ( arg ? : number ) => 95 ) instanceof Function ;
( ( ... arg : number [ ] ) => 96 ) instanceof Function ;
'' + ( arg ) => 100 ;
( ( arg ) => 0 ) + '' + ( arg ) => 101 ;
( ( arg = 1 ) => 0 ) + '' + ( arg = 2 ) => 102 ;
( ( arg ? ) => 0 ) + '' + ( arg ? ) => 103 ;
( ( arg : number ) => 0 ) + '' + ( arg : number ) => 104 ;
( ( arg : number = 1 ) => 0 ) + '' + ( arg : number = 2 ) => 105 ;
( ( arg ? : number = 1 ) => 0 ) + '' + ( arg ? : number = 2 ) => 106 ;
( ( ... arg : number [ ] ) => 0 ) + '' + ( ... arg : number [ ] ) => 107 ;
( ( arg1 , arg2 ? ) => 0 ) + '' + ( arg1 , arg2 ? ) => 108 ;
( ( arg1 , ... arg2 : number [ ] ) => 0 ) + '' + ( arg1 , ... arg2 : number [ ] ) => 108 ;
// Function Parameters
function foo ( ... arg : any [ ] ) { }
foo (
( a ) => 110 ,
( ( a ) => 111 ) ,
( a ) => {
return 112 ;
} ,
( a ? ) => 113 ,
( a , b ? ) => 114 ,
( a : number ) => 115 ,
( a : number = 0 ) => 116 ,
( a = 0 ) => 117 ,
( a ? : number = 0 ) => 118 ,
( a ? , b ? : number = 0 ) => 118 ,
( ... a : number [ ] ) => 119 ,
( a , b ? = 0 , ... c : number [ ] ) => 120 ,
( a ) => ( b ) => ( c ) => 121 ,
false ? ( a ) => 0 : ( b ) => 122
) ;
@@ -0,0 +1,112 @@
// valid
() => 1;
(arg) => 2;
arg => 2;
(arg = 1) => 3;
(arg?) => 4;
(arg: number) => 5;
(arg: number = 0) => 6;
(arg?: number) => 7;
(...arg: number[]) => 8;
(arg1, arg2) => 12;
(arg1 = 1, arg2 = 3) => 13;
(arg1?, arg2?) => 14;
(arg1: number, arg2: number) => 15;
(arg1: number = 0, arg2: number = 1) => 16;
(arg1?: number, arg2?: number) => 17;
(arg1, ...arg2: number[]) => 18;
(arg1, arg2?: number) => 19;
// in paren
(() => 21);
((arg) => 22);
((arg = 1) => 23);
((arg?) => 24);
((arg: number) => 25);
((arg: number = 0) => 26);
((arg?: number) => 27);
((...arg: number[]) => 28);
// in multiple paren
(((((arg) => { return 32; }))));
// in ternary exression
false ? () => 41 : null;
false ? (arg) => 42 : null;
false ? (arg = 1) => 43 : null;
false ? (arg?) => 44 : null;
false ? (arg: number) => 45 : null;
false ? (arg?: number) => 46 : null;
false ? (arg?: number = 0) => 47 : null;
false ? (...arg: number[]) => 48 : null;
// in ternary exression within paren
false ? (() => 51) : null;
false ? ((arg) => 52) : null;
false ? ((arg = 1) => 53) : null;
false ? ((arg?) => 54) : null;
false ? ((arg: number) => 55) : null;
false ? ((arg?: number) => 56) : null;
false ? ((arg?: number = 0) => 57) : null;
false ? ((...arg: number[]) => 58) : null;
// ternary exression's else clause
false ? null : () => 61;
false ? null : (arg) => 62;
false ? null : (arg = 1) => 63;
false ? null : (arg?) => 64;
false ? null : (arg: number) => 65;
false ? null : (arg?: number) => 66;
false ? null : (arg?: number = 0) => 67;
false ? null : (...arg: number[]) => 68;
// nested ternary expressions
(a?) => { return a; } ? (b?) => { return b; } : (c?) => { return c; };
//multiple levels
(a?) => { return a; } ? (b) => (c) => 81 : (c) => (d) => 82;
// In Expressions
((arg) => 90) instanceof Function;
((arg = 1) => 91) instanceof Function;
((arg?) => 92) instanceof Function;
((arg: number) => 93) instanceof Function;
((arg: number = 1) => 94) instanceof Function;
((arg?: number) => 95) instanceof Function;
((...arg: number[]) => 96) instanceof Function;
'' + (arg) => 100;
((arg) => 0) + '' + (arg) => 101;
((arg = 1) => 0) + '' + (arg = 2) => 102;
((arg?) => 0) + '' + (arg?) => 103;
((arg: number) => 0) + '' + (arg: number) => 104;
((arg: number = 1) => 0) + '' + (arg: number = 2) => 105;
((arg?: number = 1) => 0) + '' + (arg?: number = 2) => 106;
((...arg: number[]) => 0) + '' + (...arg: number[]) => 107;
((arg1, arg2?) => 0) + '' + (arg1, arg2?) => 108;
((arg1, ...arg2: number[]) => 0) + '' + (arg1, ...arg2: number[]) => 108;
// Function Parameters
function foo(...arg: any[]) { }
foo(
(a) => 110,
((a) => 111),
(a) => {
return 112;
},
(a?) => 113,
(a, b?) => 114,
(a: number) => 115,
(a: number = 0) => 116,
(a = 0) => 117,
(a?: number = 0) => 118,
(a?, b?: number = 0) => 118,
(...a: number[]) => 119,
(a, b? = 0, ...c: number[]) => 120,
(a) => (b) => (c) => 121,
false ? (a) => 0 : (b) => 122
);
@@ -0,0 +1,2 @@
if(false){debugger;}
if ( false ) { debugger ; }
@@ -0,0 +1,2 @@
if (false) { debugger; }
if (false) { debugger; }
@@ -0,0 +1,13 @@
var fun1 = function ( ) {
var x = 'foo' ,
z = 'bar' ;
return x ;
},
fun2 = ( function ( f ) {
var fun = function ( ) {
console . log ( f ( ) ) ;
},
x = 'Foo' ;
return fun ;
} ( fun1 ) ) ;
@@ -0,0 +1,13 @@
var fun1 = function() {
var x = 'foo',
z = 'bar';
return x;
},
fun2 = (function(f) {
var fun = function() {
console.log(f());
},
x = 'Foo';
return fun;
} (fun1));
Loaded 100 of 182 files, more files were not shown because too many files have changed in this diff. Show more