diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index e617f228378..9cf1c9d8f3f 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -18,6 +18,25 @@
"problemMatcher": [
"$tsc"
]
+ },
+ {
+ "taskName": "lint-server",
+ "args": [],
+ "problemMatcher": {
+ "owner": "typescript",
+ "fileLocation": ["relative", "${workspaceRoot}"],
+ "pattern": {
+ "regexp": "^(warning|error)\\s+([^(]+)\\s+\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(.*)$",
+ "severity": 1,
+ "file": 2,
+ "location": 3,
+ "message": 4
+ },
+ "watchedTaskBeginsRegExp": "^\\*\\*\\*Lint failure\\*\\*\\*$",
+ "watchedTaskEndsRegExp": "^\\*\\*\\* Total \\d+ failures\\.$"
+ },
+ "showOutput": "always",
+ "isWatching": true
}
]
}
\ No newline at end of file
diff --git a/Jakefile.js b/Jakefile.js
index c84713c18bc..e99043d3f5f 100644
--- a/Jakefile.js
+++ b/Jakefile.js
@@ -4,6 +4,7 @@ var fs = require("fs");
var os = require("os");
var path = require("path");
var child_process = require("child_process");
+var Linter = require("tslint");
// Variables
var compilerDirectory = "src/compiler/";
@@ -812,7 +813,6 @@ task("update-sublime", ["local", serverFile], function() {
var tslintRuleDir = "scripts/tslint";
var tslintRules = ([
"nextLineRule",
- "noInferrableTypesRule",
"noNullRule",
"booleanTriviaRule"
]);
@@ -828,17 +828,93 @@ tslintRulesFiles.forEach(function(ruleFile, i) {
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ true, /*noOutFile*/ true, /*generateDeclarations*/ false, path.join(builtLocalDirectory, "tslint"));
});
+function getLinterOptions() {
+ return {
+ configuration: require("./tslint.json"),
+ formatter: "prose",
+ formattersDirectory: undefined,
+ rulesDirectory: "built/local/tslint"
+ };
+}
+
+function lintFileContents(options, path, contents) {
+ var ll = new Linter(path, contents, options);
+ return ll.lint();
+}
+
+function lintFile(options, path) {
+ var contents = fs.readFileSync(path, "utf8");
+ return lintFileContents(options, path, contents);
+}
+
+function lintFileAsync(options, path, cb) {
+ fs.readFile(path, "utf8", function(err, contents) {
+ if (err) {
+ return cb(err);
+ }
+ var result = lintFileContents(options, path, contents);
+ cb(undefined, result);
+ });
+}
+
+var lintTargets = compilerSources.concat(harnessCoreSources);
+
// if the codebase were free of linter errors we could make jake runtests
// run this task automatically
desc("Runs tslint on the compiler sources");
task("lint", ["build-rules"], function() {
- function success(f) { return function() { console.log('SUCCESS: No linter errors in ' + f + '\n'); }};
- function failure(f) { return function() { console.log('FAILURE: Please fix linting errors in ' + f + '\n') }};
-
- var lintTargets = compilerSources.concat(harnessCoreSources);
+ var lintOptions = getLinterOptions();
for (var i in lintTargets) {
- var f = lintTargets[i];
- var cmd = 'tslint --rules-dir built/local/tslint -c tslint.json ' + f;
- exec(cmd, success(f), failure(f));
+ var result = lintFile(lintOptions, lintTargets[i]);
+ if (result.failureCount > 0) {
+ console.log(result.output);
+ fail('Linter errors.', result.failureCount);
+ }
}
-}, { async: true });
+});
+
+/**
+ * This is required because file watches on Windows get fires _twice_
+ * when a file changes on some node/windows version configuations
+ * (node v4 and win 10, for example). By not running a lint for a file
+ * which already has a pending lint, we avoid duplicating our work.
+ * (And avoid printing duplicate results!)
+ */
+var lintSemaphores = {};
+
+function lintWatchFile(filename) {
+ fs.watch(filename, {persistent: true}, function(event) {
+ if (event !== "change") {
+ return;
+ }
+
+ if (!lintSemaphores[filename]) {
+ lintSemaphores[filename] = true;
+ lintFileAsync(getLinterOptions(), filename, function(err, result) {
+ delete lintSemaphores[filename];
+ if (err) {
+ console.log(err);
+ return;
+ }
+ if (result.failureCount > 0) {
+ console.log("***Lint failure***");
+ for (var i = 0; i < result.failures.length; i++) {
+ var failure = result.failures[i];
+ var start = failure.startPosition.lineAndCharacter;
+ var end = failure.endPosition.lineAndCharacter;
+ console.log("warning " + filename + " (" + (start.line + 1) + "," + (start.character + 1) + "," + (end.line + 1) + "," + (end.character + 1) + "): " + failure.failure);
+ }
+ console.log("*** Total " + result.failureCount + " failures.");
+ }
+ });
+ }
+ });
+}
+
+desc("Watches files for changes to rerun a lint pass");
+task("lint-server", ["build-rules"], function() {
+ console.log("Watching ./src for changes to linted files");
+ for (var i = 0; i < lintTargets.length; i++) {
+ lintWatchFile(lintTargets[i]);
+ }
+});
diff --git a/package.json b/package.json
index 548b4c20734..607a38552ba 100644
--- a/package.json
+++ b/package.json
@@ -40,12 +40,13 @@
},
"scripts": {
"pretest": "jake tests",
- "test": "jake runtests",
+ "test": "jake runtests && npm run lint",
"build": "npm run build:compiler && npm run build:tests",
"build:compiler": "jake local",
"build:tests": "jake tests",
"clean": "jake clean",
"jake": "jake",
+ "lint": "jake lint",
"setup-hooks": "node scripts/link-hooks.js"
},
"browser": {
diff --git a/scripts/tslint/nextLineRule.ts b/scripts/tslint/nextLineRule.ts
index 7eec75a1baf..6d803fc7f88 100644
--- a/scripts/tslint/nextLineRule.ts
+++ b/scripts/tslint/nextLineRule.ts
@@ -5,8 +5,8 @@ const OPTION_CATCH = "check-catch";
const OPTION_ELSE = "check-else";
export class Rule extends Lint.Rules.AbstractRule {
- public static CATCH_FAILURE_STRING = "'catch' should be on the line following the previous block's ending curly brace";
- public static ELSE_FAILURE_STRING = "'else' should be on the line following the previous block's ending curly brace";
+ public static CATCH_FAILURE_STRING = "'catch' should not be on the same line as the preceeding block's curly brace";
+ public static ELSE_FAILURE_STRING = "'else' should not be on the same line as the preceeding block's curly brace";
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
return this.applyWithWalker(new NextLineWalker(sourceFile, this.getOptions()));
@@ -25,7 +25,7 @@ class NextLineWalker extends Lint.RuleWalker {
if (this.hasOption(OPTION_ELSE) && !!elseKeyword) {
const thenStatementEndLoc = sourceFile.getLineAndCharacterOfPosition(thenStatement.getEnd());
const elseKeywordLoc = sourceFile.getLineAndCharacterOfPosition(elseKeyword.getStart(sourceFile));
- if (thenStatementEndLoc.line !== (elseKeywordLoc.line - 1)) {
+ if (thenStatementEndLoc.line === elseKeywordLoc.line) {
const failure = this.createFailure(elseKeyword.getStart(sourceFile), elseKeyword.getWidth(sourceFile), Rule.ELSE_FAILURE_STRING);
this.addFailure(failure);
}
@@ -47,7 +47,7 @@ class NextLineWalker extends Lint.RuleWalker {
const catchKeyword = catchClause.getFirstToken(sourceFile);
const tryClosingBraceLoc = sourceFile.getLineAndCharacterOfPosition(tryClosingBrace.getEnd());
const catchKeywordLoc = sourceFile.getLineAndCharacterOfPosition(catchKeyword.getStart(sourceFile));
- if (tryClosingBraceLoc.line !== (catchKeywordLoc.line - 1)) {
+ if (tryClosingBraceLoc.line === catchKeywordLoc.line) {
const failure = this.createFailure(catchKeyword.getStart(sourceFile), catchKeyword.getWidth(sourceFile), Rule.CATCH_FAILURE_STRING);
this.addFailure(failure);
}
@@ -58,4 +58,4 @@ class NextLineWalker extends Lint.RuleWalker {
function getFirstChildOfKind(node: ts.Node, kind: ts.SyntaxKind) {
return node.getChildren().filter((child) => child.kind === kind)[0];
-}
\ No newline at end of file
+}
diff --git a/scripts/tslint/noInferrableTypesRule.ts b/scripts/tslint/noInferrableTypesRule.ts
deleted file mode 100644
index cbc0162260e..00000000000
--- a/scripts/tslint/noInferrableTypesRule.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-///
-///
-
-
-export class Rule extends Lint.Rules.AbstractRule {
- public static FAILURE_STRING_FACTORY = (type: string) => `LHS type (${type}) inferred by RHS expression, remove type annotation`;
-
- public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
- return this.applyWithWalker(new InferrableTypeWalker(sourceFile, this.getOptions()));
- }
-}
-
-class InferrableTypeWalker extends Lint.RuleWalker {
- visitVariableStatement(node: ts.VariableStatement) {
- node.declarationList.declarations.forEach(e => {
- if ((!!e.type) && (!!e.initializer)) {
- let failure: string;
- switch (e.type.kind) {
- case ts.SyntaxKind.BooleanKeyword:
- if (e.initializer.kind === ts.SyntaxKind.TrueKeyword || e.initializer.kind === ts.SyntaxKind.FalseKeyword) {
- failure = 'boolean';
- }
- break;
- case ts.SyntaxKind.NumberKeyword:
- if (e.initializer.kind === ts.SyntaxKind.NumericLiteral) {
- failure = 'number';
- }
- break;
- case ts.SyntaxKind.StringKeyword:
- switch (e.initializer.kind) {
- case ts.SyntaxKind.StringLiteral:
- case ts.SyntaxKind.NoSubstitutionTemplateLiteral:
- case ts.SyntaxKind.TemplateExpression:
- failure = 'string';
- break;
- default:
- break;
- }
- break;
- }
- if (failure) {
- this.addFailure(this.createFailure(e.type.getStart(), e.type.getWidth(), Rule.FAILURE_STRING_FACTORY(failure)));
- }
- }
- });
-
- super.visitVariableStatement(node);
- }
-}
diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts
index 16f2a59a58d..65768332360 100644
--- a/src/compiler/binder.ts
+++ b/src/compiler/binder.ts
@@ -88,6 +88,7 @@ namespace ts {
let container: Node;
let blockScopeContainer: Node;
let lastContainer: Node;
+ let seenThisKeyword: boolean;
// If this file is an external module, then it is automatically in strict-mode according to
// ES6. If it is not an external module, then we'll determine if it is in strict mode or
@@ -329,7 +330,14 @@ namespace ts {
blockScopeContainer.locals = undefined;
}
- forEachChild(node, bind);
+ if (node.kind === SyntaxKind.InterfaceDeclaration) {
+ seenThisKeyword = false;
+ forEachChild(node, bind);
+ node.flags = seenThisKeyword ? node.flags | NodeFlags.ContainsThis : node.flags & ~NodeFlags.ContainsThis;
+ }
+ else {
+ forEachChild(node, bind);
+ }
container = saveContainer;
parent = saveParent;
@@ -851,6 +859,9 @@ namespace ts {
return checkStrictModePrefixUnaryExpression(node);
case SyntaxKind.WithStatement:
return checkStrictModeWithStatement(node);
+ case SyntaxKind.ThisKeyword:
+ seenThisKeyword = true;
+ return;
case SyntaxKind.TypeParameter:
return declareSymbolAndAddToSymbolTable(node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes);
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 9f1bf504a0e..663825f1e84 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -38,6 +38,7 @@ namespace ts {
let Signature = objectAllocator.getSignatureConstructor();
let typeCount = 0;
+ let symbolCount = 0;
let emptyArray: any[] = [];
let emptySymbols: SymbolTable = {};
@@ -54,7 +55,7 @@ namespace ts {
let checker: TypeChecker = {
getNodeCount: () => sum(host.getSourceFiles(), "nodeCount"),
getIdentifierCount: () => sum(host.getSourceFiles(), "identifierCount"),
- getSymbolCount: () => sum(host.getSourceFiles(), "symbolCount"),
+ getSymbolCount: () => sum(host.getSourceFiles(), "symbolCount") + symbolCount,
getTypeCount: () => typeCount,
isUndefinedSymbol: symbol => symbol === undefinedSymbol,
isArgumentsSymbol: symbol => symbol === argumentsSymbol,
@@ -243,6 +244,7 @@ namespace ts {
}
function createSymbol(flags: SymbolFlags, name: string): Symbol {
+ symbolCount++;
return new Symbol(flags, name);
}
@@ -948,12 +950,6 @@ namespace ts {
return symbol.flags & meaning ? symbol : resolveAlias(symbol);
}
- function isExternalModuleNameRelative(moduleName: string): boolean {
- // TypeScript 1.0 spec (April 2014): 11.2.1
- // An external module name is "relative" if the first term is "." or "..".
- return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
- }
-
function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression): Symbol {
if (moduleReferenceExpression.kind !== SyntaxKind.StringLiteral) {
return;
@@ -1593,6 +1589,7 @@ namespace ts {
function buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]) {
let globalFlagsToPass = globalFlags & TypeFormatFlags.WriteOwnNameForAnyLike;
+ let inObjectTypeLiteral = false;
return writeType(type, globalFlags);
function writeType(type: Type, flags: TypeFormatFlags) {
@@ -1603,6 +1600,12 @@ namespace ts {
? "any"
: (type).intrinsicName);
}
+ else if (type.flags & TypeFlags.ThisType) {
+ if (inObjectTypeLiteral) {
+ writer.reportInaccessibleThisError();
+ }
+ writer.writeKeyword("this");
+ }
else if (type.flags & TypeFlags.Reference) {
writeTypeReference(type, flags);
}
@@ -1646,11 +1649,10 @@ namespace ts {
}
}
- function writeSymbolTypeReference(symbol: Symbol, typeArguments: Type[], pos: number, end: number) {
- // Unnamed function expressions, arrow functions, and unnamed class expressions have reserved names that
- // we don't want to display
- if (!isReservedMemberName(symbol.name)) {
- buildSymbolDisplay(symbol, writer, enclosingDeclaration, SymbolFlags.Type);
+ function writeSymbolTypeReference(symbol: Symbol, typeArguments: Type[], pos: number, end: number, flags: TypeFormatFlags) {
+ // Unnamed function expressions and arrow functions have reserved names that we don't want to display
+ if (symbol.flags & SymbolFlags.Class || !isReservedMemberName(symbol.name)) {
+ buildSymbolDisplay(symbol, writer, enclosingDeclaration, SymbolFlags.Type, SymbolFormatFlags.None, flags);
}
if (pos < end) {
writePunctuation(writer, SyntaxKind.LessThanToken);
@@ -1665,7 +1667,7 @@ namespace ts {
}
function writeTypeReference(type: TypeReference, flags: TypeFormatFlags) {
- let typeArguments = type.typeArguments;
+ let typeArguments = type.typeArguments || emptyArray;
if (type.target === globalArrayType && !(flags & TypeFormatFlags.WriteArrayAsGenericType)) {
writeType(typeArguments[0], TypeFormatFlags.InElementType);
writePunctuation(writer, SyntaxKind.OpenBracketToken);
@@ -1689,12 +1691,13 @@ namespace ts {
// When type parameters are their own type arguments for the whole group (i.e. we have
// the default outer type arguments), we don't show the group.
if (!rangeEquals(outerTypeParameters, typeArguments, start, i)) {
- writeSymbolTypeReference(parent, typeArguments, start, i);
+ writeSymbolTypeReference(parent, typeArguments, start, i, flags);
writePunctuation(writer, SyntaxKind.DotToken);
}
}
}
- writeSymbolTypeReference(type.symbol, typeArguments, i, typeArguments.length);
+ let typeParameterCount = (type.target.typeParameters || emptyArray).length;
+ writeSymbolTypeReference(type.symbol, typeArguments, i, typeParameterCount, flags);
}
}
@@ -1817,6 +1820,8 @@ namespace ts {
}
}
+ let saveInObjectTypeLiteral = inObjectTypeLiteral;
+ inObjectTypeLiteral = true;
writePunctuation(writer, SyntaxKind.OpenBraceToken);
writer.writeLine();
writer.increaseIndent();
@@ -1889,6 +1894,7 @@ namespace ts {
}
writer.decreaseIndent();
writePunctuation(writer, SyntaxKind.CloseBraceToken);
+ inObjectTypeLiteral = saveInObjectTypeLiteral;
}
}
@@ -2380,7 +2386,7 @@ namespace ts {
if (isBindingPattern(declaration.parent)) {
return getTypeForBindingElement(declaration);
}
-
+
// Use type from type annotation if one is present
if (declaration.type) {
return getTypeFromTypeNode(declaration.type);
@@ -2401,12 +2407,12 @@ namespace ts {
return type;
}
}
-
+
// Use the type of the initializer expression if one is present
if (declaration.initializer) {
return checkExpressionCached(declaration.initializer);
}
-
+
// If it is a short-hand property assignment, use the type of the identifier
if (declaration.kind === SyntaxKind.ShorthandPropertyAssignment) {
return checkIdentifier(declaration.name);
@@ -2501,10 +2507,10 @@ namespace ts {
// tools see the actual type.
return declaration.kind !== SyntaxKind.PropertyAssignment ? getWidenedType(type) : type;
}
-
+
// Rest parameters default to type any[], other parameters default to type any
type = declaration.dotDotDotToken ? anyArrayType : anyType;
-
+
// Report implicit any errors unless this is a private property within an ambient declaration
if (reportErrors && compilerOptions.noImplicitAny) {
let root = getRootDeclaration(declaration);
@@ -2890,6 +2896,31 @@ namespace ts {
}
}
+ // Returns true if the interface given by the symbol is free of "this" references. Specifically, the result is
+ // true if the interface itself contains no references to "this" in its body, if all base types are interfaces,
+ // and if none of the base interfaces have a "this" type.
+ function isIndependentInterface(symbol: Symbol): boolean {
+ for (let declaration of symbol.declarations) {
+ if (declaration.kind === SyntaxKind.InterfaceDeclaration) {
+ if (declaration.flags & NodeFlags.ContainsThis) {
+ return false;
+ }
+ let baseTypeNodes = getInterfaceBaseTypeNodes(declaration);
+ if (baseTypeNodes) {
+ for (let node of baseTypeNodes) {
+ if (isSupportedExpressionWithTypeArguments(node)) {
+ let baseSymbol = resolveEntityName(node.expression, SymbolFlags.Type, /*ignoreErrors*/ true);
+ if (!baseSymbol || !(baseSymbol.flags & SymbolFlags.Interface) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+
function getDeclaredTypeOfClassOrInterface(symbol: Symbol): InterfaceType {
let links = getSymbolLinks(symbol);
if (!links.declaredType) {
@@ -2897,7 +2928,12 @@ namespace ts {
let type = links.declaredType = createObjectType(kind, symbol);
let outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol);
let localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
- if (outerTypeParameters || localTypeParameters) {
+ // A class or interface is generic if it has type parameters or a "this" type. We always give classes a "this" type
+ // because it is not feasible to analyze all members to determine if the "this" type escapes the class (in particular,
+ // property types inferred from initializers and method return types inferred from return statements are very hard
+ // to exhaustively analyze). We give interfaces a "this" type if we can't definitely determine that they are free of
+ // "this" references.
+ if (outerTypeParameters || localTypeParameters || kind === TypeFlags.Class || !isIndependentInterface(symbol)) {
type.flags |= TypeFlags.Reference;
type.typeParameters = concatenate(outerTypeParameters, localTypeParameters);
type.outerTypeParameters = outerTypeParameters;
@@ -2906,6 +2942,9 @@ namespace ts {
(type).instantiations[getTypeListId(type.typeParameters)] = type;
(type).target = type;
(type).typeArguments = type.typeParameters;
+ type.thisType = createType(TypeFlags.TypeParameter | TypeFlags.ThisType);
+ type.thisType.symbol = symbol;
+ type.thisType.constraint = getTypeWithThisArgument(type);
}
}
return links.declaredType;
@@ -2990,6 +3029,82 @@ namespace ts {
return unknownType;
}
+ // A type reference is considered independent if each type argument is considered independent.
+ function isIndependentTypeReference(node: TypeReferenceNode): boolean {
+ if (node.typeArguments) {
+ for (let typeNode of node.typeArguments) {
+ if (!isIndependentType(typeNode)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ // A type is considered independent if it the any, string, number, boolean, symbol, or void keyword, a string
+ // literal type, an array with an element type that is considered independent, or a type reference that is
+ // considered independent.
+ function isIndependentType(node: TypeNode): boolean {
+ switch (node.kind) {
+ case SyntaxKind.AnyKeyword:
+ case SyntaxKind.StringKeyword:
+ case SyntaxKind.NumberKeyword:
+ case SyntaxKind.BooleanKeyword:
+ case SyntaxKind.SymbolKeyword:
+ case SyntaxKind.VoidKeyword:
+ case SyntaxKind.StringLiteral:
+ return true;
+ case SyntaxKind.ArrayType:
+ return isIndependentType((node).elementType);
+ case SyntaxKind.TypeReference:
+ return isIndependentTypeReference(node);
+ }
+ return false;
+ }
+
+ // A variable-like declaration is considered independent (free of this references) if it has a type annotation
+ // that specifies an independent type, or if it has no type annotation and no initializer (and thus of type any).
+ function isIndependentVariableLikeDeclaration(node: VariableLikeDeclaration): boolean {
+ return node.type && isIndependentType(node.type) || !node.type && !node.initializer;
+ }
+
+ // A function-like declaration is considered independent (free of this references) if it has a return type
+ // annotation that is considered independent and if each parameter is considered independent.
+ function isIndependentFunctionLikeDeclaration(node: FunctionLikeDeclaration): boolean {
+ if (node.kind !== SyntaxKind.Constructor && (!node.type || !isIndependentType(node.type))) {
+ return false;
+ }
+ for (let parameter of node.parameters) {
+ if (!isIndependentVariableLikeDeclaration(parameter)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // Returns true if the class or interface member given by the symbol is free of "this" references. The
+ // function may return false for symbols that are actually free of "this" references because it is not
+ // feasible to perform a complete analysis in all cases. In particular, property members with types
+ // inferred from their initializers and function members with inferred return types are convervatively
+ // assumed not to be free of "this" references.
+ function isIndependentMember(symbol: Symbol): boolean {
+ if (symbol.declarations && symbol.declarations.length === 1) {
+ let declaration = symbol.declarations[0];
+ if (declaration) {
+ switch (declaration.kind) {
+ case SyntaxKind.PropertyDeclaration:
+ case SyntaxKind.PropertySignature:
+ return isIndependentVariableLikeDeclaration(declaration);
+ case SyntaxKind.MethodDeclaration:
+ case SyntaxKind.MethodSignature:
+ case SyntaxKind.Constructor:
+ return isIndependentFunctionLikeDeclaration(declaration);
+ }
+ }
+ }
+ return false;
+ }
+
function createSymbolTable(symbols: Symbol[]): SymbolTable {
let result: SymbolTable = {};
for (let symbol of symbols) {
@@ -2998,10 +3113,12 @@ namespace ts {
return result;
}
- function createInstantiatedSymbolTable(symbols: Symbol[], mapper: TypeMapper): SymbolTable {
+ // The mappingThisOnly flag indicates that the only type parameter being mapped is "this". When the flag is true,
+ // we check symbols to see if we can quickly conclude they are free of "this" references, thus needing no instantiation.
+ function createInstantiatedSymbolTable(symbols: Symbol[], mapper: TypeMapper, mappingThisOnly: boolean): SymbolTable {
let result: SymbolTable = {};
for (let symbol of symbols) {
- result[symbol.name] = instantiateSymbol(symbol, mapper);
+ result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper);
}
return result;
}
@@ -3034,44 +3151,57 @@ namespace ts {
return type;
}
- function resolveClassOrInterfaceMembers(type: InterfaceType): void {
- let target = resolveDeclaredMembers(type);
- let members = target.symbol.members;
- let callSignatures = target.declaredCallSignatures;
- let constructSignatures = target.declaredConstructSignatures;
- let stringIndexType = target.declaredStringIndexType;
- let numberIndexType = target.declaredNumberIndexType;
- let baseTypes = getBaseTypes(target);
+ function getTypeWithThisArgument(type: ObjectType, thisArgument?: Type) {
+ if (type.flags & TypeFlags.Reference) {
+ return createTypeReference((type).target,
+ concatenate((type).typeArguments, [thisArgument || (type).target.thisType]));
+ }
+ return type;
+ }
+
+ function resolveObjectTypeMembers(type: ObjectType, source: InterfaceTypeWithDeclaredMembers, typeParameters: TypeParameter[], typeArguments: Type[]) {
+ let mapper = identityMapper;
+ let members = source.symbol.members;
+ let callSignatures = source.declaredCallSignatures;
+ let constructSignatures = source.declaredConstructSignatures;
+ let stringIndexType = source.declaredStringIndexType;
+ let numberIndexType = source.declaredNumberIndexType;
+ if (!rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) {
+ mapper = createTypeMapper(typeParameters, typeArguments);
+ members = createInstantiatedSymbolTable(source.declaredProperties, mapper, /*mappingThisOnly*/ typeParameters.length === 1);
+ callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature);
+ constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature);
+ stringIndexType = source.declaredStringIndexType ? instantiateType(source.declaredStringIndexType, mapper) : undefined;
+ numberIndexType = source.declaredNumberIndexType ? instantiateType(source.declaredNumberIndexType, mapper) : undefined;
+ }
+ let baseTypes = getBaseTypes(source);
if (baseTypes.length) {
- members = createSymbolTable(target.declaredProperties);
+ if (members === source.symbol.members) {
+ members = createSymbolTable(source.declaredProperties);
+ }
+ let thisArgument = lastOrUndefined(typeArguments);
for (let baseType of baseTypes) {
- addInheritedMembers(members, getPropertiesOfObjectType(baseType));
- callSignatures = concatenate(callSignatures, getSignaturesOfType(baseType, SignatureKind.Call));
- constructSignatures = concatenate(constructSignatures, getSignaturesOfType(baseType, SignatureKind.Construct));
- stringIndexType = stringIndexType || getIndexTypeOfType(baseType, IndexKind.String);
- numberIndexType = numberIndexType || getIndexTypeOfType(baseType, IndexKind.Number);
+ let instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType;
+ addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType));
+ callSignatures = concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, SignatureKind.Call));
+ constructSignatures = concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, SignatureKind.Construct));
+ stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, IndexKind.String);
+ numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, IndexKind.Number);
}
}
setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType);
}
+ function resolveClassOrInterfaceMembers(type: InterfaceType): void {
+ resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray);
+ }
+
function resolveTypeReferenceMembers(type: TypeReference): void {
- let target = resolveDeclaredMembers(type.target);
- let mapper = createTypeMapper(target.typeParameters, type.typeArguments);
- let members = createInstantiatedSymbolTable(target.declaredProperties, mapper);
- let callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature);
- let constructSignatures = instantiateList(target.declaredConstructSignatures, mapper, instantiateSignature);
- let stringIndexType = target.declaredStringIndexType ? instantiateType(target.declaredStringIndexType, mapper) : undefined;
- let numberIndexType = target.declaredNumberIndexType ? instantiateType(target.declaredNumberIndexType, mapper) : undefined;
- forEach(getBaseTypes(target), baseType => {
- let instantiatedBaseType = instantiateType(baseType, mapper);
- addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType));
- callSignatures = concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, SignatureKind.Call));
- constructSignatures = concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, SignatureKind.Construct));
- stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, IndexKind.String);
- numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, IndexKind.Number);
- });
- setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType);
+ let source = resolveDeclaredMembers(type.target);
+ let typeParameters = concatenate(source.typeParameters, [source.thisType]);
+ let typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ?
+ type.typeArguments : concatenate(type.typeArguments, [type]);
+ resolveObjectTypeMembers(type, source, typeParameters, typeArguments);
}
function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], parameters: Symbol[],
@@ -3126,7 +3256,9 @@ namespace ts {
}
function resolveTupleTypeMembers(type: TupleType) {
- let arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, /*noSubtypeReduction*/ true)));
+ let arrayElementType = getUnionType(type.elementTypes, /*noSubtypeReduction*/ true);
+ // Make the tuple type itself the 'this' type by including an extra type argument
+ let arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type]));
let members = createTupleTypeMemberSymbols(type.elementTypes);
addInheritedMembers(members, arrayType.properties);
setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType);
@@ -3285,7 +3417,10 @@ namespace ts {
function resolveStructuredTypeMembers(type: ObjectType): ResolvedType {
if (!(type).members) {
- if (type.flags & (TypeFlags.Class | TypeFlags.Interface)) {
+ if (type.flags & TypeFlags.Reference) {
+ resolveTypeReferenceMembers(type);
+ }
+ else if (type.flags & (TypeFlags.Class | TypeFlags.Interface)) {
resolveClassOrInterfaceMembers(type);
}
else if (type.flags & TypeFlags.Anonymous) {
@@ -3300,9 +3435,6 @@ namespace ts {
else if (type.flags & TypeFlags.Intersection) {
resolveIntersectionTypeMembers(type);
}
- else {
- resolveTypeReferenceMembers(type);
- }
}
return type;
}
@@ -3768,22 +3900,24 @@ namespace ts {
}
function getTypeListId(types: Type[]) {
- switch (types.length) {
- case 1:
- return "" + types[0].id;
- case 2:
- return types[0].id + "," + types[1].id;
- default:
- let result = "";
- for (let i = 0; i < types.length; i++) {
- if (i > 0) {
- result += ",";
+ if (types) {
+ switch (types.length) {
+ case 1:
+ return "" + types[0].id;
+ case 2:
+ return types[0].id + "," + types[1].id;
+ default:
+ let result = "";
+ for (let i = 0; i < types.length; i++) {
+ if (i > 0) {
+ result += ",";
+ }
+ result += types[i].id;
}
-
- result += types[i].id;
- }
- return result;
+ return result;
+ }
}
+ return "";
}
// This function is used to propagate certain flags when creating new object type references and union types.
@@ -3802,7 +3936,7 @@ namespace ts {
let id = getTypeListId(typeArguments);
let type = target.instantiations[id];
if (!type) {
- let flags = TypeFlags.Reference | getPropagatingFlagsOfTypes(typeArguments);
+ let flags = TypeFlags.Reference | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0);
type = target.instantiations[id] = createObjectType(flags, target.symbol);
type.target = target;
type.typeArguments = typeArguments;
@@ -3861,8 +3995,8 @@ namespace ts {
// Get type from reference to class or interface
function getTypeFromClassOrInterfaceReference(node: TypeReferenceNode | ExpressionWithTypeArguments, symbol: Symbol): Type {
- let type = getDeclaredTypeOfSymbol(symbol);
- let typeParameters = (type).localTypeParameters;
+ let type = getDeclaredTypeOfSymbol(symbol);
+ let typeParameters = type.localTypeParameters;
if (typeParameters) {
if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) {
error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), typeParameters.length);
@@ -3871,8 +4005,7 @@ namespace ts {
// In a type reference, the outer type parameters of the referenced class or interface are automatically
// supplied as type arguments and the type reference only specifies arguments for the local type parameters
// of the class or interface.
- return createTypeReference(type, concatenate((type).outerTypeParameters,
- map(node.typeArguments, getTypeFromTypeNode)));
+ return createTypeReference(type, concatenate(type.outerTypeParameters, map(node.typeArguments, getTypeFromTypeNode)));
}
if (node.typeArguments) {
error(node, Diagnostics.Type_0_is_not_generic, typeToString(type));
@@ -4028,20 +4161,20 @@ namespace ts {
/**
* Instantiates a global type that is generic with some element type, and returns that instantiation.
*/
- function createTypeFromGenericGlobalType(genericGlobalType: GenericType, elementType: Type): Type {
- return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, [elementType]) : emptyObjectType;
+ function createTypeFromGenericGlobalType(genericGlobalType: GenericType, typeArguments: Type[]): Type {
+ return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;
}
function createIterableType(elementType: Type): Type {
- return createTypeFromGenericGlobalType(globalIterableType, elementType);
+ return createTypeFromGenericGlobalType(globalIterableType, [elementType]);
}
function createIterableIteratorType(elementType: Type): Type {
- return createTypeFromGenericGlobalType(globalIterableIteratorType, elementType);
+ return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]);
}
function createArrayType(elementType: Type): Type {
- return createTypeFromGenericGlobalType(globalArrayType, elementType);
+ return createTypeFromGenericGlobalType(globalArrayType, [elementType]);
}
function getTypeFromArrayTypeNode(node: ArrayTypeNode): Type {
@@ -4230,6 +4363,26 @@ namespace ts {
return links.resolvedType;
}
+ function getThisType(node: TypeNode): Type {
+ let container = getThisContainer(node, /*includeArrowFunctions*/ false);
+ let parent = container && container.parent;
+ if (parent && (isClassLike(parent) || parent.kind === SyntaxKind.InterfaceDeclaration)) {
+ if (!(container.flags & NodeFlags.Static)) {
+ return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
+ }
+ }
+ error(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);
+ return unknownType;
+ }
+
+ function getTypeFromThisTypeNode(node: TypeNode): Type {
+ let links = getNodeLinks(node);
+ if (!links.resolvedType) {
+ links.resolvedType = getThisType(node);
+ }
+ return links.resolvedType;
+ }
+
function getTypeFromTypeNode(node: TypeNode): Type {
switch (node.kind) {
case SyntaxKind.AnyKeyword:
@@ -4244,6 +4397,8 @@ namespace ts {
return esSymbolType;
case SyntaxKind.VoidKeyword:
return voidType;
+ case SyntaxKind.ThisKeyword:
+ return getTypeFromThisTypeNode(node);
case SyntaxKind.StringLiteral:
return getTypeFromStringLiteral(node);
case SyntaxKind.TypeReference:
@@ -4346,7 +4501,7 @@ namespace ts {
}
return t;
};
-
+
mapper.context = context;
return mapper;
}
@@ -4698,7 +4853,7 @@ namespace ts {
else {
if (source.flags & TypeFlags.Reference && target.flags & TypeFlags.Reference && (source).target === (target).target) {
// We have type references to same target type, see if relationship holds for all type arguments
- if (result = typesRelatedTo((source).typeArguments, (target).typeArguments, reportErrors)) {
+ if (result = typeArgumentsRelatedTo(source, target, reportErrors)) {
return result;
}
}
@@ -4729,7 +4884,7 @@ namespace ts {
if (source.flags & TypeFlags.ObjectType && target.flags & TypeFlags.ObjectType) {
if (source.flags & TypeFlags.Reference && target.flags & TypeFlags.Reference && (source).target === (target).target) {
// We have type references to same target type, see if all type arguments are identical
- if (result = typesRelatedTo((source).typeArguments, (target).typeArguments, /*reportErrors*/ false)) {
+ if (result = typeArgumentsRelatedTo(source, target, /*reportErrors*/ false)) {
return result;
}
}
@@ -4780,7 +4935,7 @@ namespace ts {
// We know *exactly* where things went wrong when comparing the types.
// Use this property as the error node as this will be more helpful in
// reasoning about what went wrong.
- errorNode = prop.valueDeclaration
+ errorNode = prop.valueDeclaration;
reportError(Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
symbolToString(prop),
typeToString(target));
@@ -4851,9 +5006,14 @@ namespace ts {
return result;
}
- function typesRelatedTo(sources: Type[], targets: Type[], reportErrors: boolean): Ternary {
+ function typeArgumentsRelatedTo(source: TypeReference, target: TypeReference, reportErrors: boolean): Ternary {
+ let sources = source.typeArguments || emptyArray;
+ let targets = target.typeArguments || emptyArray;
+ if (sources.length !== targets.length && relation === identityRelation) {
+ return Ternary.False;
+ }
let result = Ternary.True;
- for (let i = 0, len = sources.length; i < len; i++) {
+ for (let i = 0; i < targets.length; i++) {
let related = isRelatedTo(sources[i], targets[i], reportErrors);
if (!related) {
return Ternary.False;
@@ -5080,7 +5240,7 @@ namespace ts {
if (kind === SignatureKind.Construct) {
// Only want to compare the construct signatures for abstractness guarantees.
-
+
// Because the "abstractness" of a class is the same across all construct signatures
// (internally we are checking the corresponding declaration), it is enough to perform
// the check and report an error once over all pairs of source and target construct signatures.
@@ -5752,9 +5912,10 @@ namespace ts {
}
else if (source.flags & TypeFlags.Reference && target.flags & TypeFlags.Reference && (source).target === (target).target) {
// If source and target are references to the same generic type, infer from type arguments
- let sourceTypes = (source).typeArguments;
- let targetTypes = (target).typeArguments;
- for (let i = 0; i < sourceTypes.length; i++) {
+ let sourceTypes = (source).typeArguments || emptyArray;
+ let targetTypes = (target).typeArguments || emptyArray;
+ let count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
+ for (let i = 0; i < count; i++) {
inferFromTypes(sourceTypes[i], targetTypes[i]);
}
}
@@ -6249,7 +6410,7 @@ namespace ts {
return getUnionType(assignableConstituents);
}
}
-
+
if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) {
// Narrow to the target type if it's assignable to the current type
return narrowedTypeCandidate;
@@ -6456,7 +6617,7 @@ namespace ts {
if (isClassLike(container.parent)) {
let symbol = getSymbolOfNode(container.parent);
- return container.flags & NodeFlags.Static ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol);
+ return container.flags & NodeFlags.Static ? getTypeOfSymbol(symbol) : (getDeclaredTypeOfSymbol(symbol)).thisType;
}
return anyType;
}
@@ -6476,46 +6637,46 @@ namespace ts {
let classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration));
let baseClassType = classType && getBaseTypes(classType)[0];
- let container = getSuperContainer(node, /*includeFunctions*/ true);
+ let container = getSuperContainer(node, /*includeFunctions*/ true);
let needToCaptureLexicalThis = false;
- if (!isCallExpression) {
+ if (!isCallExpression) {
// adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting
while (container && container.kind === SyntaxKind.ArrowFunction) {
container = getSuperContainer(container, /*includeFunctions*/ true);
needToCaptureLexicalThis = languageVersion < ScriptTarget.ES6;
}
}
-
+
let canUseSuperExpression = isLegalUsageOfSuperExpression(container);
let nodeCheckFlag: NodeCheckFlags = 0;
-
+
// always set NodeCheckFlags for 'super' expression node
- if (canUseSuperExpression) {
+ if (canUseSuperExpression) {
if ((container.flags & NodeFlags.Static) || isCallExpression) {
nodeCheckFlag = NodeCheckFlags.SuperStatic;
}
else {
nodeCheckFlag = NodeCheckFlags.SuperInstance;
}
-
+
getNodeLinks(node).flags |= nodeCheckFlag;
-
+
if (needToCaptureLexicalThis) {
// call expressions are allowed only in constructors so they should always capture correct 'this'
// super property access expressions can also appear in arrow functions -
// in this case they should also use correct lexical this
captureLexicalThis(node.parent, container);
- }
+ }
}
-
+
if (!baseClassType) {
if (!classDeclaration || !getClassExtendsHeritageClauseElement(classDeclaration)) {
error(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
}
- return unknownType;
+ return unknownType;
}
-
+
if (!canUseSuperExpression) {
if (container && container.kind === SyntaxKind.ComputedPropertyName) {
error(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
@@ -6526,20 +6687,20 @@ namespace ts {
else {
error(node, Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class);
}
-
+
return unknownType;
}
-
+
if (container.kind === SyntaxKind.Constructor && isInConstructorArgumentInitializer(node, container)) {
// issue custom error message for super property access in constructor arguments (to be aligned with old compiler)
error(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
return unknownType;
}
-
+
return nodeCheckFlag === NodeCheckFlags.SuperStatic
? getBaseConstructorTypeOfClass(classType)
: baseClassType;
-
+
function isLegalUsageOfSuperExpression(container: Node): boolean {
if (!container) {
return false;
@@ -6575,9 +6736,9 @@ namespace ts {
}
}
}
-
+
return false;
- }
+ }
}
// Return contextual type of parameter or undefined if no contextual type is available
@@ -7090,7 +7251,7 @@ namespace ts {
}
}
}
- return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType)
+ return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType);
}
function isNumericName(name: DeclarationName): boolean {
@@ -7361,7 +7522,7 @@ namespace ts {
// Maybe there's a string indexer?
let indexerType = getIndexTypeOfType(elementAttributesType, IndexKind.String);
if (indexerType) {
- correspondingPropType = indexerType
+ correspondingPropType = indexerType;
}
else {
// If there's no corresponding property with this name, error
@@ -7429,7 +7590,8 @@ namespace ts {
if (!links.resolvedSymbol) {
if (isJsxIntrinsicIdentifier(node.tagName)) {
links.resolvedSymbol = lookupIntrinsicTag(node);
- } else {
+ }
+ else {
links.resolvedSymbol = lookupClassTag(node);
}
}
@@ -7843,7 +8005,7 @@ namespace ts {
let prop = getPropertyOfType(apparentType, right.text);
if (!prop) {
if (right.text) {
- error(right, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(right), typeToString(type));
+ error(right, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(right), typeToString(type.flags & TypeFlags.ThisType ? apparentType : type));
}
return unknownType;
}
@@ -7851,7 +8013,7 @@ namespace ts {
getNodeLinks(node).resolvedSymbol = prop;
if (prop.parent && prop.parent.flags & SymbolFlags.Class) {
- checkClassPropertyAccess(node, left, type, prop);
+ checkClassPropertyAccess(node, left, apparentType, prop);
}
return getTypeOfSymbol(prop);
}
@@ -8053,9 +8215,9 @@ namespace ts {
function reorderCandidates(signatures: Signature[], result: Signature[]): void {
let lastParent: Node;
let lastSymbol: Symbol;
- let cutoffIndex: number = 0;
+ let cutoffIndex = 0;
let index: number;
- let specializedIndex: number = -1;
+ let specializedIndex = -1;
let spliceIndex: number;
Debug.assert(!result.length);
for (let signature of signatures) {
@@ -8402,6 +8564,12 @@ namespace ts {
case SyntaxKind.SetAccessor:
// A method or accessor declaration decorator will have two or three arguments (see
// `PropertyDecorator` and `MethodDecorator` in core.d.ts)
+
+ // If we are emitting decorators for ES3, we will only pass two arguments.
+ if (languageVersion === ScriptTarget.ES3) {
+ return 2;
+ }
+
// If the method decorator signature only accepts a target and a key, we will only
// type check those arguments.
return signature.parameters.length >= 3 ? 3 : 2;
@@ -10654,7 +10822,7 @@ namespace ts {
}
if (!superCallStatement) {
error(node, Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties);
- }
+ }
else {
// In such a required super call, it is a compile-time error for argument expressions to reference this.
markThisReferencesAsErrors(superCallStatement.expression);
@@ -11093,7 +11261,7 @@ namespace ts {
// Spaces for anyting not declared a 'default export'.
let nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces;
-
+
let commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces;
let commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces;
@@ -11101,7 +11269,7 @@ namespace ts {
// declaration spaces for exported and non-exported declarations intersect
for (let d of symbol.declarations) {
let declarationSpaces = getDeclarationSpaces(d);
-
+
// Only error on the declarations that conributed to the intersecting spaces.
if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) {
error(d.name, Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, declarationNameToString(d.name));
@@ -11928,7 +12096,7 @@ namespace ts {
function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node: Node) {
// We only disallow modifier on a method declaration if it is a property of object-literal-expression
- if (node.modifiers && node.parent.kind === SyntaxKind.ObjectLiteralExpression){
+ if (node.modifiers && node.parent.kind === SyntaxKind.ObjectLiteralExpression) {
if (isAsyncFunctionLike(node)) {
if (node.modifiers.length > 1) {
return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here);
@@ -12655,6 +12823,7 @@ namespace ts {
checkExportsOnMergedDeclarations(node);
let symbol = getSymbolOfNode(node);
let type = getDeclaredTypeOfSymbol(symbol);
+ let typeWithThis = getTypeWithThisArgument(type);
let staticType = getTypeOfSymbol(symbol);
let baseTypeNode = getClassExtendsHeritageClauseElement(node);
@@ -12673,7 +12842,7 @@ namespace ts {
}
}
}
- checkTypeAssignableTo(type, baseType, node.name || node, Diagnostics.Class_0_incorrectly_extends_base_class_1);
+ checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name || node, Diagnostics.Class_0_incorrectly_extends_base_class_1);
checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node,
Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
@@ -12693,7 +12862,7 @@ namespace ts {
let implementedTypeNodes = getClassImplementsHeritageClauseElements(node);
if (implementedTypeNodes) {
- forEach(implementedTypeNodes, typeRefNode => {
+ for (let typeRefNode of implementedTypeNodes) {
if (!isSupportedExpressionWithTypeArguments(typeRefNode)) {
error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
}
@@ -12703,14 +12872,14 @@ namespace ts {
if (t !== unknownType) {
let declaredType = (t.flags & TypeFlags.Reference) ? (t).target : t;
if (declaredType.flags & (TypeFlags.Class | TypeFlags.Interface)) {
- checkTypeAssignableTo(type, t, node.name || node, Diagnostics.Class_0_incorrectly_implements_interface_1);
+ checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, Diagnostics.Class_0_incorrectly_implements_interface_1);
}
else {
error(typeRefNode, Diagnostics.A_class_may_only_implement_another_class_or_interface);
}
}
}
- });
+ }
}
if (produceDiagnostics) {
@@ -12870,7 +13039,7 @@ namespace ts {
let ok = true;
for (let base of baseTypes) {
- let properties = getPropertiesOfObjectType(base);
+ let properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType));
for (let prop of properties) {
if (!hasProperty(seen, prop.name)) {
seen[prop.name] = { prop: prop, containingType: base };
@@ -12915,11 +13084,12 @@ namespace ts {
// Only check this symbol once
if (node === firstInterfaceDecl) {
let type = getDeclaredTypeOfSymbol(symbol);
+ let typeWithThis = getTypeWithThisArgument(type);
// run subsequent checks only if first set succeeded
if (checkInheritedPropertiesAreIdentical(type, node.name)) {
- forEach(getBaseTypes(type), baseType => {
- checkTypeAssignableTo(type, baseType, node.name, Diagnostics.Interface_0_incorrectly_extends_interface_1);
- });
+ for (let baseType of getBaseTypes(type)) {
+ checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, Diagnostics.Interface_0_incorrectly_extends_interface_1);
+ }
checkIndexConstraints(type);
}
}
@@ -12975,7 +13145,7 @@ namespace ts {
}
const previousEnumMemberIsNonConstant = autoValue === undefined;
-
+
let initializer = member.initializer;
if (initializer) {
autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient);
@@ -13014,7 +13184,7 @@ namespace ts {
}
else if (ambient) {
error(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
- }
+ }
else {
// Only here do we need to check that the initializer is assignable to the enum type.
checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*headMessage*/ undefined);
@@ -13289,7 +13459,7 @@ namespace ts {
// Checks for ambient external modules.
if (isAmbientExternalModule) {
if (!isGlobalSourceFile(node.parent)) {
- error(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules);
+ error(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);
}
if (isExternalModuleNameRelative(node.name.text)) {
error(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);
@@ -13314,7 +13484,7 @@ namespace ts {
Debug.assert(node.kind === SyntaxKind.Identifier);
return node;
}
-
+
function checkExternalImportOrExportDeclaration(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean {
let moduleName = getExternalModuleName(node);
if (!nodeIsMissing(moduleName) && moduleName.kind !== SyntaxKind.StringLiteral) {
@@ -13941,11 +14111,11 @@ namespace ts {
}
break;
}
-
+
if (introducesArgumentsExoticObject(location)) {
copySymbol(argumentsSymbol, meaning);
}
-
+
memberFlags = location.flags;
location = location.parent;
}
@@ -14060,7 +14230,21 @@ namespace ts {
}
if (isHeritageClauseElementIdentifier(entityName)) {
- let meaning = entityName.parent.kind === SyntaxKind.ExpressionWithTypeArguments ? SymbolFlags.Type : SymbolFlags.Namespace;
+ let meaning = SymbolFlags.None;
+
+ // In an interface or class, we're definitely interested in a type.
+ if (entityName.parent.kind === SyntaxKind.ExpressionWithTypeArguments) {
+ meaning = SymbolFlags.Type;
+
+ // In a class 'extends' clause we are also looking for a value.
+ if (isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
+ meaning |= SymbolFlags.Value;
+ }
+ }
+ else {
+ meaning = SymbolFlags.Namespace;
+ }
+
meaning |= SymbolFlags.Alias;
return resolveEntityName(entityName, meaning);
}
@@ -14152,7 +14336,7 @@ namespace ts {
case SyntaxKind.ThisKeyword:
case SyntaxKind.SuperKeyword:
- let type = checkExpression(node);
+ let type = isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node);
return type.symbol;
case SyntaxKind.ConstructorKeyword:
@@ -14417,9 +14601,9 @@ namespace ts {
}
// const enums and modules that contain only const enums are not considered values from the emit perespective
// unless 'preserveConstEnums' option is set to true
- return target !== unknownSymbol &&
- target &&
- target.flags & SymbolFlags.Value &&
+ return target !== unknownSymbol &&
+ target &&
+ target.flags & SymbolFlags.Value &&
(compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));
}
@@ -14490,7 +14674,7 @@ namespace ts {
function isFunctionType(type: Type): boolean {
return type.flags & TypeFlags.ObjectType && getSignaturesOfType(type, SignatureKind.Call).length > 0;
}
-
+
function getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind {
// Resolve the symbol as a value to ensure the type can be reached at runtime during emit.
let valueSymbol = resolveEntityName(typeName, SymbolFlags.Value, /*ignoreErrors*/ true);
@@ -14503,7 +14687,7 @@ namespace ts {
let typeSymbol = resolveEntityName(typeName, SymbolFlags.Type, /*ignoreErrors*/ true);
// We might not be able to resolve type symbol so use unknown type in that case (eg error case)
if (!typeSymbol) {
- return TypeReferenceSerializationKind.ObjectType;
+ return TypeReferenceSerializationKind.ObjectType;
}
let type = getDeclaredTypeOfSymbol(typeSymbol);
if (type === unknownType) {
@@ -14739,9 +14923,6 @@ namespace ts {
if (!nodeCanBeDecorated(node)) {
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here);
}
- else if (languageVersion < ScriptTarget.ES5) {
- return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher);
- }
else if (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor) {
let accessors = getAllAccessorDeclarations((node.parent).members, node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts
index f1d4b6e31ec..11062983aaa 100644
--- a/src/compiler/commandLineParser.ts
+++ b/src/compiler/commandLineParser.ts
@@ -470,7 +470,7 @@ namespace ts {
fileNames = map(json["files"], s => combinePaths(basePath, s));
}
else {
- errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array"));
+ errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array"));
}
}
else {
diff --git a/src/compiler/core.ts b/src/compiler/core.ts
index a1f6565ed1f..ce59c3b3bc6 100644
--- a/src/compiler/core.ts
+++ b/src/compiler/core.ts
@@ -52,7 +52,7 @@ namespace ts {
function normalizeKey(key: string) {
return getCanonicalFileName(normalizeSlashes(key));
}
-
+
function clear() {
files = {};
}
@@ -117,7 +117,7 @@ namespace ts {
return count;
}
- export function filter(array: T[], f: (x: T) => boolean): T[]{
+ export function filter(array: T[], f: (x: T) => boolean): T[] {
let result: T[];
if (array) {
result = [];
@@ -130,7 +130,7 @@ namespace ts {
return result;
}
- export function map(array: T[], f: (x: T) => U): U[]{
+ export function map(array: T[], f: (x: T) => U): U[] {
let result: U[];
if (array) {
result = [];
@@ -148,7 +148,7 @@ namespace ts {
return array1.concat(array2);
}
- export function deduplicate(array: T[]): T[]{
+ export function deduplicate(array: T[]): T[] {
let result: T[];
if (array) {
result = [];
@@ -486,7 +486,7 @@ namespace ts {
return text1 ? Comparison.GreaterThan : Comparison.LessThan;
}
- export function sortAndDeduplicateDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]{
+ export function sortAndDeduplicateDiagnostics(diagnostics: Diagnostic[]): Diagnostic[] {
return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics));
}
@@ -795,7 +795,7 @@ namespace ts {
VeryAggressive = 3,
}
- export module Debug {
+ export namespace Debug {
let currentAssertionLevel = AssertionLevel.None;
export function shouldAssert(level: AssertionLevel): boolean {
diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts
index e5914d10060..00085f16086 100644
--- a/src/compiler/declarationEmitter.ts
+++ b/src/compiler/declarationEmitter.ts
@@ -52,6 +52,7 @@ namespace ts {
let enclosingDeclaration: Node;
let currentSourceFile: SourceFile;
let reportedDeclarationError = false;
+ let errorNameNode: DeclarationName;
let emitJsDocComments = compilerOptions.removeComments ? function (declaration: Node) { } : writeJsDocComments;
let emit = compilerOptions.stripInternal ? stripInternal : emitNode;
@@ -152,6 +153,7 @@ namespace ts {
function createAndSetNewTextWriterWithSymbolWriter(): EmitTextWriterWithSymbolWriter {
let writer = createTextWriter(newLine);
writer.trackSymbol = trackSymbol;
+ writer.reportInaccessibleThisError = reportInaccessibleThisError;
writer.writeKeyword = writer.write;
writer.writeOperator = writer.write;
writer.writePunctuation = writer.write;
@@ -178,9 +180,11 @@ namespace ts {
let nodeToCheck: Node;
if (declaration.kind === SyntaxKind.VariableDeclaration) {
nodeToCheck = declaration.parent.parent;
- } else if (declaration.kind === SyntaxKind.NamedImports || declaration.kind === SyntaxKind.ImportSpecifier || declaration.kind === SyntaxKind.ImportClause) {
+ }
+ else if (declaration.kind === SyntaxKind.NamedImports || declaration.kind === SyntaxKind.ImportSpecifier || declaration.kind === SyntaxKind.ImportClause) {
Debug.fail("We should be getting ImportDeclaration instead to write");
- } else {
+ }
+ else {
nodeToCheck = declaration;
}
@@ -257,6 +261,13 @@ namespace ts {
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning));
}
+ function reportInaccessibleThisError() {
+ if (errorNameNode) {
+ diagnostics.push(createDiagnosticForNode(errorNameNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary,
+ declarationNameToString(errorNameNode)));
+ }
+ }
+
function writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, type: TypeNode, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) {
writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;
write(": ");
@@ -265,7 +276,9 @@ namespace ts {
emitType(type);
}
else {
+ errorNameNode = declaration.name;
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
+ errorNameNode = undefined;
}
}
@@ -277,7 +290,9 @@ namespace ts {
emitType(signature.type);
}
else {
+ errorNameNode = signature.name;
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
+ errorNameNode = undefined;
}
}
@@ -326,6 +341,7 @@ namespace ts {
case SyntaxKind.BooleanKeyword:
case SyntaxKind.SymbolKeyword:
case SyntaxKind.VoidKeyword:
+ case SyntaxKind.ThisKeyword:
case SyntaxKind.StringLiteral:
return writeTextOfNode(currentSourceFile, type);
case SyntaxKind.ExpressionWithTypeArguments:
@@ -1068,7 +1084,7 @@ namespace ts {
// emitted: declare var c: number; // instead of declare var c:number, ;
let elements: Node[] = [];
for (let element of bindingPattern.elements) {
- if (element.kind !== SyntaxKind.OmittedExpression){
+ if (element.kind !== SyntaxKind.OmittedExpression) {
elements.push(element);
}
}
diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json
index 4875a847750..f6656edb250 100644
--- a/src/compiler/diagnosticMessages.json
+++ b/src/compiler/diagnosticMessages.json
@@ -631,10 +631,6 @@
"category": "Error",
"code": 1204
},
- "Decorators are only available when targeting ECMAScript 5 and higher.": {
- "category": "Error",
- "code": 1205
- },
"Decorators are not valid here.": {
"category": "Error",
"code": 1206
@@ -1300,7 +1296,7 @@
"category": "Error",
"code": 2434
},
- "Ambient modules cannot be nested in other modules.": {
+ "Ambient modules cannot be nested in other modules or namespaces.": {
"category": "Error",
"code": 2435
},
@@ -1652,6 +1648,14 @@
"category": "Error",
"code": 2525
},
+ "A 'this' type is available only in a non-static member of a class or interface.": {
+ "category": "Error",
+ "code": 2526
+ },
+ "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary.": {
+ "category": "Error",
+ "code": 2527
+ },
"JSX element attributes type '{0}' must be an object type.": {
"category": "Error",
"code": 2600
diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts
index db2a749c4d8..11942562dcb 100644
--- a/src/compiler/emitter.ts
+++ b/src/compiler/emitter.ts
@@ -7,6 +7,264 @@ namespace ts {
return isExternalModule(sourceFile) || isDeclarationFile(sourceFile);
}
+ type DependencyGroup = Array;
+
+ let entities: Map = {
+ "quot": 0x0022,
+ "amp": 0x0026,
+ "apos": 0x0027,
+ "lt": 0x003C,
+ "gt": 0x003E,
+ "nbsp": 0x00A0,
+ "iexcl": 0x00A1,
+ "cent": 0x00A2,
+ "pound": 0x00A3,
+ "curren": 0x00A4,
+ "yen": 0x00A5,
+ "brvbar": 0x00A6,
+ "sect": 0x00A7,
+ "uml": 0x00A8,
+ "copy": 0x00A9,
+ "ordf": 0x00AA,
+ "laquo": 0x00AB,
+ "not": 0x00AC,
+ "shy": 0x00AD,
+ "reg": 0x00AE,
+ "macr": 0x00AF,
+ "deg": 0x00B0,
+ "plusmn": 0x00B1,
+ "sup2": 0x00B2,
+ "sup3": 0x00B3,
+ "acute": 0x00B4,
+ "micro": 0x00B5,
+ "para": 0x00B6,
+ "middot": 0x00B7,
+ "cedil": 0x00B8,
+ "sup1": 0x00B9,
+ "ordm": 0x00BA,
+ "raquo": 0x00BB,
+ "frac14": 0x00BC,
+ "frac12": 0x00BD,
+ "frac34": 0x00BE,
+ "iquest": 0x00BF,
+ "Agrave": 0x00C0,
+ "Aacute": 0x00C1,
+ "Acirc": 0x00C2,
+ "Atilde": 0x00C3,
+ "Auml": 0x00C4,
+ "Aring": 0x00C5,
+ "AElig": 0x00C6,
+ "Ccedil": 0x00C7,
+ "Egrave": 0x00C8,
+ "Eacute": 0x00C9,
+ "Ecirc": 0x00CA,
+ "Euml": 0x00CB,
+ "Igrave": 0x00CC,
+ "Iacute": 0x00CD,
+ "Icirc": 0x00CE,
+ "Iuml": 0x00CF,
+ "ETH": 0x00D0,
+ "Ntilde": 0x00D1,
+ "Ograve": 0x00D2,
+ "Oacute": 0x00D3,
+ "Ocirc": 0x00D4,
+ "Otilde": 0x00D5,
+ "Ouml": 0x00D6,
+ "times": 0x00D7,
+ "Oslash": 0x00D8,
+ "Ugrave": 0x00D9,
+ "Uacute": 0x00DA,
+ "Ucirc": 0x00DB,
+ "Uuml": 0x00DC,
+ "Yacute": 0x00DD,
+ "THORN": 0x00DE,
+ "szlig": 0x00DF,
+ "agrave": 0x00E0,
+ "aacute": 0x00E1,
+ "acirc": 0x00E2,
+ "atilde": 0x00E3,
+ "auml": 0x00E4,
+ "aring": 0x00E5,
+ "aelig": 0x00E6,
+ "ccedil": 0x00E7,
+ "egrave": 0x00E8,
+ "eacute": 0x00E9,
+ "ecirc": 0x00EA,
+ "euml": 0x00EB,
+ "igrave": 0x00EC,
+ "iacute": 0x00ED,
+ "icirc": 0x00EE,
+ "iuml": 0x00EF,
+ "eth": 0x00F0,
+ "ntilde": 0x00F1,
+ "ograve": 0x00F2,
+ "oacute": 0x00F3,
+ "ocirc": 0x00F4,
+ "otilde": 0x00F5,
+ "ouml": 0x00F6,
+ "divide": 0x00F7,
+ "oslash": 0x00F8,
+ "ugrave": 0x00F9,
+ "uacute": 0x00FA,
+ "ucirc": 0x00FB,
+ "uuml": 0x00FC,
+ "yacute": 0x00FD,
+ "thorn": 0x00FE,
+ "yuml": 0x00FF,
+ "OElig": 0x0152,
+ "oelig": 0x0153,
+ "Scaron": 0x0160,
+ "scaron": 0x0161,
+ "Yuml": 0x0178,
+ "fnof": 0x0192,
+ "circ": 0x02C6,
+ "tilde": 0x02DC,
+ "Alpha": 0x0391,
+ "Beta": 0x0392,
+ "Gamma": 0x0393,
+ "Delta": 0x0394,
+ "Epsilon": 0x0395,
+ "Zeta": 0x0396,
+ "Eta": 0x0397,
+ "Theta": 0x0398,
+ "Iota": 0x0399,
+ "Kappa": 0x039A,
+ "Lambda": 0x039B,
+ "Mu": 0x039C,
+ "Nu": 0x039D,
+ "Xi": 0x039E,
+ "Omicron": 0x039F,
+ "Pi": 0x03A0,
+ "Rho": 0x03A1,
+ "Sigma": 0x03A3,
+ "Tau": 0x03A4,
+ "Upsilon": 0x03A5,
+ "Phi": 0x03A6,
+ "Chi": 0x03A7,
+ "Psi": 0x03A8,
+ "Omega": 0x03A9,
+ "alpha": 0x03B1,
+ "beta": 0x03B2,
+ "gamma": 0x03B3,
+ "delta": 0x03B4,
+ "epsilon": 0x03B5,
+ "zeta": 0x03B6,
+ "eta": 0x03B7,
+ "theta": 0x03B8,
+ "iota": 0x03B9,
+ "kappa": 0x03BA,
+ "lambda": 0x03BB,
+ "mu": 0x03BC,
+ "nu": 0x03BD,
+ "xi": 0x03BE,
+ "omicron": 0x03BF,
+ "pi": 0x03C0,
+ "rho": 0x03C1,
+ "sigmaf": 0x03C2,
+ "sigma": 0x03C3,
+ "tau": 0x03C4,
+ "upsilon": 0x03C5,
+ "phi": 0x03C6,
+ "chi": 0x03C7,
+ "psi": 0x03C8,
+ "omega": 0x03C9,
+ "thetasym": 0x03D1,
+ "upsih": 0x03D2,
+ "piv": 0x03D6,
+ "ensp": 0x2002,
+ "emsp": 0x2003,
+ "thinsp": 0x2009,
+ "zwnj": 0x200C,
+ "zwj": 0x200D,
+ "lrm": 0x200E,
+ "rlm": 0x200F,
+ "ndash": 0x2013,
+ "mdash": 0x2014,
+ "lsquo": 0x2018,
+ "rsquo": 0x2019,
+ "sbquo": 0x201A,
+ "ldquo": 0x201C,
+ "rdquo": 0x201D,
+ "bdquo": 0x201E,
+ "dagger": 0x2020,
+ "Dagger": 0x2021,
+ "bull": 0x2022,
+ "hellip": 0x2026,
+ "permil": 0x2030,
+ "prime": 0x2032,
+ "Prime": 0x2033,
+ "lsaquo": 0x2039,
+ "rsaquo": 0x203A,
+ "oline": 0x203E,
+ "frasl": 0x2044,
+ "euro": 0x20AC,
+ "image": 0x2111,
+ "weierp": 0x2118,
+ "real": 0x211C,
+ "trade": 0x2122,
+ "alefsym": 0x2135,
+ "larr": 0x2190,
+ "uarr": 0x2191,
+ "rarr": 0x2192,
+ "darr": 0x2193,
+ "harr": 0x2194,
+ "crarr": 0x21B5,
+ "lArr": 0x21D0,
+ "uArr": 0x21D1,
+ "rArr": 0x21D2,
+ "dArr": 0x21D3,
+ "hArr": 0x21D4,
+ "forall": 0x2200,
+ "part": 0x2202,
+ "exist": 0x2203,
+ "empty": 0x2205,
+ "nabla": 0x2207,
+ "isin": 0x2208,
+ "notin": 0x2209,
+ "ni": 0x220B,
+ "prod": 0x220F,
+ "sum": 0x2211,
+ "minus": 0x2212,
+ "lowast": 0x2217,
+ "radic": 0x221A,
+ "prop": 0x221D,
+ "infin": 0x221E,
+ "ang": 0x2220,
+ "and": 0x2227,
+ "or": 0x2228,
+ "cap": 0x2229,
+ "cup": 0x222A,
+ "int": 0x222B,
+ "there4": 0x2234,
+ "sim": 0x223C,
+ "cong": 0x2245,
+ "asymp": 0x2248,
+ "ne": 0x2260,
+ "equiv": 0x2261,
+ "le": 0x2264,
+ "ge": 0x2265,
+ "sub": 0x2282,
+ "sup": 0x2283,
+ "nsub": 0x2284,
+ "sube": 0x2286,
+ "supe": 0x2287,
+ "oplus": 0x2295,
+ "otimes": 0x2297,
+ "perp": 0x22A5,
+ "sdot": 0x22C5,
+ "lceil": 0x2308,
+ "rceil": 0x2309,
+ "lfloor": 0x230A,
+ "rfloor": 0x230B,
+ "lang": 0x2329,
+ "rang": 0x232A,
+ "loz": 0x25CA,
+ "spades": 0x2660,
+ "clubs": 0x2663,
+ "hearts": 0x2665,
+ "diams": 0x2666
+ };
+
// Flags enum to track count of temp variables and a few dedicated names
const enum TempFlags {
Auto = 0x00000000, // No preferred name
@@ -27,12 +285,10 @@ var __extends = (this && this.__extends) || function (d, b) {
// emit output for the __decorate helper function
const decorateHelper = `
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};`;
// emit output for the __metadata helper function
@@ -189,7 +445,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
/** If removeComments is true, no leading-comments needed to be emitted **/
let emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos: number) { } : emitLeadingCommentsOfPositionWorker;
-
+
let moduleEmitDelegates: Map<(node: SourceFile, startIndex: number) => void> = {
[ModuleKind.ES6]: emitES6Module,
[ModuleKind.AMD]: emitAMDModule,
@@ -695,7 +951,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
}
-
+
function emitNodeWithCommentsAndWithSourcemap(node: Node) {
emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap);
}
@@ -1190,7 +1446,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function emitJsxElement(openingNode: JsxOpeningLikeElement, children?: JsxChild[]) {
let syntheticReactRef = createSynthesizedNode(SyntaxKind.Identifier);
- syntheticReactRef.text = 'React';
+ syntheticReactRef.text = "React";
syntheticReactRef.parent = openingNode;
// Call React.createElement(tag, ...
@@ -1394,7 +1650,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
//
// The emit for the decorated computed property decorator is:
//
- // Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
+ // __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a));
//
if (nodeIsDecorated(node.parent)) {
if (!computedPropertyNamesToGeneratedNames) {
@@ -1434,6 +1690,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
let parent = node.parent;
switch (parent.kind) {
case SyntaxKind.ArrayLiteralExpression:
+ case SyntaxKind.AsExpression:
case SyntaxKind.BinaryExpression:
case SyntaxKind.CallExpression:
case SyntaxKind.CaseClause:
@@ -1524,8 +1781,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
else if (declaration.kind === SyntaxKind.ImportSpecifier) {
// Identifier references named import
write(getGeneratedNameForNode(declaration.parent.parent.parent));
- var name = (declaration).propertyName || (declaration).name;
- var identifier = getSourceTextOfNodeFromSourceFile(currentSourceFile, name);
+ let name = (declaration).propertyName || (declaration).name;
+ let identifier = getSourceTextOfNodeFromSourceFile(currentSourceFile, name);
if (languageVersion === ScriptTarget.ES3 && identifier === "default") {
write(`["default"]`);
}
@@ -2068,15 +2325,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
return false;
}
-
+
function tryGetConstEnumValue(node: Node): number {
if (compilerOptions.isolatedModules) {
return undefined;
}
-
- return node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.ElementAccessExpression
+
+ return node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.ElementAccessExpression
? resolver.getConstantValue(node)
- : undefined
+ : undefined;
}
// Returns 'true' if the code was actually indented, false otherwise.
@@ -3146,7 +3403,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (modulekind === ModuleKind.System) {
return;
}
-
+
if (!exportEquals && exportSpecifiers && hasProperty(exportSpecifiers, name.text)) {
for (let specifier of exportSpecifiers[name.text]) {
writeLine();
@@ -3161,14 +3418,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
}
-
+
function emitExportSpecifierInSystemModule(specifier: ExportSpecifier): void {
Debug.assert(modulekind === ModuleKind.System);
if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier) ) {
return;
}
-
+
writeLine();
emitStart(specifier.name);
write(`${exportFunctionForFile}("`);
@@ -4448,7 +4705,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
//
// let C = class {
// };
- // Object.defineProperty(C, "name", { value: "C", configurable: true });
// C = __decorate([dec], C);
//
// * For an exported class declaration:
@@ -4460,7 +4716,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
//
// export let C = class {
// };
- // Object.defineProperty(C, "name", { value: "C", configurable: true });
// C = __decorate([dec], C);
//
// * For a default export of a class declaration with a name:
@@ -4472,7 +4727,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
//
// let C = class {
// }
- // Object.defineProperty(C, "name", { value: "C", configurable: true });
// C = __decorate([dec], C);
// export default C;
//
@@ -4800,21 +5054,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
//
// The emit for a method is:
//
- // Object.defineProperty(C.prototype, "method",
- // __decorate([
- // dec,
- // __param(0, dec2),
- // __metadata("design:type", Function),
- // __metadata("design:paramtypes", [Object]),
- // __metadata("design:returntype", void 0)
- // ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
+ // __decorate([
+ // dec,
+ // __param(0, dec2),
+ // __metadata("design:type", Function),
+ // __metadata("design:paramtypes", [Object]),
+ // __metadata("design:returntype", void 0)
+ // ], C.prototype, "method", undefined);
//
// The emit for an accessor is:
//
- // Object.defineProperty(C.prototype, "accessor",
- // __decorate([
- // dec
- // ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
+ // __decorate([
+ // dec
+ // ], C.prototype, "accessor", undefined);
//
// The emit for a property is:
//
@@ -4825,18 +5077,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
writeLine();
emitStart(member);
- if (member.kind !== SyntaxKind.PropertyDeclaration) {
- write("Object.defineProperty(");
- emitStart(member.name);
- emitClassMemberPrefix(node, member);
- write(", ");
- emitExpressionForPropertyName(member.name);
- emitEnd(member.name);
- write(",");
- increaseIndent();
- writeLine();
- }
-
write("__decorate([");
increaseIndent();
writeLine();
@@ -4860,15 +5100,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
emitExpressionForPropertyName(member.name);
emitEnd(member.name);
- if (member.kind !== SyntaxKind.PropertyDeclaration) {
- write(", Object.getOwnPropertyDescriptor(");
- emitStart(member.name);
- emitClassMemberPrefix(node, member);
- write(", ");
- emitExpressionForPropertyName(member.name);
- emitEnd(member.name);
- write("))");
- decreaseIndent();
+ if (languageVersion > ScriptTarget.ES3) {
+ if (member.kind !== SyntaxKind.PropertyDeclaration) {
+ // We emit `null` here to indicate to `__decorate` that it can invoke `Object.getOwnPropertyDescriptor` directly.
+ // We have this extra argument here so that we can inject an explicit property descriptor at a later date.
+ write(", null");
+ }
+ else {
+ // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it
+ // should not invoke `Object.getOwnPropertyDescriptor`.
+ write(", void 0");
+ }
}
write(");");
@@ -5401,14 +5643,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
emitExportMemberAssignments(node.name);
}
}
-
+
/*
* Some bundlers (SystemJS builder) sometimes want to rename dependencies.
* Here we check if alternative name was provided for a given moduleName and return it if possible.
*/
function tryRenameExternalModule(moduleName: LiteralExpression): string {
if (currentSourceFile.renamedDependencies && hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) {
- return `"${currentSourceFile.renamedDependencies[moduleName.text]}"`
+ return `"${currentSourceFile.renamedDependencies[moduleName.text]}"`;
}
return undefined;
}
@@ -5730,7 +5972,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
emitContainingModuleName(node);
if (languageVersion === ScriptTarget.ES3) {
write("[\"default\"] = ");
- } else {
+ }
+ else {
write(".default = ");
}
emit(node.expression);
@@ -5823,7 +6066,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function getExternalModuleNameText(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration): string {
let moduleName = getExternalModuleName(importNode);
if (moduleName.kind === SyntaxKind.StringLiteral) {
- return tryRenameExternalModule(moduleName) || getLiteralText(moduleName);
+ return tryRenameExternalModule(moduleName) || getLiteralText(moduleName);
}
return undefined;
@@ -6225,7 +6468,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function emitSetters(exportStarFunction: string, dependencyGroups: DependencyGroup[]) {
write("setters:[");
-
+
for (let i = 0; i < dependencyGroups.length; ++i) {
if (i !== 0) {
write(",");
@@ -6233,17 +6476,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
writeLine();
increaseIndent();
-
+
let group = dependencyGroups[i];
-
+
// derive a unique name for parameter from the first named entry in the group
let parameterName = makeUniqueName(forEach(group, getLocalNameForExternalImport) || "");
write(`function (${parameterName}) {`);
increaseIndent();
-
- for(let entry of group) {
+
+ for (let entry of group) {
let importVariableName = getLocalNameForExternalImport(entry) || "";
-
+
switch (entry.kind) {
case SyntaxKind.ImportDeclaration:
if (!(entry).importClause) {
@@ -6279,7 +6522,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(",");
writeLine();
}
-
+
let e = (entry).exportClause.elements[i];
write(`"`);
emitNodeWithCommentsAndWithoutSourcemap(e.name);
@@ -6289,7 +6532,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
decreaseIndent();
writeLine();
- write("});")
+ write("});");
}
else {
writeLine();
@@ -6324,7 +6567,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
// - import declarations are not emitted since they are already handled in setters
// - export declarations with module specifiers are not emitted since they were already written in setters
// - export declarations without module specifiers are emitted preserving the order
- case SyntaxKind.FunctionDeclaration:
+ case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ImportDeclaration:
continue;
case SyntaxKind.ExportDeclaration:
@@ -6344,15 +6587,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
default:
writeLine();
emit(statement);
- }
+ }
}
decreaseIndent();
writeLine();
write("}"); // execute
}
-
- type DependencyGroup = Array;
-
+
function emitSystemModule(node: SourceFile, startIndex: number): void {
collectExternalModuleInfo(node);
// System modules has the following shape
@@ -6372,7 +6613,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(`"${node.moduleName}", `);
}
write("[");
-
+
let groupIndices: Map = {};
let dependencyGroups: DependencyGroup[] = [];
@@ -6392,7 +6633,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (i !== 0) {
write(", ");
}
-
+
write(text);
}
write(`], function(${exportFunctionForFile}) {`);
@@ -7103,7 +7344,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (compilerOptions.removeComments) {
return;
}
-
+
let leadingComments: CommentRange[];
if (isEmittedNode) {
leadingComments = getLeadingCommentsToEmit(node);
@@ -7236,7 +7477,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
}
-
+
function emitShebang() {
let shebang = getShebang(currentSourceFile.text);
if (shebang) {
@@ -7253,260 +7494,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
}
-
- var entities: Map = {
- "quot": 0x0022,
- "amp": 0x0026,
- "apos": 0x0027,
- "lt": 0x003C,
- "gt": 0x003E,
- "nbsp": 0x00A0,
- "iexcl": 0x00A1,
- "cent": 0x00A2,
- "pound": 0x00A3,
- "curren": 0x00A4,
- "yen": 0x00A5,
- "brvbar": 0x00A6,
- "sect": 0x00A7,
- "uml": 0x00A8,
- "copy": 0x00A9,
- "ordf": 0x00AA,
- "laquo": 0x00AB,
- "not": 0x00AC,
- "shy": 0x00AD,
- "reg": 0x00AE,
- "macr": 0x00AF,
- "deg": 0x00B0,
- "plusmn": 0x00B1,
- "sup2": 0x00B2,
- "sup3": 0x00B3,
- "acute": 0x00B4,
- "micro": 0x00B5,
- "para": 0x00B6,
- "middot": 0x00B7,
- "cedil": 0x00B8,
- "sup1": 0x00B9,
- "ordm": 0x00BA,
- "raquo": 0x00BB,
- "frac14": 0x00BC,
- "frac12": 0x00BD,
- "frac34": 0x00BE,
- "iquest": 0x00BF,
- "Agrave": 0x00C0,
- "Aacute": 0x00C1,
- "Acirc": 0x00C2,
- "Atilde": 0x00C3,
- "Auml": 0x00C4,
- "Aring": 0x00C5,
- "AElig": 0x00C6,
- "Ccedil": 0x00C7,
- "Egrave": 0x00C8,
- "Eacute": 0x00C9,
- "Ecirc": 0x00CA,
- "Euml": 0x00CB,
- "Igrave": 0x00CC,
- "Iacute": 0x00CD,
- "Icirc": 0x00CE,
- "Iuml": 0x00CF,
- "ETH": 0x00D0,
- "Ntilde": 0x00D1,
- "Ograve": 0x00D2,
- "Oacute": 0x00D3,
- "Ocirc": 0x00D4,
- "Otilde": 0x00D5,
- "Ouml": 0x00D6,
- "times": 0x00D7,
- "Oslash": 0x00D8,
- "Ugrave": 0x00D9,
- "Uacute": 0x00DA,
- "Ucirc": 0x00DB,
- "Uuml": 0x00DC,
- "Yacute": 0x00DD,
- "THORN": 0x00DE,
- "szlig": 0x00DF,
- "agrave": 0x00E0,
- "aacute": 0x00E1,
- "acirc": 0x00E2,
- "atilde": 0x00E3,
- "auml": 0x00E4,
- "aring": 0x00E5,
- "aelig": 0x00E6,
- "ccedil": 0x00E7,
- "egrave": 0x00E8,
- "eacute": 0x00E9,
- "ecirc": 0x00EA,
- "euml": 0x00EB,
- "igrave": 0x00EC,
- "iacute": 0x00ED,
- "icirc": 0x00EE,
- "iuml": 0x00EF,
- "eth": 0x00F0,
- "ntilde": 0x00F1,
- "ograve": 0x00F2,
- "oacute": 0x00F3,
- "ocirc": 0x00F4,
- "otilde": 0x00F5,
- "ouml": 0x00F6,
- "divide": 0x00F7,
- "oslash": 0x00F8,
- "ugrave": 0x00F9,
- "uacute": 0x00FA,
- "ucirc": 0x00FB,
- "uuml": 0x00FC,
- "yacute": 0x00FD,
- "thorn": 0x00FE,
- "yuml": 0x00FF,
- "OElig": 0x0152,
- "oelig": 0x0153,
- "Scaron": 0x0160,
- "scaron": 0x0161,
- "Yuml": 0x0178,
- "fnof": 0x0192,
- "circ": 0x02C6,
- "tilde": 0x02DC,
- "Alpha": 0x0391,
- "Beta": 0x0392,
- "Gamma": 0x0393,
- "Delta": 0x0394,
- "Epsilon": 0x0395,
- "Zeta": 0x0396,
- "Eta": 0x0397,
- "Theta": 0x0398,
- "Iota": 0x0399,
- "Kappa": 0x039A,
- "Lambda": 0x039B,
- "Mu": 0x039C,
- "Nu": 0x039D,
- "Xi": 0x039E,
- "Omicron": 0x039F,
- "Pi": 0x03A0,
- "Rho": 0x03A1,
- "Sigma": 0x03A3,
- "Tau": 0x03A4,
- "Upsilon": 0x03A5,
- "Phi": 0x03A6,
- "Chi": 0x03A7,
- "Psi": 0x03A8,
- "Omega": 0x03A9,
- "alpha": 0x03B1,
- "beta": 0x03B2,
- "gamma": 0x03B3,
- "delta": 0x03B4,
- "epsilon": 0x03B5,
- "zeta": 0x03B6,
- "eta": 0x03B7,
- "theta": 0x03B8,
- "iota": 0x03B9,
- "kappa": 0x03BA,
- "lambda": 0x03BB,
- "mu": 0x03BC,
- "nu": 0x03BD,
- "xi": 0x03BE,
- "omicron": 0x03BF,
- "pi": 0x03C0,
- "rho": 0x03C1,
- "sigmaf": 0x03C2,
- "sigma": 0x03C3,
- "tau": 0x03C4,
- "upsilon": 0x03C5,
- "phi": 0x03C6,
- "chi": 0x03C7,
- "psi": 0x03C8,
- "omega": 0x03C9,
- "thetasym": 0x03D1,
- "upsih": 0x03D2,
- "piv": 0x03D6,
- "ensp": 0x2002,
- "emsp": 0x2003,
- "thinsp": 0x2009,
- "zwnj": 0x200C,
- "zwj": 0x200D,
- "lrm": 0x200E,
- "rlm": 0x200F,
- "ndash": 0x2013,
- "mdash": 0x2014,
- "lsquo": 0x2018,
- "rsquo": 0x2019,
- "sbquo": 0x201A,
- "ldquo": 0x201C,
- "rdquo": 0x201D,
- "bdquo": 0x201E,
- "dagger": 0x2020,
- "Dagger": 0x2021,
- "bull": 0x2022,
- "hellip": 0x2026,
- "permil": 0x2030,
- "prime": 0x2032,
- "Prime": 0x2033,
- "lsaquo": 0x2039,
- "rsaquo": 0x203A,
- "oline": 0x203E,
- "frasl": 0x2044,
- "euro": 0x20AC,
- "image": 0x2111,
- "weierp": 0x2118,
- "real": 0x211C,
- "trade": 0x2122,
- "alefsym": 0x2135,
- "larr": 0x2190,
- "uarr": 0x2191,
- "rarr": 0x2192,
- "darr": 0x2193,
- "harr": 0x2194,
- "crarr": 0x21B5,
- "lArr": 0x21D0,
- "uArr": 0x21D1,
- "rArr": 0x21D2,
- "dArr": 0x21D3,
- "hArr": 0x21D4,
- "forall": 0x2200,
- "part": 0x2202,
- "exist": 0x2203,
- "empty": 0x2205,
- "nabla": 0x2207,
- "isin": 0x2208,
- "notin": 0x2209,
- "ni": 0x220B,
- "prod": 0x220F,
- "sum": 0x2211,
- "minus": 0x2212,
- "lowast": 0x2217,
- "radic": 0x221A,
- "prop": 0x221D,
- "infin": 0x221E,
- "ang": 0x2220,
- "and": 0x2227,
- "or": 0x2228,
- "cap": 0x2229,
- "cup": 0x222A,
- "int": 0x222B,
- "there4": 0x2234,
- "sim": 0x223C,
- "cong": 0x2245,
- "asymp": 0x2248,
- "ne": 0x2260,
- "equiv": 0x2261,
- "le": 0x2264,
- "ge": 0x2265,
- "sub": 0x2282,
- "sup": 0x2283,
- "nsub": 0x2284,
- "sube": 0x2286,
- "supe": 0x2287,
- "oplus": 0x2295,
- "otimes": 0x2297,
- "perp": 0x22A5,
- "sdot": 0x22C5,
- "lceil": 0x2308,
- "rceil": 0x2309,
- "lfloor": 0x230A,
- "rfloor": 0x230B,
- "lang": 0x2329,
- "rang": 0x232A,
- "loz": 0x25CA,
- "spades": 0x2660,
- "clubs": 0x2663,
- "hearts": 0x2665,
- "diams": 0x2666
- }
}
diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts
index 23fb846c0b4..08f21e80e14 100644
--- a/src/compiler/parser.ts
+++ b/src/compiler/parser.ts
@@ -425,7 +425,7 @@ namespace ts {
// Implement the parser as a singleton module. We do this for perf reasons because creating
// parser instances can actually be expensive enough to impact us on projects with many source
// files.
- module Parser {
+ namespace Parser {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true);
@@ -518,7 +518,7 @@ namespace ts {
//
// Note: any errors at the end of the file that do not precede a regular node, should get
// attached to the EOF token.
- let parseErrorBeforeNextFinishedNode: boolean = false;
+ let parseErrorBeforeNextFinishedNode = false;
export function parseSourceFile(fileName: string, _sourceText: string, languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor, setParentNodes?: boolean): SourceFile {
initializeState(fileName, _sourceText, languageVersion, _syntaxCursor);
@@ -2360,6 +2360,7 @@ namespace ts {
let node = tryParse(parseKeywordAndNoDot);
return node || parseTypeReferenceOrTypePredicate();
case SyntaxKind.VoidKeyword:
+ case SyntaxKind.ThisKeyword:
return parseTokenNode();
case SyntaxKind.TypeOfKeyword:
return parseTypeQuery();
@@ -2382,6 +2383,7 @@ namespace ts {
case SyntaxKind.BooleanKeyword:
case SyntaxKind.SymbolKeyword:
case SyntaxKind.VoidKeyword:
+ case SyntaxKind.ThisKeyword:
case SyntaxKind.TypeOfKeyword:
case SyntaxKind.OpenBraceToken:
case SyntaxKind.OpenBracketToken:
@@ -3938,7 +3940,8 @@ namespace ts {
forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);
parseExpected(SyntaxKind.CloseParenToken);
forOrForInOrForOfStatement = forOfStatement;
- } else {
+ }
+ else {
let forStatement = createNode(SyntaxKind.ForStatement, pos);
forStatement.initializer = initializer;
parseExpected(SyntaxKind.SemicolonToken);
@@ -4825,7 +4828,7 @@ namespace ts {
return finishNode(node);
}
-
+
function parseNameOfClassDeclarationOrExpression(): Identifier {
// implements is a future reserved word so
// 'class implements' might mean either
@@ -4836,11 +4839,11 @@ namespace ts {
? parseIdentifier()
: undefined;
}
-
+
function isImplementsClause() {
- return token === SyntaxKind.ImplementsKeyword && lookAhead(nextTokenIsIdentifierOrKeyword)
+ return token === SyntaxKind.ImplementsKeyword && lookAhead(nextTokenIsIdentifierOrKeyword);
}
-
+
function parseHeritageClauses(isClassHeritageClause: boolean): NodeArray {
// ClassTail[Yield,Await] : (Modified) See 14.5
// ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt }
@@ -5315,7 +5318,7 @@ namespace ts {
Unknown
}
- export module JSDocParser {
+ export namespace JSDocParser {
export function isJSDocType() {
switch (token) {
case SyntaxKind.AsteriskToken:
@@ -5960,7 +5963,7 @@ namespace ts {
}
}
- module IncrementalParser {
+ namespace IncrementalParser {
export function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks: boolean): SourceFile {
aggressiveChecks = aggressiveChecks || Debug.shouldAssert(AssertionLevel.Aggressive);
diff --git a/src/compiler/program.ts b/src/compiler/program.ts
index 0dbaa3b39b2..c6d3a245a8d 100644
--- a/src/compiler/program.ts
+++ b/src/compiler/program.ts
@@ -9,9 +9,9 @@ namespace ts {
/* @internal */ export let ioWriteTime = 0;
/** The version of the TypeScript compiler release */
-
+
let emptyArray: any[] = [];
-
+
export const version = "1.7.0";
export function findConfigFile(searchPath: string): string {
@@ -29,36 +29,36 @@ namespace ts {
}
return undefined;
}
-
+
export function resolveTripleslashReference(moduleName: string, containingFile: string): string {
let basePath = getDirectoryPath(containingFile);
let referencedFileName = isRootedDiskPath(moduleName) ? moduleName : combinePaths(basePath, moduleName);
return normalizePath(referencedFileName);
}
-
+
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
- let moduleResolution = compilerOptions.moduleResolution !== undefined
+ let moduleResolution = compilerOptions.moduleResolution !== undefined
? compilerOptions.moduleResolution
: compilerOptions.module === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic;
-
+
switch (moduleResolution) {
case ModuleResolutionKind.NodeJs: return nodeModuleNameResolver(moduleName, containingFile, host);
case ModuleResolutionKind.Classic: return classicNameResolver(moduleName, containingFile, compilerOptions, host);
}
}
-
+
export function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
- let containingDirectory = getDirectoryPath(containingFile);
+ let containingDirectory = getDirectoryPath(containingFile);
if (getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) {
let failedLookupLocations: string[] = [];
let candidate = normalizePath(combinePaths(containingDirectory, moduleName));
let resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
-
+
if (resolvedFileName) {
return { resolvedModule: { resolvedFileName }, failedLookupLocations };
}
-
+
resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
return resolvedFileName
? { resolvedModule: { resolvedFileName }, failedLookupLocations }
@@ -68,7 +68,7 @@ namespace ts {
return loadModuleFromNodeModules(moduleName, containingDirectory, host);
}
}
-
+
function loadNodeModuleFromFile(candidate: string, loadOnlyDts: boolean, failedLookupLocation: string[], host: ModuleResolutionHost): string {
if (loadOnlyDts) {
return tryLoad(".d.ts");
@@ -76,7 +76,7 @@ namespace ts {
else {
return forEach(supportedExtensions, tryLoad);
}
-
+
function tryLoad(ext: string): string {
let fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext;
if (host.fileExists(fileName)) {
@@ -88,13 +88,13 @@ namespace ts {
}
}
}
-
+
function loadNodeModuleFromDirectory(candidate: string, loadOnlyDts: boolean, failedLookupLocation: string[], host: ModuleResolutionHost): string {
let packageJsonPath = combinePaths(candidate, "package.json");
if (host.fileExists(packageJsonPath)) {
-
+
let jsonContent: { typings?: string };
-
+
try {
let jsonText = host.readFile(packageJsonPath);
jsonContent = jsonText ? <{ typings?: string }>JSON.parse(jsonText) : { typings: undefined };
@@ -103,7 +103,7 @@ namespace ts {
// gracefully handle if readFile fails or returns not JSON
jsonContent = { typings: undefined };
}
-
+
if (jsonContent.typings) {
let result = loadNodeModuleFromFile(normalizePath(combinePaths(candidate, jsonContent.typings)), loadOnlyDts, failedLookupLocation, host);
if (result) {
@@ -115,12 +115,12 @@ namespace ts {
// record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results
failedLookupLocation.push(packageJsonPath);
}
-
+
return loadNodeModuleFromFile(combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host);
}
-
+
function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
- let failedLookupLocations: string[] = [];
+ let failedLookupLocations: string[] = [];
directory = normalizeSlashes(directory);
while (true) {
let baseName = getBaseFileName(directory);
@@ -131,36 +131,36 @@ namespace ts {
if (result) {
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations };
}
-
+
result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
if (result) {
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations };
}
}
-
+
let parentPath = getDirectoryPath(directory);
if (parentPath === directory) {
break;
}
-
+
directory = parentPath;
}
-
+
return { resolvedModule: undefined, failedLookupLocations };
}
-
+
function nameStartsWithDotSlashOrDotDotSlash(name: string) {
let i = name.lastIndexOf("./", 1);
return i === 0 || (i === 1 && name.charCodeAt(0) === CharacterCodes.dot);
}
export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
-
+
// module names that contain '!' are used to reference resources and are not resolved to actual files on disk
- if (moduleName.indexOf('!') != -1) {
+ if (moduleName.indexOf("!") != -1) {
return { resolvedModule: undefined, failedLookupLocations: [] };
}
-
+
let searchPath = getDirectoryPath(containingFile);
let searchName: string;
@@ -175,7 +175,7 @@ namespace ts {
// 'logical not' handles both undefined and None cases
return undefined;
}
-
+
let candidate = searchName + extension;
if (host.fileExists(candidate)) {
return candidate;
@@ -277,8 +277,7 @@ namespace ts {
}
const newLine = getNewLineCharacter(options);
-
-
+
return {
getSourceFile,
getDefaultLibFileName: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFileName(options)),
@@ -347,26 +346,26 @@ namespace ts {
let start = new Date().getTime();
host = host || createCompilerHost(options);
-
+
const resolveModuleNamesWorker = host.resolveModuleNames
? ((moduleNames: string[], containingFile: string) => host.resolveModuleNames(moduleNames, containingFile))
: ((moduleNames: string[], containingFile: string) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedModule));
let filesByName = createFileMap(fileName => host.getCanonicalFileName(fileName));
-
+
if (oldProgram) {
// check properties that can affect structure of the program or module resolution strategy
// if any of these properties has changed - structure cannot be reused
let oldOptions = oldProgram.getCompilerOptions();
- if ((oldOptions.module !== options.module) ||
- (oldOptions.noResolve !== options.noResolve) ||
- (oldOptions.target !== options.target) ||
+ if ((oldOptions.module !== options.module) ||
+ (oldOptions.noResolve !== options.noResolve) ||
+ (oldOptions.target !== options.target) ||
(oldOptions.noLib !== options.noLib) ||
(oldOptions.jsx !== options.jsx)) {
oldProgram = undefined;
}
}
-
+
if (!tryReuseStructureFromOldProgram()) {
forEach(rootNames, name => processRootFile(name, false));
// Do not process the default library if:
@@ -427,7 +426,7 @@ namespace ts {
if (!oldProgram) {
return false;
}
-
+
Debug.assert(!oldProgram.structureIsReused);
// there is an old program, check if we can reuse its structure
@@ -435,7 +434,7 @@ namespace ts {
if (!arrayIsEqualTo(oldRootNames, rootNames)) {
return false;
}
-
+
// check if program source files has changed in the way that can affect structure of the program
let newSourceFiles: SourceFile[] = [];
let modifiedSourceFiles: SourceFile[] = [];
@@ -445,7 +444,7 @@ namespace ts {
return false;
}
- if (oldSourceFile !== newSourceFile) {
+ if (oldSourceFile !== newSourceFile) {
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
// value of no-default-lib has changed
// this will affect if default library is injected into the list of files
@@ -457,14 +456,14 @@ namespace ts {
// tripleslash references has changed
return false;
}
-
+
// check imports
collectExternalModuleReferences(newSourceFile);
if (!arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
// imports has changed
return false;
}
-
+
if (resolveModuleNamesWorker) {
let moduleNames = map(newSourceFile.imports, name => name.text);
let resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName);
@@ -473,11 +472,11 @@ namespace ts {
let newResolution = resolutions[i];
let oldResolution = getResolvedModule(oldSourceFile, moduleNames[i]);
let resolutionChanged = oldResolution
- ? !newResolution ||
+ ? !newResolution ||
oldResolution.resolvedFileName !== newResolution.resolvedFileName ||
!!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport
: newResolution;
-
+
if (resolutionChanged) {
return false;
}
@@ -491,24 +490,24 @@ namespace ts {
// file has no changes - use it as is
newSourceFile = oldSourceFile;
}
-
+
// if file has passed all checks it should be safe to reuse it
newSourceFiles.push(newSourceFile);
}
-
+
// update fileName -> file mapping
for (let file of newSourceFiles) {
filesByName.set(file.fileName, file);
}
-
+
files = newSourceFiles;
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
-
+
for (let modifiedFile of modifiedSourceFiles) {
fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile);
}
oldProgram.structureIsReused = true;
-
+
return true;
}
@@ -554,7 +553,7 @@ namespace ts {
// This is because in the -out scenario all files need to be emitted, and therefore all
// files need to be type checked. And the way to specify that all files need to be type
// checked is to not pass the file to getEmitResolver.
- let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out)? undefined : sourceFile);
+ let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile);
let start = new Date().getTime();
@@ -568,7 +567,9 @@ namespace ts {
}
function getSourceFile(fileName: string) {
- return filesByName.get(fileName);
+ // first try to use file name as is to find file
+ // then try to convert relative file name to absolute and use it to retrieve source file
+ return filesByName.get(fileName) || filesByName.get(getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()));
}
function getDiagnosticsHelper(
@@ -656,7 +657,7 @@ namespace ts {
function getOptionsDiagnostics(): Diagnostic[] {
let allDiagnostics: Diagnostic[] = [];
- addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics())
+ addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics());
addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics());
return sortAndDeduplicateDiagnostics(allDiagnostics);
}
@@ -673,23 +674,29 @@ namespace ts {
function processRootFile(fileName: string, isDefaultLib: boolean) {
processSourceFile(normalizePath(fileName), isDefaultLib);
- }
-
+ }
+
function fileReferenceIsEqualTo(a: FileReference, b: FileReference): boolean {
return a.fileName === b.fileName;
}
-
+
function moduleNameIsEqualTo(a: LiteralExpression, b: LiteralExpression): boolean {
return a.text === b.text;
}
-
+
function collectExternalModuleReferences(file: SourceFile): void {
if (file.imports) {
return;
}
-
+
let imports: LiteralExpression[];
for (let node of file.statements) {
+ collect(node, /* allowRelativeModuleNames */ true);
+ }
+
+ file.imports = imports || emptyArray;
+
+ function collect(node: Node, allowRelativeModuleNames: boolean): void {
switch (node.kind) {
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
@@ -702,7 +709,9 @@ namespace ts {
break;
}
- (imports || (imports = [])).push(moduleNameExpr);
+ if (allowRelativeModuleNames || !isExternalModuleNameRelative((moduleNameExpr).text)) {
+ (imports || (imports = [])).push(moduleNameExpr);
+ }
break;
case SyntaxKind.ModuleDeclaration:
if ((node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) {
@@ -712,23 +721,15 @@ namespace ts {
// The StringLiteral must specify a top - level external module name.
// Relative external module names are not permitted
forEachChild((node).body, node => {
- if (isExternalModuleImportEqualsDeclaration(node) &&
- getExternalModuleImportEqualsDeclarationExpression(node).kind === SyntaxKind.StringLiteral) {
- let moduleName = getExternalModuleImportEqualsDeclarationExpression(node);
- // TypeScript 1.0 spec (April 2014): 12.1.6
- // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
- // only through top - level external module names. Relative external module names are not permitted.
- if (moduleName) {
- (imports || (imports = [])).push(moduleName);
- }
- }
+ // TypeScript 1.0 spec (April 2014): 12.1.6
+ // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
+ // only through top - level external module names. Relative external module names are not permitted.
+ collect(node, /* allowRelativeModuleNames */ false);
});
}
break;
}
}
-
- file.imports = imports || emptyArray;
}
function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) {
@@ -775,60 +776,62 @@ namespace ts {
// Get source file from normalized fileName
function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number): SourceFile {
- let canonicalName = host.getCanonicalFileName(normalizeSlashes(fileName));
- if (filesByName.contains(canonicalName)) {
+ if (filesByName.contains(fileName)) {
// We've already looked for this file, use cached result
- return getSourceFileFromCache(fileName, canonicalName, /*useAbsolutePath*/ false);
+ return getSourceFileFromCache(fileName, /*useAbsolutePath*/ false);
}
- else {
- let normalizedAbsolutePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
- let canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath);
- if (filesByName.contains(canonicalAbsolutePath)) {
- return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true);
- }
-
- // We haven't looked for this file, do so now and cache result
- let file = host.getSourceFile(fileName, options.target, hostErrorMessage => {
- if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
- fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
- Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
- }
- else {
- fileProcessingDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
- }
- });
- filesByName.set(canonicalName, file);
- if (file) {
- skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib;
-
- // Set the source file for normalized absolute path
- filesByName.set(canonicalAbsolutePath, file);
-
- let basePath = getDirectoryPath(fileName);
- if (!options.noResolve) {
- processReferencedFiles(file, basePath);
- }
-
- // always process imported modules to record module name resolutions
- processImportedModules(file, basePath);
-
- if (isDefaultLib) {
- file.isDefaultLib = true;
- files.unshift(file);
- }
- else {
- files.push(file);
- }
- }
+ let normalizedAbsolutePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
+ if (filesByName.contains(normalizedAbsolutePath)) {
+ const file = getSourceFileFromCache(normalizedAbsolutePath, /*useAbsolutePath*/ true);
+ // we don't have resolution for this relative file name but the match was found by absolute file name
+ // store resolution for relative name as well
+ filesByName.set(fileName, file);
return file;
}
- function getSourceFileFromCache(fileName: string, canonicalName: string, useAbsolutePath: boolean): SourceFile {
- let file = filesByName.get(canonicalName);
+ // We haven't looked for this file, do so now and cache result
+ let file = host.getSourceFile(fileName, options.target, hostErrorMessage => {
+ if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
+ fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
+ Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
+ }
+ else {
+ fileProcessingDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
+ }
+ });
+
+ filesByName.set(fileName, file);
+ if (file) {
+ skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib;
+
+ // Set the source file for normalized absolute path
+ filesByName.set(normalizedAbsolutePath, file);
+
+ let basePath = getDirectoryPath(fileName);
+ if (!options.noResolve) {
+ processReferencedFiles(file, basePath);
+ }
+
+ // always process imported modules to record module name resolutions
+ processImportedModules(file, basePath);
+
+ if (isDefaultLib) {
+ file.isDefaultLib = true;
+ files.unshift(file);
+ }
+ else {
+ files.push(file);
+ }
+ }
+
+ return file;
+
+ function getSourceFileFromCache(fileName: string, useAbsolutePath: boolean): SourceFile {
+ let file = filesByName.get(fileName);
if (file && host.useCaseSensitiveFileNames()) {
let sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName;
- if (canonicalName !== sourceFileName) {
+ if (normalizeSlashes(fileName) !== normalizeSlashes(sourceFileName)) {
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
@@ -848,7 +851,7 @@ namespace ts {
processSourceFile(referencedFileName, /* isDefaultLib */ false, file, ref.pos, ref.end);
});
}
-
+
function processImportedModules(file: SourceFile, basePath: string) {
collectExternalModuleReferences(file);
if (file.imports.length) {
@@ -862,11 +865,11 @@ namespace ts {
const importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]);
if (importedFile && resolution.isExternalLibraryImport) {
if (!isExternalModule(importedFile)) {
- let start = getTokenPosOfNode(file.imports[i], file)
- fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
+ let start = getTokenPosOfNode(file.imports[i], file);
+ fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
}
else if (!fileExtensionIs(importedFile.fileName, ".d.ts")) {
- let start = getTokenPosOfNode(file.imports[i], file)
+ let start = getTokenPosOfNode(file.imports[i], file);
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition));
}
else if (importedFile.referencedFiles.length) {
diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts
index 58ca14ab577..ee4dea04f09 100644
--- a/src/compiler/scanner.ts
+++ b/src/compiler/scanner.ts
@@ -224,7 +224,7 @@ namespace ts {
}
// Perform binary search in one of the Unicode range maps
- let lo: number = 0;
+ let lo = 0;
let hi: number = map.length;
let mid: number;
@@ -657,7 +657,7 @@ namespace ts {
export function getTrailingCommentRanges(text: string, pos: number): CommentRange[] {
return getCommentRanges(text, pos, /*trailing*/ true);
}
-
+
/** Optionally, get the shebang */
export function getShebang(text: string): string {
return shebangTriviaRegex.test(text)
@@ -1361,7 +1361,9 @@ namespace ts {
if (text.charCodeAt(pos + 1) === CharacterCodes.equals) {
return pos += 2, token = SyntaxKind.LessThanEqualsToken;
}
- if (text.charCodeAt(pos + 1) === CharacterCodes.slash && languageVariant === LanguageVariant.JSX) {
+ if (languageVariant === LanguageVariant.JSX &&
+ text.charCodeAt(pos + 1) === CharacterCodes.slash &&
+ text.charCodeAt(pos + 2) !== CharacterCodes.asterisk) {
return pos += 2, token = SyntaxKind.LessThanSlashToken;
}
return pos++, token = SyntaxKind.LessThanToken;
diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts
index 5b46324601b..76f12666878 100644
--- a/src/compiler/sys.ts
+++ b/src/compiler/sys.ts
@@ -8,7 +8,7 @@ namespace ts {
write(s: string): void;
readFile(path: string, encoding?: string): string;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
- watchFile?(path: string, callback: (path: string) => void): FileWatcher;
+ watchFile?(path: string, callback: (path: string, removed: boolean) => void): FileWatcher;
resolvePath(path: string): string;
fileExists(path: string): boolean;
directoryExists(path: string): boolean;
@@ -29,8 +29,8 @@ namespace ts {
declare var process: any;
declare var global: any;
declare var __filename: string;
- declare var Buffer: {
- new (str: string, encoding?: string): any;
+ declare var Buffer: {
+ new (str: string, encoding?: string): any;
};
declare class Enumerator {
@@ -116,7 +116,7 @@ namespace ts {
return path.toLowerCase();
}
- function getNames(collection: any): string[]{
+ function getNames(collection: any): string[] {
let result: string[] = [];
for (let e = new Enumerator(collection); !e.atEnd(); e.moveNext()) {
result.push(e.item().Name);
@@ -270,9 +270,9 @@ namespace ts {
args: process.argv.slice(2),
newLine: _os.EOL,
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
- write(s: string): void {
- const buffer = new Buffer(s, "utf8");
- let offset: number = 0;
+ write(s: string): void {
+ const buffer = new Buffer(s, "utf8");
+ let offset = 0;
let toWrite: number = buffer.length;
let written = 0;
// 1 is a standard descriptor for stdout
@@ -280,7 +280,7 @@ namespace ts {
offset += written;
toWrite -= written;
}
- },
+ },
readFile,
writeFile,
watchFile: (fileName, callback) => {
@@ -292,11 +292,16 @@ namespace ts {
};
function fileChanged(curr: any, prev: any) {
+ // mtime.getTime() equals 0 if file was removed
+ if (curr.mtime.getTime() === 0) {
+ callback(fileName, /* removed */ true);
+ return;
+ }
if (+curr.mtime <= +prev.mtime) {
return;
}
- callback(fileName);
+ callback(fileName, /* removed */ false);
}
},
resolvePath: function (path: string): string {
diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts
index 96759b68250..7b74024aec4 100644
--- a/src/compiler/tsc.ts
+++ b/src/compiler/tsc.ts
@@ -86,7 +86,6 @@ namespace ts {
if (diagnostic.file) {
let loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
-
output += `${ diagnostic.file.fileName }(${ loc.line + 1 },${ loc.character + 1 }): `;
}
@@ -102,6 +101,19 @@ namespace ts {
}
}
+ function reportWatchDiagnostic(diagnostic: Diagnostic) {
+ let output = new Date().toLocaleTimeString() + " - ";
+
+ if (diagnostic.file) {
+ let loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
+ output += `${ diagnostic.file.fileName }(${ loc.line + 1 },${ loc.character + 1 }): `;
+ }
+
+ output += `${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`;
+
+ sys.write(output);
+ }
+
function padLeft(s: string, length: number) {
while (s.length < length) {
s = " " + s;
@@ -218,7 +230,7 @@ namespace ts {
let result = readConfigFile(configFileName, sys.readFile);
if (result.error) {
- reportDiagnostic(result.error);
+ reportWatchDiagnostic(result.error);
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
@@ -247,7 +259,7 @@ namespace ts {
}
setCachedProgram(compileResult.program);
- reportDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
+ reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
}
function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) {
@@ -263,7 +275,7 @@ namespace ts {
let sourceFile = hostGetSourceFile(fileName, languageVersion, onError);
if (sourceFile && compilerOptions.watch) {
// Attach a file watcher
- sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, () => sourceFileChanged(sourceFile));
+ sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, (fileName, removed) => sourceFileChanged(sourceFile, removed));
}
return sourceFile;
}
@@ -285,9 +297,15 @@ namespace ts {
}
// If a source file changes, mark it as unwatched and start the recompilation timer
- function sourceFileChanged(sourceFile: SourceFile) {
+ function sourceFileChanged(sourceFile: SourceFile, removed: boolean) {
sourceFile.fileWatcher.close();
sourceFile.fileWatcher = undefined;
+ if (removed) {
+ let index = rootFileNames.indexOf(sourceFile.fileName);
+ if (index >= 0) {
+ rootFileNames.splice(index, 1);
+ }
+ }
startTimer();
}
@@ -309,7 +327,7 @@ namespace ts {
function recompile() {
timerHandle = undefined;
- reportDiagnostic(createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation));
+ reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation));
performCompilation();
}
}
@@ -361,7 +379,7 @@ namespace ts {
function compileProgram(): ExitStatus {
let diagnostics: Diagnostic[];
-
+
// First get and report any syntactic errors.
diagnostics = program.getSyntacticDiagnostics();
@@ -497,7 +515,7 @@ namespace ts {
function writeConfigFile(options: CompilerOptions, fileNames: string[]) {
let currentDirectory = sys.getCurrentDirectory();
- let file = combinePaths(currentDirectory, 'tsconfig.json');
+ let file = combinePaths(currentDirectory, "tsconfig.json");
if (sys.fileExists(file)) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file));
}
@@ -519,8 +537,8 @@ namespace ts {
return;
- function serializeCompilerOptions(options: CompilerOptions): Map {
- let result: Map = {};
+ function serializeCompilerOptions(options: CompilerOptions): Map {
+ let result: Map = {};
let optionsNameMap = getOptionNameMap().optionNameMap;
for (let name in options) {
diff --git a/src/compiler/types.ts b/src/compiler/types.ts
index 2cb429a993e..5979c4246b1 100644
--- a/src/compiler/types.ts
+++ b/src/compiler/types.ts
@@ -376,6 +376,7 @@ namespace ts {
OctalLiteral = 0x00010000, // Octal numeric literal
Namespace = 0x00020000, // Namespace declaration
ExportContext = 0x00040000, // Export context (initialized by binding)
+ ContainsThis = 0x00080000, // Interface contains references to "this"
Modifier = Export | Ambient | Public | Private | Protected | Static | Abstract | Default | Async,
AccessibilityModifier = Public | Private | Protected,
@@ -1244,7 +1245,7 @@ namespace ts {
moduleName: string;
referencedFiles: FileReference[];
languageVariant: LanguageVariant;
-
+
// this map is used by transpiler to supply alternative names for dependencies (i.e. in case of bundling)
/* @internal */
renamedDependencies?: Map;
@@ -1312,12 +1313,12 @@ namespace ts {
}
export interface Program extends ScriptReferenceHost {
-
+
/**
* Get a list of root file names that were passed to a 'createProgram'
*/
- getRootFileNames(): string[]
-
+ getRootFileNames(): string[];
+
/**
* Get a list of files in the program
*/
@@ -1496,6 +1497,7 @@ namespace ts {
// declaration emitter to help determine if it should patch up the final declaration file
// with import statements it previously saw (but chose not to emit).
trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
+ reportInaccessibleThisError(): void;
}
export const enum TypeFormatFlags {
@@ -1598,7 +1600,7 @@ namespace ts {
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
getBlockScopedVariableId(node: Identifier): number;
getReferencedValueDeclaration(reference: Identifier): Declaration;
- getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind;
+ getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind;
isOptionalParameter(node: ParameterDeclaration): boolean;
}
@@ -1797,6 +1799,7 @@ namespace ts {
/* @internal */
ContainsAnyFunctionType = 0x00800000, // Type is or contains object literal type
ESSymbol = 0x01000000, // Type of symbol primitive introduced in ES6
+ ThisType = 0x02000000, // This type
/* @internal */
Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null,
@@ -1842,6 +1845,7 @@ namespace ts {
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
outerTypeParameters: TypeParameter[]; // Outer type parameters (undefined if none)
localTypeParameters: TypeParameter[]; // Local type parameters (undefined if none)
+ thisType: TypeParameter; // The "this" type (undefined if none)
/* @internal */
resolvedBaseConstructorType?: Type; // Resolved base constructor type of class
/* @internal */
@@ -1856,10 +1860,17 @@ namespace ts {
declaredNumberIndexType: Type; // Declared numeric index type
}
- // Type references (TypeFlags.Reference)
+ // Type references (TypeFlags.Reference). When a class or interface has type parameters or
+ // a "this" type, references to the class or interface are made using type references. The
+ // typeArguments property specififes the types to substitute for the type parameters of the
+ // class or interface and optionally includes an extra element that specifies the type to
+ // substitute for "this" in the resulting instantiation. When no extra argument is present,
+ // the type reference itself is substituted for "this". The typeArguments property is undefined
+ // if the class or interface has no type parameters and the reference isn't specifying an
+ // explicit "this" argument.
export interface TypeReference extends ObjectType {
target: GenericType; // Type reference target
- typeArguments: Type[]; // Type reference type arguments
+ typeArguments: Type[]; // Type reference type arguments (undefined if none)
}
// Generic class and interface types
@@ -2014,12 +2025,12 @@ namespace ts {
Error,
Message,
}
-
+
export const enum ModuleResolutionKind {
Classic = 1,
NodeJs = 2
}
-
+
export interface CompilerOptions {
allowNonTsExtensions?: boolean;
charset?: string;
@@ -2061,7 +2072,7 @@ namespace ts {
experimentalDecorators?: boolean;
experimentalAsyncFunctions?: boolean;
emitDecoratorMetadata?: boolean;
- moduleResolution?: ModuleResolutionKind
+ moduleResolution?: ModuleResolutionKind;
/* @internal */ stripInternal?: boolean;
// Skip checking lib.d.ts to help speed up tests.
@@ -2276,15 +2287,15 @@ namespace ts {
byteOrderMark = 0xFEFF,
tab = 0x09, // \t
verticalTab = 0x0B, // \v
- }
-
+ }
+
export interface ModuleResolutionHost {
fileExists(fileName: string): boolean;
// readFile function is used to read arbitrary text files on disk, i.e. when resolution procedure needs the content of 'package.json'
// to determine location of bundled typings for node module
readFile(fileName: string): string;
}
-
+
export interface ResolvedModule {
resolvedFileName: string;
/*
@@ -2295,12 +2306,12 @@ namespace ts {
*/
isExternalLibraryImport?: boolean;
}
-
+
export interface ResolvedModuleWithFailedLookupLocations {
resolvedModule: ResolvedModule;
failedLookupLocations: string[];
}
-
+
export interface CompilerHost extends ModuleResolutionHost {
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
getCancellationToken?(): CancellationToken;
@@ -2310,7 +2321,7 @@ namespace ts {
getCanonicalFileName(fileName: string): string;
useCaseSensitiveFileNames(): boolean;
getNewLine(): string;
-
+
/*
* CompilerHost must either implement resolveModuleNames (in case if it wants to be completely in charge of
* module name resolution) or provide implementation for methods from ModuleResolutionHost (in this case compiler
@@ -2349,7 +2360,7 @@ namespace ts {
// operation caused diagnostics to be returned by storing and comparing the return value
// of this method before/after the operation is performed.
getModificationCount(): number;
-
+
/* @internal */ reattachFileDiagnostics(newFile: SourceFile): void;
}
}
diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts
index 9928be4529b..5127b98ab3a 100644
--- a/src/compiler/utilities.ts
+++ b/src/compiler/utilities.ts
@@ -65,7 +65,8 @@ namespace ts {
increaseIndent: () => { },
decreaseIndent: () => { },
clear: () => str = "",
- trackSymbol: () => { }
+ trackSymbol: () => { },
+ reportInaccessibleThisError: () => { }
};
}
@@ -98,8 +99,8 @@ namespace ts {
}
return true;
- }
-
+ }
+
export function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean {
return sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText);
}
@@ -468,13 +469,12 @@ namespace ts {
else if (node.parent.kind === SyntaxKind.PropertyAccessExpression && (node.parent).name === node) {
node = node.parent;
}
- // fall through
- case SyntaxKind.QualifiedName:
- case SyntaxKind.PropertyAccessExpression:
// At this point, node is either a qualified name or an identifier
Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression,
"'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'.");
-
+ case SyntaxKind.QualifiedName:
+ case SyntaxKind.PropertyAccessExpression:
+ case SyntaxKind.ThisKeyword:
let parent = node.parent;
if (parent.kind === SyntaxKind.TypeQuery) {
return false;
@@ -733,6 +733,9 @@ namespace ts {
case SyntaxKind.Constructor:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
+ case SyntaxKind.CallSignature:
+ case SyntaxKind.ConstructSignature:
+ case SyntaxKind.IndexSignature:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.SourceFile:
return node;
@@ -895,7 +898,6 @@ namespace ts {
export function isExpression(node: Node): boolean {
switch (node.kind) {
- case SyntaxKind.ThisKeyword:
case SyntaxKind.SuperKeyword:
case SyntaxKind.NullKeyword:
case SyntaxKind.TrueKeyword:
@@ -928,6 +930,7 @@ namespace ts {
case SyntaxKind.JsxElement:
case SyntaxKind.JsxSelfClosingElement:
case SyntaxKind.YieldExpression:
+ case SyntaxKind.AwaitExpression:
return true;
case SyntaxKind.QualifiedName:
while (node.parent.kind === SyntaxKind.QualifiedName) {
@@ -941,6 +944,7 @@ namespace ts {
// fall through
case SyntaxKind.NumericLiteral:
case SyntaxKind.StringLiteral:
+ case SyntaxKind.ThisKeyword:
let parent = node.parent;
switch (parent.kind) {
case SyntaxKind.VariableDeclaration:
@@ -981,6 +985,7 @@ namespace ts {
return node === (parent).expression;
case SyntaxKind.Decorator:
case SyntaxKind.JsxExpression:
+ case SyntaxKind.JsxSpreadAttribute:
return true;
case SyntaxKind.ExpressionWithTypeArguments:
return (parent).expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
@@ -993,6 +998,12 @@ namespace ts {
return false;
}
+ export function isExternalModuleNameRelative(moduleName: string): boolean {
+ // TypeScript 1.0 spec (April 2014): 11.2.1
+ // An external module name is "relative" if the first term is "." or "..".
+ return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
+ }
+
export function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean) {
let moduleState = getModuleInstanceState(node);
return moduleState === ModuleInstanceState.Instantiated ||
@@ -1516,12 +1527,12 @@ namespace ts {
function getModificationCount() {
return modificationCount;
}
-
+
function reattachFileDiagnostics(newFile: SourceFile): void {
if (!hasProperty(fileDiagnostics, newFile.fileName)) {
return;
}
-
+
for (let diagnostic of fileDiagnostics[newFile.fileName]) {
diagnostic.file = newFile;
}
diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts
index a24ed30ae14..108c6f4518a 100644
--- a/src/harness/compilerRunner.ts
+++ b/src/harness/compilerRunner.ts
@@ -1,6 +1,7 @@
///
///
///
+/* tslint:disable:no-null */
const enum CompilerTestType {
Conformance,
@@ -32,7 +33,8 @@ class CompilerBaselineRunner extends RunnerBase {
}
else if (testType === CompilerTestType.Test262) {
this.testSuiteName = "test262";
- } else {
+ }
+ else {
this.testSuiteName = "compiler"; // default to this for historical reasons
}
this.basePath += "/" + this.testSuiteName;
@@ -82,7 +84,8 @@ class CompilerBaselineRunner extends RunnerBase {
otherFiles.push({ unitName: rootDir + unit.name, content: unit.content });
}
});
- } else {
+ }
+ else {
toBeCompiled = units.map(unit => {
return { unitName: rootDir + unit.name, content: unit.content };
});
@@ -193,7 +196,8 @@ class CompilerBaselineRunner extends RunnerBase {
if (jsCode.length > 0) {
return tsCode + "\r\n\r\n" + jsCode;
- } else {
+ }
+ else {
return null;
}
});
diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts
index 7faf4d1cc0b..a846077a85f 100644
--- a/src/harness/fourslash.ts
+++ b/src/harness/fourslash.ts
@@ -18,8 +18,9 @@
///
///
///
+/* tslint:disable:no-null */
-module FourSlash {
+namespace FourSlash {
ts.disableIncrementalParsing = false;
// Represents a parsed source file with metadata
@@ -156,7 +157,7 @@ module FourSlash {
return true;
}
- public setCancelled(numberOfCalls: number = 0): void {
+ public setCancelled(numberOfCalls = 0): void {
ts.Debug.assert(numberOfCalls >= 0);
this.numberOfCallsBeforeCancellation = numberOfCalls;
}
@@ -258,7 +259,8 @@ module FourSlash {
this.inputFiles[file.fileName] = file.content;
if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference] === "true") {
startResolveFileRef = file;
- } else if (startResolveFileRef) {
+ }
+ else if (startResolveFileRef) {
// If entry point for resolving file references is already specified, report duplication error
throw new Error("There exists a Fourslash file which has resolveReference flag specified; remove duplicated resolveReference flag");
}
@@ -361,7 +363,8 @@ module FourSlash {
this.currentCaretPosition = Math.min(this.currentCaretPosition, this.getFileContent(this.activeFile.fileName).length);
if (count > 0) {
this.scenarioActions.push(``);
- } else {
+ }
+ else {
this.scenarioActions.push(``);
}
}
@@ -436,7 +439,8 @@ module FourSlash {
predicate = function (errorMinChar: number, errorLimChar: number, startPos: number, endPos: number) {
return ((errorMinChar >= startPos) && (errorLimChar >= startPos)) ? true : false;
};
- } else {
+ }
+ else {
predicate = function (errorMinChar: number, errorLimChar: number, startPos: number, endPos: number) {
return ((errorMinChar <= startPos) && (errorLimChar <= startPos)) ? true : false;
};
@@ -476,7 +480,8 @@ module FourSlash {
private printErrorLog(expectErrors: boolean, errors: ts.Diagnostic[]) {
if (expectErrors) {
Harness.IO.log("Expected error not found. Error list is:");
- } else {
+ }
+ else {
Harness.IO.log("Unexpected error(s) found. Error list is:");
}
@@ -549,10 +554,12 @@ module FourSlash {
if (negative) {
this.verifyMemberListIsEmpty(false);
return;
- } else {
+ }
+ else {
this.scenarioActions.push("");
}
- } else {
+ }
+ else {
this.scenarioActions.push("");
this.scenarioActions.push(``);
}
@@ -595,14 +602,16 @@ module FourSlash {
public verifyMemberListIsEmpty(negative: boolean) {
if (negative) {
this.scenarioActions.push("");
- } else {
+ }
+ else {
this.scenarioActions.push("");
}
let members = this.getMemberListAtCaret();
if ((!members || members.entries.length === 0) && negative) {
this.raiseError("Member list is empty at Caret");
- } else if ((members && members.entries.length !== 0) && !negative) {
+ }
+ else if ((members && members.entries.length !== 0) && !negative) {
let errorMsg = "\n" + "Member List contains: [" + members.entries[0].name;
for (let i = 1; i < members.entries.length; i++) {
@@ -639,7 +648,8 @@ module FourSlash {
if ((completions && !completions.isNewIdentifierLocation) && !negative) {
this.raiseError("Expected builder completion entry");
- } else if ((completions && completions.isNewIdentifierLocation) && negative) {
+ }
+ else if ((completions && completions.isNewIdentifierLocation) && negative) {
this.raiseError("Un-expected builder completion entry");
}
}
@@ -751,7 +761,7 @@ module FourSlash {
this.raiseError(`verifyReferencesAtPositionListContains failed - could not find the item: ${JSON.stringify(missingItem)} in the returned list: (${JSON.stringify(references)})`);
}
- public verifyReferencesCountIs(count: number, localFilesOnly: boolean = true) {
+ public verifyReferencesCountIs(count: number, localFilesOnly = true) {
this.taoInvalidReason = "verifyReferences NYI";
let references = this.getReferencesAtCaret();
@@ -832,7 +842,8 @@ module FourSlash {
if (expectedDocumentation != undefined) {
assert.notEqual(actualQuickInfoDocumentation, expectedDocumentation, this.messageAtLastKnownMarker("quick info doc comment"));
}
- } else {
+ }
+ else {
if (expectedText !== undefined) {
assert.equal(actualQuickInfoText, expectedText, this.messageAtLastKnownMarker("quick info text"));
}
@@ -1014,7 +1025,8 @@ module FourSlash {
if (!actual) {
this.raiseError("Expected signature help to be present, but it wasn't");
}
- } else {
+ }
+ else {
if (actual) {
this.raiseError(`Expected no signature help, but got "${JSON.stringify(actual)}"`);
}
@@ -1371,7 +1383,8 @@ module FourSlash {
public type(text: string) {
if (text === "") {
this.taoInvalidReason = "Test used empty-insert workaround.";
- } else {
+ }
+ else {
this.scenarioActions.push(``);
}
@@ -1398,7 +1411,8 @@ module FourSlash {
if (ch === "(" || ch === ",") {
/* Signature help*/
this.languageService.getSignatureHelpItems(this.activeFile.fileName, offset);
- } else if (prevChar === " " && /A-Za-z_/.test(ch)) {
+ }
+ else if (prevChar === " " && /A-Za-z_/.test(ch)) {
/* Completions */
this.languageService.getCompletionsAtPosition(this.activeFile.fileName, offset);
}
@@ -1547,7 +1561,8 @@ module FourSlash {
if (marker.position < limChar) {
// Marker is inside the edit - mark it as invalidated (?)
marker.position = -1;
- } else {
+ }
+ else {
// Move marker back/forward by the appropriate amount
marker.position += (minChar - limChar) + text.length;
}
@@ -1568,7 +1583,8 @@ module FourSlash {
public goToDefinition(definitionIndex: number) {
if (definitionIndex === 0) {
this.scenarioActions.push("");
- } else {
+ }
+ else {
this.taoInvalidReason = "GoToDefinition not supported for non-zero definition indices";
}
@@ -1650,7 +1666,8 @@ module FourSlash {
if (negative) {
assert.notEqual(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Name"));
assert.notEqual(actualDefinitionContainerName, expectedContainerName, this.messageAtLastKnownMarker("Definition Info Container Name"));
- } else {
+ }
+ else {
assert.equal(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Name"));
assert.equal(actualDefinitionContainerName, expectedContainerName, this.messageAtLastKnownMarker("Definition Info Container Name"));
}
@@ -1897,22 +1914,22 @@ module FourSlash {
if (expected === undefined) {
if (actual) {
- this.raiseError(name + ' failed - expected no template but got {newText: \"' + actual.newText + '\" caretOffset: ' + actual.caretOffset + '}');
+ this.raiseError(name + " failed - expected no template but got {newText: \"" + actual.newText + "\" caretOffset: " + actual.caretOffset + "}");
}
return;
}
else {
if (actual === undefined) {
- this.raiseError(name + ' failed - expected the template {newText: \"' + actual.newText + '\" caretOffset: ' + actual.caretOffset + '} but got nothing instead');
+ this.raiseError(name + " failed - expected the template {newText: \"" + actual.newText + "\" caretOffset: " + actual.caretOffset + "} but got nothing instead");
}
if (actual.newText !== expected.newText) {
- this.raiseError(name + ' failed - expected insertion:\n' + this.clarifyNewlines(expected.newText) + '\nactual insertion:\n' + this.clarifyNewlines(actual.newText));
+ this.raiseError(name + " failed - expected insertion:\n" + this.clarifyNewlines(expected.newText) + "\nactual insertion:\n" + this.clarifyNewlines(actual.newText));
}
if (actual.caretOffset !== expected.caretOffset) {
- this.raiseError(name + ' failed - expected caretOffset: ' + expected.caretOffset + ',\nactual caretOffset:' + actual.caretOffset);
+ this.raiseError(name + " failed - expected caretOffset: " + expected.caretOffset + ",\nactual caretOffset:" + actual.caretOffset);
}
}
}
@@ -1936,9 +1953,11 @@ module FourSlash {
let actualMatchPosition = -1;
if (bracePosition === actual[0].start) {
actualMatchPosition = actual[1].start;
- } else if (bracePosition === actual[1].start) {
+ }
+ else if (bracePosition === actual[1].start) {
actualMatchPosition = actual[0].start;
- } else {
+ }
+ else {
this.raiseError(`verifyMatchingBracePosition failed - could not find the brace position: ${bracePosition} in the returned list: (${actual[0].start},${ts.textSpanEnd(actual[0])}) and (${actual[1].start},${ts.textSpanEnd(actual[1])})`);
}
@@ -2108,7 +2127,7 @@ module FourSlash {
let occurrences = this.getOccurrencesAtCurrentPosition();
if (!occurrences || occurrences.length === 0) {
- this.raiseError('verifyOccurrencesAtPositionListContains failed - found 0 references, expected at least one.');
+ this.raiseError("verifyOccurrencesAtPositionListContains failed - found 0 references, expected at least one.");
}
for (let occurrence of occurrences) {
@@ -2140,12 +2159,12 @@ module FourSlash {
}
public verifyDocumentHighlightsAtPositionListContains(fileName: string, start: number, end: number, fileNamesToSearch: string[], kind?: string) {
- this.taoInvalidReason = 'verifyDocumentHighlightsAtPositionListContains NYI';
+ this.taoInvalidReason = "verifyDocumentHighlightsAtPositionListContains NYI";
let documentHighlights = this.getDocumentHighlightsAtCurrentPosition(fileNamesToSearch);
if (!documentHighlights || documentHighlights.length === 0) {
- this.raiseError('verifyDocumentHighlightsAtPositionListContains failed - found 0 highlights, expected at least one.');
+ this.raiseError("verifyDocumentHighlightsAtPositionListContains failed - found 0 highlights, expected at least one.");
}
for (let documentHighlight of documentHighlights) {
@@ -2168,15 +2187,15 @@ module FourSlash {
}
public verifyDocumentHighlightsAtPositionListCount(expectedCount: number, fileNamesToSearch: string[]) {
- this.taoInvalidReason = 'verifyDocumentHighlightsAtPositionListCount NYI';
+ this.taoInvalidReason = "verifyDocumentHighlightsAtPositionListCount NYI";
let documentHighlights = this.getDocumentHighlightsAtCurrentPosition(fileNamesToSearch);
- let actualCount = documentHighlights
- ? documentHighlights.reduce((currentCount, { highlightSpans }) => currentCount + highlightSpans.length, 0)
+ let actualCount = documentHighlights
+ ? documentHighlights.reduce((currentCount, { highlightSpans }) => currentCount + highlightSpans.length, 0)
: 0;
if (expectedCount !== actualCount) {
- this.raiseError('verifyDocumentHighlightsAtPositionListCount failed - actual: ' + actualCount + ', expected:' + expectedCount);
+ this.raiseError("verifyDocumentHighlightsAtPositionListCount failed - actual: " + actualCount + ", expected:" + expectedCount);
}
}
@@ -2250,10 +2269,12 @@ module FourSlash {
let index = indexOrName;
if (index >= this.testData.files.length) {
throw new Error(`File index (${index}) in openFile was out of range. There are only ${this.testData.files.length} files in this test.`);
- } else {
+ }
+ else {
result = this.testData.files[index];
}
- } else if (typeof indexOrName === "string") {
+ }
+ else if (typeof indexOrName === "string") {
let name = indexOrName;
// names are stored in the compiler with this relative path, this allows people to use goTo.file on just the fileName
@@ -2276,7 +2297,8 @@ module FourSlash {
if (!foundIt) {
throw new Error(`No test file named "${name}" exists. Available file names are: ${availableNames.join(", ")}`);
}
- } else {
+ }
+ else {
throw new Error("Unknown argument type");
}
@@ -2294,7 +2316,8 @@ module FourSlash {
let markerNames: string[] = [];
for (let m in this.testData.markerPositions) markerNames.push(m);
throw new Error(`Unknown marker "${markerName}" Available markers: ${markerNames.map(m => "\"" + m + "\"").join(", ")}`);
- } else {
+ }
+ else {
return markerPos;
}
}
@@ -2439,13 +2462,15 @@ module FourSlash {
// Append to the current subfile content, inserting a newline needed
if (currentFileContent === null) {
currentFileContent = "";
- } else {
+ }
+ else {
// End-of-line
currentFileContent = currentFileContent + "\n";
}
currentFileContent = currentFileContent + line.substr(4);
- } else if (line.substr(0, 2) === "//") {
+ }
+ else if (line.substr(0, 2) === "//") {
// Comment line, check for global/file @options and record them
let match = optionRegex.exec(line.substr(2));
if (match) {
@@ -2475,17 +2500,20 @@ module FourSlash {
currentFileName = basePath + "/" + match[2];
currentFileOptions[match[1]] = match[2];
- } else {
+ }
+ else {
// Add other fileMetadata flag
currentFileOptions[match[1]] = match[2];
}
}
}
// TODO: should be '==='?
- } else if (line == "" || lineLength === 0) {
+ }
+ else if (line == "" || lineLength === 0) {
// Previously blank lines between fourslash content caused it to be considered as 2 files,
// Remove this behavior since it just causes errors now
- } else {
+ }
+ else {
// Empty line or code line, terminate current subfile if there is one
if (currentFileContent) {
let file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges);
@@ -2555,7 +2583,8 @@ module FourSlash {
try {
// Attempt to parse the marker value as JSON
markerValue = JSON.parse("{ " + text + " }");
- } catch (e) {
+ }
+ catch (e) {
reportError(fileName, location.sourceLine, location.sourceColumn, "Unable to parse marker text " + e.message);
}
@@ -2591,7 +2620,8 @@ module FourSlash {
let message = "Marker '" + name + "' is duplicated in the source file contents.";
reportError(marker.fileName, location.sourceLine, location.sourceColumn, message);
return null;
- } else {
+ }
+ else {
markerMap[name] = marker;
markers.push(marker);
return marker;
@@ -2605,7 +2635,7 @@ module FourSlash {
let validMarkerChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz$1234567890_";
/// The file content (minus metacharacters) so far
- let output: string = "";
+ let output = "";
/// The current marker (or maybe multi-line comment?) we're parsing, possibly
let openMarker: ILocationInformation = null;
@@ -2617,22 +2647,23 @@ module FourSlash {
let localRanges: Range[] = [];
/// The latest position of the start of an unflushed plain text area
- let lastNormalCharPosition: number = 0;
+ let lastNormalCharPosition = 0;
/// The total number of metacharacters removed from the file (so far)
- let difference: number = 0;
+ let difference = 0;
/// The fourslash file state object we are generating
let state: State = State.none;
/// Current position data
- let line: number = 1;
- let column: number = 1;
+ let line = 1;
+ let column = 1;
let flush = (lastSafeCharIndex: number) => {
if (lastSafeCharIndex === undefined) {
output = output + content.substr(lastNormalCharPosition);
- } else {
+ }
+ else {
output = output + content.substr(lastNormalCharPosition, lastSafeCharIndex - lastNormalCharPosition);
}
};
@@ -2655,7 +2686,8 @@ module FourSlash {
flush(i - 1);
lastNormalCharPosition = i + 1;
difference += 2;
- } else if (previousChar === "|" && currentChar === "]") {
+ }
+ else if (previousChar === "|" && currentChar === "]") {
// found a range end
let rangeStart = openRanges.pop();
if (!rangeStart) {
@@ -2674,7 +2706,8 @@ module FourSlash {
flush(i - 1);
lastNormalCharPosition = i + 1;
difference += 2;
- } else if (previousChar === "/" && currentChar === "*") {
+ }
+ else if (previousChar === "/" && currentChar === "*") {
// found a possible marker start
state = State.inSlashStarMarker;
openMarker = {
@@ -2683,7 +2716,8 @@ module FourSlash {
sourceLine: line,
sourceColumn: column,
};
- } else if (previousChar === "{" && currentChar === "|") {
+ }
+ else if (previousChar === "{" && currentChar === "|") {
// found an object marker start
state = State.inObjectMarker;
openMarker = {
@@ -2736,10 +2770,12 @@ module FourSlash {
// Reset the state
openMarker = null;
state = State.none;
- } else if (validMarkerChars.indexOf(currentChar) < 0) {
+ }
+ else if (validMarkerChars.indexOf(currentChar) < 0) {
if (currentChar === "*" && i < content.length - 1 && content.charAt(i + 1) === "/") {
// The marker is about to be closed, ignore the 'invalid' char
- } else {
+ }
+ else {
// We've hit a non-valid marker character, so we were actually in a block comment
// Bail out the text we've gathered so far back into the output
flush(i);
@@ -2755,7 +2791,8 @@ module FourSlash {
if (currentChar === "\n" && previousChar === "\r") {
// Ignore trailing \n after a \r
continue;
- } else if (currentChar === "\n" || currentChar === "\r") {
+ }
+ else if (currentChar === "\n" || currentChar === "\r") {
line++;
column = 1;
continue;
diff --git a/src/harness/fourslashRunner.ts b/src/harness/fourslashRunner.ts
index d30a30d88e3..867c0d5a4d6 100644
--- a/src/harness/fourslashRunner.ts
+++ b/src/harness/fourslashRunner.ts
@@ -1,6 +1,7 @@
///
///
///
+/* tslint:disable:no-null */
const enum FourSlashTestType {
Native,
@@ -25,8 +26,8 @@ class FourSlashRunner extends RunnerBase {
this.testSuiteName = "fourslash-shims";
break;
case FourSlashTestType.ShimsWithPreprocess:
- this.basePath = 'tests/cases/fourslash/shims-pp';
- this.testSuiteName = 'fourslash-shims-pp';
+ this.basePath = "tests/cases/fourslash/shims-pp";
+ this.testSuiteName = "fourslash-shims-pp";
break;
case FourSlashTestType.Server:
this.basePath = "tests/cases/fourslash/server";
@@ -87,7 +88,8 @@ class FourSlashRunner extends RunnerBase {
FourSlash.xmlData.forEach(xml => {
if (xml.invalidReason !== null) {
lines.push("");
- } else {
+ }
+ else {
lines.push(" ");
xml.actions.forEach(action => {
lines.push(" " + action);
diff --git a/src/harness/harness.ts b/src/harness/harness.ts
index 57eb848ac23..a37b647a124 100644
--- a/src/harness/harness.ts
+++ b/src/harness/harness.ts
@@ -23,6 +23,7 @@
///
///
///
+/* tslint:disable:no-null */
// Block scoped definitions work poorly for global variables, temporarily enable var
/* tslint:disable:no-var-keyword */
@@ -35,7 +36,7 @@ declare var __dirname: string; // Node-specific
var global = Function("return this").call(null);
/* tslint:enable:no-var-keyword */
-module Utils {
+namespace Utils {
// Setup some globals based on the current environment
export const enum ExecutionEnvironment {
Node,
@@ -54,17 +55,17 @@ module Utils {
return ExecutionEnvironment.Node;
}
}
-
+
export let currentExecutionEnvironment = getExecutionEnvironment();
- const Buffer: BufferConstructor = currentExecutionEnvironment !== ExecutionEnvironment.Browser
- ? require("buffer").Buffer
+ const Buffer: BufferConstructor = currentExecutionEnvironment !== ExecutionEnvironment.Browser
+ ? require("buffer").Buffer
: undefined;
export function encodeString(s: string): string {
return Buffer ? (new Buffer(s)).toString("utf8") : s;
}
-
+
export function evalFile(fileContents: string, fileName: string, nodeContext?: any) {
let environment = getExecutionEnvironment();
switch (environment) {
@@ -76,7 +77,8 @@ module Utils {
let vm = require("vm");
if (nodeContext) {
vm.runInNewContext(fileContents, nodeContext, fileName);
- } else {
+ }
+ else {
vm.runInThisContext(fileContents, fileName);
}
break;
@@ -126,7 +128,8 @@ module Utils {
let cachedResult = cache[key];
if (cachedResult) {
return cachedResult;
- } else {
+ }
+ else {
return cache[key] = f.apply(this, arguments);
}
});
@@ -396,7 +399,7 @@ module Utils {
}
}
-module Harness.Path {
+namespace Harness.Path {
export function getFileName(fullPath: string) {
return fullPath.replace(/^.*[\\\/]/, "");
}
@@ -409,7 +412,7 @@ module Harness.Path {
}
}
-module Harness {
+namespace Harness {
export interface IO {
newLine(): string;
getCurrentDirectory(): string;
@@ -431,11 +434,11 @@ module Harness {
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
}
export var IO: IO;
-
+
// harness always uses one kind of new line
const harnessNewLine = "\r\n";
-
- module IOImpl {
+
+ namespace IOImpl {
declare class Enumerator {
public atEnd(): boolean;
public moveNext(): boolean;
@@ -443,14 +446,15 @@ module Harness {
constructor(o: any);
}
- export module CScript {
+ export namespace CScript {
let fso: any;
if (global.ActiveXObject) {
fso = new global.ActiveXObject("Scripting.FileSystemObject");
- } else {
+ }
+ else {
fso = {};
}
-
+
export const args = () => ts.sys.args;
export const getExecutingFilePath = () => ts.sys.getExecutingFilePath();
export const exit = (exitCode: number) => ts.sys.exit(exitCode);
@@ -511,16 +515,17 @@ module Harness {
};
}
- export module Node {
+ export namespace Node {
declare let require: any;
let fs: any, pathModule: any;
if (require) {
fs = require("fs");
pathModule = require("path");
- } else {
+ }
+ else {
fs = pathModule = {};
}
-
+
export const resolvePath = (path: string) => ts.sys.resolvePath(path);
export const getCurrentDirectory = () => ts.sys.getCurrentDirectory();
export const newLine = () => harnessNewLine;
@@ -545,7 +550,8 @@ module Harness {
export function deleteFile(path: string) {
try {
fs.unlinkSync(path);
- } catch (e) {
+ }
+ catch (e) {
}
}
@@ -559,7 +565,8 @@ module Harness {
// Node will just continue to repeat the root path, rather than return null
if (dirPath === path) {
dirPath = null;
- } else {
+ }
+ else {
return dirPath;
}
}
@@ -596,7 +603,7 @@ module Harness {
};
}
- export module Network {
+ export namespace Network {
let serverRoot = "http://localhost:8888/";
export const newLine = () => harnessNewLine;
@@ -605,10 +612,11 @@ module Harness {
export const args = () => [];
export const getExecutingFilePath = () => "";
export const exit = (exitCode: number) => {};
-
- let supportsCodePage = () => false;
- module Http {
+ let supportsCodePage = () => false;
+ export let log = (s: string) => console.log(s);
+
+ namespace Http {
function waitForXHR(xhr: XMLHttpRequest) {
while (xhr.readyState !== 4) { }
return { status: xhr.status, responseText: xhr.responseText };
@@ -683,10 +691,12 @@ module Harness {
if (dirPath.match(/localhost:\d+$/) || dirPath.match(/localhost:\d+\/$/)) {
dirPath = null;
// path + fileName
- } else if (dirPath.indexOf(".") === -1) {
+ }
+ else if (dirPath.indexOf(".") === -1) {
dirPath = dirPath.substring(0, dirPath.lastIndexOf("/"));
// path
- } else {
+ }
+ else {
// strip any trailing slash
if (dirPath.match(/.*\/$/)) {
dirPath = dirPath.substring(0, dirPath.length - 2);
@@ -710,7 +720,8 @@ module Harness {
let results = response.responseText.split(",");
if (spec) {
return results.filter(file => spec.test(file));
- } else {
+ }
+ else {
return results;
}
}
@@ -720,13 +731,12 @@ module Harness {
};
export let listFiles = Utils.memoize(_listFilesImpl);
- export let log = (s: string) => console.log(s);
-
export function readFile(file: string) {
let response = Http.getFileFromServerSync(serverRoot + file);
if (response.status === 200) {
return response.responseText;
- } else {
+ }
+ else {
return null;
}
}
@@ -754,7 +764,7 @@ module Harness {
}
}
-module Harness {
+namespace Harness {
let tcServicesFileName = "typescriptServices.js";
export let libFolder: string;
@@ -785,7 +795,7 @@ module Harness {
export let lightMode = false;
/** Functionality for compiling TypeScript code */
- export module Compiler {
+ export namespace Compiler {
/** Aggregate various writes into a single array of lines. Useful for passing to the
* TypeScript compiler to fill with source code or errors.
*/
@@ -864,7 +874,7 @@ module Harness {
languageVersion: ts.ScriptTarget) {
// We'll only assert inletiants outside of light mode.
const shouldAssertInvariants = !Harness.lightMode;
-
+
// Only set the parent nodes if we're asserting inletiants. We don't need them otherwise.
let result = ts.createSourceFile(fileName, sourceText, languageVersion, /*setParentNodes:*/ shouldAssertInvariants);
@@ -1102,7 +1112,7 @@ module Harness {
}
let useCaseSensitiveFileNames = options.useCaseSensitiveFileNames !== undefined ? options.useCaseSensitiveFileNames : Harness.IO.useCaseSensitiveFileNames();
-
+
let fileOutputs: GeneratedFile[] = [];
let programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName);
@@ -1231,12 +1241,12 @@ module Harness {
.filter(s => s.length > 0)
.map(s => "!!! " + ts.DiagnosticCategory[error.category].toLowerCase() + " TS" + error.code + ": " + s);
errLines.forEach(e => outputLines.push(e));
-
+
// do not count errors from lib.d.ts here, they are computed separately as numLibraryDiagnostics
// if lib.d.ts is explicitly included in input files and there are some errors in it (i.e. because of duplicate identifiers)
// then they will be added twice thus triggering 'total errors' assertion with condition
// 'totalErrorsReportedInNonLibraryFiles + numLibraryDiagnostics + numTest262HarnessDiagnostics, diagnostics.length
-
+
if (!error.file || !isLibraryFile(error.file.fileName)) {
totalErrorsReportedInNonLibraryFiles++;
}
@@ -1280,7 +1290,8 @@ module Harness {
// On the last line of the file, fake the next line start number so that we handle errors on the last character of the file correctly
if (lineIndex === lines.length - 1) {
nextLineStart = inputFile.content.length;
- } else {
+ }
+ else {
nextLineStart = lineStarts[lineIndex + 1];
}
// Emit this line from the original file
@@ -1344,7 +1355,7 @@ module Harness {
// FileName header + content
result += "/*====== " + outputFile.fileName + " ======*/\r\n";
-
+
result += outputFile.code;
}
@@ -1444,7 +1455,7 @@ module Harness {
}
}
- export module TestCaseParser {
+ export namespace TestCaseParser {
/** all the necessary information to set the right compiler settings */
export interface CompilerSettings {
[name: string]: string;
@@ -1497,7 +1508,8 @@ module Harness {
let metaDataName = testMetaData[1].toLowerCase();
if (metaDataName === "filename") {
currentFileOptions[testMetaData[1]] = testMetaData[2];
- } else {
+ }
+ else {
continue;
}
@@ -1518,16 +1530,19 @@ module Harness {
currentFileOptions = {};
currentFileName = testMetaData[2];
refs = [];
- } else {
+ }
+ else {
// First metadata marker in the file
currentFileName = testMetaData[2];
}
- } else {
+ }
+ else {
// Subfile content line
// Append to the current subfile content, inserting a newline needed
if (currentFileContent === null) {
currentFileContent = "";
- } else {
+ }
+ else {
// End-of-line
currentFileContent = currentFileContent + "\n";
}
@@ -1553,7 +1568,7 @@ module Harness {
}
/** Support class for baseline files */
- export module Baseline {
+ export namespace Baseline {
export interface BaselineOptions {
Subfolder?: string;
@@ -1581,7 +1596,8 @@ module Harness {
function baselinePath(fileName: string, type: string, baselineFolder: string, subfolder?: string) {
if (subfolder !== undefined) {
return Harness.userSpecifiedRoot + baselineFolder + "/" + subfolder + "/" + type + "/" + fileName;
- } else {
+ }
+ else {
return Harness.userSpecifiedRoot + baselineFolder + "/" + type + "/" + fileName;
}
}
@@ -1673,7 +1689,8 @@ module Harness {
actual = generateActual(actualFileName, generateContent);
let comparison = compareToBaseline(actual, relativeFileName, opts);
writeComparison(comparison.expected, comparison.actual, relativeFileName, actualFileName, descriptionForDescribe);
- } else {
+ }
+ else {
actual = generateActual(actualFileName, generateContent);
let comparison = compareToBaseline(actual, relativeFileName, opts);
diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts
index c97ce50d275..dfde2bd1c08 100644
--- a/src/harness/harnessLanguageService.ts
+++ b/src/harness/harnessLanguageService.ts
@@ -3,11 +3,11 @@
///
///
-module Harness.LanguageService {
+namespace Harness.LanguageService {
export class ScriptInfo {
public version: number = 1;
public editRanges: { length: number; textChangeRange: ts.TextChangeRange; }[] = [];
- public lineMap: number[] = null;
+ public lineMap: number[] = undefined;
constructor(public fileName: string, public content: string) {
this.setContent(content);
@@ -95,8 +95,8 @@ module Harness.LanguageService {
let oldShim = oldScript;
let range = this.scriptSnapshot.getChangeRange(oldShim.scriptSnapshot);
- if (range === null) {
- return null;
+ if (range === undefined) {
+ return undefined;
}
return JSON.stringify({ span: { start: range.span.start, length: range.span.length }, newLength: range.newLength });
@@ -118,11 +118,11 @@ module Harness.LanguageService {
getPreProcessedFileInfo(fileName: string, fileContents: string): ts.PreProcessedFileInfo;
}
- export class LanguageServiceAdapterHost {
+ export class LanguageServiceAdapterHost {
protected fileNameToScript: ts.Map = {};
-
+
constructor(protected cancellationToken = DefaultHostCancellationToken.Instance,
- protected settings = ts.getDefaultCompilerOptions()) {
+ protected settings = ts.getDefaultCompilerOptions()) {
}
public getNewLine(): string {
@@ -145,7 +145,7 @@ module Harness.LanguageService {
public editScript(fileName: string, start: number, end: number, newText: string) {
let script = this.getScriptInfo(fileName);
- if (script !== null) {
+ if (script !== undefined) {
script.editContent(start, end, newText);
return;
}
@@ -169,7 +169,7 @@ module Harness.LanguageService {
}
/// Native adapter
- class NativeLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceHost {
+ class NativeLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceHost {
getCompilationSettings() { return this.settings; }
getCancellationToken() { return this.cancellationToken; }
getCurrentDirectory(): string { return ""; }
@@ -191,7 +191,7 @@ module Harness.LanguageService {
export class NativeLanugageServiceAdapter implements LanguageServiceAdapter {
private host: NativeLanguageServiceHost;
- constructor(cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
+ constructor(cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
this.host = new NativeLanguageServiceHost(cancellationToken, options);
}
getHost() { return this.host; }
@@ -204,14 +204,14 @@ module Harness.LanguageService {
class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceShimHost, ts.CoreServicesShimHost {
private nativeHost: NativeLanguageServiceHost;
- public getModuleResolutionsForFile: (fileName: string)=> string;
+ public getModuleResolutionsForFile: (fileName: string) => string;
constructor(preprocessToResolve: boolean, cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) {
super(cancellationToken, options);
this.nativeHost = new NativeLanguageServiceHost(cancellationToken, options);
if (preprocessToResolve) {
- let compilerOptions = this.nativeHost.getCompilationSettings()
+ let compilerOptions = this.nativeHost.getCompilationSettings();
let moduleResolutionHost: ts.ModuleResolutionHost = {
fileExists: fileName => this.getScriptInfo(fileName) !== undefined,
readFile: fileName => {
@@ -230,7 +230,7 @@ module Harness.LanguageService {
}
}
return JSON.stringify(imports);
- }
+ };
}
}
@@ -247,7 +247,7 @@ module Harness.LanguageService {
getScriptFileNames(): string { return JSON.stringify(this.nativeHost.getScriptFileNames()); }
getScriptSnapshot(fileName: string): ts.ScriptSnapshotShim {
let nativeScriptSnapshot = this.nativeHost.getScriptSnapshot(fileName);
- return nativeScriptSnapshot && new ScriptSnapshotProxy(nativeScriptSnapshot);
+ return nativeScriptSnapshot && new ScriptSnapshotProxy(nativeScriptSnapshot);
}
getScriptVersion(fileName: string): string { return this.nativeHost.getScriptVersion(fileName); }
getLocalizedDiagnosticMessages(): string { return JSON.stringify({}); }
@@ -255,17 +255,17 @@ module Harness.LanguageService {
readDirectory(rootDir: string, extension: string): string {
throw new Error("NYI");
}
- fileExists(fileName: string) { return this.getScriptInfo(fileName) !== undefined; }
- readFile(fileName: string) {
+ fileExists(fileName: string) { return this.getScriptInfo(fileName) !== undefined; }
+ readFile(fileName: string) {
let snapshot = this.nativeHost.getScriptSnapshot(fileName);
return snapshot && snapshot.getText(0, snapshot.getLength());
- }
+ }
log(s: string): void { this.nativeHost.log(s); }
trace(s: string): void { this.nativeHost.trace(s); }
error(s: string): void { this.nativeHost.error(s); }
}
- class ClassifierShimProxy implements ts.Classifier {
+ class ClassifierShimProxy implements ts.Classifier {
constructor(private shim: ts.ClassifierShim) {
}
getEncodedLexicalClassifications(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.Classifications {
@@ -302,7 +302,7 @@ module Harness.LanguageService {
if (parsedResult.error) {
throw new Error("Language Service Shim Error: " + JSON.stringify(parsedResult.error));
}
- else if (parsedResult.canceled) {
+ else if (parsedResult.canceled) {
throw new ts.OperationCanceledException();
}
return parsedResult.result;
@@ -369,7 +369,7 @@ module Harness.LanguageService {
getDefinitionAtPosition(fileName: string, position: number): ts.DefinitionInfo[] {
return unwrapJSONCallResult(this.shim.getDefinitionAtPosition(fileName, position));
}
- getTypeDefinitionAtPosition(fileName: string, position: number): ts.DefinitionInfo[]{
+ getTypeDefinitionAtPosition(fileName: string, position: number): ts.DefinitionInfo[] {
return unwrapJSONCallResult(this.shim.getTypeDefinitionAtPosition(fileName, position));
}
getReferencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[] {
@@ -474,19 +474,19 @@ module Harness.LanguageService {
}
// Server adapter
- class SessionClientHost extends NativeLanguageServiceHost implements ts.server.SessionClientHost {
+ class SessionClientHost extends NativeLanguageServiceHost implements ts.server.SessionClientHost {
private client: ts.server.SessionClient;
constructor(cancellationToken: ts.HostCancellationToken, settings: ts.CompilerOptions) {
super(cancellationToken, settings);
}
- onMessage(message: string): void {
-
+ onMessage(message: string): void {
+
}
- writeMessage(message: string): void {
-
+ writeMessage(message: string): void {
+
}
setClient(client: ts.server.SessionClient) {
@@ -504,7 +504,7 @@ module Harness.LanguageService {
}
}
- class SessionServerHost implements ts.server.ServerHost, ts.server.Logger {
+ class SessionServerHost implements ts.server.ServerHost, ts.server.Logger {
args: string[] = [];
newLine: string;
useCaseSensitiveFileNames: boolean = false;
@@ -513,23 +513,23 @@ module Harness.LanguageService {
this.newLine = this.host.getNewLine();
}
- onMessage(message: string): void {
-
+ onMessage(message: string): void {
+
}
writeMessage(message: string): void {
}
- write(message: string): void {
+ write(message: string): void {
this.writeMessage(message);
}
readFile(fileName: string): string {
- if (fileName.indexOf(Harness.Compiler.defaultLibFileName) >= 0) {
+ if (fileName.indexOf(Harness.Compiler.defaultLibFileName) >= 0) {
fileName = Harness.Compiler.defaultLibFileName;
}
-
+
let snapshot = this.host.getScriptSnapshot(fileName);
return snapshot && snapshot.getText(0, snapshot.getLength());
}
@@ -567,8 +567,8 @@ module Harness.LanguageService {
readDirectory(path: string, extension?: string): string[] {
throw new Error("Not implemented Yet.");
}
-
- watchFile(fileName: string, callback: (fileName: string) => void): ts.FileWatcher {
+
+ watchFile(fileName: string, callback: (fileName: string) => void): ts.FileWatcher {
return { close() { } };
}
@@ -582,7 +582,7 @@ module Harness.LanguageService {
msg(message: string) {
return this.host.log(message);
}
-
+
loggingEnabled() {
return true;
}
@@ -602,7 +602,7 @@ module Harness.LanguageService {
startGroup(): void {
}
}
-
+
export class ServerLanugageServiceAdapter implements LanguageServiceAdapter {
private host: SessionClientHost;
private client: ts.server.SessionClient;
diff --git a/src/harness/loggedIO.ts b/src/harness/loggedIO.ts
index d0801612500..d60756edf19 100644
--- a/src/harness/loggedIO.ts
+++ b/src/harness/loggedIO.ts
@@ -1,6 +1,7 @@
///
///
///
+/* tslint:disable:no-null */
interface FileInformation {
contents: string;
@@ -76,7 +77,7 @@ interface PlaybackControl {
endRecord(): void;
}
-module Playback {
+namespace Playback {
let recordLog: IOLog = undefined;
let replayLog: IOLog = undefined;
let recordLogFileNameBase = "";
@@ -95,7 +96,7 @@ module Playback {
run.reset = () => {
lookup = null;
};
-
+
return run;
}
diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts
index fe4ab8ea8ea..862e446352d 100644
--- a/src/harness/projectsRunner.ts
+++ b/src/harness/projectsRunner.ts
@@ -1,5 +1,6 @@
///
///
+/* tslint:disable:no-null */
// Test case is json of below type in tests/cases/project/
interface ProjectRunnerTestCase {
@@ -199,7 +200,7 @@ class ProjectRunner extends RunnerBase {
}
}
- function batchCompilerProjectTestCase(moduleKind: ts.ModuleKind): BatchCompileProjectTestCaseResult{
+ function batchCompilerProjectTestCase(moduleKind: ts.ModuleKind): BatchCompileProjectTestCaseResult {
let nonSubfolderDiskFiles = 0;
let outputFiles: BatchCompileProjectTestCaseEmittedFile[] = [];
@@ -300,7 +301,7 @@ class ProjectRunner extends RunnerBase {
allInputFiles.unshift(findOutpuDtsFile(outputDtsFileName));
}
else {
- let outputDtsFileName = ts.removeFileExtension(compilerOptions.outFile|| compilerOptions.out) + ".d.ts";
+ let outputDtsFileName = ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts";
let outputDtsFile = findOutpuDtsFile(outputDtsFileName);
if (!ts.contains(allInputFiles, outputDtsFile)) {
allInputFiles.unshift(outputDtsFile);
diff --git a/src/harness/runner.ts b/src/harness/runner.ts
index 822fcdebe8c..366355520a2 100644
--- a/src/harness/runner.ts
+++ b/src/harness/runner.ts
@@ -20,8 +20,10 @@
///
///
+/* tslint:disable:no-null */
+
let runners: RunnerBase[] = [];
-let iterations: number = 1;
+let iterations = 1;
function runTests(runners: RunnerBase[]) {
for (let i = iterations; i > 0; i--) {
@@ -68,10 +70,10 @@ if (testConfigFile !== "") {
case "fourslash-shims":
runners.push(new FourSlashRunner(FourSlashTestType.Shims));
break;
- case 'fourslash-shims-pp':
+ case "fourslash-shims-pp":
runners.push(new FourSlashRunner(FourSlashTestType.ShimsWithPreprocess));
break;
- case 'fourslash-server':
+ case "fourslash-server":
runners.push(new FourSlashRunner(FourSlashTestType.Server));
break;
case "fourslash-generated":
diff --git a/src/harness/runnerbase.ts b/src/harness/runnerbase.ts
index afe757ea829..7469325475a 100644
--- a/src/harness/runnerbase.ts
+++ b/src/harness/runnerbase.ts
@@ -25,12 +25,12 @@ abstract class RunnerBase {
let fixedPath = path;
// full paths either start with a drive letter or / for *nix, shouldn't have \ in the path at this point
- let fullPath = /(\w+:|\/)?([\w+\-\.]|\/)*\.tsx?/g;
+ let fullPath = /(\w+:|\/)?([\w+\-\.]|\/)*\.tsx?/g;
let fullPathList = fixedPath.match(fullPath);
if (fullPathList) {
fullPathList.forEach((match: string) => fixedPath = fixedPath.replace(match, Harness.Path.getFileName(match)));
}
-
+
// when running in the browser the 'full path' is the host name, shows up in error baselines
let localHost = /http:\/localhost:\d+/g;
fixedPath = fixedPath.replace(localHost, "");
diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts
index 1e81392049d..3027afae9dc 100644
--- a/src/harness/rwcRunner.ts
+++ b/src/harness/rwcRunner.ts
@@ -2,8 +2,9 @@
///
///
///
+/* tslint:disable:no-null */
-module RWC {
+namespace RWC {
function runWithIOLog(ioLog: IOLog, fn: (oldIO: Harness.IO) => void) {
let oldIO = Harness.IO;
@@ -105,7 +106,7 @@ module RWC {
}
otherFiles.push(getHarnessCompilerInputUnit(fileRead.path));
}
- else if (!opts.options.noLib && Harness.isLibraryFile(fileRead.path)){
+ else if (!opts.options.noLib && Harness.isLibraryFile(fileRead.path)) {
if (!inInputList) {
// If useCustomLibraryFile is true, we will use lib.d.ts from json object
// otherwise use the lib.d.ts from built/local
diff --git a/src/harness/sourceMapRecorder.ts b/src/harness/sourceMapRecorder.ts
index 55ca9ea9651..dcdc59a2a40 100644
--- a/src/harness/sourceMapRecorder.ts
+++ b/src/harness/sourceMapRecorder.ts
@@ -15,14 +15,14 @@
///
-module Harness.SourceMapRecoder {
+namespace Harness.SourceMapRecoder {
interface SourceMapSpanWithDecodeErrors {
sourceMapSpan: ts.SourceMapSpan;
decodeErrors: string[];
}
- module SourceMapDecoder {
+ namespace SourceMapDecoder {
let sourceMapMappings: string;
let sourceMapNames: string[];
let decodingIndex: number;
@@ -202,7 +202,7 @@ module Harness.SourceMapRecoder {
}
}
- module SourceMapSpanWriter {
+ namespace SourceMapSpanWriter {
let sourceMapRecoder: Compiler.WriterAggregator;
let sourceMapSources: string[];
let sourceMapNames: string[];
@@ -442,7 +442,7 @@ module Harness.SourceMapRecoder {
for (let i = 0; i < sourceMapDataList.length; i++) {
let sourceMapData = sourceMapDataList[i];
- let prevSourceFile: ts.SourceFile = null;
+ let prevSourceFile: ts.SourceFile;
SourceMapSpanWriter.intializeSourceMapSpanWriter(sourceMapRecoder, sourceMapData, jsFiles[i]);
for (let j = 0; j < sourceMapData.sourceMapDecodedMappings.length; j++) {
diff --git a/src/harness/test262Runner.ts b/src/harness/test262Runner.ts
index d9bbd55e7a3..491c71a5839 100644
--- a/src/harness/test262Runner.ts
+++ b/src/harness/test262Runner.ts
@@ -1,5 +1,6 @@
///
///
+/* tslint:disable:no-null */
class Test262BaselineRunner extends RunnerBase {
private static basePath = "internal/cases/test262";
diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts
index 90075a290a4..e34ce36633f 100644
--- a/src/lib/dom.generated.d.ts
+++ b/src/lib/dom.generated.d.ts
@@ -202,8 +202,8 @@ interface AnalyserNode extends AudioNode {
smoothingTimeConstant: number;
getByteFrequencyData(array: Uint8Array): void;
getByteTimeDomainData(array: Uint8Array): void;
- getFloatFrequencyData(array: any): void;
- getFloatTimeDomainData(array: any): void;
+ getFloatFrequencyData(array: Float32Array): void;
+ getFloatTimeDomainData(array: Float32Array): void;
}
declare var AnalyserNode: {
@@ -290,7 +290,7 @@ interface AudioBuffer {
length: number;
numberOfChannels: number;
sampleRate: number;
- getChannelData(channel: number): any;
+ getChannelData(channel: number): Float32Array;
}
declare var AudioBuffer: {
@@ -334,7 +334,7 @@ interface AudioContext extends EventTarget {
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
createOscillator(): OscillatorNode;
createPanner(): PannerNode;
- createPeriodicWave(real: any, imag: any): PeriodicWave;
+ createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave;
createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
createStereoPanner(): StereoPannerNode;
createWaveShaper(): WaveShaperNode;
@@ -392,7 +392,7 @@ interface AudioParam {
linearRampToValueAtTime(value: number, endTime: number): void;
setTargetAtTime(target: number, startTime: number, timeConstant: number): void;
setValueAtTime(value: number, startTime: number): void;
- setValueCurveAtTime(values: any, startTime: number, duration: number): void;
+ setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;
}
declare var AudioParam: {
@@ -468,7 +468,7 @@ interface BiquadFilterNode extends AudioNode {
frequency: AudioParam;
gain: AudioParam;
type: string;
- getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
+ getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;
}
declare var BiquadFilterNode: {
@@ -10893,7 +10893,7 @@ declare var WEBGL_depth_texture: {
}
interface WaveShaperNode extends AudioNode {
- curve: any;
+ curve: Float32Array;
oversample: string;
}
@@ -11080,34 +11080,34 @@ interface WebGLRenderingContext {
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void;
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void;
uniform1f(location: WebGLUniformLocation, x: number): void;
- uniform1fv(location: WebGLUniformLocation, v: any): void;
+ uniform1fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform1i(location: WebGLUniformLocation, x: number): void;
uniform1iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform2f(location: WebGLUniformLocation, x: number, y: number): void;
- uniform2fv(location: WebGLUniformLocation, v: any): void;
+ uniform2fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform2i(location: WebGLUniformLocation, x: number, y: number): void;
uniform2iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void;
- uniform3fv(location: WebGLUniformLocation, v: any): void;
+ uniform3fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void;
uniform3iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
- uniform4fv(location: WebGLUniformLocation, v: any): void;
+ uniform4fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
uniform4iv(location: WebGLUniformLocation, v: Int32Array): void;
- uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
- uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
- uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
+ uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
+ uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
+ uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
useProgram(program: WebGLProgram): void;
validateProgram(program: WebGLProgram): void;
vertexAttrib1f(indx: number, x: number): void;
- vertexAttrib1fv(indx: number, values: any): void;
+ vertexAttrib1fv(indx: number, values: Float32Array): void;
vertexAttrib2f(indx: number, x: number, y: number): void;
- vertexAttrib2fv(indx: number, values: any): void;
+ vertexAttrib2fv(indx: number, values: Float32Array): void;
vertexAttrib3f(indx: number, x: number, y: number, z: number): void;
- vertexAttrib3fv(indx: number, values: any): void;
+ vertexAttrib3fv(indx: number, values: Float32Array): void;
vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;
- vertexAttrib4fv(indx: number, values: any): void;
+ vertexAttrib4fv(indx: number, values: Float32Array): void;
vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;
viewport(x: number, y: number, width: number, height: number): void;
ACTIVE_ATTRIBUTES: number;
diff --git a/src/lib/webworker.generated.d.ts b/src/lib/webworker.generated.d.ts
index 9353047e9c6..f37ea5c6ed2 100644
--- a/src/lib/webworker.generated.d.ts
+++ b/src/lib/webworker.generated.d.ts
@@ -17,7 +17,7 @@ interface AudioBuffer {
length: number;
numberOfChannels: number;
sampleRate: number;
- getChannelData(channel: number): any;
+ getChannelData(channel: number): Float32Array;
}
declare var AudioBuffer: {
diff --git a/src/server/server.ts b/src/server/server.ts
index 843197b918a..c3942b01a39 100644
--- a/src/server/server.ts
+++ b/src/server/server.ts
@@ -11,7 +11,7 @@ namespace ts.server {
input: process.stdin,
output: process.stdout,
terminal: false,
- });
+ });
class Logger implements ts.server.Logger {
fd = -1;
@@ -58,7 +58,7 @@ namespace ts.server {
isVerbose() {
return this.loggingEnabled() && (this.level == "verbose");
}
-
+
msg(s: string, type = "Err") {
if (this.fd < 0) {
@@ -85,7 +85,7 @@ namespace ts.server {
interface WatchedFile {
fileName: string;
- callback: (fileName: string) => void;
+ callback: (fileName: string, removed: boolean) => void;
mtime: Date;
}
@@ -121,11 +121,11 @@ namespace ts.server {
fs.stat(watchedFile.fileName,(err, stats) => {
if (err) {
- watchedFile.callback(watchedFile.fileName);
+ watchedFile.callback(watchedFile.fileName, /* removed */ false);
}
else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) {
watchedFile.mtime = WatchedFileSet.getModifiedTime(watchedFile.fileName);
- watchedFile.callback(watchedFile.fileName);
+ watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0);
}
});
}
@@ -153,7 +153,7 @@ namespace ts.server {
}, this.interval);
}
- addFile(fileName: string, callback: (fileName: string) => void ): WatchedFile {
+ addFile(fileName: string, callback: (fileName: string, removed: boolean) => void ): WatchedFile {
var file: WatchedFile = {
fileName,
callback,
@@ -170,7 +170,7 @@ namespace ts.server {
removeFile(file: WatchedFile) {
this.watchedFiles = WatchedFileSet.copyListRemovingItem(file, this.watchedFiles);
}
- }
+ }
class IOSession extends Session {
constructor(host: ServerHost, logger: ts.server.Logger) {
@@ -243,11 +243,11 @@ namespace ts.server {
// TODO: check that this location is writable
var logger = createLoggerFromEnv();
-
+
// REVIEW: for now this implementation uses polling.
// The advantage of polling is that it works reliably
// on all os and with network mounted files.
- // For 90 referenced files, the average time to detect
+ // For 90 referenced files, the average time to detect
// changes is 2*msInterval (by default 5 seconds).
// The overhead of this is .04 percent (1/2500) with
// average pause of < 1 millisecond (and max
@@ -271,4 +271,4 @@ namespace ts.server {
});
// Start listening
ioSession.listen();
-}
\ No newline at end of file
+}
diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts
index fad3ebe6e2b..4a7033c6f3e 100644
--- a/src/services/formatting/formatting.ts
+++ b/src/services/formatting/formatting.ts
@@ -325,7 +325,7 @@ namespace ts.formatting {
let lastIndentedLine: number;
let indentationOnLastIndentedLine: number;
-
+
let edits: TextChange[] = [];
formattingScanner.advance();
@@ -354,12 +354,12 @@ namespace ts.formatting {
* If list element is in the range - its indentation will be equal
* to inherited indentation from its predecessors.
*/
- function tryComputeIndentationForListItem(startPos: number,
- endPos: number,
- parentStartLine: number,
- range: TextRange,
+ function tryComputeIndentationForListItem(startPos: number,
+ endPos: number,
+ parentStartLine: number,
+ range: TextRange,
inheritedIndentation: number): number {
-
+
if (rangeOverlapsWithStartEnd(range, startPos, endPos)) {
if (inheritedIndentation !== Constants.Unknown) {
return inheritedIndentation;
@@ -376,7 +376,7 @@ namespace ts.formatting {
return Constants.Unknown;
}
-
+
function computeIndentation(
node: TextRangeWithKind,
startLine: number,
@@ -419,8 +419,8 @@ namespace ts.formatting {
// if node is located on the same line with the parent
// - inherit indentation from the parent
// - push children if either parent of node itself has non-zero delta
- indentation = startLine === lastIndentedLine
- ? indentationOnLastIndentedLine
+ indentation = startLine === lastIndentedLine
+ ? indentationOnLastIndentedLine
: parentDynamicIndentation.getIndentation();
delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta);
}
@@ -586,7 +586,7 @@ namespace ts.formatting {
if (!rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) {
return inheritedIndentation;
}
-
+
if (child.getFullWidth() === 0) {
return inheritedIndentation;
}
@@ -624,8 +624,8 @@ namespace ts.formatting {
return inheritedIndentation;
}
- function processChildNodes(nodes: NodeArray,
- parent: Node,
+ function processChildNodes(nodes: NodeArray,
+ parent: Node,
parentStartLine: number,
parentDynamicIndentation: DynamicIndentation): void {
@@ -751,7 +751,7 @@ namespace ts.formatting {
// indent token only if is it is in target range and does not overlap with any error ranges
if (tokenIndentation !== Constants.Unknown) {
insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded);
-
+
lastIndentedLine = tokenStart.line;
indentationOnLastIndentedLine = tokenIndentation;
}
@@ -772,12 +772,12 @@ namespace ts.formatting {
}
}
- function processRange(range: TextRangeWithKind,
- rangeStart: LineAndCharacter,
- parent: Node,
- contextNode: Node,
+ function processRange(range: TextRangeWithKind,
+ rangeStart: LineAndCharacter,
+ parent: Node,
+ contextNode: Node,
dynamicIndentation: DynamicIndentation): boolean {
-
+
let rangeHasError = rangeContainsError(range);
let lineAdded: boolean;
if (!rangeHasError && !previousRangeHasError) {
@@ -787,7 +787,7 @@ namespace ts.formatting {
trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line);
}
else {
- lineAdded =
+ lineAdded =
processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation)
}
}
@@ -933,8 +933,8 @@ namespace ts.formatting {
let lineStartPosition = getStartPositionOfLine(line, sourceFile);
let lineEndPosition = getEndLinePosition(line, sourceFile);
- // do not trim whitespaces in comments
- if (range && isComment(range.kind) && range.pos <= lineEndPosition && range.end > lineEndPosition) {
+ // do not trim whitespaces in comments or template expression
+ if (range && (isComment(range.kind) || isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) {
continue;
}
diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts
index 8355fac03f5..8035c963cf3 100644
--- a/src/services/formatting/smartIndenter.ts
+++ b/src/services/formatting/smartIndenter.ts
@@ -19,13 +19,7 @@ namespace ts.formatting {
}
// no indentation in string \regex\template literals
- let precedingTokenIsLiteral =
- precedingToken.kind === SyntaxKind.StringLiteral ||
- precedingToken.kind === SyntaxKind.RegularExpressionLiteral ||
- precedingToken.kind === SyntaxKind.NoSubstitutionTemplateLiteral ||
- precedingToken.kind === SyntaxKind.TemplateHead ||
- precedingToken.kind === SyntaxKind.TemplateMiddle ||
- precedingToken.kind === SyntaxKind.TemplateTail;
+ let precedingTokenIsLiteral = isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind);
if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
return 0;
}
@@ -405,6 +399,7 @@ namespace ts.formatting {
function nodeContentIsAlwaysIndented(kind: SyntaxKind): boolean {
switch (kind) {
+ case SyntaxKind.ExpressionStatement:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
case SyntaxKind.InterfaceDeclaration:
diff --git a/src/services/services.ts b/src/services/services.ts
index 2bbf286a1f2..82fa9de5203 100644
--- a/src/services/services.ts
+++ b/src/services/services.ts
@@ -725,7 +725,7 @@ namespace ts {
}
getBaseTypes(): ObjectType[] {
return this.flags & (TypeFlags.Class | TypeFlags.Interface)
- ? this.checker.getBaseTypes(this)
+ ? this.checker.getBaseTypes(this)
: undefined;
}
}
@@ -3549,6 +3549,9 @@ namespace ts {
if (parent && (parent.kind === SyntaxKind.JsxSelfClosingElement || parent.kind === SyntaxKind.JsxOpeningElement)) {
return parent;
}
+ else if (parent.kind === SyntaxKind.JsxAttribute) {
+ return parent.parent;
+ }
break;
// The context token is the closing } or " of an attribute, which means
@@ -3659,9 +3662,9 @@ namespace ts {
return containingNodeKind === SyntaxKind.Parameter;
case SyntaxKind.AsKeyword:
- containingNodeKind === SyntaxKind.ImportSpecifier ||
- containingNodeKind === SyntaxKind.ExportSpecifier ||
- containingNodeKind === SyntaxKind.NamespaceImport;
+ return containingNodeKind === SyntaxKind.ImportSpecifier ||
+ containingNodeKind === SyntaxKind.ExportSpecifier ||
+ containingNodeKind === SyntaxKind.NamespaceImport;
case SyntaxKind.ClassKeyword:
case SyntaxKind.EnumKeyword:
@@ -6249,7 +6252,8 @@ namespace ts {
}
return node.parent.kind === SyntaxKind.TypeReference ||
- (node.parent.kind === SyntaxKind.ExpressionWithTypeArguments && !isExpressionWithTypeArgumentsInClassExtendsClause(node.parent));
+ (node.parent.kind === SyntaxKind.ExpressionWithTypeArguments && !isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) ||
+ node.kind === SyntaxKind.ThisKeyword && !isExpression(node);
}
function isNamespaceReference(node: Node): boolean {
@@ -7811,6 +7815,7 @@ namespace ts {
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.InstanceOfKeyword:
case SyntaxKind.InKeyword:
+ case SyntaxKind.AsKeyword:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
diff --git a/src/services/utilities.ts b/src/services/utilities.ts
index 8b77dcb953b..a7198b4cc6d 100644
--- a/src/services/utilities.ts
+++ b/src/services/utilities.ts
@@ -9,7 +9,7 @@ namespace ts {
export function getEndLinePosition(line: number, sourceFile: SourceFile): number {
Debug.assert(line >= 0);
let lineStarts = sourceFile.getLineStarts();
-
+
let lineIndex = line;
if (lineIndex + 1 === lineStarts.length) {
// last line - return EOF
@@ -128,7 +128,8 @@ namespace ts {
return isCompletedNode((n).thenStatement, sourceFile);
case SyntaxKind.ExpressionStatement:
- return isCompletedNode((n).expression, sourceFile);
+ return isCompletedNode((n).expression, sourceFile) ||
+ hasChildOfKind(n, SyntaxKind.SemicolonToken);
case SyntaxKind.ArrayLiteralExpression:
case SyntaxKind.ArrayBindingPattern:
@@ -170,7 +171,7 @@ namespace ts {
case SyntaxKind.VoidExpression:
case SyntaxKind.YieldExpression:
case SyntaxKind.SpreadElementExpression:
- let unaryWordExpression = (n);
+ let unaryWordExpression = (n);
return isCompletedNode(unaryWordExpression.expression, sourceFile);
case SyntaxKind.TaggedTemplateExpression:
@@ -252,7 +253,7 @@ namespace ts {
});
// Either we didn't find an appropriate list, or the list must contain us.
- Debug.assert(!syntaxList || contains(syntaxList.getChildren(), node));
+ Debug.assert(!syntaxList || contains(syntaxList.getChildren(), node));
return syntaxList;
}
@@ -388,7 +389,7 @@ namespace ts {
// if this is the case - then we should assume that token in question is located in previous child.
if (position < child.end && (nodeHasTokens(child) || child.kind === SyntaxKind.JsxText)) {
const start = child.getStart(sourceFile);
- const lookInPreviousChild =
+ const lookInPreviousChild =
(start >= position) || // cursor in the leading trivia
(child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText
@@ -425,7 +426,7 @@ namespace ts {
}
}
}
-
+
export function isInString(sourceFile: SourceFile, position: number) {
let token = getTokenAtPosition(sourceFile, position);
return token && token.kind === SyntaxKind.StringLiteral && position > token.getStart();
@@ -473,7 +474,7 @@ namespace ts {
let commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
return forEach(commentRanges, jsDocPrefix);
-
+
function jsDocPrefix(c: CommentRange): boolean {
var text = sourceFile.text;
return text.length >= c.pos + 3 && text[c.pos] === '/' && text[c.pos + 1] === '*' && text[c.pos + 2] === '*';
@@ -562,6 +563,15 @@ namespace ts {
return kind === SyntaxKind.SingleLineCommentTrivia || kind === SyntaxKind.MultiLineCommentTrivia;
}
+ export function isStringOrRegularExpressionOrTemplateLiteral(kind: SyntaxKind): boolean {
+ if (kind === SyntaxKind.StringLiteral
+ || kind === SyntaxKind.RegularExpressionLiteral
+ || isTemplateLiteralKind(kind)) {
+ return true;
+ }
+ return false;
+ }
+
export function isPunctuation(kind: SyntaxKind): boolean {
return SyntaxKind.FirstPunctuation <= kind && kind <= SyntaxKind.LastPunctuation;
}
@@ -626,7 +636,8 @@ namespace ts {
increaseIndent: () => { indent++; },
decreaseIndent: () => { indent--; },
clear: resetWriter,
- trackSymbol: () => { }
+ trackSymbol: () => { },
+ reportInaccessibleThisError: () => { }
};
function writeIndent() {
@@ -689,7 +700,7 @@ namespace ts {
}
export function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart {
- return {
+ return {
text: text,
kind: SymbolDisplayPartKind[kind]
};
diff --git a/tests/baselines/reference/2dArrays.types b/tests/baselines/reference/2dArrays.types
index b113ccdce7b..00805899294 100644
--- a/tests/baselines/reference/2dArrays.types
+++ b/tests/baselines/reference/2dArrays.types
@@ -28,7 +28,7 @@ class Board {
>this.ships.every(function (val) { return val.isSunk; }) : boolean
>this.ships.every : (callbackfn: (value: Ship, index: number, array: Ship[]) => boolean, thisArg?: any) => boolean
>this.ships : Ship[]
->this : Board
+>this : this
>ships : Ship[]
>every : (callbackfn: (value: Ship, index: number, array: Ship[]) => boolean, thisArg?: any) => boolean
>function (val) { return val.isSunk; } : (val: Ship) => boolean
diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.types b/tests/baselines/reference/accessOverriddenBaseClassMember1.types
index 2aeb541d723..f444544ea48 100644
--- a/tests/baselines/reference/accessOverriddenBaseClassMember1.types
+++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.types
@@ -15,11 +15,11 @@ class Point {
>"x=" + this.x : string
>"x=" : string
>this.x : number
->this : Point
+>this : this
>x : number
>" y=" : string
>this.y : number
->this : Point
+>this : this
>y : number
}
}
@@ -50,7 +50,7 @@ class ColoredPoint extends Point {
>toString : () => string
>" color=" : string
>this.color : string
->this : ColoredPoint
+>this : this
>color : string
}
}
diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.types b/tests/baselines/reference/aliasUsageInAccessorsOfClass.types
index ea6ab451b11..c66f4c5c193 100644
--- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.types
+++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.types
@@ -26,7 +26,7 @@ class C2 {
return this.x;
>this.x : IHasVisualizationModel
->this : C2
+>this : this
>x : IHasVisualizationModel
}
set A(x) {
diff --git a/tests/baselines/reference/ambientErrors.errors.txt b/tests/baselines/reference/ambientErrors.errors.txt
index a0ded21299c..5e257c2de3f 100644
--- a/tests/baselines/reference/ambientErrors.errors.txt
+++ b/tests/baselines/reference/ambientErrors.errors.txt
@@ -10,7 +10,7 @@ tests/cases/conformance/ambient/ambientErrors.ts(38,13): error TS1039: Initializ
tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1183: An implementation cannot be declared in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1183: An implementation cannot be declared in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1183: An implementation cannot be declared in ambient contexts.
-tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient modules cannot be nested in other modules.
+tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient modules cannot be nested in other modules or namespaces.
tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient module declaration cannot specify relative module name.
tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements.
@@ -88,7 +88,7 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export
module M2 {
declare module 'nope' { }
~~~~~~
-!!! error TS2435: Ambient modules cannot be nested in other modules.
+!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces.
}
// Ambient external module with a string literal name that isn't a top level external module name
diff --git a/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt b/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt
index 79f37c4764e..0e508470b13 100644
--- a/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt
+++ b/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt
@@ -1,4 +1,4 @@
-tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2435: Ambient modules cannot be nested in other modules.
+tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces.
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): error TS2307: Cannot find module 'ext'.
@@ -9,7 +9,7 @@ tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): err
declare module "ext" {
~~~~~
-!!! error TS2435: Ambient modules cannot be nested in other modules.
+!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces.
export class C { }
}
diff --git a/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt b/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt
index 87aae44840e..7e4ac795d0d 100644
--- a/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt
+++ b/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt
@@ -1,9 +1,9 @@
-tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,27): error TS2435: Ambient modules cannot be nested in other modules.
+tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,27): error TS2435: Ambient modules cannot be nested in other modules or namespaces.
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts (1 errors) ====
module M {
export declare module "M" { }
~~~
-!!! error TS2435: Ambient modules cannot be nested in other modules.
+!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt b/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt
index 763317ecc0c..e5905aaaf8f 100644
--- a/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt
+++ b/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt
@@ -1,7 +1,7 @@
-tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2435: Ambient modules cannot be nested in other modules.
+tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2435: Ambient modules cannot be nested in other modules or namespaces.
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts (1 errors) ====
export declare module "M" { }
~~~
-!!! error TS2435: Ambient modules cannot be nested in other modules.
\ No newline at end of file
+!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces.
\ No newline at end of file
diff --git a/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.types b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.types
index d4df0f75d16..65f26f25770 100644
--- a/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.types
+++ b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.types
@@ -31,7 +31,7 @@ class TestClass {
this.bar(x); // should not error
>this.bar(x) : void
>this.bar : { (x: string): void; (x: string[]): void; }
->this : TestClass
+>this : this
>bar : { (x: string): void; (x: string[]): void; }
>x : any
}
@@ -71,7 +71,7 @@ class TestClass2 {
return this.bar(x); // should not error
>this.bar(x) : number
>this.bar : { (x: string): number; (x: string[]): number; }
->this : TestClass2
+>this : this
>bar : { (x: string): number; (x: string[]): number; }
>x : any
}
diff --git a/tests/baselines/reference/amdModuleName1.types b/tests/baselines/reference/amdModuleName1.types
index 64bc7842451..c0db9c8b1b5 100644
--- a/tests/baselines/reference/amdModuleName1.types
+++ b/tests/baselines/reference/amdModuleName1.types
@@ -10,7 +10,7 @@ class Foo {
this.x = 5;
>this.x = 5 : number
>this.x : number
->this : Foo
+>this : this
>x : number
>5 : number
}
diff --git a/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt
index d13e0a265f7..d60f0b7d03c 100644
--- a/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt
+++ b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt
@@ -34,6 +34,8 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(25,5): error
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(26,5): error TS2322: Type 'StrNum' is not assignable to type '[string]'.
Types of property 'pop' are incompatible.
Type '() => string | number' is not assignable to type '() => string'.
+ Type 'string | number' is not assignable to type 'string'.
+ Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(27,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string]'.
Property 'length' is missing in type '{ 0: string; 1: number; }'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(28,5): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'.
@@ -125,6 +127,8 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(30,5): error
!!! error TS2322: Type 'StrNum' is not assignable to type '[string]'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => string | number' is not assignable to type '() => string'.
+!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
+!!! error TS2322: Type 'number' is not assignable to type 'string'.
var m3: [string] = z;
~~
!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string]'.
diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types
index 20f36e5c459..fca66793f40 100644
--- a/tests/baselines/reference/arrayBestCommonTypes.types
+++ b/tests/baselines/reference/arrayBestCommonTypes.types
@@ -51,7 +51,7 @@ module EmptyTypes {
>(this.voidIfAny([4, 2][0])) : number
>this.voidIfAny([4, 2][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[4, 2][0] : number
>[4, 2] : number[]
@@ -64,7 +64,7 @@ module EmptyTypes {
>(this.voidIfAny([4, 2, undefined][0])) : number
>this.voidIfAny([4, 2, undefined][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[4, 2, undefined][0] : number
>[4, 2, undefined] : number[]
@@ -78,7 +78,7 @@ module EmptyTypes {
>(this.voidIfAny([undefined, 2, 4][0])) : number
>this.voidIfAny([undefined, 2, 4][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[undefined, 2, 4][0] : number
>[undefined, 2, 4] : number[]
@@ -92,7 +92,7 @@ module EmptyTypes {
>(this.voidIfAny([null, 2, 4][0])) : number
>this.voidIfAny([null, 2, 4][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[null, 2, 4][0] : number
>[null, 2, 4] : number[]
@@ -106,7 +106,7 @@ module EmptyTypes {
>(this.voidIfAny([2, 4, null][0])) : number
>this.voidIfAny([2, 4, null][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[2, 4, null][0] : number
>[2, 4, null] : number[]
@@ -120,7 +120,7 @@ module EmptyTypes {
>(this.voidIfAny([undefined, 4, null][0])) : number
>this.voidIfAny([undefined, 4, null][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[undefined, 4, null][0] : number
>[undefined, 4, null] : number[]
@@ -134,7 +134,7 @@ module EmptyTypes {
>(this.voidIfAny(['', "q"][0])) : number
>this.voidIfAny(['', "q"][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>['', "q"][0] : string
>['', "q"] : string[]
@@ -147,7 +147,7 @@ module EmptyTypes {
>(this.voidIfAny(['', "q", undefined][0])) : number
>this.voidIfAny(['', "q", undefined][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>['', "q", undefined][0] : string
>['', "q", undefined] : string[]
@@ -161,7 +161,7 @@ module EmptyTypes {
>(this.voidIfAny([undefined, "q", ''][0])) : number
>this.voidIfAny([undefined, "q", ''][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[undefined, "q", ''][0] : string
>[undefined, "q", ''] : string[]
@@ -175,7 +175,7 @@ module EmptyTypes {
>(this.voidIfAny([null, "q", ''][0])) : number
>this.voidIfAny([null, "q", ''][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[null, "q", ''][0] : string
>[null, "q", ''] : string[]
@@ -189,7 +189,7 @@ module EmptyTypes {
>(this.voidIfAny(["q", '', null][0])) : number
>this.voidIfAny(["q", '', null][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>["q", '', null][0] : string
>["q", '', null] : string[]
@@ -203,7 +203,7 @@ module EmptyTypes {
>(this.voidIfAny([undefined, '', null][0])) : number
>this.voidIfAny([undefined, '', null][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[undefined, '', null][0] : string
>[undefined, '', null] : string[]
@@ -217,7 +217,7 @@ module EmptyTypes {
>(this.voidIfAny([[3, 4], [null]][0][0])) : number
>this.voidIfAny([[3, 4], [null]][0][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[[3, 4], [null]][0][0] : number
>[[3, 4], [null]][0] : number[]
@@ -454,7 +454,7 @@ module NonEmptyTypes {
>(this.voidIfAny([4, 2][0])) : number
>this.voidIfAny([4, 2][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[4, 2][0] : number
>[4, 2] : number[]
@@ -467,7 +467,7 @@ module NonEmptyTypes {
>(this.voidIfAny([4, 2, undefined][0])) : number
>this.voidIfAny([4, 2, undefined][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[4, 2, undefined][0] : number
>[4, 2, undefined] : number[]
@@ -481,7 +481,7 @@ module NonEmptyTypes {
>(this.voidIfAny([undefined, 2, 4][0])) : number
>this.voidIfAny([undefined, 2, 4][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[undefined, 2, 4][0] : number
>[undefined, 2, 4] : number[]
@@ -495,7 +495,7 @@ module NonEmptyTypes {
>(this.voidIfAny([null, 2, 4][0])) : number
>this.voidIfAny([null, 2, 4][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[null, 2, 4][0] : number
>[null, 2, 4] : number[]
@@ -509,7 +509,7 @@ module NonEmptyTypes {
>(this.voidIfAny([2, 4, null][0])) : number
>this.voidIfAny([2, 4, null][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[2, 4, null][0] : number
>[2, 4, null] : number[]
@@ -523,7 +523,7 @@ module NonEmptyTypes {
>(this.voidIfAny([undefined, 4, null][0])) : number
>this.voidIfAny([undefined, 4, null][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[undefined, 4, null][0] : number
>[undefined, 4, null] : number[]
@@ -537,7 +537,7 @@ module NonEmptyTypes {
>(this.voidIfAny(['', "q"][0])) : number
>this.voidIfAny(['', "q"][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>['', "q"][0] : string
>['', "q"] : string[]
@@ -550,7 +550,7 @@ module NonEmptyTypes {
>(this.voidIfAny(['', "q", undefined][0])) : number
>this.voidIfAny(['', "q", undefined][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>['', "q", undefined][0] : string
>['', "q", undefined] : string[]
@@ -564,7 +564,7 @@ module NonEmptyTypes {
>(this.voidIfAny([undefined, "q", ''][0])) : number
>this.voidIfAny([undefined, "q", ''][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[undefined, "q", ''][0] : string
>[undefined, "q", ''] : string[]
@@ -578,7 +578,7 @@ module NonEmptyTypes {
>(this.voidIfAny([null, "q", ''][0])) : number
>this.voidIfAny([null, "q", ''][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[null, "q", ''][0] : string
>[null, "q", ''] : string[]
@@ -592,7 +592,7 @@ module NonEmptyTypes {
>(this.voidIfAny(["q", '', null][0])) : number
>this.voidIfAny(["q", '', null][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>["q", '', null][0] : string
>["q", '', null] : string[]
@@ -606,7 +606,7 @@ module NonEmptyTypes {
>(this.voidIfAny([undefined, '', null][0])) : number
>this.voidIfAny([undefined, '', null][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[undefined, '', null][0] : string
>[undefined, '', null] : string[]
@@ -620,7 +620,7 @@ module NonEmptyTypes {
>(this.voidIfAny([[3, 4], [null]][0][0])) : number
>this.voidIfAny([[3, 4], [null]][0][0]) : number
>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
->this : f
+>this : this
>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; }
>[[3, 4], [null]][0][0] : number
>[[3, 4], [null]][0] : number[]
diff --git a/tests/baselines/reference/arrayOfExportedClass.types b/tests/baselines/reference/arrayOfExportedClass.types
index 1e41e82e448..8447ed2841f 100644
--- a/tests/baselines/reference/arrayOfExportedClass.types
+++ b/tests/baselines/reference/arrayOfExportedClass.types
@@ -18,7 +18,7 @@ class Road {
this.cars = cars;
>this.cars = cars : Car[]
>this.cars : Car[]
->this : Road
+>this : this
>cars : Car[]
>cars : Car[]
}
diff --git a/tests/baselines/reference/arrayconcat.types b/tests/baselines/reference/arrayconcat.types
index 3560272a363..45615cd63b8 100644
--- a/tests/baselines/reference/arrayconcat.types
+++ b/tests/baselines/reference/arrayconcat.types
@@ -38,12 +38,12 @@ class parser {
this.options = this.options.sort(function(a, b) {
>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; } }) : IOptions[]
>this.options : IOptions[]
->this : parser
+>this : this
>options : IOptions[]
>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; } }) : IOptions[]
>this.options.sort : (compareFn?: (a: IOptions, b: IOptions) => number) => IOptions[]
>this.options : IOptions[]
->this : parser
+>this : this
>options : IOptions[]
>sort : (compareFn?: (a: IOptions, b: IOptions) => number) => IOptions[]
>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; } } : (a: IOptions, b: IOptions) => number
diff --git a/tests/baselines/reference/arrowFunctionExpressions.types b/tests/baselines/reference/arrowFunctionExpressions.types
index 6ac405e6d7e..eedd20944fe 100644
--- a/tests/baselines/reference/arrowFunctionExpressions.types
+++ b/tests/baselines/reference/arrowFunctionExpressions.types
@@ -129,12 +129,12 @@ class MyClass {
>1 : number
p = (n) => n && this;
->p : (n: any) => MyClass
->(n) => n && this : (n: any) => MyClass
+>p : (n: any) => this
+>(n) => n && this : (n: any) => this
>n : any
->n && this : MyClass
+>n && this : this
>n : any
->this : MyClass
+>this : this
fn() {
>fn : () => void
@@ -148,12 +148,12 @@ class MyClass {
>1 : number
var p = (n) => n && this;
->p : (n: any) => MyClass
->(n) => n && this : (n: any) => MyClass
+>p : (n: any) => this
+>(n) => n && this : (n: any) => this
>n : any
->n && this : MyClass
+>n && this : this
>n : any
->this : MyClass
+>this : this
}
}
diff --git a/tests/baselines/reference/asOperator4.js b/tests/baselines/reference/asOperator4.js
new file mode 100644
index 00000000000..906b807fe73
--- /dev/null
+++ b/tests/baselines/reference/asOperator4.js
@@ -0,0 +1,22 @@
+//// [tests/cases/conformance/expressions/asOperator/asOperator4.ts] ////
+
+//// [foo.ts]
+
+export function foo() { }
+
+//// [bar.ts]
+import { foo } from './foo';
+
+// These should emit identically
+foo;
+(foo as any);
+
+
+//// [foo.js]
+function foo() { }
+exports.foo = foo;
+//// [bar.js]
+var foo_1 = require('./foo');
+// These should emit identically
+foo_1.foo;
+foo_1.foo;
diff --git a/tests/baselines/reference/asOperator4.symbols b/tests/baselines/reference/asOperator4.symbols
new file mode 100644
index 00000000000..4ee5f6fe83f
--- /dev/null
+++ b/tests/baselines/reference/asOperator4.symbols
@@ -0,0 +1,16 @@
+=== tests/cases/conformance/expressions/asOperator/foo.ts ===
+
+export function foo() { }
+>foo : Symbol(foo, Decl(foo.ts, 0, 0))
+
+=== tests/cases/conformance/expressions/asOperator/bar.ts ===
+import { foo } from './foo';
+>foo : Symbol(foo, Decl(bar.ts, 0, 8))
+
+// These should emit identically
+foo;
+>foo : Symbol(foo, Decl(bar.ts, 0, 8))
+
+(foo as any);
+>foo : Symbol(foo, Decl(bar.ts, 0, 8))
+
diff --git a/tests/baselines/reference/asOperator4.types b/tests/baselines/reference/asOperator4.types
new file mode 100644
index 00000000000..0dc6be46a2c
--- /dev/null
+++ b/tests/baselines/reference/asOperator4.types
@@ -0,0 +1,19 @@
+=== tests/cases/conformance/expressions/asOperator/foo.ts ===
+
+export function foo() { }
+>foo : () => void
+
+=== tests/cases/conformance/expressions/asOperator/bar.ts ===
+import { foo } from './foo';
+>foo : () => void
+
+// These should emit identically
+foo;
+>foo : any
+>foo : () => void
+
+(foo as any);
+>(foo as any) : any
+>foo as any : any
+>foo : () => void
+
diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types
index b3f6f18cde8..76853858c5c 100644
--- a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types
+++ b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types
@@ -11,11 +11,12 @@ class C {
var fn = async () => await other.apply(this, arguments);
>fn : () => Promise
>async () => await other.apply(this, arguments) : () => Promise
+>await other.apply(this, arguments) : any
>other.apply(this, arguments) : any
>other.apply : (thisArg: any, argArray?: any) => any
>other : () => void
>apply : (thisArg: any, argArray?: any) => any
->this : C
+>this : this
>arguments : IArguments
}
}
diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.types b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.types
index f3cd0f2d2de..5386a956ada 100644
--- a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.types
+++ b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es6.types
@@ -6,9 +6,10 @@ class C {
>method : () => void
var fn = async () => await this;
->fn : () => Promise
->async () => await this : () => Promise
->this : C
+>fn : () => Promise
+>async () => await this : () => Promise
+>await this : this
+>this : this
}
}
diff --git a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols
index 5203e666db9..6ee2b1de415 100644
--- a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols
+++ b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols
@@ -13,6 +13,7 @@ async function func(): Promise {
"before";
var b = await p || a;
>b : Symbol(b, Decl(awaitBinaryExpression1_es6.ts, 4, 7))
+>p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11))
>a : Symbol(a, Decl(awaitBinaryExpression1_es6.ts, 0, 11))
"after";
diff --git a/tests/baselines/reference/awaitBinaryExpression1_es6.types b/tests/baselines/reference/awaitBinaryExpression1_es6.types
index 59370dda14b..4718f5f8fe9 100644
--- a/tests/baselines/reference/awaitBinaryExpression1_es6.types
+++ b/tests/baselines/reference/awaitBinaryExpression1_es6.types
@@ -16,7 +16,8 @@ async function func(): Promise {
var b = await p || a;
>b : boolean
>await p || a : boolean
->p : any
+>await p : boolean
+>p : Promise
>a : boolean
"after";
diff --git a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols
index da1efd0fda4..9c65780cfad 100644
--- a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols
+++ b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols
@@ -13,6 +13,7 @@ async function func(): Promise {
"before";
var b = await p && a;
>b : Symbol(b, Decl(awaitBinaryExpression2_es6.ts, 4, 7))
+>p : Symbol(p, Decl(awaitBinaryExpression2_es6.ts, 1, 11))
>a : Symbol(a, Decl(awaitBinaryExpression2_es6.ts, 0, 11))
"after";
diff --git a/tests/baselines/reference/awaitBinaryExpression2_es6.types b/tests/baselines/reference/awaitBinaryExpression2_es6.types
index c3f33bca2fa..6154377a6f1 100644
--- a/tests/baselines/reference/awaitBinaryExpression2_es6.types
+++ b/tests/baselines/reference/awaitBinaryExpression2_es6.types
@@ -16,7 +16,8 @@ async function func(): Promise {
var b = await p && a;
>b : boolean
>await p && a : boolean
->p : any
+>await p : boolean
+>p : Promise
>a : boolean
"after";
diff --git a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols
index e35d1663486..69d02403e85 100644
--- a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols
+++ b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols
@@ -13,6 +13,7 @@ async function func(): Promise {
"before";
var b = await p + a;
>b : Symbol(b, Decl(awaitBinaryExpression3_es6.ts, 4, 7))
+>p : Symbol(p, Decl(awaitBinaryExpression3_es6.ts, 1, 11))
>a : Symbol(a, Decl(awaitBinaryExpression3_es6.ts, 0, 11))
"after";
diff --git a/tests/baselines/reference/awaitBinaryExpression3_es6.types b/tests/baselines/reference/awaitBinaryExpression3_es6.types
index 786eabadae4..2d5b087d6e3 100644
--- a/tests/baselines/reference/awaitBinaryExpression3_es6.types
+++ b/tests/baselines/reference/awaitBinaryExpression3_es6.types
@@ -16,7 +16,8 @@ async function func(): Promise {
var b = await p + a;
>b : number
>await p + a : number
->p : any
+>await p : number
+>p : Promise
>a : number
"after";
diff --git a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols
index 19dd741e2db..c88e0f247a5 100644
--- a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols
+++ b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols
@@ -13,6 +13,7 @@ async function func(): Promise {
"before";
var b = await p, a;
>b : Symbol(b, Decl(awaitBinaryExpression4_es6.ts, 4, 7))
+>p : Symbol(p, Decl(awaitBinaryExpression4_es6.ts, 1, 11))
>a : Symbol(a, Decl(awaitBinaryExpression4_es6.ts, 4, 20))
"after";
diff --git a/tests/baselines/reference/awaitBinaryExpression4_es6.types b/tests/baselines/reference/awaitBinaryExpression4_es6.types
index 73126b7797d..80135203a82 100644
--- a/tests/baselines/reference/awaitBinaryExpression4_es6.types
+++ b/tests/baselines/reference/awaitBinaryExpression4_es6.types
@@ -15,7 +15,8 @@ async function func(): Promise {
var b = await p, a;
>b : boolean
->p : any
+>await p : boolean
+>p : Promise
>a : any
"after";
diff --git a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols
index 4cc5914692b..0ee4a03f3c5 100644
--- a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols
+++ b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols
@@ -19,6 +19,7 @@ async function func(): Promise {
>o.a : Symbol(a, Decl(awaitBinaryExpression5_es6.ts, 4, 12))
>o : Symbol(o, Decl(awaitBinaryExpression5_es6.ts, 4, 7))
>a : Symbol(a, Decl(awaitBinaryExpression5_es6.ts, 4, 12))
+>p : Symbol(p, Decl(awaitBinaryExpression5_es6.ts, 1, 11))
"after";
}
diff --git a/tests/baselines/reference/awaitBinaryExpression5_es6.types b/tests/baselines/reference/awaitBinaryExpression5_es6.types
index 922e5887a77..8b76b6f8b88 100644
--- a/tests/baselines/reference/awaitBinaryExpression5_es6.types
+++ b/tests/baselines/reference/awaitBinaryExpression5_es6.types
@@ -22,7 +22,8 @@ async function func(): Promise {
>o.a : boolean
>o : { a: boolean; }
>a : boolean
->p : any
+>await p : boolean
+>p : Promise
"after";
>"after" : string
diff --git a/tests/baselines/reference/awaitCallExpression2_es6.symbols b/tests/baselines/reference/awaitCallExpression2_es6.symbols
index 1ce953f5367..a3fd474060a 100644
--- a/tests/baselines/reference/awaitCallExpression2_es6.symbols
+++ b/tests/baselines/reference/awaitCallExpression2_es6.symbols
@@ -42,6 +42,7 @@ async function func(): Promise {
var b = fn(await p, a, a);
>b : Symbol(b, Decl(awaitCallExpression2_es6.ts, 8, 7))
>fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 1, 32))
+>p : Symbol(p, Decl(awaitCallExpression2_es6.ts, 1, 11))
>a : Symbol(a, Decl(awaitCallExpression2_es6.ts, 0, 11))
>a : Symbol(a, Decl(awaitCallExpression2_es6.ts, 0, 11))
diff --git a/tests/baselines/reference/awaitCallExpression2_es6.types b/tests/baselines/reference/awaitCallExpression2_es6.types
index 6c7f02a578a..1617f4a14ff 100644
--- a/tests/baselines/reference/awaitCallExpression2_es6.types
+++ b/tests/baselines/reference/awaitCallExpression2_es6.types
@@ -45,7 +45,8 @@ async function func(): Promise {
>b : void
>fn(await p, a, a) : void
>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void
->p : any
+>await p : boolean
+>p : Promise
>a : boolean
>a : boolean
diff --git a/tests/baselines/reference/awaitCallExpression3_es6.symbols b/tests/baselines/reference/awaitCallExpression3_es6.symbols
index ea9c6934502..6dde8fc7f58 100644
--- a/tests/baselines/reference/awaitCallExpression3_es6.symbols
+++ b/tests/baselines/reference/awaitCallExpression3_es6.symbols
@@ -43,6 +43,7 @@ async function func(): Promise {
>b : Symbol(b, Decl(awaitCallExpression3_es6.ts, 8, 7))
>fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 1, 32))
>a : Symbol(a, Decl(awaitCallExpression3_es6.ts, 0, 11))
+>p : Symbol(p, Decl(awaitCallExpression3_es6.ts, 1, 11))
>a : Symbol(a, Decl(awaitCallExpression3_es6.ts, 0, 11))
"after";
diff --git a/tests/baselines/reference/awaitCallExpression3_es6.types b/tests/baselines/reference/awaitCallExpression3_es6.types
index 24d22db3c8c..6304a803f64 100644
--- a/tests/baselines/reference/awaitCallExpression3_es6.types
+++ b/tests/baselines/reference/awaitCallExpression3_es6.types
@@ -46,7 +46,8 @@ async function func(): Promise {
>fn(a, await p, a) : void
>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void
>a : boolean
->p : any
+>await p : boolean
+>p : Promise
>a : boolean
"after";
diff --git a/tests/baselines/reference/awaitCallExpression4_es6.symbols b/tests/baselines/reference/awaitCallExpression4_es6.symbols
index f35e690bc6e..ca563274b51 100644
--- a/tests/baselines/reference/awaitCallExpression4_es6.symbols
+++ b/tests/baselines/reference/awaitCallExpression4_es6.symbols
@@ -41,6 +41,7 @@ async function func(): Promise {
"before";
var b = (await pfn)(a, a, a);
>b : Symbol(b, Decl(awaitCallExpression4_es6.ts, 8, 7))
+>pfn : Symbol(pfn, Decl(awaitCallExpression4_es6.ts, 4, 11))
>a : Symbol(a, Decl(awaitCallExpression4_es6.ts, 0, 11))
>a : Symbol(a, Decl(awaitCallExpression4_es6.ts, 0, 11))
>a : Symbol(a, Decl(awaitCallExpression4_es6.ts, 0, 11))
diff --git a/tests/baselines/reference/awaitCallExpression4_es6.types b/tests/baselines/reference/awaitCallExpression4_es6.types
index 04115466427..ff5d8f4012b 100644
--- a/tests/baselines/reference/awaitCallExpression4_es6.types
+++ b/tests/baselines/reference/awaitCallExpression4_es6.types
@@ -45,7 +45,8 @@ async function func(): Promise {
>b : void
>(await pfn)(a, a, a) : void
>(await pfn) : (arg0: boolean, arg1: boolean, arg2: boolean) => void
->pfn : any
+>await pfn : (arg0: boolean, arg1: boolean, arg2: boolean) => void
+>pfn : Promise<(arg0: boolean, arg1: boolean, arg2: boolean) => void>
>a : boolean
>a : boolean
>a : boolean
diff --git a/tests/baselines/reference/awaitCallExpression6_es6.symbols b/tests/baselines/reference/awaitCallExpression6_es6.symbols
index 0a053d172a0..effed91ec06 100644
--- a/tests/baselines/reference/awaitCallExpression6_es6.symbols
+++ b/tests/baselines/reference/awaitCallExpression6_es6.symbols
@@ -44,6 +44,7 @@ async function func(): Promise {
>o.fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 3, 16))
>o : Symbol(o, Decl(awaitCallExpression6_es6.ts, 3, 11))
>fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 3, 16))
+>p : Symbol(p, Decl(awaitCallExpression6_es6.ts, 1, 11))
>a : Symbol(a, Decl(awaitCallExpression6_es6.ts, 0, 11))
>a : Symbol(a, Decl(awaitCallExpression6_es6.ts, 0, 11))
diff --git a/tests/baselines/reference/awaitCallExpression6_es6.types b/tests/baselines/reference/awaitCallExpression6_es6.types
index d18377cebbb..3266733fab0 100644
--- a/tests/baselines/reference/awaitCallExpression6_es6.types
+++ b/tests/baselines/reference/awaitCallExpression6_es6.types
@@ -47,7 +47,8 @@ async function func(): Promise {
>o.fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void
>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }
>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void
->p : any
+>await p : boolean
+>p : Promise
>a : boolean
>a : boolean
diff --git a/tests/baselines/reference/awaitCallExpression7_es6.symbols b/tests/baselines/reference/awaitCallExpression7_es6.symbols
index 41dd8bcaff9..3393d2a0759 100644
--- a/tests/baselines/reference/awaitCallExpression7_es6.symbols
+++ b/tests/baselines/reference/awaitCallExpression7_es6.symbols
@@ -45,6 +45,7 @@ async function func(): Promise {
>o : Symbol(o, Decl(awaitCallExpression7_es6.ts, 3, 11))
>fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 3, 16))
>a : Symbol(a, Decl(awaitCallExpression7_es6.ts, 0, 11))
+>p : Symbol(p, Decl(awaitCallExpression7_es6.ts, 1, 11))
>a : Symbol(a, Decl(awaitCallExpression7_es6.ts, 0, 11))
"after";
diff --git a/tests/baselines/reference/awaitCallExpression7_es6.types b/tests/baselines/reference/awaitCallExpression7_es6.types
index b213a75dcd6..b1b382f7325 100644
--- a/tests/baselines/reference/awaitCallExpression7_es6.types
+++ b/tests/baselines/reference/awaitCallExpression7_es6.types
@@ -48,7 +48,8 @@ async function func(): Promise {
>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }
>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void
>a : boolean
->p : any
+>await p : boolean
+>p : Promise
>a : boolean
"after";
diff --git a/tests/baselines/reference/awaitCallExpression8_es6.symbols b/tests/baselines/reference/awaitCallExpression8_es6.symbols
index caaf10d4dba..331ebbdb7e1 100644
--- a/tests/baselines/reference/awaitCallExpression8_es6.symbols
+++ b/tests/baselines/reference/awaitCallExpression8_es6.symbols
@@ -42,6 +42,7 @@ async function func(): Promise {
var b = (await po).fn(a, a, a);
>b : Symbol(b, Decl(awaitCallExpression8_es6.ts, 8, 7))
>(await po).fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 5, 25))
+>po : Symbol(po, Decl(awaitCallExpression8_es6.ts, 5, 11))
>fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 5, 25))
>a : Symbol(a, Decl(awaitCallExpression8_es6.ts, 0, 11))
>a : Symbol(a, Decl(awaitCallExpression8_es6.ts, 0, 11))
diff --git a/tests/baselines/reference/awaitCallExpression8_es6.types b/tests/baselines/reference/awaitCallExpression8_es6.types
index 37511a7e3d7..76719c09c85 100644
--- a/tests/baselines/reference/awaitCallExpression8_es6.types
+++ b/tests/baselines/reference/awaitCallExpression8_es6.types
@@ -46,7 +46,8 @@ async function func(): Promise {
>(await po).fn(a, a, a) : void
>(await po).fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void
>(await po) : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }
->po : any
+>await po : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }
+>po : Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>
>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void
>a : boolean
>a : boolean
diff --git a/tests/baselines/reference/awaitUnion_es6.symbols b/tests/baselines/reference/awaitUnion_es6.symbols
index ca0b9afaf92..2db3b1a2fdb 100644
--- a/tests/baselines/reference/awaitUnion_es6.symbols
+++ b/tests/baselines/reference/awaitUnion_es6.symbols
@@ -24,16 +24,21 @@ async function f() {
let await_a = await a;
>await_a : Symbol(await_a, Decl(awaitUnion_es6.ts, 6, 4))
+>a : Symbol(a, Decl(awaitUnion_es6.ts, 0, 11))
let await_b = await b;
>await_b : Symbol(await_b, Decl(awaitUnion_es6.ts, 7, 4))
+>b : Symbol(b, Decl(awaitUnion_es6.ts, 1, 11))
let await_c = await c;
>await_c : Symbol(await_c, Decl(awaitUnion_es6.ts, 8, 4))
+>c : Symbol(c, Decl(awaitUnion_es6.ts, 2, 11))
let await_d = await d;
>await_d : Symbol(await_d, Decl(awaitUnion_es6.ts, 9, 4))
+>d : Symbol(d, Decl(awaitUnion_es6.ts, 3, 11))
let await_e = await e;
>await_e : Symbol(await_e, Decl(awaitUnion_es6.ts, 10, 4))
+>e : Symbol(e, Decl(awaitUnion_es6.ts, 4, 11))
}
diff --git a/tests/baselines/reference/awaitUnion_es6.types b/tests/baselines/reference/awaitUnion_es6.types
index d0b5b6ccfd0..97d4bd2fc57 100644
--- a/tests/baselines/reference/awaitUnion_es6.types
+++ b/tests/baselines/reference/awaitUnion_es6.types
@@ -24,21 +24,26 @@ async function f() {
let await_a = await a;
>await_a : number | string
->a : any
+>await a : number | string
+>a : number | string
let await_b = await b;
>await_b : number | string
->b : any
+>await b : number | string
+>b : PromiseLike | PromiseLike
let await_c = await c;
>await_c : number | string
->c : any
+>await c : number | string
+>c : PromiseLike
let await_d = await d;
>await_d : number | string
->d : any
+>await d : number | string
+>d : number | PromiseLike
let await_e = await e;
>await_e : number | string
->e : any
+>await e : number | string
+>e : number | PromiseLike
}
diff --git a/tests/baselines/reference/badThisBinding.types b/tests/baselines/reference/badThisBinding.types
index a6b1c478d53..201f3e70288 100644
--- a/tests/baselines/reference/badThisBinding.types
+++ b/tests/baselines/reference/badThisBinding.types
@@ -22,8 +22,8 @@ class Greeter {
>() => { var x = this; } : () => void
var x = this;
->x : Greeter
->this : Greeter
+>x : this
+>this : this
});
});
diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.types b/tests/baselines/reference/baseTypeWrappingInstantiationChain.types
index 747b672dd0d..ba702171de9 100644
--- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.types
+++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.types
@@ -13,7 +13,7 @@ class C extends CBase {
>CBaseBase : typeof CBaseBase
>Wrapper : Wrapper
>T1 : T1
->this : C
+>this : this
}
public alsoWorks() {
>alsoWorks : () => void
@@ -22,7 +22,7 @@ class C extends CBase {
>new CBase(this) : CBase
>CBase : typeof CBase
>T1 : T1
->this : C
+>this : this
}
public method(t: Wrapper) { }
diff --git a/tests/baselines/reference/binopAssignmentShouldHaveType.types b/tests/baselines/reference/binopAssignmentShouldHaveType.types
index fdef2fbcabd..d09138bbb88 100644
--- a/tests/baselines/reference/binopAssignmentShouldHaveType.types
+++ b/tests/baselines/reference/binopAssignmentShouldHaveType.types
@@ -32,7 +32,7 @@ module Test {
>name : string
>this.getName() : string
>this.getName : () => string
->this : Bug
+>this : this
>getName : () => string
>length : number
>0 : number
diff --git a/tests/baselines/reference/callWithSpread.types b/tests/baselines/reference/callWithSpread.types
index 8964708c05e..eae92c471e9 100644
--- a/tests/baselines/reference/callWithSpread.types
+++ b/tests/baselines/reference/callWithSpread.types
@@ -180,7 +180,7 @@ class C {
this.foo(x, y);
>this.foo(x, y) : void
>this.foo : (x: number, y: number, ...z: string[]) => void
->this : C
+>this : this
>foo : (x: number, y: number, ...z: string[]) => void
>x : number
>y : number
@@ -188,7 +188,7 @@ class C {
this.foo(x, y, ...z);
>this.foo(x, y, ...z) : void
>this.foo : (x: number, y: number, ...z: string[]) => void
->this : C
+>this : this
>foo : (x: number, y: number, ...z: string[]) => void
>x : number
>y : number
diff --git a/tests/baselines/reference/callWithSpreadES6.types b/tests/baselines/reference/callWithSpreadES6.types
index 9c9e795ce24..b0c118855fe 100644
--- a/tests/baselines/reference/callWithSpreadES6.types
+++ b/tests/baselines/reference/callWithSpreadES6.types
@@ -181,7 +181,7 @@ class C {
this.foo(x, y);
>this.foo(x, y) : void
>this.foo : (x: number, y: number, ...z: string[]) => void
->this : C
+>this : this
>foo : (x: number, y: number, ...z: string[]) => void
>x : number
>y : number
@@ -189,7 +189,7 @@ class C {
this.foo(x, y, ...z);
>this.foo(x, y, ...z) : void
>this.foo : (x: number, y: number, ...z: string[]) => void
->this : C
+>this : this
>foo : (x: number, y: number, ...z: string[]) => void
>x : number
>y : number
diff --git a/tests/baselines/reference/captureThisInSuperCall.types b/tests/baselines/reference/captureThisInSuperCall.types
index faa7d2ad97e..4a0902e9f1e 100644
--- a/tests/baselines/reference/captureThisInSuperCall.types
+++ b/tests/baselines/reference/captureThisInSuperCall.types
@@ -18,7 +18,7 @@ class B extends A {
>() => this.someMethod() : () => void
>this.someMethod() : void
>this.someMethod : () => void
->this : B
+>this : this
>someMethod : () => void
someMethod() {}
diff --git a/tests/baselines/reference/classConstructorParametersAccessibility3.types b/tests/baselines/reference/classConstructorParametersAccessibility3.types
index 3372044569c..d664aaf3172 100644
--- a/tests/baselines/reference/classConstructorParametersAccessibility3.types
+++ b/tests/baselines/reference/classConstructorParametersAccessibility3.types
@@ -20,7 +20,7 @@ class Derived extends Base {
this.p; // OK
>this.p : number
->this : Derived
+>this : this
>p : number
}
}
diff --git a/tests/baselines/reference/classExpressionWithDecorator1.js b/tests/baselines/reference/classExpressionWithDecorator1.js
index 4b1700df7af..8494ec32cda 100644
--- a/tests/baselines/reference/classExpressionWithDecorator1.js
+++ b/tests/baselines/reference/classExpressionWithDecorator1.js
@@ -3,12 +3,10 @@ var v = @decorate class C { static p = 1 };
//// [classExpressionWithDecorator1.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var v = ;
var C = (function () {
diff --git a/tests/baselines/reference/classOrder2.types b/tests/baselines/reference/classOrder2.types
index 07bd6ba45a5..ac65da2ec9d 100644
--- a/tests/baselines/reference/classOrder2.types
+++ b/tests/baselines/reference/classOrder2.types
@@ -8,7 +8,7 @@ class A extends B {
>foo : () => void
>this.bar() : void
>this.bar : () => void
->this : A
+>this : this
>bar : () => void
}
diff --git a/tests/baselines/reference/classOrderBug.types b/tests/baselines/reference/classOrderBug.types
index 979b65b8008..703a87adc4f 100644
--- a/tests/baselines/reference/classOrderBug.types
+++ b/tests/baselines/reference/classOrderBug.types
@@ -11,7 +11,7 @@ class bar {
this.baz = new foo();
>this.baz = new foo() : foo
>this.baz : foo
->this : bar
+>this : this
>baz : foo
>new foo() : foo
>foo : typeof foo
diff --git a/tests/baselines/reference/classSideInheritance2.types b/tests/baselines/reference/classSideInheritance2.types
index 9c2d632ebbb..7a3ee630266 100644
--- a/tests/baselines/reference/classSideInheritance2.types
+++ b/tests/baselines/reference/classSideInheritance2.types
@@ -41,7 +41,7 @@ class TextBase implements IText {
return new SubText(this, span);
>new SubText(this, span) : SubText
>SubText : typeof SubText
->this : TextBase
+>this : this
>span : TextSpan
}
}
diff --git a/tests/baselines/reference/commentsClassMembers.types b/tests/baselines/reference/commentsClassMembers.types
index fbd514bf77b..b599edc0463 100644
--- a/tests/baselines/reference/commentsClassMembers.types
+++ b/tests/baselines/reference/commentsClassMembers.types
@@ -16,7 +16,7 @@ class c1 {
return this.p1 + b;
>this.p1 + b : number
>this.p1 : number
->this : c1
+>this : this
>p1 : number
>b : number
@@ -28,10 +28,10 @@ class c1 {
return this.p2(this.p1);
>this.p2(this.p1) : number
>this.p2 : (b: number) => number
->this : c1
+>this : this
>p2 : (b: number) => number
>this.p1 : number
->this : c1
+>this : this
>p1 : number
}// trailing comment Getter
@@ -43,11 +43,11 @@ class c1 {
this.p1 = this.p2(value);
>this.p1 = this.p2(value) : number
>this.p1 : number
->this : c1
+>this : this
>p1 : number
>this.p2(value) : number
>this.p2 : (b: number) => number
->this : c1
+>this : this
>p2 : (b: number) => number
>value : number
@@ -64,7 +64,7 @@ class c1 {
return this.p1 + b;
>this.p1 + b : number
>this.p1 : number
->this : c1
+>this : this
>p1 : number
>b : number
@@ -76,10 +76,10 @@ class c1 {
return this.pp2(this.pp1);
>this.pp2(this.pp1) : number
>this.pp2 : (b: number) => number
->this : c1
+>this : this
>pp2 : (b: number) => number
>this.pp1 : number
->this : c1
+>this : this
>pp1 : number
}
/** setter property*/
@@ -90,11 +90,11 @@ class c1 {
this.pp1 = this.pp2(value);
>this.pp1 = this.pp2(value) : number
>this.pp1 : number
->this : c1
+>this : this
>pp1 : number
>this.pp2(value) : number
>this.pp2 : (b: number) => number
->this : c1
+>this : this
>pp2 : (b: number) => number
>value : number
}
@@ -158,7 +158,7 @@ class c1 {
return this.nc_p1 + b;
>this.nc_p1 + b : number
>this.nc_p1 : number
->this : c1
+>this : this
>nc_p1 : number
>b : number
}
@@ -168,10 +168,10 @@ class c1 {
return this.nc_p2(this.nc_p1);
>this.nc_p2(this.nc_p1) : number
>this.nc_p2 : (b: number) => number
->this : c1
+>this : this
>nc_p2 : (b: number) => number
>this.nc_p1 : number
->this : c1
+>this : this
>nc_p1 : number
}
public set nc_p3(value: number) {
@@ -181,11 +181,11 @@ class c1 {
this.nc_p1 = this.nc_p2(value);
>this.nc_p1 = this.nc_p2(value) : number
>this.nc_p1 : number
->this : c1
+>this : this
>nc_p1 : number
>this.nc_p2(value) : number
>this.nc_p2 : (b: number) => number
->this : c1
+>this : this
>nc_p2 : (b: number) => number
>value : number
}
@@ -199,7 +199,7 @@ class c1 {
return this.nc_pp1 + b;
>this.nc_pp1 + b : number
>this.nc_pp1 : number
->this : c1
+>this : this
>nc_pp1 : number
>b : number
}
@@ -209,10 +209,10 @@ class c1 {
return this.nc_pp2(this.nc_pp1);
>this.nc_pp2(this.nc_pp1) : number
>this.nc_pp2 : (b: number) => number
->this : c1
+>this : this
>nc_pp2 : (b: number) => number
>this.nc_pp1 : number
->this : c1
+>this : this
>nc_pp1 : number
}
private set nc_pp3(value: number) {
@@ -222,11 +222,11 @@ class c1 {
this.nc_pp1 = this.nc_pp2(value);
>this.nc_pp1 = this.nc_pp2(value) : number
>this.nc_pp1 : number
->this : c1
+>this : this
>nc_pp1 : number
>this.nc_pp2(value) : number
>this.nc_pp2 : (b: number) => number
->this : c1
+>this : this
>nc_pp2 : (b: number) => number
>value : number
}
@@ -284,7 +284,7 @@ class c1 {
return this.a_p1 + b;
>this.a_p1 + b : number
>this.a_p1 : number
->this : c1
+>this : this
>a_p1 : number
>b : number
}
@@ -295,10 +295,10 @@ class c1 {
return this.a_p2(this.a_p1);
>this.a_p2(this.a_p1) : number
>this.a_p2 : (b: number) => number
->this : c1
+>this : this
>a_p2 : (b: number) => number
>this.a_p1 : number
->this : c1
+>this : this
>a_p1 : number
}
// setter property
@@ -309,11 +309,11 @@ class c1 {
this.a_p1 = this.a_p2(value);
>this.a_p1 = this.a_p2(value) : number
>this.a_p1 : number
->this : c1
+>this : this
>a_p1 : number
>this.a_p2(value) : number
>this.a_p2 : (b: number) => number
->this : c1
+>this : this
>a_p2 : (b: number) => number
>value : number
}
@@ -329,7 +329,7 @@ class c1 {
return this.a_p1 + b;
>this.a_p1 + b : number
>this.a_p1 : number
->this : c1
+>this : this
>a_p1 : number
>b : number
}
@@ -340,10 +340,10 @@ class c1 {
return this.a_pp2(this.a_pp1);
>this.a_pp2(this.a_pp1) : number
>this.a_pp2 : (b: number) => number
->this : c1
+>this : this
>a_pp2 : (b: number) => number
>this.a_pp1 : number
->this : c1
+>this : this
>a_pp1 : number
}
// setter property
@@ -354,11 +354,11 @@ class c1 {
this.a_pp1 = this.a_pp2(value);
>this.a_pp1 = this.a_pp2(value) : number
>this.a_pp1 : number
->this : c1
+>this : this
>a_pp1 : number
>this.a_pp2(value) : number
>this.a_pp2 : (b: number) => number
->this : c1
+>this : this
>a_pp2 : (b: number) => number
>value : number
}
@@ -422,7 +422,7 @@ class c1 {
return this.b_p1 + b;
>this.b_p1 + b : number
>this.b_p1 : number
->this : c1
+>this : this
>b_p1 : number
>b : number
}
@@ -433,10 +433,10 @@ class c1 {
return this.b_p2(this.b_p1);
>this.b_p2(this.b_p1) : number
>this.b_p2 : (b: number) => number
->this : c1
+>this : this
>b_p2 : (b: number) => number
>this.b_p1 : number
->this : c1
+>this : this
>b_p1 : number
}
/** setter property */
@@ -447,11 +447,11 @@ class c1 {
this.b_p1 = this.b_p2(value);
>this.b_p1 = this.b_p2(value) : number
>this.b_p1 : number
->this : c1
+>this : this
>b_p1 : number
>this.b_p2(value) : number
>this.b_p2 : (b: number) => number
->this : c1
+>this : this
>b_p2 : (b: number) => number
>value : number
}
@@ -467,7 +467,7 @@ class c1 {
return this.b_p1 + b;
>this.b_p1 + b : number
>this.b_p1 : number
->this : c1
+>this : this
>b_p1 : number
>b : number
}
@@ -478,10 +478,10 @@ class c1 {
return this.b_pp2(this.b_pp1);
>this.b_pp2(this.b_pp1) : number
>this.b_pp2 : (b: number) => number
->this : c1
+>this : this
>b_pp2 : (b: number) => number
>this.b_pp1 : number
->this : c1
+>this : this
>b_pp1 : number
}
/** setter property */
@@ -492,11 +492,11 @@ class c1 {
this.b_pp1 = this.b_pp2(value);
>this.b_pp1 = this.b_pp2(value) : number
>this.b_pp1 : number
->this : c1
+>this : this
>b_pp1 : number
>this.b_pp2(value) : number
>this.b_pp2 : (b: number) => number
->this : c1
+>this : this
>b_pp2 : (b: number) => number
>value : number
}
@@ -704,7 +704,7 @@ class cProperties {
return this.val;
>this.val : number
->this : cProperties
+>this : this
>val : number
} // trailing comment of only getter
@@ -713,7 +713,7 @@ class cProperties {
return this.val;
>this.val : number
->this : cProperties
+>this : this
>val : number
}
/**setter only property*/
@@ -724,7 +724,7 @@ class cProperties {
this.val = value;
>this.val = value : number
>this.val : number
->this : cProperties
+>this : this
>val : number
>value : number
}
@@ -735,7 +735,7 @@ class cProperties {
this.val = value;
>this.val = value : number
>this.val : number
->this : cProperties
+>this : this
>val : number
>value : number
diff --git a/tests/baselines/reference/commentsInheritance.types b/tests/baselines/reference/commentsInheritance.types
index 1c25f13937b..21dcde99dbf 100644
--- a/tests/baselines/reference/commentsInheritance.types
+++ b/tests/baselines/reference/commentsInheritance.types
@@ -170,7 +170,7 @@ class c2 {
this.c2_p1 = a;
>this.c2_p1 = a : number
>this.c2_p1 : number
->this : c2
+>this : this
>c2_p1 : number
>a : number
}
diff --git a/tests/baselines/reference/commentsdoNotEmitComments.types b/tests/baselines/reference/commentsdoNotEmitComments.types
index 024f1c2a21f..067275f2151 100644
--- a/tests/baselines/reference/commentsdoNotEmitComments.types
+++ b/tests/baselines/reference/commentsdoNotEmitComments.types
@@ -43,7 +43,7 @@ class c {
return this.b;
>this.b : number
->this : c
+>this : this
>b : number
}
@@ -53,7 +53,7 @@ class c {
return this.b;
>this.b : number
->this : c
+>this : this
>b : number
}
@@ -65,7 +65,7 @@ class c {
this.b = val;
>this.b = val : number
>this.b : number
->this : c
+>this : this
>b : number
>val : number
}
diff --git a/tests/baselines/reference/commentsemitComments.types b/tests/baselines/reference/commentsemitComments.types
index 2311ca09dd0..2594fb53fe9 100644
--- a/tests/baselines/reference/commentsemitComments.types
+++ b/tests/baselines/reference/commentsemitComments.types
@@ -43,7 +43,7 @@ class c {
return this.b;
>this.b : number
->this : c
+>this : this
>b : number
}
@@ -53,7 +53,7 @@ class c {
return this.b;
>this.b : number
->this : c
+>this : this
>b : number
}
@@ -65,7 +65,7 @@ class c {
this.b = val;
>this.b = val : number
>this.b : number
->this : c
+>this : this
>b : number
>val : number
}
diff --git a/tests/baselines/reference/complexClassRelationships.types b/tests/baselines/reference/complexClassRelationships.types
index 43d0232e30a..525baf5168a 100644
--- a/tests/baselines/reference/complexClassRelationships.types
+++ b/tests/baselines/reference/complexClassRelationships.types
@@ -79,14 +79,14 @@ class Foo {
return new GenericType(this);
>new GenericType(this) : GenericType
>GenericType : typeof GenericType
->this : Foo
+>this : this
}
public populate() {
>populate : () => void
this.prop2;
>this.prop2 : BaseCollection
->this : Foo
+>this : this
>prop2 : BaseCollection
}
public get prop2(): BaseCollection {
diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.types b/tests/baselines/reference/computedPropertyNames22_ES5.types
index d3008669b4d..ca59250825c 100644
--- a/tests/baselines/reference/computedPropertyNames22_ES5.types
+++ b/tests/baselines/reference/computedPropertyNames22_ES5.types
@@ -12,7 +12,7 @@ class C {
[this.bar()]() { }
>this.bar() : number
>this.bar : () => number
->this : C
+>this : this
>bar : () => number
};
diff --git a/tests/baselines/reference/computedPropertyNames22_ES6.types b/tests/baselines/reference/computedPropertyNames22_ES6.types
index 0936eab29ab..d5fbce29f7d 100644
--- a/tests/baselines/reference/computedPropertyNames22_ES6.types
+++ b/tests/baselines/reference/computedPropertyNames22_ES6.types
@@ -12,7 +12,7 @@ class C {
[this.bar()]() { }
>this.bar() : number
>this.bar : () => number
->this : C
+>this : this
>bar : () => number
};
diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.types b/tests/baselines/reference/computedPropertyNames29_ES5.types
index 674343b3a1a..f3448f10857 100644
--- a/tests/baselines/reference/computedPropertyNames29_ES5.types
+++ b/tests/baselines/reference/computedPropertyNames29_ES5.types
@@ -15,7 +15,7 @@ class C {
[this.bar()]() { } // needs capture
>this.bar() : number
>this.bar : () => number
->this : C
+>this : this
>bar : () => number
};
diff --git a/tests/baselines/reference/computedPropertyNames29_ES6.types b/tests/baselines/reference/computedPropertyNames29_ES6.types
index 52f06bb9d88..cd01d37556a 100644
--- a/tests/baselines/reference/computedPropertyNames29_ES6.types
+++ b/tests/baselines/reference/computedPropertyNames29_ES6.types
@@ -15,7 +15,7 @@ class C {
[this.bar()]() { } // needs capture
>this.bar() : number
>this.bar : () => number
->this : C
+>this : this
>bar : () => number
};
diff --git a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration3.types b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration3.types
index c5b9ec9a6f2..1271d4ef869 100644
--- a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration3.types
+++ b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration3.types
@@ -20,7 +20,7 @@ class Rule {
this.name = name;
>this.name = name : string
>this.name : string
->this : Rule
+>this : this
>name : string
>name : string
}
diff --git a/tests/baselines/reference/contextualThisType.js b/tests/baselines/reference/contextualThisType.js
new file mode 100644
index 00000000000..1fce0828edc
--- /dev/null
+++ b/tests/baselines/reference/contextualThisType.js
@@ -0,0 +1,24 @@
+//// [contextualThisType.ts]
+interface X {
+ a: (p: this) => this;
+}
+
+interface Y extends X {
+}
+
+var x: Y = {
+ a(p) {
+ return p;
+ }
+}
+
+var y = x.a(x);
+
+
+//// [contextualThisType.js]
+var x = {
+ a: function (p) {
+ return p;
+ }
+};
+var y = x.a(x);
diff --git a/tests/baselines/reference/contextualThisType.symbols b/tests/baselines/reference/contextualThisType.symbols
new file mode 100644
index 00000000000..5030a9bbcde
--- /dev/null
+++ b/tests/baselines/reference/contextualThisType.symbols
@@ -0,0 +1,34 @@
+=== tests/cases/conformance/types/thisType/contextualThisType.ts ===
+interface X {
+>X : Symbol(X, Decl(contextualThisType.ts, 0, 0))
+
+ a: (p: this) => this;
+>a : Symbol(a, Decl(contextualThisType.ts, 0, 13))
+>p : Symbol(p, Decl(contextualThisType.ts, 1, 8))
+}
+
+interface Y extends X {
+>Y : Symbol(Y, Decl(contextualThisType.ts, 2, 1))
+>X : Symbol(X, Decl(contextualThisType.ts, 0, 0))
+}
+
+var x: Y = {
+>x : Symbol(x, Decl(contextualThisType.ts, 7, 3))
+>Y : Symbol(Y, Decl(contextualThisType.ts, 2, 1))
+
+ a(p) {
+>a : Symbol(a, Decl(contextualThisType.ts, 7, 12))
+>p : Symbol(p, Decl(contextualThisType.ts, 8, 6))
+
+ return p;
+>p : Symbol(p, Decl(contextualThisType.ts, 8, 6))
+ }
+}
+
+var y = x.a(x);
+>y : Symbol(y, Decl(contextualThisType.ts, 13, 3))
+>x.a : Symbol(X.a, Decl(contextualThisType.ts, 0, 13))
+>x : Symbol(x, Decl(contextualThisType.ts, 7, 3))
+>a : Symbol(X.a, Decl(contextualThisType.ts, 0, 13))
+>x : Symbol(x, Decl(contextualThisType.ts, 7, 3))
+
diff --git a/tests/baselines/reference/contextualThisType.types b/tests/baselines/reference/contextualThisType.types
new file mode 100644
index 00000000000..fb4588c5fb0
--- /dev/null
+++ b/tests/baselines/reference/contextualThisType.types
@@ -0,0 +1,36 @@
+=== tests/cases/conformance/types/thisType/contextualThisType.ts ===
+interface X {
+>X : X
+
+ a: (p: this) => this;
+>a : (p: this) => this
+>p : this
+}
+
+interface Y extends X {
+>Y : Y
+>X : X
+}
+
+var x: Y = {
+>x : Y
+>Y : Y
+>{ a(p) { return p; }} : { a(p: Y): Y; }
+
+ a(p) {
+>a : (p: Y) => Y
+>p : Y
+
+ return p;
+>p : Y
+ }
+}
+
+var y = x.a(x);
+>y : Y
+>x.a(x) : Y
+>x.a : (p: Y) => Y
+>x : Y
+>a : (p: Y) => Y
+>x : Y
+
diff --git a/tests/baselines/reference/contextualTypeAppliedToVarArgs.types b/tests/baselines/reference/contextualTypeAppliedToVarArgs.types
index cbd16aea35f..df6ead16095 100644
--- a/tests/baselines/reference/contextualTypeAppliedToVarArgs.types
+++ b/tests/baselines/reference/contextualTypeAppliedToVarArgs.types
@@ -21,7 +21,7 @@ class Foo{
delegate(this, function (source, args2)
>delegate(this, function (source, args2) { var a = source.node; var b = args2.node; } ) : (...args: any[]) => any
>delegate : (instance: any, method: (...args: any[]) => any, data?: any) => (...args: any[]) => any
->this : Foo
+>this : this
>function (source, args2) { var a = source.node; var b = args2.node; } : (source: any, args2: any) => void
>source : any
>args2 : any
diff --git a/tests/baselines/reference/declFileForTypeParameters.types b/tests/baselines/reference/declFileForTypeParameters.types
index 6308a0c92ba..fe69da2cd0f 100644
--- a/tests/baselines/reference/declFileForTypeParameters.types
+++ b/tests/baselines/reference/declFileForTypeParameters.types
@@ -16,7 +16,7 @@ class C {
return this.x;
>this.x : T
->this : C
+>this : this
>x : T
}
}
diff --git a/tests/baselines/reference/declFileGenericType2.types b/tests/baselines/reference/declFileGenericType2.types
index 07bcba3e85a..c2a43db1921 100644
--- a/tests/baselines/reference/declFileGenericType2.types
+++ b/tests/baselines/reference/declFileGenericType2.types
@@ -142,7 +142,7 @@ module templa.dom.mvc.composite {
this._controllers = [];
>this._controllers = [] : undefined[]
>this._controllers : templa.mvc.IController[]
->this : AbstractCompositeElementController
+>this : this
>_controllers : templa.mvc.IController[]
>[] : undefined[]
}
diff --git a/tests/baselines/reference/declarationEmit_protectedMembers.types b/tests/baselines/reference/declarationEmit_protectedMembers.types
index 89aa3f56332..d541e1d14d2 100644
--- a/tests/baselines/reference/declarationEmit_protectedMembers.types
+++ b/tests/baselines/reference/declarationEmit_protectedMembers.types
@@ -12,7 +12,7 @@ class C1 {
return this.x;
>this.x : number
->this : C1
+>this : this
>x : number
}
@@ -60,7 +60,7 @@ class C2 extends C1 {
>super : C1
>f : () => number
>this.x : number
->this : C2
+>this : this
>x : number
}
protected static sf() {
diff --git a/tests/baselines/reference/declarationFiles.errors.txt b/tests/baselines/reference/declarationFiles.errors.txt
new file mode 100644
index 00000000000..c55cac9000b
--- /dev/null
+++ b/tests/baselines/reference/declarationFiles.errors.txt
@@ -0,0 +1,63 @@
+tests/cases/conformance/types/thisType/declarationFiles.ts(31,5): error TS2527: The inferred type of 'x1' references an inaccessible 'this' type. A type annotation is necessary.
+tests/cases/conformance/types/thisType/declarationFiles.ts(33,5): error TS2527: The inferred type of 'x3' references an inaccessible 'this' type. A type annotation is necessary.
+tests/cases/conformance/types/thisType/declarationFiles.ts(35,5): error TS2527: The inferred type of 'f1' references an inaccessible 'this' type. A type annotation is necessary.
+tests/cases/conformance/types/thisType/declarationFiles.ts(41,5): error TS2527: The inferred type of 'f3' references an inaccessible 'this' type. A type annotation is necessary.
+
+
+==== tests/cases/conformance/types/thisType/declarationFiles.ts (4 errors) ====
+
+ class C1 {
+ x: this;
+ f(x: this): this { return undefined; }
+ constructor(x: this) { }
+ }
+
+ class C2 {
+ [x: string]: this;
+ }
+
+ interface Foo {
+ x: T;
+ y: this;
+ }
+
+ class C3 {
+ a: this[];
+ b: [this, this];
+ c: this | Date;
+ d: this & Date;
+ e: (((this)));
+ f: (x: this) => this;
+ g: new (x: this) => this;
+ h: Foo;
+ i: Foo this)>;
+ j: (x: any) => x is this;
+ }
+
+ class C4 {
+ x1 = { a: this };
+ ~~
+!!! error TS2527: The inferred type of 'x1' references an inaccessible 'this' type. A type annotation is necessary.
+ x2 = [this];
+ x3 = [{ a: this }];
+ ~~
+!!! error TS2527: The inferred type of 'x3' references an inaccessible 'this' type. A type annotation is necessary.
+ x4 = () => this;
+ f1() {
+ ~~
+!!! error TS2527: The inferred type of 'f1' references an inaccessible 'this' type. A type annotation is necessary.
+ return { a: this };
+ }
+ f2() {
+ return [this];
+ }
+ f3() {
+ ~~
+!!! error TS2527: The inferred type of 'f3' references an inaccessible 'this' type. A type annotation is necessary.
+ return [{ a: this }];
+ }
+ f4() {
+ return () => this;
+ }
+ }
+
\ No newline at end of file
diff --git a/tests/baselines/reference/declarationFiles.js b/tests/baselines/reference/declarationFiles.js
new file mode 100644
index 00000000000..d7ed9bde8c7
--- /dev/null
+++ b/tests/baselines/reference/declarationFiles.js
@@ -0,0 +1,135 @@
+//// [declarationFiles.ts]
+
+class C1 {
+ x: this;
+ f(x: this): this { return undefined; }
+ constructor(x: this) { }
+}
+
+class C2 {
+ [x: string]: this;
+}
+
+interface Foo {
+ x: T;
+ y: this;
+}
+
+class C3 {
+ a: this[];
+ b: [this, this];
+ c: this | Date;
+ d: this & Date;
+ e: (((this)));
+ f: (x: this) => this;
+ g: new (x: this) => this;
+ h: Foo;
+ i: Foo this)>;
+ j: (x: any) => x is this;
+}
+
+class C4 {
+ x1 = { a: this };
+ x2 = [this];
+ x3 = [{ a: this }];
+ x4 = () => this;
+ f1() {
+ return { a: this };
+ }
+ f2() {
+ return [this];
+ }
+ f3() {
+ return [{ a: this }];
+ }
+ f4() {
+ return () => this;
+ }
+}
+
+
+//// [declarationFiles.js]
+var C1 = (function () {
+ function C1(x) {
+ }
+ C1.prototype.f = function (x) { return undefined; };
+ return C1;
+})();
+var C2 = (function () {
+ function C2() {
+ }
+ return C2;
+})();
+var C3 = (function () {
+ function C3() {
+ }
+ return C3;
+})();
+var C4 = (function () {
+ function C4() {
+ var _this = this;
+ this.x1 = { a: this };
+ this.x2 = [this];
+ this.x3 = [{ a: this }];
+ this.x4 = function () { return _this; };
+ }
+ C4.prototype.f1 = function () {
+ return { a: this };
+ };
+ C4.prototype.f2 = function () {
+ return [this];
+ };
+ C4.prototype.f3 = function () {
+ return [{ a: this }];
+ };
+ C4.prototype.f4 = function () {
+ var _this = this;
+ return function () { return _this; };
+ };
+ return C4;
+})();
+
+
+//// [declarationFiles.d.ts]
+declare class C1 {
+ x: this;
+ f(x: this): this;
+ constructor(x: this);
+}
+declare class C2 {
+ [x: string]: this;
+}
+interface Foo {
+ x: T;
+ y: this;
+}
+declare class C3 {
+ a: this[];
+ b: [this, this];
+ c: this | Date;
+ d: this & Date;
+ e: (((this)));
+ f: (x: this) => this;
+ g: new (x: this) => this;
+ h: Foo;
+ i: Foo this)>;
+ j: (x: any) => x is this;
+}
+declare class C4 {
+ x1: {
+ a: this;
+ };
+ x2: this[];
+ x3: {
+ a: this;
+ }[];
+ x4: () => this;
+ f1(): {
+ a: this;
+ };
+ f2(): this[];
+ f3(): {
+ a: this;
+ }[];
+ f4(): () => this;
+}
diff --git a/tests/baselines/reference/decoratedClassFromExternalModule.js b/tests/baselines/reference/decoratedClassFromExternalModule.js
index aca1d28b952..000fe2f37d6 100644
--- a/tests/baselines/reference/decoratedClassFromExternalModule.js
+++ b/tests/baselines/reference/decoratedClassFromExternalModule.js
@@ -11,12 +11,10 @@ import Decorated from 'decorated';
//// [decorated.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
function decorate(target) { }
let Decorated = class {
diff --git a/tests/baselines/reference/decoratorChecksFunctionBodies.js b/tests/baselines/reference/decoratorChecksFunctionBodies.js
index adb710efccc..a5aa63b0b31 100644
--- a/tests/baselines/reference/decoratorChecksFunctionBodies.js
+++ b/tests/baselines/reference/decoratorChecksFunctionBodies.js
@@ -17,12 +17,10 @@ class A {
//// [decoratorChecksFunctionBodies.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
// from #2971
function func(s) {
@@ -32,13 +30,12 @@ var A = (function () {
}
A.prototype.m = function () {
};
- Object.defineProperty(A.prototype, "m",
- __decorate([
- (function (x, p) {
- var a = 3;
- func(a);
- return x;
- })
- ], A.prototype, "m", Object.getOwnPropertyDescriptor(A.prototype, "m")));
+ __decorate([
+ (function (x, p) {
+ var a = 3;
+ func(a);
+ return x;
+ })
+ ], A.prototype, "m", null);
return A;
})();
diff --git a/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.js b/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.js
index 08ba6e9ea7e..ee39c1746a2 100644
--- a/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.js
+++ b/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.js
@@ -26,12 +26,10 @@ class Wat {
exports.test = 'abc';
//// [b.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var a_1 = require('./a');
function filter(handler) {
@@ -45,9 +43,8 @@ var Wat = (function () {
Wat.whatever = function () {
// ...
};
- Object.defineProperty(Wat, "whatever",
- __decorate([
- filter(function () { return a_1.test == 'abc'; })
- ], Wat, "whatever", Object.getOwnPropertyDescriptor(Wat, "whatever")));
+ __decorate([
+ filter(function () { return a_1.test == 'abc'; })
+ ], Wat, "whatever", null);
return Wat;
})();
diff --git a/tests/baselines/reference/decoratorMetadata.js b/tests/baselines/reference/decoratorMetadata.js
index 5c2ce580507..3c4637d9dab 100644
--- a/tests/baselines/reference/decoratorMetadata.js
+++ b/tests/baselines/reference/decoratorMetadata.js
@@ -24,12 +24,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Service;
//// [component.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
diff --git a/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js b/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js
index 204b1ba9a49..911a93f948d 100644
--- a/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js
+++ b/tests/baselines/reference/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js
@@ -20,12 +20,11 @@ var MyClass = (function () {
}
MyClass.prototype.doSomething = function () {
};
- Object.defineProperty(MyClass.prototype, "doSomething",
- __decorate([
- decorator,
- __metadata('design:type', Function),
- __metadata('design:paramtypes', []),
- __metadata('design:returntype', void 0)
- ], MyClass.prototype, "doSomething", Object.getOwnPropertyDescriptor(MyClass.prototype, "doSomething")));
+ __decorate([
+ decorator,
+ __metadata('design:type', Function),
+ __metadata('design:paramtypes', []),
+ __metadata('design:returntype', void 0)
+ ], MyClass.prototype, "doSomething", null);
return MyClass;
})();
diff --git a/tests/baselines/reference/decoratorMetadataOnInferredType.js b/tests/baselines/reference/decoratorMetadataOnInferredType.js
index 8103dbbdafa..32aeca93c1b 100644
--- a/tests/baselines/reference/decoratorMetadataOnInferredType.js
+++ b/tests/baselines/reference/decoratorMetadataOnInferredType.js
@@ -33,7 +33,7 @@ var B = (function () {
__decorate([
decorator,
__metadata('design:type', Object)
- ], B.prototype, "x");
+ ], B.prototype, "x", void 0);
return B;
})();
exports.B = B;
diff --git a/tests/baselines/reference/decoratorMetadataWithConstructorType.js b/tests/baselines/reference/decoratorMetadataWithConstructorType.js
index 1523915a390..717ae5c4ce2 100644
--- a/tests/baselines/reference/decoratorMetadataWithConstructorType.js
+++ b/tests/baselines/reference/decoratorMetadataWithConstructorType.js
@@ -33,7 +33,7 @@ var B = (function () {
__decorate([
decorator,
__metadata('design:type', A)
- ], B.prototype, "x");
+ ], B.prototype, "x", void 0);
return B;
})();
exports.B = B;
diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.types
index 60cf7f10cea..aa705735f3e 100644
--- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.types
+++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.types
@@ -35,7 +35,7 @@ class MyClass {
this.db = db;
>this.db = db : db
>this.db : db
->this : MyClass
+>this : this
>db : db
>db : db
@@ -43,7 +43,7 @@ class MyClass {
>this.db.doSomething() : void
>this.db.doSomething : () => void
>this.db : db
->this : MyClass
+>this : this
>db : db
>doSomething : () => void
}
diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.types
index 73005b4673f..3d8ad0937bc 100644
--- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.types
+++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.types
@@ -36,7 +36,7 @@ class MyClass {
this.db = db;
>this.db = db : Database
>this.db : Database
->this : MyClass
+>this : this
>db : Database
>db : Database
@@ -44,7 +44,7 @@ class MyClass {
>this.db.doSomething() : void
>this.db.doSomething : () => void
>this.db : Database
->this : MyClass
+>this : this
>db : Database
>doSomething : () => void
}
diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.types
index 0eea3e13b66..634c45e650c 100644
--- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.types
+++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.types
@@ -28,7 +28,7 @@ class MyClass {
this.db = db;
>this.db = db : db.db
>this.db : db.db
->this : MyClass
+>this : this
>db : db.db
>db : db.db
@@ -36,7 +36,7 @@ class MyClass {
>this.db.doSomething() : void
>this.db.doSomething : () => void
>this.db : db.db
->this : MyClass
+>this : this
>db : db.db
>doSomething : () => void
}
diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.types
index 0fbc48db157..987d7a532e8 100644
--- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.types
+++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.types
@@ -35,7 +35,7 @@ class MyClass {
this.db = db;
>this.db = db : db
>this.db : db
->this : MyClass
+>this : this
>db : db
>db : db
@@ -43,7 +43,7 @@ class MyClass {
>this.db.doSomething() : void
>this.db.doSomething : () => void
>this.db : db
->this : MyClass
+>this : this
>db : db
>doSomething : () => void
}
diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.types
index e3a68882dfb..3bd8df0eff3 100644
--- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.types
+++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.types
@@ -35,7 +35,7 @@ class MyClass {
this.db = db;
>this.db = db : database
>this.db : database
->this : MyClass
+>this : this
>db : database
>db : database
@@ -43,7 +43,7 @@ class MyClass {
>this.db.doSomething() : void
>this.db.doSomething : () => void
>this.db : database
->this : MyClass
+>this : this
>db : database
>doSomething : () => void
}
diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.types
index faaab056885..f0f1ca190aa 100644
--- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.types
+++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.types
@@ -28,7 +28,7 @@ class MyClass {
this.db = db;
>this.db = db : database.db
>this.db : database.db
->this : MyClass
+>this : this
>db : database.db
>db : database.db
@@ -36,7 +36,7 @@ class MyClass {
>this.db.doSomething() : void
>this.db.doSomething : () => void
>this.db : database.db
->this : MyClass
+>this : this
>db : database.db
>doSomething : () => void
}
diff --git a/tests/baselines/reference/decoratorOnClass1.js b/tests/baselines/reference/decoratorOnClass1.js
index b8099222acc..81fb8a4afbf 100644
--- a/tests/baselines/reference/decoratorOnClass1.js
+++ b/tests/baselines/reference/decoratorOnClass1.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClass1.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
diff --git a/tests/baselines/reference/decoratorOnClass2.js b/tests/baselines/reference/decoratorOnClass2.js
index 18492794331..5e5f4e4b07d 100644
--- a/tests/baselines/reference/decoratorOnClass2.js
+++ b/tests/baselines/reference/decoratorOnClass2.js
@@ -7,12 +7,10 @@ export class C {
//// [decoratorOnClass2.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
diff --git a/tests/baselines/reference/decoratorOnClass3.js b/tests/baselines/reference/decoratorOnClass3.js
index 2291a2dbc57..53888b7f107 100644
--- a/tests/baselines/reference/decoratorOnClass3.js
+++ b/tests/baselines/reference/decoratorOnClass3.js
@@ -8,12 +8,10 @@ class C {
//// [decoratorOnClass3.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
diff --git a/tests/baselines/reference/decoratorOnClass4.js b/tests/baselines/reference/decoratorOnClass4.js
index 484efdf6128..bfcfe490498 100644
--- a/tests/baselines/reference/decoratorOnClass4.js
+++ b/tests/baselines/reference/decoratorOnClass4.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClass4.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
diff --git a/tests/baselines/reference/decoratorOnClass5.js b/tests/baselines/reference/decoratorOnClass5.js
index 02ea01c3fd6..b3ceb807408 100644
--- a/tests/baselines/reference/decoratorOnClass5.js
+++ b/tests/baselines/reference/decoratorOnClass5.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClass5.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
diff --git a/tests/baselines/reference/decoratorOnClass8.js b/tests/baselines/reference/decoratorOnClass8.js
index e75ccac3c86..81edefc39fa 100644
--- a/tests/baselines/reference/decoratorOnClass8.js
+++ b/tests/baselines/reference/decoratorOnClass8.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClass8.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
diff --git a/tests/baselines/reference/decoratorOnClassAccessor1.js b/tests/baselines/reference/decoratorOnClassAccessor1.js
index 2700c531e42..5a5d7ec98ee 100644
--- a/tests/baselines/reference/decoratorOnClassAccessor1.js
+++ b/tests/baselines/reference/decoratorOnClassAccessor1.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClassAccessor1.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
@@ -22,9 +20,8 @@ var C = (function () {
enumerable: true,
configurable: true
});
- Object.defineProperty(C.prototype, "accessor",
- __decorate([
- dec
- ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
+ __decorate([
+ dec
+ ], C.prototype, "accessor", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassAccessor2.js b/tests/baselines/reference/decoratorOnClassAccessor2.js
index c29c7598013..62b4d46669b 100644
--- a/tests/baselines/reference/decoratorOnClassAccessor2.js
+++ b/tests/baselines/reference/decoratorOnClassAccessor2.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClassAccessor2.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
@@ -22,9 +20,8 @@ var C = (function () {
enumerable: true,
configurable: true
});
- Object.defineProperty(C.prototype, "accessor",
- __decorate([
- dec
- ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
+ __decorate([
+ dec
+ ], C.prototype, "accessor", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassAccessor3.js b/tests/baselines/reference/decoratorOnClassAccessor3.js
index 61430a986ac..ce630dde3b2 100644
--- a/tests/baselines/reference/decoratorOnClassAccessor3.js
+++ b/tests/baselines/reference/decoratorOnClassAccessor3.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClassAccessor3.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
@@ -22,9 +20,8 @@ var C = (function () {
enumerable: true,
configurable: true
});
- Object.defineProperty(C.prototype, "accessor",
- __decorate([
- dec
- ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
+ __decorate([
+ dec
+ ], C.prototype, "accessor", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassAccessor4.js b/tests/baselines/reference/decoratorOnClassAccessor4.js
index 0ad11c4c09e..5d47233c797 100644
--- a/tests/baselines/reference/decoratorOnClassAccessor4.js
+++ b/tests/baselines/reference/decoratorOnClassAccessor4.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClassAccessor4.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
@@ -22,9 +20,8 @@ var C = (function () {
enumerable: true,
configurable: true
});
- Object.defineProperty(C.prototype, "accessor",
- __decorate([
- dec
- ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
+ __decorate([
+ dec
+ ], C.prototype, "accessor", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassAccessor5.js b/tests/baselines/reference/decoratorOnClassAccessor5.js
index 53a43f7912c..b0383637272 100644
--- a/tests/baselines/reference/decoratorOnClassAccessor5.js
+++ b/tests/baselines/reference/decoratorOnClassAccessor5.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClassAccessor5.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
@@ -22,9 +20,8 @@ var C = (function () {
enumerable: true,
configurable: true
});
- Object.defineProperty(C.prototype, "accessor",
- __decorate([
- dec
- ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
+ __decorate([
+ dec
+ ], C.prototype, "accessor", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassAccessor6.js b/tests/baselines/reference/decoratorOnClassAccessor6.js
index eaa21f45234..e76151ef562 100644
--- a/tests/baselines/reference/decoratorOnClassAccessor6.js
+++ b/tests/baselines/reference/decoratorOnClassAccessor6.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClassAccessor6.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
@@ -22,9 +20,8 @@ var C = (function () {
enumerable: true,
configurable: true
});
- Object.defineProperty(C.prototype, "accessor",
- __decorate([
- dec
- ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
+ __decorate([
+ dec
+ ], C.prototype, "accessor", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter1.js b/tests/baselines/reference/decoratorOnClassConstructorParameter1.js
index b2af1450123..b100a5a60f8 100644
--- a/tests/baselines/reference/decoratorOnClassConstructorParameter1.js
+++ b/tests/baselines/reference/decoratorOnClassConstructorParameter1.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClassConstructorParameter1.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js
index 5273482586e..73d7bfba5a9 100644
--- a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js
+++ b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClassConstructorParameter4.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
diff --git a/tests/baselines/reference/decoratorOnClassMethod1.js b/tests/baselines/reference/decoratorOnClassMethod1.js
index 65c2f4b6008..3b8d308570c 100644
--- a/tests/baselines/reference/decoratorOnClassMethod1.js
+++ b/tests/baselines/reference/decoratorOnClassMethod1.js
@@ -7,20 +7,17 @@ class C {
//// [decoratorOnClassMethod1.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
C.prototype.method = function () { };
- Object.defineProperty(C.prototype, "method",
- __decorate([
- dec
- ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
+ __decorate([
+ dec
+ ], C.prototype, "method", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassMethod10.js b/tests/baselines/reference/decoratorOnClassMethod10.js
index bae4e97fb5b..22a6be7f613 100644
--- a/tests/baselines/reference/decoratorOnClassMethod10.js
+++ b/tests/baselines/reference/decoratorOnClassMethod10.js
@@ -7,20 +7,17 @@ class C {
//// [decoratorOnClassMethod10.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
C.prototype.method = function () { };
- Object.defineProperty(C.prototype, "method",
- __decorate([
- dec
- ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
+ __decorate([
+ dec
+ ], C.prototype, "method", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassMethod11.js b/tests/baselines/reference/decoratorOnClassMethod11.js
index 5d4ac60c14e..59f0594f483 100644
--- a/tests/baselines/reference/decoratorOnClassMethod11.js
+++ b/tests/baselines/reference/decoratorOnClassMethod11.js
@@ -10,12 +10,10 @@ module M {
//// [decoratorOnClassMethod11.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var M;
(function (M) {
@@ -24,10 +22,9 @@ var M;
}
C.prototype.decorator = function (target, key) { };
C.prototype.method = function () { };
- Object.defineProperty(C.prototype, "method",
- __decorate([
- this.decorator
- ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
+ __decorate([
+ this.decorator
+ ], C.prototype, "method", null);
return C;
})();
})(M || (M = {}));
diff --git a/tests/baselines/reference/decoratorOnClassMethod12.js b/tests/baselines/reference/decoratorOnClassMethod12.js
index 05c4f285291..5c43251e4c1 100644
--- a/tests/baselines/reference/decoratorOnClassMethod12.js
+++ b/tests/baselines/reference/decoratorOnClassMethod12.js
@@ -16,12 +16,10 @@ var __extends = (this && this.__extends) || function (d, b) {
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var M;
(function (M) {
@@ -37,10 +35,9 @@ var M;
_super.apply(this, arguments);
}
C.prototype.method = function () { };
- Object.defineProperty(C.prototype, "method",
- __decorate([
- _super.decorator
- ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
+ __decorate([
+ _super.decorator
+ ], C.prototype, "method", null);
return C;
})(S);
})(M || (M = {}));
diff --git a/tests/baselines/reference/decoratorOnClassMethod13.js b/tests/baselines/reference/decoratorOnClassMethod13.js
index b39fa63686a..adf21f733eb 100644
--- a/tests/baselines/reference/decoratorOnClassMethod13.js
+++ b/tests/baselines/reference/decoratorOnClassMethod13.js
@@ -8,23 +8,19 @@ class C {
//// [decoratorOnClassMethod13.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
class C {
[_a = "1"]() { }
[_b = "b"]() { }
}
-Object.defineProperty(C.prototype, _a,
- __decorate([
- dec
- ], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
-Object.defineProperty(C.prototype, _b,
- __decorate([
- dec
- ], C.prototype, _b, Object.getOwnPropertyDescriptor(C.prototype, _b)));
+__decorate([
+ dec
+], C.prototype, _a, null);
+__decorate([
+ dec
+], C.prototype, _b, null);
var _a, _b;
diff --git a/tests/baselines/reference/decoratorOnClassMethod2.js b/tests/baselines/reference/decoratorOnClassMethod2.js
index 8b4ceeb47ee..1841baeb724 100644
--- a/tests/baselines/reference/decoratorOnClassMethod2.js
+++ b/tests/baselines/reference/decoratorOnClassMethod2.js
@@ -7,20 +7,17 @@ class C {
//// [decoratorOnClassMethod2.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
C.prototype.method = function () { };
- Object.defineProperty(C.prototype, "method",
- __decorate([
- dec
- ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
+ __decorate([
+ dec
+ ], C.prototype, "method", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassMethod3.js b/tests/baselines/reference/decoratorOnClassMethod3.js
index fff0e845860..8ede72027d8 100644
--- a/tests/baselines/reference/decoratorOnClassMethod3.js
+++ b/tests/baselines/reference/decoratorOnClassMethod3.js
@@ -7,20 +7,17 @@ class C {
//// [decoratorOnClassMethod3.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
C.prototype.method = function () { };
- Object.defineProperty(C.prototype, "method",
- __decorate([
- dec
- ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
+ __decorate([
+ dec
+ ], C.prototype, "method", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassMethod4.js b/tests/baselines/reference/decoratorOnClassMethod4.js
index 9f5b0d67eb1..5c7b91c1c83 100644
--- a/tests/baselines/reference/decoratorOnClassMethod4.js
+++ b/tests/baselines/reference/decoratorOnClassMethod4.js
@@ -7,18 +7,15 @@ class C {
//// [decoratorOnClassMethod4.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
class C {
[_a = "method"]() { }
}
-Object.defineProperty(C.prototype, _a,
- __decorate([
- dec
- ], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
+__decorate([
+ dec
+], C.prototype, _a, null);
var _a;
diff --git a/tests/baselines/reference/decoratorOnClassMethod5.js b/tests/baselines/reference/decoratorOnClassMethod5.js
index f767b176207..2fedbaaf764 100644
--- a/tests/baselines/reference/decoratorOnClassMethod5.js
+++ b/tests/baselines/reference/decoratorOnClassMethod5.js
@@ -7,18 +7,15 @@ class C {
//// [decoratorOnClassMethod5.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
class C {
[_a = "method"]() { }
}
-Object.defineProperty(C.prototype, _a,
- __decorate([
- dec()
- ], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
+__decorate([
+ dec()
+], C.prototype, _a, null);
var _a;
diff --git a/tests/baselines/reference/decoratorOnClassMethod6.js b/tests/baselines/reference/decoratorOnClassMethod6.js
index 33dc4c86fd2..7966225e221 100644
--- a/tests/baselines/reference/decoratorOnClassMethod6.js
+++ b/tests/baselines/reference/decoratorOnClassMethod6.js
@@ -7,18 +7,15 @@ class C {
//// [decoratorOnClassMethod6.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
class C {
[_a = "method"]() { }
}
-Object.defineProperty(C.prototype, _a,
- __decorate([
- dec
- ], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
+__decorate([
+ dec
+], C.prototype, _a, null);
var _a;
diff --git a/tests/baselines/reference/decoratorOnClassMethod7.js b/tests/baselines/reference/decoratorOnClassMethod7.js
index c20a726fc46..3ec509e17f0 100644
--- a/tests/baselines/reference/decoratorOnClassMethod7.js
+++ b/tests/baselines/reference/decoratorOnClassMethod7.js
@@ -7,18 +7,15 @@ class C {
//// [decoratorOnClassMethod7.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
class C {
[_a = "method"]() { }
}
-Object.defineProperty(C.prototype, _a,
- __decorate([
- dec
- ], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
+__decorate([
+ dec
+], C.prototype, _a, null);
var _a;
diff --git a/tests/baselines/reference/decoratorOnClassMethod8.js b/tests/baselines/reference/decoratorOnClassMethod8.js
index a664bdb8494..2cb404cf078 100644
--- a/tests/baselines/reference/decoratorOnClassMethod8.js
+++ b/tests/baselines/reference/decoratorOnClassMethod8.js
@@ -7,20 +7,17 @@ class C {
//// [decoratorOnClassMethod8.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
C.prototype.method = function () { };
- Object.defineProperty(C.prototype, "method",
- __decorate([
- dec
- ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
+ __decorate([
+ dec
+ ], C.prototype, "method", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassMethodParameter1.js b/tests/baselines/reference/decoratorOnClassMethodParameter1.js
index a6ab1704acc..099f746727c 100644
--- a/tests/baselines/reference/decoratorOnClassMethodParameter1.js
+++ b/tests/baselines/reference/decoratorOnClassMethodParameter1.js
@@ -7,12 +7,10 @@ class C {
//// [decoratorOnClassMethodParameter1.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
@@ -21,9 +19,8 @@ var C = (function () {
function C() {
}
C.prototype.method = function (p) { };
- Object.defineProperty(C.prototype, "method",
- __decorate([
- __param(0, dec)
- ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
+ __decorate([
+ __param(0, dec)
+ ], C.prototype, "method", null);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassProperty1.js b/tests/baselines/reference/decoratorOnClassProperty1.js
index 567eb510cb3..9283570bf3a 100644
--- a/tests/baselines/reference/decoratorOnClassProperty1.js
+++ b/tests/baselines/reference/decoratorOnClassProperty1.js
@@ -7,18 +7,16 @@ class C {
//// [decoratorOnClassProperty1.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
__decorate([
dec
- ], C.prototype, "prop");
+ ], C.prototype, "prop", void 0);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassProperty10.js b/tests/baselines/reference/decoratorOnClassProperty10.js
index b64986a8c97..5246dff9643 100644
--- a/tests/baselines/reference/decoratorOnClassProperty10.js
+++ b/tests/baselines/reference/decoratorOnClassProperty10.js
@@ -7,18 +7,16 @@ class C {
//// [decoratorOnClassProperty10.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
__decorate([
dec()
- ], C.prototype, "prop");
+ ], C.prototype, "prop", void 0);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassProperty11.js b/tests/baselines/reference/decoratorOnClassProperty11.js
index a33fc724180..51bce1f1385 100644
--- a/tests/baselines/reference/decoratorOnClassProperty11.js
+++ b/tests/baselines/reference/decoratorOnClassProperty11.js
@@ -7,18 +7,16 @@ class C {
//// [decoratorOnClassProperty11.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
__decorate([
dec
- ], C.prototype, "prop");
+ ], C.prototype, "prop", void 0);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassProperty2.js b/tests/baselines/reference/decoratorOnClassProperty2.js
index f5de593b057..153c72ce0b9 100644
--- a/tests/baselines/reference/decoratorOnClassProperty2.js
+++ b/tests/baselines/reference/decoratorOnClassProperty2.js
@@ -7,18 +7,16 @@ class C {
//// [decoratorOnClassProperty2.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
__decorate([
dec
- ], C.prototype, "prop");
+ ], C.prototype, "prop", void 0);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassProperty3.js b/tests/baselines/reference/decoratorOnClassProperty3.js
index d2876d2cd6a..4f3b1ca5929 100644
--- a/tests/baselines/reference/decoratorOnClassProperty3.js
+++ b/tests/baselines/reference/decoratorOnClassProperty3.js
@@ -7,18 +7,16 @@ class C {
//// [decoratorOnClassProperty3.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
__decorate([
dec
- ], C.prototype, "prop");
+ ], C.prototype, "prop", void 0);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassProperty6.js b/tests/baselines/reference/decoratorOnClassProperty6.js
index 4ebd19ceee8..e92e018c587 100644
--- a/tests/baselines/reference/decoratorOnClassProperty6.js
+++ b/tests/baselines/reference/decoratorOnClassProperty6.js
@@ -7,18 +7,16 @@ class C {
//// [decoratorOnClassProperty6.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
__decorate([
dec
- ], C.prototype, "prop");
+ ], C.prototype, "prop", void 0);
return C;
})();
diff --git a/tests/baselines/reference/decoratorOnClassProperty7.js b/tests/baselines/reference/decoratorOnClassProperty7.js
index 045f8722b97..9521fe0ce5e 100644
--- a/tests/baselines/reference/decoratorOnClassProperty7.js
+++ b/tests/baselines/reference/decoratorOnClassProperty7.js
@@ -7,18 +7,16 @@ class C {
//// [decoratorOnClassProperty7.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var C = (function () {
function C() {
}
__decorate([
dec
- ], C.prototype, "prop");
+ ], C.prototype, "prop", void 0);
return C;
})();
diff --git a/tests/baselines/reference/derivedClasses.types b/tests/baselines/reference/derivedClasses.types
index 906cfb2741c..7fc585e29ce 100644
--- a/tests/baselines/reference/derivedClasses.types
+++ b/tests/baselines/reference/derivedClasses.types
@@ -11,7 +11,7 @@ class Red extends Color {
>() => { return this.hue(); } : () => string
>this.hue() : string
>this.hue : () => string
->this : Red
+>this : this
>hue : () => string
return getHue() + " red";
@@ -46,7 +46,7 @@ class Blue extends Color {
>() => { return this.hue(); } : () => string
>this.hue() : string
>this.hue : () => string
->this : Blue
+>this : this
>hue : () => string
return getHue() + " blue";
diff --git a/tests/baselines/reference/detachedCommentAtStartOfConstructor1.types b/tests/baselines/reference/detachedCommentAtStartOfConstructor1.types
index 392821de751..7cbae62f83d 100644
--- a/tests/baselines/reference/detachedCommentAtStartOfConstructor1.types
+++ b/tests/baselines/reference/detachedCommentAtStartOfConstructor1.types
@@ -19,13 +19,13 @@ class TestFile {
>message + this.name : string
>message : string
>this.name : any
->this : TestFile
+>this : this
>name : any
this.message = getMessage();
>this.message = getMessage() : string
>this.message : string
->this : TestFile
+>this : this
>message : string
>getMessage() : string
>getMessage : () => string
diff --git a/tests/baselines/reference/detachedCommentAtStartOfConstructor2.types b/tests/baselines/reference/detachedCommentAtStartOfConstructor2.types
index b413cd557a5..830be456e9a 100644
--- a/tests/baselines/reference/detachedCommentAtStartOfConstructor2.types
+++ b/tests/baselines/reference/detachedCommentAtStartOfConstructor2.types
@@ -20,13 +20,13 @@ class TestFile {
>message + this.name : string
>message : string
>this.name : string
->this : TestFile
+>this : this
>name : string
this.message = getMessage();
>this.message = getMessage() : string
>this.message : string
->this : TestFile
+>this : this
>message : string
>getMessage() : string
>getMessage : () => string
diff --git a/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction1.types b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction1.types
index 016a123c5c1..e05a4c083cb 100644
--- a/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction1.types
+++ b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction1.types
@@ -20,7 +20,7 @@ class TestFile {
>message + this.name : string
>message : string
>this.name : string
->this : TestFile
+>this : this
>name : string
}
}
diff --git a/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction2.types b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction2.types
index 2199a4490b5..8dde223dad0 100644
--- a/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction2.types
+++ b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction2.types
@@ -21,7 +21,7 @@ class TestFile {
>message + this.name : string
>message : string
>this.name : string
->this : TestFile
+>this : this
>name : string
}
}
diff --git a/tests/baselines/reference/emitClassDeclarationWithConstructorInES6.types b/tests/baselines/reference/emitClassDeclarationWithConstructorInES6.types
index ecb48cb3047..3bdf5af2ba5 100644
--- a/tests/baselines/reference/emitClassDeclarationWithConstructorInES6.types
+++ b/tests/baselines/reference/emitClassDeclarationWithConstructorInES6.types
@@ -38,7 +38,7 @@ class B {
this.y = 10;
>this.y = 10 : number
>this.y : number
->this : B
+>this : this
>y : number
>10 : number
}
@@ -53,7 +53,7 @@ class B {
return this._bar;
>this._bar : string
->this : B
+>this : this
>_bar : string
}
}
diff --git a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.types b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.types
index b26d6b3dd81..292fb961b10 100644
--- a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.types
+++ b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.types
@@ -10,7 +10,7 @@ class C {
return this._name;
>this._name : string
->this : C
+>this : this
>_name : string
}
static get name2(): string {
diff --git a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.types b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.types
index d3e75c9235c..10ae930c244 100644
--- a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.types
+++ b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.types
@@ -25,7 +25,7 @@ class D {
return this._bar;
>this._bar : string
->this : D
+>this : this
>_bar : string
}
baz(a: any, x: string): string {
diff --git a/tests/baselines/reference/emitClassDeclarationWithPropertyAssignmentInES6.types b/tests/baselines/reference/emitClassDeclarationWithPropertyAssignmentInES6.types
index f3504d655ed..ccf4ca3ca9d 100644
--- a/tests/baselines/reference/emitClassDeclarationWithPropertyAssignmentInES6.types
+++ b/tests/baselines/reference/emitClassDeclarationWithPropertyAssignmentInES6.types
@@ -21,7 +21,7 @@ class D {
this.y = 10;
>this.y = 10 : number
>this.y : number
->this : D
+>this : this
>y : number
>10 : number
}
@@ -55,7 +55,7 @@ class F extends D{
this.j = "HI";
>this.j = "HI" : string
>this.j : string
->this : F
+>this : this
>j : string
>"HI" : string
}
diff --git a/tests/baselines/reference/emitClassDeclarationWithThisKeywordInES6.types b/tests/baselines/reference/emitClassDeclarationWithThisKeywordInES6.types
index 14c57a60bc4..7c0159fbd63 100644
--- a/tests/baselines/reference/emitClassDeclarationWithThisKeywordInES6.types
+++ b/tests/baselines/reference/emitClassDeclarationWithThisKeywordInES6.types
@@ -10,7 +10,7 @@ class B {
this.x = 10;
>this.x = 10 : number
>this.x : number
->this : B
+>this : this
>x : number
>10 : number
}
@@ -27,7 +27,7 @@ class B {
>B : typeof B
>log : (a: number) => void
>this.x : number
->this : B
+>this : this
>x : number
}
@@ -36,7 +36,7 @@ class B {
return this.x;
>this.x : number
->this : B
+>this : this
>x : number
}
@@ -47,7 +47,7 @@ class B {
this.x = y;
>this.x = y : number
>this.x : number
->this : B
+>this : this
>x : number
>y : number
}
diff --git a/tests/baselines/reference/emitClassDeclarationWithTypeArgumentAndOverloadInES6.types b/tests/baselines/reference/emitClassDeclarationWithTypeArgumentAndOverloadInES6.types
index ba515168a5d..4bc2bfdfa92 100644
--- a/tests/baselines/reference/emitClassDeclarationWithTypeArgumentAndOverloadInES6.types
+++ b/tests/baselines/reference/emitClassDeclarationWithTypeArgumentAndOverloadInES6.types
@@ -24,7 +24,7 @@ class B {
>T : T
>this.B = a : T
>this.B : T
->this : B
+>this : this
>B : T
>a : T
@@ -47,7 +47,7 @@ class B {
return this.x;
>this.x : T
->this : B
+>this : this
>x : T
}
@@ -57,7 +57,7 @@ class B {
return this.B;
>this.B : T
->this : B
+>this : this
>B : T
}
set BBWith(c: T) {
@@ -68,7 +68,7 @@ class B {
this.B = c;
>this.B = c : T
>this.B : T
->this : B
+>this : this
>B : T
>c : T
}
diff --git a/tests/baselines/reference/emitClassDeclarationWithTypeArgumentInES6.types b/tests/baselines/reference/emitClassDeclarationWithTypeArgumentInES6.types
index 8081d044e35..b4d2df96712 100644
--- a/tests/baselines/reference/emitClassDeclarationWithTypeArgumentInES6.types
+++ b/tests/baselines/reference/emitClassDeclarationWithTypeArgumentInES6.types
@@ -16,7 +16,7 @@ class B {
>T : T
>this.B = a : T
>this.B : T
->this : B
+>this : this
>B : T
>a : T
@@ -26,7 +26,7 @@ class B {
return this.x;
>this.x : T
->this : B
+>this : this
>x : T
}
get BB(): T {
@@ -35,7 +35,7 @@ class B {
return this.B;
>this.B : T
->this : B
+>this : this
>B : T
}
set BBWith(c: T) {
@@ -46,7 +46,7 @@ class B {
this.B = c;
>this.B = c : T
>this.B : T
->this : B
+>this : this
>B : T
>c : T
}
diff --git a/tests/baselines/reference/es6ClassTest3.types b/tests/baselines/reference/es6ClassTest3.types
index d73007f211b..208d8cdf4d9 100644
--- a/tests/baselines/reference/es6ClassTest3.types
+++ b/tests/baselines/reference/es6ClassTest3.types
@@ -24,14 +24,14 @@ module M {
this.x = 1;
>this.x = 1 : number
>this.x : number
->this : Visibility
+>this : this
>x : number
>1 : number
this.y = 2;
>this.y = 2 : number
>this.y : number
->this : Visibility
+>this : this
>y : number
>2 : number
}
diff --git a/tests/baselines/reference/es6ClassTest8.types b/tests/baselines/reference/es6ClassTest8.types
index 622f81f1d10..b12d65e595f 100644
--- a/tests/baselines/reference/es6ClassTest8.types
+++ b/tests/baselines/reference/es6ClassTest8.types
@@ -119,7 +119,7 @@ class Camera {
this.forward = Vector.norm(Vector.minus(lookAt,this.pos));
>this.forward = Vector.norm(Vector.minus(lookAt,this.pos)) : Vector
>this.forward : Vector
->this : Camera
+>this : this
>forward : Vector
>Vector.norm(Vector.minus(lookAt,this.pos)) : Vector
>Vector.norm : (v: Vector) => Vector
@@ -131,13 +131,13 @@ class Camera {
>minus : (v1: Vector, v2: Vector) => Vector
>lookAt : Vector
>this.pos : Vector
->this : Camera
+>this : this
>pos : Vector
this.right = Vector.times(down, Vector.norm(Vector.cross(this.forward, down)));
>this.right = Vector.times(down, Vector.norm(Vector.cross(this.forward, down))) : Vector
>this.right : Vector
->this : Camera
+>this : this
>right : Vector
>Vector.times(down, Vector.norm(Vector.cross(this.forward, down))) : Vector
>Vector.times : (v1: Vector, v2: Vector) => Vector
@@ -153,14 +153,14 @@ class Camera {
>Vector : typeof Vector
>cross : (v1: Vector, v2: Vector) => Vector
>this.forward : Vector
->this : Camera
+>this : this
>forward : Vector
>down : Vector
this.up = Vector.times(down, Vector.norm(Vector.cross(this.forward, this.right)));
>this.up = Vector.times(down, Vector.norm(Vector.cross(this.forward, this.right))) : Vector
>this.up : Vector
->this : Camera
+>this : this
>up : Vector
>Vector.times(down, Vector.norm(Vector.cross(this.forward, this.right))) : Vector
>Vector.times : (v1: Vector, v2: Vector) => Vector
@@ -176,10 +176,10 @@ class Camera {
>Vector : typeof Vector
>cross : (v1: Vector, v2: Vector) => Vector
>this.forward : Vector
->this : Camera
+>this : this
>forward : Vector
>this.right : Vector
->this : Camera
+>this : this
>right : Vector
}
}
diff --git a/tests/baselines/reference/exportsInAmbientModules1.js b/tests/baselines/reference/exportsInAmbientModules1.js
new file mode 100644
index 00000000000..4370b197403
--- /dev/null
+++ b/tests/baselines/reference/exportsInAmbientModules1.js
@@ -0,0 +1,13 @@
+//// [tests/cases/compiler/exportsInAmbientModules1.ts] ////
+
+//// [external.d.ts]
+
+export var x: number
+
+//// [main.ts]
+
+declare module "M" {
+ export {x} from "external"
+}
+
+//// [main.js]
diff --git a/tests/baselines/reference/exportsInAmbientModules1.symbols b/tests/baselines/reference/exportsInAmbientModules1.symbols
new file mode 100644
index 00000000000..58cdf8663a7
--- /dev/null
+++ b/tests/baselines/reference/exportsInAmbientModules1.symbols
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/external.d.ts ===
+
+export var x: number
+>x : Symbol(x, Decl(external.d.ts, 1, 10))
+
+=== tests/cases/compiler/main.ts ===
+
+declare module "M" {
+ export {x} from "external"
+>x : Symbol(x, Decl(main.ts, 2, 12))
+}
diff --git a/tests/baselines/reference/exportsInAmbientModules1.types b/tests/baselines/reference/exportsInAmbientModules1.types
new file mode 100644
index 00000000000..490a63caf92
--- /dev/null
+++ b/tests/baselines/reference/exportsInAmbientModules1.types
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/external.d.ts ===
+
+export var x: number
+>x : number
+
+=== tests/cases/compiler/main.ts ===
+
+declare module "M" {
+ export {x} from "external"
+>x : number
+}
diff --git a/tests/baselines/reference/exportsInAmbientModules2.js b/tests/baselines/reference/exportsInAmbientModules2.js
new file mode 100644
index 00000000000..f08ff17f8ba
--- /dev/null
+++ b/tests/baselines/reference/exportsInAmbientModules2.js
@@ -0,0 +1,13 @@
+//// [tests/cases/compiler/exportsInAmbientModules2.ts] ////
+
+//// [external.d.ts]
+
+export default class C {}
+
+//// [main.ts]
+
+declare module "M" {
+ export * from "external"
+}
+
+//// [main.js]
diff --git a/tests/baselines/reference/exportsInAmbientModules2.symbols b/tests/baselines/reference/exportsInAmbientModules2.symbols
new file mode 100644
index 00000000000..54e8b44ec34
--- /dev/null
+++ b/tests/baselines/reference/exportsInAmbientModules2.symbols
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/external.d.ts ===
+
+export default class C {}
+>C : Symbol(C, Decl(external.d.ts, 0, 0))
+
+=== tests/cases/compiler/main.ts ===
+
+No type information for this code.declare module "M" {
+No type information for this code. export * from "external"
+No type information for this code.}
+No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/exportsInAmbientModules2.types b/tests/baselines/reference/exportsInAmbientModules2.types
new file mode 100644
index 00000000000..3472a35bf75
--- /dev/null
+++ b/tests/baselines/reference/exportsInAmbientModules2.types
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/external.d.ts ===
+
+export default class C {}
+>C : C
+
+=== tests/cases/compiler/main.ts ===
+
+No type information for this code.declare module "M" {
+No type information for this code. export * from "external"
+No type information for this code.}
+No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/extendClassExpressionFromModule.symbols b/tests/baselines/reference/extendClassExpressionFromModule.symbols
index c131ea8fa28..78d483b5d7d 100644
--- a/tests/baselines/reference/extendClassExpressionFromModule.symbols
+++ b/tests/baselines/reference/extendClassExpressionFromModule.symbols
@@ -8,6 +8,7 @@ var x = foo1;
class y extends x {}
>y : Symbol(y, Decl(foo2.ts, 1, 13))
+>x : Symbol(x, Decl(foo2.ts, 1, 3))
=== tests/cases/conformance/classes/classExpressions/foo1.ts ===
class x{}
diff --git a/tests/baselines/reference/extendNonClassSymbol1.symbols b/tests/baselines/reference/extendNonClassSymbol1.symbols
index 02291ebb181..7c03ef3a97f 100644
--- a/tests/baselines/reference/extendNonClassSymbol1.symbols
+++ b/tests/baselines/reference/extendNonClassSymbol1.symbols
@@ -9,4 +9,5 @@ var x = A;
class C extends x { } // error, could not find symbol xs
>C : Symbol(C, Decl(extendNonClassSymbol1.ts, 1, 10))
+>x : Symbol(x, Decl(extendNonClassSymbol1.ts, 1, 3))
diff --git a/tests/baselines/reference/fatArrowSelf.types b/tests/baselines/reference/fatArrowSelf.types
index c4b2936fd37..574262265bc 100644
--- a/tests/baselines/reference/fatArrowSelf.types
+++ b/tests/baselines/reference/fatArrowSelf.types
@@ -38,7 +38,7 @@ module Consumer {
>this.emitter.addListener('change', (e) => { this.changed(); }) : void
>this.emitter.addListener : (type: string, listener: Events.ListenerCallback) => void
>this.emitter : Events.EventEmitter
->this : EventEmitterConsummer
+>this : this
>emitter : Events.EventEmitter
>addListener : (type: string, listener: Events.ListenerCallback) => void
>'change' : string
@@ -48,7 +48,7 @@ module Consumer {
this.changed();
>this.changed() : void
>this.changed : () => void
->this : EventEmitterConsummer
+>this : this
>changed : () => void
});
diff --git a/tests/baselines/reference/fluentClasses.js b/tests/baselines/reference/fluentClasses.js
new file mode 100644
index 00000000000..12f3cfff48d
--- /dev/null
+++ b/tests/baselines/reference/fluentClasses.js
@@ -0,0 +1,56 @@
+//// [fluentClasses.ts]
+class A {
+ foo() {
+ return this;
+ }
+}
+class B extends A {
+ bar() {
+ return this;
+ }
+}
+class C extends B {
+ baz() {
+ return this;
+ }
+}
+var c: C;
+var z = c.foo().bar().baz(); // Fluent pattern
+
+
+//// [fluentClasses.js]
+var __extends = (this && this.__extends) || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+};
+var A = (function () {
+ function A() {
+ }
+ A.prototype.foo = function () {
+ return this;
+ };
+ return A;
+})();
+var B = (function (_super) {
+ __extends(B, _super);
+ function B() {
+ _super.apply(this, arguments);
+ }
+ B.prototype.bar = function () {
+ return this;
+ };
+ return B;
+})(A);
+var C = (function (_super) {
+ __extends(C, _super);
+ function C() {
+ _super.apply(this, arguments);
+ }
+ C.prototype.baz = function () {
+ return this;
+ };
+ return C;
+})(B);
+var c;
+var z = c.foo().bar().baz(); // Fluent pattern
diff --git a/tests/baselines/reference/fluentClasses.symbols b/tests/baselines/reference/fluentClasses.symbols
new file mode 100644
index 00000000000..3125235b6b1
--- /dev/null
+++ b/tests/baselines/reference/fluentClasses.symbols
@@ -0,0 +1,47 @@
+=== tests/cases/conformance/types/thisType/fluentClasses.ts ===
+class A {
+>A : Symbol(A, Decl(fluentClasses.ts, 0, 0))
+
+ foo() {
+>foo : Symbol(foo, Decl(fluentClasses.ts, 0, 9))
+
+ return this;
+>this : Symbol(A, Decl(fluentClasses.ts, 0, 0))
+ }
+}
+class B extends A {
+>B : Symbol(B, Decl(fluentClasses.ts, 4, 1))
+>A : Symbol(A, Decl(fluentClasses.ts, 0, 0))
+
+ bar() {
+>bar : Symbol(bar, Decl(fluentClasses.ts, 5, 19))
+
+ return this;
+>this : Symbol(B, Decl(fluentClasses.ts, 4, 1))
+ }
+}
+class C extends B {
+>C : Symbol(C, Decl(fluentClasses.ts, 9, 1))
+>B : Symbol(B, Decl(fluentClasses.ts, 4, 1))
+
+ baz() {
+>baz : Symbol(baz, Decl(fluentClasses.ts, 10, 19))
+
+ return this;
+>this : Symbol(C, Decl(fluentClasses.ts, 9, 1))
+ }
+}
+var c: C;
+>c : Symbol(c, Decl(fluentClasses.ts, 15, 3))
+>C : Symbol(C, Decl(fluentClasses.ts, 9, 1))
+
+var z = c.foo().bar().baz(); // Fluent pattern
+>z : Symbol(z, Decl(fluentClasses.ts, 16, 3))
+>c.foo().bar().baz : Symbol(C.baz, Decl(fluentClasses.ts, 10, 19))
+>c.foo().bar : Symbol(B.bar, Decl(fluentClasses.ts, 5, 19))
+>c.foo : Symbol(A.foo, Decl(fluentClasses.ts, 0, 9))
+>c : Symbol(c, Decl(fluentClasses.ts, 15, 3))
+>foo : Symbol(A.foo, Decl(fluentClasses.ts, 0, 9))
+>bar : Symbol(B.bar, Decl(fluentClasses.ts, 5, 19))
+>baz : Symbol(C.baz, Decl(fluentClasses.ts, 10, 19))
+
diff --git a/tests/baselines/reference/fluentClasses.types b/tests/baselines/reference/fluentClasses.types
new file mode 100644
index 00000000000..31ed6aafa01
--- /dev/null
+++ b/tests/baselines/reference/fluentClasses.types
@@ -0,0 +1,50 @@
+=== tests/cases/conformance/types/thisType/fluentClasses.ts ===
+class A {
+>A : A
+
+ foo() {
+>foo : () => this
+
+ return this;
+>this : this
+ }
+}
+class B extends A {
+>B : B
+>A : A
+
+ bar() {
+>bar : () => this
+
+ return this;
+>this : this
+ }
+}
+class C extends B {
+>C : C
+>B : B
+
+ baz() {
+>baz : () => this
+
+ return this;
+>this : this
+ }
+}
+var c: C;
+>c : C
+>C : C
+
+var z = c.foo().bar().baz(); // Fluent pattern
+>z : C
+>c.foo().bar().baz() : C
+>c.foo().bar().baz : () => C
+>c.foo().bar() : C
+>c.foo().bar : () => C
+>c.foo() : C
+>c.foo : () => C
+>c : C
+>foo : () => C
+>bar : () => C
+>baz : () => C
+
diff --git a/tests/baselines/reference/fluentInterfaces.js b/tests/baselines/reference/fluentInterfaces.js
new file mode 100644
index 00000000000..1be15923d6c
--- /dev/null
+++ b/tests/baselines/reference/fluentInterfaces.js
@@ -0,0 +1,17 @@
+//// [fluentInterfaces.ts]
+interface A {
+ foo(): this;
+}
+interface B extends A {
+ bar(): this;
+}
+interface C extends B {
+ baz(): this;
+}
+var c: C;
+var z = c.foo().bar().baz(); // Fluent pattern
+
+
+//// [fluentInterfaces.js]
+var c;
+var z = c.foo().bar().baz(); // Fluent pattern
diff --git a/tests/baselines/reference/fluentInterfaces.symbols b/tests/baselines/reference/fluentInterfaces.symbols
new file mode 100644
index 00000000000..e059cdc127e
--- /dev/null
+++ b/tests/baselines/reference/fluentInterfaces.symbols
@@ -0,0 +1,35 @@
+=== tests/cases/conformance/types/thisType/fluentInterfaces.ts ===
+interface A {
+>A : Symbol(A, Decl(fluentInterfaces.ts, 0, 0))
+
+ foo(): this;
+>foo : Symbol(foo, Decl(fluentInterfaces.ts, 0, 13))
+}
+interface B extends A {
+>B : Symbol(B, Decl(fluentInterfaces.ts, 2, 1))
+>A : Symbol(A, Decl(fluentInterfaces.ts, 0, 0))
+
+ bar(): this;
+>bar : Symbol(bar, Decl(fluentInterfaces.ts, 3, 23))
+}
+interface C extends B {
+>C : Symbol(C, Decl(fluentInterfaces.ts, 5, 1))
+>B : Symbol(B, Decl(fluentInterfaces.ts, 2, 1))
+
+ baz(): this;
+>baz : Symbol(baz, Decl(fluentInterfaces.ts, 6, 23))
+}
+var c: C;
+>c : Symbol(c, Decl(fluentInterfaces.ts, 9, 3))
+>C : Symbol(C, Decl(fluentInterfaces.ts, 5, 1))
+
+var z = c.foo().bar().baz(); // Fluent pattern
+>z : Symbol(z, Decl(fluentInterfaces.ts, 10, 3))
+>c.foo().bar().baz : Symbol(C.baz, Decl(fluentInterfaces.ts, 6, 23))
+>c.foo().bar : Symbol(B.bar, Decl(fluentInterfaces.ts, 3, 23))
+>c.foo : Symbol(A.foo, Decl(fluentInterfaces.ts, 0, 13))
+>c : Symbol(c, Decl(fluentInterfaces.ts, 9, 3))
+>foo : Symbol(A.foo, Decl(fluentInterfaces.ts, 0, 13))
+>bar : Symbol(B.bar, Decl(fluentInterfaces.ts, 3, 23))
+>baz : Symbol(C.baz, Decl(fluentInterfaces.ts, 6, 23))
+
diff --git a/tests/baselines/reference/fluentInterfaces.types b/tests/baselines/reference/fluentInterfaces.types
new file mode 100644
index 00000000000..26e5a74c188
--- /dev/null
+++ b/tests/baselines/reference/fluentInterfaces.types
@@ -0,0 +1,38 @@
+=== tests/cases/conformance/types/thisType/fluentInterfaces.ts ===
+interface A {
+>A : A
+
+ foo(): this;
+>foo : () => this
+}
+interface B extends A {
+>B : B
+>A : A
+
+ bar(): this;
+>bar : () => this
+}
+interface C extends B {
+>C : C
+>B : B
+
+ baz(): this;
+>baz : () => this
+}
+var c: C;
+>c : C
+>C : C
+
+var z = c.foo().bar().baz(); // Fluent pattern
+>z : C
+>c.foo().bar().baz() : C
+>c.foo().bar().baz : () => C
+>c.foo().bar() : C
+>c.foo().bar : () => C
+>c.foo() : C
+>c.foo : () => C
+>c : C
+>foo : () => C
+>bar : () => C
+>baz : () => C
+
diff --git a/tests/baselines/reference/for-of18.types b/tests/baselines/reference/for-of18.types
index 5b2be7edc3e..415f2b11568 100644
--- a/tests/baselines/reference/for-of18.types
+++ b/tests/baselines/reference/for-of18.types
@@ -32,6 +32,6 @@ class StringIterator {
>iterator : symbol
return this;
->this : StringIterator
+>this : this
}
}
diff --git a/tests/baselines/reference/for-of19.types b/tests/baselines/reference/for-of19.types
index 02ef786ddd9..5128617bf24 100644
--- a/tests/baselines/reference/for-of19.types
+++ b/tests/baselines/reference/for-of19.types
@@ -37,6 +37,6 @@ class FooIterator {
>iterator : symbol
return this;
->this : FooIterator
+>this : this
}
}
diff --git a/tests/baselines/reference/for-of20.types b/tests/baselines/reference/for-of20.types
index 3da6fd484b1..de12979c650 100644
--- a/tests/baselines/reference/for-of20.types
+++ b/tests/baselines/reference/for-of20.types
@@ -37,6 +37,6 @@ class FooIterator {
>iterator : symbol
return this;
->this : FooIterator
+>this : this
}
}
diff --git a/tests/baselines/reference/for-of21.types b/tests/baselines/reference/for-of21.types
index a0cc50e99d7..cab24c525d9 100644
--- a/tests/baselines/reference/for-of21.types
+++ b/tests/baselines/reference/for-of21.types
@@ -37,6 +37,6 @@ class FooIterator {
>iterator : symbol
return this;
->this : FooIterator
+>this : this
}
}
diff --git a/tests/baselines/reference/for-of22.types b/tests/baselines/reference/for-of22.types
index 09e85798554..f15a1d7e114 100644
--- a/tests/baselines/reference/for-of22.types
+++ b/tests/baselines/reference/for-of22.types
@@ -38,6 +38,6 @@ class FooIterator {
>iterator : symbol
return this;
->this : FooIterator
+>this : this
}
}
diff --git a/tests/baselines/reference/for-of23.types b/tests/baselines/reference/for-of23.types
index 37515c0b70a..87f1eeabbb7 100644
--- a/tests/baselines/reference/for-of23.types
+++ b/tests/baselines/reference/for-of23.types
@@ -38,6 +38,6 @@ class FooIterator {
>iterator : symbol
return this;
->this : FooIterator
+>this : this
}
}
diff --git a/tests/baselines/reference/for-of26.types b/tests/baselines/reference/for-of26.types
index d2608fbf154..fe930e2e57f 100644
--- a/tests/baselines/reference/for-of26.types
+++ b/tests/baselines/reference/for-of26.types
@@ -22,6 +22,6 @@ class StringIterator {
>iterator : symbol
return this;
->this : StringIterator
+>this : this
}
}
diff --git a/tests/baselines/reference/for-of28.types b/tests/baselines/reference/for-of28.types
index 91b77a55a4d..882d2df6186 100644
--- a/tests/baselines/reference/for-of28.types
+++ b/tests/baselines/reference/for-of28.types
@@ -16,6 +16,6 @@ class StringIterator {
>iterator : symbol
return this;
->this : StringIterator
+>this : this
}
}
diff --git a/tests/baselines/reference/functionOverloads7.types b/tests/baselines/reference/functionOverloads7.types
index c57f042b354..7160068126f 100644
--- a/tests/baselines/reference/functionOverloads7.types
+++ b/tests/baselines/reference/functionOverloads7.types
@@ -21,7 +21,7 @@ class foo {
>foo : any
>this.bar() : any
>this.bar : { (): any; (foo: string): any; }
->this : foo
+>this : this
>bar : { (): any; (foo: string): any; }
foo = this.bar("test");
@@ -29,7 +29,7 @@ class foo {
>foo : any
>this.bar("test") : any
>this.bar : { (): any; (foo: string): any; }
->this : foo
+>this : this
>bar : { (): any; (foo: string): any; }
>"test" : string
}
diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs.types b/tests/baselines/reference/functionSubtypingOfVarArgs.types
index ebd706e94cf..ec48ff26c66 100644
--- a/tests/baselines/reference/functionSubtypingOfVarArgs.types
+++ b/tests/baselines/reference/functionSubtypingOfVarArgs.types
@@ -15,7 +15,7 @@ class EventBase {
>this._listeners.push(listener) : number
>this._listeners.push : (...items: any[]) => number
>this._listeners : any[]
->this : EventBase
+>this : this
>_listeners : any[]
>push : (...items: any[]) => number
>listener : (...args: any[]) => void
diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.types b/tests/baselines/reference/functionSubtypingOfVarArgs2.types
index 5e2b14ffc7a..3aa5b7a7a00 100644
--- a/tests/baselines/reference/functionSubtypingOfVarArgs2.types
+++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.types
@@ -16,7 +16,7 @@ class EventBase {
>this._listeners.push(listener) : number
>this._listeners.push : (...items: ((...args: any[]) => void)[]) => number
>this._listeners : ((...args: any[]) => void)[]
->this : EventBase
+>this : this
>_listeners : ((...args: any[]) => void)[]
>push : (...items: ((...args: any[]) => void)[]) => number
>listener : (...args: any[]) => void
diff --git a/tests/baselines/reference/fuzzy.errors.txt b/tests/baselines/reference/fuzzy.errors.txt
index 699841f8870..72ac4c816f9 100644
--- a/tests/baselines/reference/fuzzy.errors.txt
+++ b/tests/baselines/reference/fuzzy.errors.txt
@@ -1,10 +1,11 @@
tests/cases/compiler/fuzzy.ts(13,18): error TS2420: Class 'C' incorrectly implements interface 'I'.
Property 'alsoWorks' is missing in type 'C'.
-tests/cases/compiler/fuzzy.ts(21,20): error TS2322: Type '{ anything: number; oneI: C; }' is not assignable to type 'R'.
+tests/cases/compiler/fuzzy.ts(21,20): error TS2322: Type '{ anything: number; oneI: this; }' is not assignable to type 'R'.
Types of property 'oneI' are incompatible.
- Type 'C' is not assignable to type 'I'.
-tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Neither type '{ oneI: C; }' nor type 'R' is assignable to the other.
- Property 'anything' is missing in type '{ oneI: C; }'.
+ Type 'this' is not assignable to type 'I'.
+ Type 'C' is not assignable to type 'I'.
+tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Neither type '{ oneI: this; }' nor type 'R' is assignable to the other.
+ Property 'anything' is missing in type '{ oneI: this; }'.
==== tests/cases/compiler/fuzzy.ts (3 errors) ====
@@ -33,16 +34,17 @@ tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Neither type '{ oneI: C; }'
doesntWork():R {
return { anything:1, oneI:this };
~~~~~~~~~~~~~~~~~~~~~~~~~
-!!! error TS2322: Type '{ anything: number; oneI: C; }' is not assignable to type 'R'.
+!!! error TS2322: Type '{ anything: number; oneI: this; }' is not assignable to type 'R'.
!!! error TS2322: Types of property 'oneI' are incompatible.
-!!! error TS2322: Type 'C' is not assignable to type 'I'.
+!!! error TS2322: Type 'this' is not assignable to type 'I'.
+!!! error TS2322: Type 'C' is not assignable to type 'I'.
}
worksToo():R {
return ({ oneI: this });
~~~~~~~~~~~~~~~~~~~
-!!! error TS2352: Neither type '{ oneI: C; }' nor type 'R' is assignable to the other.
-!!! error TS2352: Property 'anything' is missing in type '{ oneI: C; }'.
+!!! error TS2352: Neither type '{ oneI: this; }' nor type 'R' is assignable to the other.
+!!! error TS2352: Property 'anything' is missing in type '{ oneI: this; }'.
}
}
}
diff --git a/tests/baselines/reference/generatorTypeCheck39.js b/tests/baselines/reference/generatorTypeCheck39.js
index e6d25045a7e..43df3b8e205 100644
--- a/tests/baselines/reference/generatorTypeCheck39.js
+++ b/tests/baselines/reference/generatorTypeCheck39.js
@@ -11,12 +11,10 @@ function* g() {
//// [generatorTypeCheck39.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
function decorator(x) {
return y => { };
diff --git a/tests/baselines/reference/generatorTypeCheck59.js b/tests/baselines/reference/generatorTypeCheck59.js
index 5b3b70386f8..8fd32e7730a 100644
--- a/tests/baselines/reference/generatorTypeCheck59.js
+++ b/tests/baselines/reference/generatorTypeCheck59.js
@@ -8,20 +8,17 @@ function* g() {
//// [generatorTypeCheck59.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
function* g() {
class C {
m() { }
}
- Object.defineProperty(C.prototype, "m",
- __decorate([
- (yield "")
- ], C.prototype, "m", Object.getOwnPropertyDescriptor(C.prototype, "m")));
+ __decorate([
+ (yield "")
+ ], C.prototype, "m", null);
;
}
diff --git a/tests/baselines/reference/generatorTypeCheck61.js b/tests/baselines/reference/generatorTypeCheck61.js
index 9e2f067f9fb..b2434ee590c 100644
--- a/tests/baselines/reference/generatorTypeCheck61.js
+++ b/tests/baselines/reference/generatorTypeCheck61.js
@@ -6,12 +6,10 @@ function * g() {
//// [generatorTypeCheck61.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
- case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
- case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
- }
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
};
function* g() {
let C = class {
diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty.types b/tests/baselines/reference/genericBaseClassLiteralProperty.types
index 87f1c55c42d..69468f9b679 100644
--- a/tests/baselines/reference/genericBaseClassLiteralProperty.types
+++ b/tests/baselines/reference/genericBaseClassLiteralProperty.types
@@ -23,14 +23,14 @@ class SubClass extends BaseClass {
>x : number
>this._getValue1() : number
>this._getValue1 : () => number
->this : SubClass
+>this : this
>_getValue1 : () => number
var y : number = this._getValue2();
>y : number
>this._getValue2() : number
>this._getValue2 : () => number
->this : SubClass
+>this : this
>_getValue2 : () => number
}
}
diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.types b/tests/baselines/reference/genericBaseClassLiteralProperty2.types
index 271aa190037..d7d512165f0 100644
--- a/tests/baselines/reference/genericBaseClassLiteralProperty2.types
+++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.types
@@ -16,7 +16,7 @@ class BaseCollection2 {
this._itemsByKey = {};
>this._itemsByKey = {} : { [x: string]: undefined; }
>this._itemsByKey : { [key: string]: TItem; }
->this : BaseCollection2
+>this : this
>_itemsByKey : { [key: string]: TItem; }
>{} : { [x: string]: undefined; }
}
@@ -36,7 +36,7 @@ class DataView2 extends BaseCollection2 {
>this._itemsByKey['dummy'] = item : CollectionItem2
>this._itemsByKey['dummy'] : CollectionItem2
>this._itemsByKey : { [key: string]: CollectionItem2; }
->this : DataView2
+>this : this
>_itemsByKey : { [key: string]: CollectionItem2; }
>'dummy' : string
>item : CollectionItem2
diff --git a/tests/baselines/reference/genericClassWithStaticFactory.symbols b/tests/baselines/reference/genericClassWithStaticFactory.symbols
index 37ee9c638e9..47b7f5f736b 100644
--- a/tests/baselines/reference/genericClassWithStaticFactory.symbols
+++ b/tests/baselines/reference/genericClassWithStaticFactory.symbols
@@ -52,23 +52,23 @@ module Editor {
>data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 12, 19))
this.prev.next = entry;
->this.prev.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>this.prev.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
>prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 13, 15))
entry.next = this;
->entry.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 13, 15))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
entry.prev = this.prev;
->entry.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 13, 15))
->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
>prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
@@ -102,16 +102,16 @@ module Editor {
for (i = 0; !(entry.isHead); i++) {
>i : Symbol(i, Decl(genericClassWithStaticFactory.ts, 24, 15))
->entry.isHead : Symbol(isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
+>entry.isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 23, 15))
->isHead : Symbol(isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
+>isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
>i : Symbol(i, Decl(genericClassWithStaticFactory.ts, 24, 15))
entry = entry.next;
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 23, 15))
->entry.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 23, 15))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
}
return (i);
@@ -138,11 +138,11 @@ module Editor {
>isEmpty : Symbol(isEmpty, Decl(genericClassWithStaticFactory.ts, 32, 9))
{
return this.next.data;
->this.next.data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 7, 43))
+>this.next.data : Symbol(List.data, Decl(genericClassWithStaticFactory.ts, 7, 43))
>this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
>next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
->data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 7, 43))
+>data : Symbol(List.data, Decl(genericClassWithStaticFactory.ts, 7, 43))
}
else {
return null;
@@ -156,22 +156,22 @@ module Editor {
>T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22))
entry.isHead = false;
->entry.isHead : Symbol(isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
+>entry.isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 48, 25))
->isHead : Symbol(isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
+>isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
entry.next = this.next;
->entry.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 48, 25))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
>next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
entry.prev = this;
->entry.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 48, 25))
->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
this.next = entry;
@@ -181,11 +181,11 @@ module Editor {
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 48, 25))
entry.next.prev = entry; // entry.next.prev does not show intellisense, but entry.prev.prev does
->entry.next.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
->entry.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>entry.next.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 48, 25))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 48, 25))
}
@@ -204,28 +204,28 @@ module Editor {
>data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 56, 20))
entry.data = data;
->entry.data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 7, 43))
+>entry.data : Symbol(List.data, Decl(genericClassWithStaticFactory.ts, 7, 43))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 57, 15))
->data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 7, 43))
+>data : Symbol(List.data, Decl(genericClassWithStaticFactory.ts, 7, 43))
>data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 56, 20))
entry.isHead = false;
->entry.isHead : Symbol(isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
+>entry.isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 57, 15))
->isHead : Symbol(isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
+>isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
entry.next = this.next;
->entry.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 57, 15))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
>next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
entry.prev = this;
->entry.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 57, 15))
->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
this.next = entry;
@@ -235,11 +235,11 @@ module Editor {
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 57, 15))
entry.next.prev = entry; // entry.next.prev does not show intellisense, but entry.prev.prev does
->entry.next.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
->entry.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>entry.next.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 57, 15))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 57, 15))
}
@@ -252,11 +252,11 @@ module Editor {
>T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22))
if (this.next.isHead) {
->this.next.isHead : Symbol(isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
+>this.next.isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
>this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
>next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
->isHead : Symbol(isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
+>isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
return null;
}
@@ -282,28 +282,28 @@ module Editor {
>T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22))
entry.isHead = false;
->entry.isHead : Symbol(isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
+>entry.isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 75, 27))
->isHead : Symbol(isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
+>isHead : Symbol(List.isHead, Decl(genericClassWithStaticFactory.ts, 7, 20))
this.prev.next = entry;
->this.prev.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>this.prev.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
>prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 75, 27))
entry.next = this;
->entry.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 75, 27))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
entry.prev = this.prev;
->entry.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 75, 27))
->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
>prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
@@ -337,17 +337,17 @@ module Editor {
>data : Symbol(data, Decl(genericClassWithStaticFactory.ts, 84, 27))
entry.next = this.next;
->entry.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 85, 15))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
>next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
entry.prev = this;
->entry.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 85, 15))
->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
this.next = entry;
@@ -357,11 +357,11 @@ module Editor {
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 85, 15))
entry.next.prev = entry;// entry.next.prev does not show intellisense, but entry.prev.prev does
->entry.next.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
->entry.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>entry.next.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 85, 15))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 85, 15))
return entry;
@@ -377,23 +377,23 @@ module Editor {
>T : Symbol(T, Decl(genericClassWithStaticFactory.ts, 2, 22))
this.prev.next = entry;
->this.prev.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>this.prev.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
>prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 93, 33))
entry.next = this;
->entry.next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>entry.next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 93, 33))
->next : Symbol(next, Decl(genericClassWithStaticFactory.ts, 2, 26))
+>next : Symbol(List.next, Decl(genericClassWithStaticFactory.ts, 2, 26))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
entry.prev = this.prev;
->entry.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>entry.prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>entry : Symbol(entry, Decl(genericClassWithStaticFactory.ts, 93, 33))
->prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
+>prev : Symbol(List.prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this.prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
>this : Symbol(List, Decl(genericClassWithStaticFactory.ts, 0, 15))
>prev : Symbol(prev, Decl(genericClassWithStaticFactory.ts, 3, 29))
diff --git a/tests/baselines/reference/genericClassWithStaticFactory.types b/tests/baselines/reference/genericClassWithStaticFactory.types
index 34d0c4aeaae..2daad9003eb 100644
--- a/tests/baselines/reference/genericClassWithStaticFactory.types
+++ b/tests/baselines/reference/genericClassWithStaticFactory.types
@@ -29,7 +29,7 @@ module Editor {
this.listFactory = new ListFactory();
>this.listFactory = new ListFactory() : ListFactory
>this.listFactory : ListFactory
->this : List
+>this : this
>listFactory : ListFactory
>new ListFactory() : ListFactory
>ListFactory : typeof ListFactory
@@ -49,7 +49,7 @@ module Editor {
>this.listFactory.MakeEntry(data) : List
>this.listFactory.MakeEntry : (data: T) => List
>this.listFactory : ListFactory
->this : List
+>this : this
>listFactory : ListFactory
>MakeEntry : (data: T) => List
>data : T
@@ -58,17 +58,17 @@ module Editor {
>this.prev.next = entry : List
>this.prev.next : List
>this.prev : List
->this : List