mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
var -> let
This commit is contained in:
@@ -474,7 +474,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function hasExportDeclarations(node: ModuleDeclaration | SourceFile): boolean {
|
||||
var body = node.kind === SyntaxKind.SourceFile ? node : (<ModuleDeclaration>node).body;
|
||||
let body = node.kind === SyntaxKind.SourceFile ? node : (<ModuleDeclaration>node).body;
|
||||
if (body.kind === SyntaxKind.SourceFile || body.kind === SyntaxKind.ModuleBlock) {
|
||||
for (let stat of (<Block>body).statements) {
|
||||
if (stat.kind === SyntaxKind.ExportDeclaration || stat.kind === SyntaxKind.ExportAssignment) {
|
||||
@@ -750,7 +750,7 @@ namespace ts {
|
||||
function bind(node: Node) {
|
||||
node.parent = parent;
|
||||
|
||||
var savedInStrictMode = inStrictMode;
|
||||
let savedInStrictMode = inStrictMode;
|
||||
if (!savedInStrictMode) {
|
||||
updateStrictMode(node);
|
||||
}
|
||||
|
||||
+26
-26
@@ -282,7 +282,7 @@ namespace ts {
|
||||
|
||||
function getSymbolLinks(symbol: Symbol): SymbolLinks {
|
||||
if (symbol.flags & SymbolFlags.Transient) return <TransientSymbol>symbol;
|
||||
var id = getSymbolId(symbol);
|
||||
let id = getSymbolId(symbol);
|
||||
return symbolLinks[id] || (symbolLinks[id] = {});
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getTargetOfNamespaceImport(node: NamespaceImport): Symbol {
|
||||
var moduleSpecifier = (<ImportDeclaration>node.parent.parent).moduleSpecifier;
|
||||
let moduleSpecifier = (<ImportDeclaration>node.parent.parent).moduleSpecifier;
|
||||
return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier);
|
||||
}
|
||||
|
||||
@@ -685,7 +685,7 @@ namespace ts {
|
||||
|
||||
function getPropertyOfVariable(symbol: Symbol, name: string): Symbol {
|
||||
if (symbol.flags & SymbolFlags.Variable) {
|
||||
var typeAnnotation = (<VariableDeclaration>symbol.valueDeclaration).type;
|
||||
let typeAnnotation = (<VariableDeclaration>symbol.valueDeclaration).type;
|
||||
if (typeAnnotation) {
|
||||
return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name));
|
||||
}
|
||||
@@ -1305,7 +1305,7 @@ namespace ts {
|
||||
// Mark the unexported alias as visible if its parent is visible
|
||||
// because these kind of aliases can be used to name types in declaration file
|
||||
|
||||
var anyImportSyntax = getAnyImportSyntax(declaration);
|
||||
let anyImportSyntax = getAnyImportSyntax(declaration);
|
||||
if (anyImportSyntax &&
|
||||
!(anyImportSyntax.flags & NodeFlags.Export) && // import clause without export
|
||||
isDeclarationVisible(<Declaration>anyImportSyntax.parent)) {
|
||||
@@ -2086,14 +2086,14 @@ namespace ts {
|
||||
}
|
||||
|
||||
function collectLinkedAliases(node: Identifier): Node[] {
|
||||
var exportSymbol: Symbol;
|
||||
let exportSymbol: Symbol;
|
||||
if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) {
|
||||
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, node);
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ExportSpecifier) {
|
||||
exportSymbol = getTargetOfExportSpecifier(<ExportSpecifier>node.parent);
|
||||
}
|
||||
var result: Node[] = [];
|
||||
let result: Node[] = [];
|
||||
if (exportSymbol) {
|
||||
buildVisibleNodeList(exportSymbol.declarations);
|
||||
}
|
||||
@@ -2102,16 +2102,16 @@ namespace ts {
|
||||
function buildVisibleNodeList(declarations: Declaration[]) {
|
||||
forEach(declarations, declaration => {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
var resultNode = getAnyImportSyntax(declaration) || declaration;
|
||||
let resultNode = getAnyImportSyntax(declaration) || declaration;
|
||||
if (!contains(result, resultNode)) {
|
||||
result.push(resultNode);
|
||||
}
|
||||
|
||||
if (isInternalModuleImportEqualsDeclaration(declaration)) {
|
||||
// Add the referenced top container visible
|
||||
var internalModuleReference = <Identifier | QualifiedName>(<ImportEqualsDeclaration>declaration).moduleReference;
|
||||
var firstIdentifier = getFirstIdentifier(internalModuleReference);
|
||||
var importSymbol = resolveName(declaration, firstIdentifier.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace,
|
||||
let internalModuleReference = <Identifier | QualifiedName>(<ImportEqualsDeclaration>declaration).moduleReference;
|
||||
let firstIdentifier = getFirstIdentifier(internalModuleReference);
|
||||
let importSymbol = resolveName(declaration, firstIdentifier.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace,
|
||||
Diagnostics.Cannot_find_name_0, firstIdentifier);
|
||||
buildVisibleNodeList(importSymbol.declarations);
|
||||
}
|
||||
@@ -2606,7 +2606,7 @@ namespace ts {
|
||||
|
||||
// The outer type parameters are those defined by enclosing generic classes, methods, or functions.
|
||||
function getOuterTypeParametersOfClassOrInterface(symbol: Symbol): TypeParameter[] {
|
||||
var declaration = symbol.flags & SymbolFlags.Class ? symbol.valueDeclaration : getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration);
|
||||
let declaration = symbol.flags & SymbolFlags.Class ? symbol.valueDeclaration : getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration);
|
||||
return appendOuterTypeParameters(undefined, declaration);
|
||||
}
|
||||
|
||||
@@ -9908,7 +9908,7 @@ namespace ts {
|
||||
// we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
var constructor = getFirstConstructorWithBody(<ClassDeclaration>node);
|
||||
let constructor = getFirstConstructorWithBody(<ClassDeclaration>node);
|
||||
if (constructor) {
|
||||
checkParameterTypeAnnotationsAsExpressions(constructor);
|
||||
}
|
||||
@@ -10159,7 +10159,7 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
var symbol = getSymbolOfNode(node);
|
||||
let symbol = getSymbolOfNode(node);
|
||||
if (symbol.flags & SymbolFlags.FunctionScopedVariable) {
|
||||
let localDeclarationSymbol = resolveName(node, (<Identifier>node.name).text, SymbolFlags.Variable, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined);
|
||||
if (localDeclarationSymbol &&
|
||||
@@ -11404,7 +11404,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// expression part in ElementAccess\PropertyAccess should be either identifier or dottedName
|
||||
var current = expression;
|
||||
let current = expression;
|
||||
while (current) {
|
||||
if (current.kind === SyntaxKind.Identifier) {
|
||||
break;
|
||||
@@ -12614,7 +12614,7 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
var isValue = isAliasResolvedToValue(getSymbolOfNode(node));
|
||||
let isValue = isAliasResolvedToValue(getSymbolOfNode(node));
|
||||
return isValue && node.moduleReference && !nodeIsMissing(node.moduleReference);
|
||||
}
|
||||
|
||||
@@ -12698,7 +12698,7 @@ namespace ts {
|
||||
// here has no effect anyway as an identifier in a type name is not an expression.
|
||||
// var substitution = getExpressionNameSubstitution(<Identifier>node, getGeneratedNameForNode);
|
||||
// var text = substitution || (<Identifier>node).text;
|
||||
var text = (<Identifier>node).text;
|
||||
let text = (<Identifier>node).text;
|
||||
if (fallbackPath) {
|
||||
fallbackPath.push(text);
|
||||
}
|
||||
@@ -12707,8 +12707,8 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
var left = serializeEntityName((<QualifiedName>node).left, fallbackPath);
|
||||
var right = serializeEntityName((<QualifiedName>node).right, fallbackPath);
|
||||
let left = serializeEntityName((<QualifiedName>node).left, fallbackPath);
|
||||
let right = serializeEntityName((<QualifiedName>node).right, fallbackPath);
|
||||
if (!fallbackPath) {
|
||||
return left + "." + right;
|
||||
}
|
||||
@@ -12748,7 +12748,7 @@ namespace ts {
|
||||
return "Symbol";
|
||||
}
|
||||
else if (type === unknownType) {
|
||||
var fallbackPath: string[] = [];
|
||||
let fallbackPath: string[] = [];
|
||||
serializeEntityName(node.typeName, fallbackPath);
|
||||
return fallbackPath;
|
||||
}
|
||||
@@ -12843,7 +12843,7 @@ namespace ts {
|
||||
//
|
||||
// For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`.
|
||||
if (node) {
|
||||
var valueDeclaration: FunctionLikeDeclaration;
|
||||
let valueDeclaration: FunctionLikeDeclaration;
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
valueDeclaration = getFirstConstructorWithBody(<ClassDeclaration>node);
|
||||
}
|
||||
@@ -12851,14 +12851,14 @@ namespace ts {
|
||||
valueDeclaration = <FunctionLikeDeclaration>node;
|
||||
}
|
||||
if (valueDeclaration) {
|
||||
var result: (string | string[])[];
|
||||
var parameters = valueDeclaration.parameters;
|
||||
var parameterCount = parameters.length;
|
||||
let result: (string | string[])[];
|
||||
let parameters = valueDeclaration.parameters;
|
||||
let parameterCount = parameters.length;
|
||||
if (parameterCount > 0) {
|
||||
result = new Array<string>(parameterCount);
|
||||
for (var i = 0; i < parameterCount; i++) {
|
||||
for (let i = 0; i < parameterCount; i++) {
|
||||
if (parameters[i].dotDotDotToken) {
|
||||
var parameterType = parameters[i].type;
|
||||
let parameterType = parameters[i].type;
|
||||
if (parameterType.kind === SyntaxKind.ArrayType) {
|
||||
parameterType = (<ArrayTypeNode>parameterType).elementType;
|
||||
}
|
||||
@@ -12905,7 +12905,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) {
|
||||
var type = getTypeOfExpression(expr);
|
||||
let type = getTypeOfExpression(expr);
|
||||
getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ts {
|
||||
/* @internal */
|
||||
export var optionDeclarations: CommandLineOption[] = [
|
||||
export let optionDeclarations: CommandLineOption[] = [
|
||||
{
|
||||
name: "charset",
|
||||
type: "string",
|
||||
@@ -207,11 +207,11 @@ namespace ts {
|
||||
];
|
||||
|
||||
export function parseCommandLine(commandLine: string[]): ParsedCommandLine {
|
||||
var options: CompilerOptions = {};
|
||||
var fileNames: string[] = [];
|
||||
var errors: Diagnostic[] = [];
|
||||
var shortOptionNames: Map<string> = {};
|
||||
var optionNameMap: Map<CommandLineOption> = {};
|
||||
let options: CompilerOptions = {};
|
||||
let fileNames: string[] = [];
|
||||
let errors: Diagnostic[] = [];
|
||||
let shortOptionNames: Map<string> = {};
|
||||
let optionNameMap: Map<CommandLineOption> = {};
|
||||
|
||||
forEach(optionDeclarations, option => {
|
||||
optionNameMap[option.name.toLowerCase()] = option;
|
||||
@@ -227,9 +227,9 @@ namespace ts {
|
||||
};
|
||||
|
||||
function parseStrings(args: string[]) {
|
||||
var i = 0;
|
||||
let i = 0;
|
||||
while (i < args.length) {
|
||||
var s = args[i++];
|
||||
let s = args[i++];
|
||||
if (s.charCodeAt(0) === CharacterCodes.at) {
|
||||
parseResponseFile(s.slice(1));
|
||||
}
|
||||
@@ -242,7 +242,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (hasProperty(optionNameMap, s)) {
|
||||
var opt = optionNameMap[s];
|
||||
let opt = optionNameMap[s];
|
||||
|
||||
// Check to see if no argument was provided (e.g. "--locale" is the last command-line argument).
|
||||
if (!args[i] && opt.type !== "boolean") {
|
||||
@@ -261,8 +261,8 @@ namespace ts {
|
||||
break;
|
||||
// If not a primitive, the possible types are specified in what is effectively a map of options.
|
||||
default:
|
||||
var map = <Map<number>>opt.type;
|
||||
var key = (args[i++] || "").toLowerCase();
|
||||
let map = <Map<number>>opt.type;
|
||||
let key = (args[i++] || "").toLowerCase();
|
||||
if (hasProperty(map, key)) {
|
||||
options[opt.name] = map[key];
|
||||
}
|
||||
@@ -282,19 +282,19 @@ namespace ts {
|
||||
}
|
||||
|
||||
function parseResponseFile(fileName: string) {
|
||||
var text = sys.readFile(fileName);
|
||||
let text = sys.readFile(fileName);
|
||||
|
||||
if (!text) {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, fileName));
|
||||
return;
|
||||
}
|
||||
|
||||
var args: string[] = [];
|
||||
var pos = 0;
|
||||
let args: string[] = [];
|
||||
let pos = 0;
|
||||
while (true) {
|
||||
while (pos < text.length && text.charCodeAt(pos) <= CharacterCodes.space) pos++;
|
||||
if (pos >= text.length) break;
|
||||
var start = pos;
|
||||
let start = pos;
|
||||
if (text.charCodeAt(start) === CharacterCodes.doubleQuote) {
|
||||
pos++;
|
||||
while (pos < text.length && text.charCodeAt(pos) !== CharacterCodes.doubleQuote) pos++;
|
||||
@@ -321,7 +321,7 @@ namespace ts {
|
||||
*/
|
||||
export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } {
|
||||
try {
|
||||
var text = sys.readFile(fileName);
|
||||
let text = sys.readFile(fileName);
|
||||
}
|
||||
catch (e) {
|
||||
return { error: createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };
|
||||
@@ -350,7 +350,7 @@ namespace ts {
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
export function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine {
|
||||
var errors: Diagnostic[] = [];
|
||||
let errors: Diagnostic[] = [];
|
||||
|
||||
return {
|
||||
options: getCompilerOptions(),
|
||||
@@ -359,22 +359,22 @@ namespace ts {
|
||||
};
|
||||
|
||||
function getCompilerOptions(): CompilerOptions {
|
||||
var options: CompilerOptions = {};
|
||||
var optionNameMap: Map<CommandLineOption> = {};
|
||||
let options: CompilerOptions = {};
|
||||
let optionNameMap: Map<CommandLineOption> = {};
|
||||
forEach(optionDeclarations, option => {
|
||||
optionNameMap[option.name] = option;
|
||||
});
|
||||
var jsonOptions = json["compilerOptions"];
|
||||
let jsonOptions = json["compilerOptions"];
|
||||
if (jsonOptions) {
|
||||
for (var id in jsonOptions) {
|
||||
for (let id in jsonOptions) {
|
||||
if (hasProperty(optionNameMap, id)) {
|
||||
var opt = optionNameMap[id];
|
||||
var optType = opt.type;
|
||||
var value = jsonOptions[id];
|
||||
var expectedType = typeof optType === "string" ? optType : "string";
|
||||
let opt = optionNameMap[id];
|
||||
let optType = opt.type;
|
||||
let value = jsonOptions[id];
|
||||
let expectedType = typeof optType === "string" ? optType : "string";
|
||||
if (typeof value === expectedType) {
|
||||
if (typeof optType !== "string") {
|
||||
var key = value.toLowerCase();
|
||||
let key = value.toLowerCase();
|
||||
if (hasProperty(optType, key)) {
|
||||
value = optType[key];
|
||||
}
|
||||
@@ -401,17 +401,17 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getFileNames(): string[] {
|
||||
var fileNames: string[] = [];
|
||||
let fileNames: string[] = [];
|
||||
if (hasProperty(json, "files")) {
|
||||
if (json["files"] instanceof Array) {
|
||||
fileNames = map(<string[]>json["files"], s => combinePaths(basePath, s));
|
||||
}
|
||||
}
|
||||
else {
|
||||
var exclude = json["exclude"] instanceof Array ? map(<string[]>json["exclude"], normalizeSlashes) : undefined;
|
||||
var sysFiles = host.readDirectory(basePath, ".ts", exclude);
|
||||
for (var i = 0; i < sysFiles.length; i++) {
|
||||
var name = sysFiles[i];
|
||||
let exclude = json["exclude"] instanceof Array ? map(<string[]>json["exclude"], normalizeSlashes) : undefined;
|
||||
let sysFiles = host.readDirectory(basePath, ".ts", exclude);
|
||||
for (let i = 0; i < sysFiles.length; i++) {
|
||||
let name = sysFiles[i];
|
||||
if (!fileExtensionIs(name, ".d.ts") || !contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) {
|
||||
fileNames.push(name);
|
||||
}
|
||||
|
||||
+14
-14
@@ -209,7 +209,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
// Note that names generated by makeTempVariableName and makeUniqueName will never conflict.
|
||||
function makeTempVariableName(flags: TempFlags): string {
|
||||
if (flags && !(tempFlags & flags)) {
|
||||
var name = flags === TempFlags._i ? "_i" : "_n";
|
||||
let name = flags === TempFlags._i ? "_i" : "_n";
|
||||
if (isUniqueName(name)) {
|
||||
tempFlags |= flags;
|
||||
return name;
|
||||
@@ -1309,7 +1309,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
write("super");
|
||||
}
|
||||
else {
|
||||
var flags = resolver.getNodeCheckFlags(node);
|
||||
let flags = resolver.getNodeCheckFlags(node);
|
||||
if (flags & NodeCheckFlags.SuperInstance) {
|
||||
write("_super.prototype");
|
||||
}
|
||||
@@ -1456,7 +1456,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
write("{");
|
||||
|
||||
if (numElements > 0) {
|
||||
var properties = node.properties;
|
||||
let properties = node.properties;
|
||||
|
||||
// If we are not doing a downlevel transformation for object literals,
|
||||
// then try to preserve the original shape of the object literal.
|
||||
@@ -2685,7 +2685,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
function emitModuleMemberName(node: Declaration) {
|
||||
emitStart(node.name);
|
||||
if (getCombinedNodeFlags(node) & NodeFlags.Export) {
|
||||
var container = getContainingModule(node);
|
||||
let container = getContainingModule(node);
|
||||
if (container) {
|
||||
write(getGeneratedNameForNode(container));
|
||||
write(".");
|
||||
@@ -3783,7 +3783,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
emitDefaultValueAssignments(ctor);
|
||||
emitRestParameter(ctor);
|
||||
if (baseTypeElement) {
|
||||
var superCall = findInitialSuperCall(ctor);
|
||||
let superCall = findInitialSuperCall(ctor);
|
||||
if (superCall) {
|
||||
writeLine();
|
||||
emit(superCall);
|
||||
@@ -3806,7 +3806,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
}
|
||||
emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false));
|
||||
if (ctor) {
|
||||
var statements: Node[] = (<Block>ctor.body).statements;
|
||||
let statements: Node[] = (<Block>ctor.body).statements;
|
||||
if (superCall) {
|
||||
statements = statements.slice(1);
|
||||
}
|
||||
@@ -3946,7 +3946,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
|
||||
var baseTypeNode = getClassExtendsHeritageClauseElement(node);
|
||||
let baseTypeNode = getClassExtendsHeritageClauseElement(node);
|
||||
if (baseTypeNode) {
|
||||
write(" extends ");
|
||||
emit(baseTypeNode.expression);
|
||||
@@ -4353,7 +4353,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
let argumentsWritten = 0;
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
if (shouldEmitTypeMetadata(node)) {
|
||||
var serializedType = resolver.serializeTypeOfNode(node);
|
||||
let serializedType = resolver.serializeTypeOfNode(node);
|
||||
if (serializedType) {
|
||||
if (writeComma) {
|
||||
write(", ");
|
||||
@@ -4366,7 +4366,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
}
|
||||
}
|
||||
if (shouldEmitParamTypesMetadata(node)) {
|
||||
var serializedTypes = resolver.serializeParameterTypesOfNode(node);
|
||||
let serializedTypes = resolver.serializeParameterTypesOfNode(node);
|
||||
if (serializedTypes) {
|
||||
if (writeComma || argumentsWritten) {
|
||||
write(", ");
|
||||
@@ -4384,7 +4384,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
}
|
||||
}
|
||||
if (shouldEmitReturnTypeMetadata(node)) {
|
||||
var serializedType = resolver.serializeReturnTypeOfNode(node);
|
||||
let serializedType = resolver.serializeReturnTypeOfNode(node);
|
||||
if (serializedType) {
|
||||
if (writeComma || argumentsWritten) {
|
||||
write(", ");
|
||||
@@ -4885,7 +4885,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
write("export default ");
|
||||
var expression = node.expression;
|
||||
let expression = node.expression;
|
||||
emit(expression);
|
||||
if (expression.kind !== SyntaxKind.FunctionDeclaration &&
|
||||
expression.kind !== SyntaxKind.ClassDeclaration) {
|
||||
@@ -5370,7 +5370,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
// }
|
||||
emitVariableDeclarationsForImports();
|
||||
writeLine();
|
||||
var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node);
|
||||
let exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node);
|
||||
let exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations);
|
||||
writeLine();
|
||||
write("return {");
|
||||
@@ -5725,7 +5725,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
emitDetachedComments(node);
|
||||
|
||||
// emit prologue directives prior to __extends
|
||||
var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false);
|
||||
let startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false);
|
||||
|
||||
// Only emit helpers if the user did not say otherwise.
|
||||
if (!compilerOptions.noEmitHelpers) {
|
||||
@@ -6081,7 +6081,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
|
||||
function emitTrailingComments(node: Node) {
|
||||
// Emit the trailing comments only if the parent's end doesn't match
|
||||
var trailingComments = filterComments(getTrailingCommentsToEmit(node), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments);
|
||||
let trailingComments = filterComments(getTrailingCommentsToEmit(node), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments);
|
||||
|
||||
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
|
||||
emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment);
|
||||
|
||||
@@ -2709,7 +2709,7 @@ namespace ts {
|
||||
|
||||
// If we have an arrow, then try to parse the body. Even if not, try to parse if we
|
||||
// have an opening brace, just in case we're in an error state.
|
||||
var lastToken = token;
|
||||
let lastToken = token;
|
||||
arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, /*reportAtCurrentPosition*/false, Diagnostics._0_expected, "=>");
|
||||
arrowFunction.body = (lastToken === SyntaxKind.EqualsGreaterThanToken || lastToken === SyntaxKind.OpenBraceToken)
|
||||
? parseArrowFunctionExpressionBody()
|
||||
@@ -4421,7 +4421,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function parseClassDeclarationOrExpression(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, kind: SyntaxKind): ClassLikeDeclaration {
|
||||
var node = <ClassLikeDeclaration>createNode(kind, fullStart);
|
||||
let node = <ClassLikeDeclaration>createNode(kind, fullStart);
|
||||
node.decorators = decorators;
|
||||
setModifiers(node, modifiers);
|
||||
parseExpected(SyntaxKind.ClassKeyword);
|
||||
@@ -4957,15 +4957,15 @@ namespace ts {
|
||||
}
|
||||
|
||||
function parseJSDocTopLevelType(): JSDocType {
|
||||
var type = parseJSDocType();
|
||||
let type = parseJSDocType();
|
||||
if (token === SyntaxKind.BarToken) {
|
||||
var unionType = <JSDocUnionType>createNode(SyntaxKind.JSDocUnionType, type.pos);
|
||||
let unionType = <JSDocUnionType>createNode(SyntaxKind.JSDocUnionType, type.pos);
|
||||
unionType.types = parseJSDocTypeList(type);
|
||||
type = finishNode(unionType);
|
||||
}
|
||||
|
||||
if (token === SyntaxKind.EqualsToken) {
|
||||
var optionalType = <JSDocOptionalType>createNode(SyntaxKind.JSDocOptionalType, type.pos);
|
||||
let optionalType = <JSDocOptionalType>createNode(SyntaxKind.JSDocOptionalType, type.pos);
|
||||
nextToken();
|
||||
optionalType.type = type;
|
||||
type = finishNode(optionalType);
|
||||
@@ -5648,7 +5648,7 @@ namespace ts {
|
||||
|
||||
function visitNode(node: IncrementalNode) {
|
||||
if (aggressiveChecks && shouldCheckNode(node)) {
|
||||
var text = oldText.substring(node.pos, node.end);
|
||||
let text = oldText.substring(node.pos, node.end);
|
||||
}
|
||||
|
||||
// Ditch any existing LS children we may have created. This way we can avoid
|
||||
|
||||
@@ -11,12 +11,12 @@ namespace ts {
|
||||
export const version = "1.5.3";
|
||||
|
||||
export function findConfigFile(searchPath: string): string {
|
||||
var fileName = "tsconfig.json";
|
||||
let fileName = "tsconfig.json";
|
||||
while (true) {
|
||||
if (sys.fileExists(fileName)) {
|
||||
return fileName;
|
||||
}
|
||||
var parentPath = getDirectoryPath(searchPath);
|
||||
let parentPath = getDirectoryPath(searchPath);
|
||||
if (parentPath === searchPath) {
|
||||
break;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ namespace ts {
|
||||
|
||||
function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) {
|
||||
try {
|
||||
var start = new Date().getTime();
|
||||
let start = new Date().getTime();
|
||||
ensureDirectoriesExist(getDirectoryPath(normalizePath(fileName)));
|
||||
sys.writeFile(fileName, data, writeByteOrderMark);
|
||||
ioWriteTime += new Date().getTime() - start;
|
||||
@@ -309,7 +309,7 @@ namespace ts {
|
||||
if (!isDeclarationFile(sourceFile)) {
|
||||
let resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile);
|
||||
// Don't actually write any files since we're just getting diagnostics.
|
||||
var writeFile: WriteFileCallback = () => { };
|
||||
let writeFile: WriteFileCallback = () => { };
|
||||
return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile);
|
||||
}
|
||||
}
|
||||
@@ -358,7 +358,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
var nonTsFile: SourceFile = options.allowNonTsExtensions && findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd);
|
||||
let nonTsFile: SourceFile = options.allowNonTsExtensions && findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd);
|
||||
if (!nonTsFile) {
|
||||
if (options.allowNonTsExtensions) {
|
||||
diagnostic = Diagnostics.File_0_not_found;
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ namespace ts {
|
||||
|
||||
function reportDiagnostic(diagnostic: Diagnostic) {
|
||||
var output = "";
|
||||
|
||||
|
||||
if (diagnostic.file) {
|
||||
var loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
||||
|
||||
|
||||
@@ -1409,7 +1409,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function createSynthesizedNodeArray(): NodeArray<any> {
|
||||
var array = <NodeArray<any>>[];
|
||||
let array = <NodeArray<any>>[];
|
||||
array.pos = -1;
|
||||
array.end = -1;
|
||||
return array;
|
||||
@@ -1994,7 +1994,7 @@ namespace ts {
|
||||
* Converts a string to a base-64 encoded ASCII string.
|
||||
*/
|
||||
export function convertToBase64(input: string): string {
|
||||
var result = "";
|
||||
let result = "";
|
||||
let charCodes = getExpandedCharCodes(input);
|
||||
let i = 0;
|
||||
let length = charCodes.length;
|
||||
|
||||
Reference in New Issue
Block a user