mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-20 13:45:34 -05:00
Minor spelling and spacing fix
This commit is contained in:
@@ -383,7 +383,7 @@ module ts {
|
||||
return [path.substr(0, rootLength)].concat(normalizedParts);
|
||||
}
|
||||
|
||||
export function getNormalizedPathComponents(path: string, getCurrentDirectory: ()=>string) {
|
||||
export function getNormalizedPathComponents(path: string, getCurrentDirectory: () => string) {
|
||||
var path = normalizeSlashes(path);
|
||||
var rootLength = getRootLength(path);
|
||||
if (rootLength == 0) {
|
||||
@@ -396,7 +396,7 @@ module ts {
|
||||
return normalizedPathComponents(path, rootLength);
|
||||
}
|
||||
|
||||
export function getNormalizedPathFromPathCompoments(pathComponents: string[]) {
|
||||
export function getNormalizedPathFromPathComponents(pathComponents: string[]) {
|
||||
if (pathComponents && pathComponents.length) {
|
||||
return pathComponents[0] + pathComponents.slice(1).join(directorySeparator);
|
||||
}
|
||||
@@ -444,7 +444,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getNormalizedPathOrUrlComponents(pathOrUrl: string, getCurrentDirectory: ()=>string) {
|
||||
function getNormalizedPathOrUrlComponents(pathOrUrl: string, getCurrentDirectory: () => string) {
|
||||
if (isUrl(pathOrUrl)) {
|
||||
return getNormalizedPathComponentsOfUrl(pathOrUrl);
|
||||
}
|
||||
@@ -457,7 +457,7 @@ module ts {
|
||||
var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, getCurrentDirectory);
|
||||
var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, getCurrentDirectory);
|
||||
if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") {
|
||||
// If the directory path given was of type test/cases/ then we really need components of directry to be only till its name
|
||||
// If the directory path given was of type test/cases/ then we really need components of directory to be only till its name
|
||||
// that is ["test", "cases", ""] needs to be actually ["test", "cases"]
|
||||
directoryComponents.length--;
|
||||
}
|
||||
@@ -483,7 +483,7 @@ module ts {
|
||||
}
|
||||
|
||||
// Cant find the relative path, get the absolute path
|
||||
var absolutePath = getNormalizedPathFromPathCompoments(pathComponents);
|
||||
var absolutePath = getNormalizedPathFromPathComponents(pathComponents);
|
||||
if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) {
|
||||
absolutePath = "file:///" + absolutePath;
|
||||
}
|
||||
|
||||
@@ -3817,11 +3817,11 @@ module ts {
|
||||
// Each file contributes into common source file path
|
||||
if (!(sourceFile.flags & NodeFlags.DeclarationFile)
|
||||
&& !fileExtensionIs(sourceFile.filename, ".js")) {
|
||||
var sourcePathCompoments = getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory);
|
||||
sourcePathCompoments.pop(); // FileName is not part of directory
|
||||
var sourcePathComponents = getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory);
|
||||
sourcePathComponents.pop(); // FileName is not part of directory
|
||||
if (commonPathComponents) {
|
||||
for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathCompoments.length); i++) {
|
||||
if (commonPathComponents[i] !== sourcePathCompoments[i]) {
|
||||
for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) {
|
||||
if (commonPathComponents[i] !== sourcePathComponents[i]) {
|
||||
if (i === 0) {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
return;
|
||||
@@ -3834,18 +3834,18 @@ module ts {
|
||||
}
|
||||
|
||||
// If the fileComponent path completely matched and less than already found update the length
|
||||
if (sourcePathCompoments.length < commonPathComponents.length) {
|
||||
commonPathComponents.length = sourcePathCompoments.length;
|
||||
if (sourcePathComponents.length < commonPathComponents.length) {
|
||||
commonPathComponents.length = sourcePathComponents.length;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// first file
|
||||
commonPathComponents = sourcePathCompoments;
|
||||
commonPathComponents = sourcePathComponents;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
commonSourceDirectory = getNormalizedPathFromPathCompoments(commonPathComponents);
|
||||
commonSourceDirectory = getNormalizedPathFromPathComponents(commonPathComponents);
|
||||
if (commonSourceDirectory) {
|
||||
// Make sure directory path ends with directory separator so this string can directly
|
||||
// used to replace with "" to get the relative path of the source file and the relative path doesn't
|
||||
|
||||
@@ -1393,7 +1393,7 @@ module ts {
|
||||
var documentRegistry = documentRegistry;
|
||||
var cancellationToken = new CancellationTokenObject(host.getCancellationToken());
|
||||
var activeCompletionSession: CompletionSession; // The current active completion session, used to get the completion entry details
|
||||
var writter: (filename: string, data: string, writebyteordermark: boolean) => void = undefined;
|
||||
var writer: (filename: string, data: string, writeByteOrderMark: boolean) => void = undefined;
|
||||
|
||||
// Check if the localized messages json is set, otherwise query the host for it
|
||||
if (!TypeScript.LocalizedDiagnosticMessages) {
|
||||
@@ -1423,8 +1423,8 @@ module ts {
|
||||
return host.getDefaultLibFilename();
|
||||
},
|
||||
writeFile: (filename, data, writeByteOrderMark) => {
|
||||
if (writter) {
|
||||
writter(filename, data, writeByteOrderMark);
|
||||
if (writer) {
|
||||
writer(filename, data, writeByteOrderMark);
|
||||
return;
|
||||
}
|
||||
throw Error("Error occurs: Invalid invocation to writeFile");
|
||||
@@ -2840,6 +2840,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function containErrors(diagnostics: Diagnostic[]): boolean {
|
||||
var hasError = forEach(diagnostics, diagnostic => diagnostic.category === DiagnosticCategory.Error);
|
||||
return hasError;
|
||||
@@ -2855,8 +2856,8 @@ module ts {
|
||||
emitOutputResult: undefined,
|
||||
};
|
||||
|
||||
// Initialize writter for CompilerHost.writeFile
|
||||
writter = function (fileName: string, data: string, writeByteOrderMark: boolean) {
|
||||
// Initialize writer for CompilerHost.writeFile
|
||||
writer = function (fileName: string, data: string, writeByteOrderMark: boolean) {
|
||||
var outputFile: OutputFile = {
|
||||
name: fileName,
|
||||
writeByteOrderMark: writeByteOrderMark,
|
||||
@@ -2893,8 +2894,8 @@ module ts {
|
||||
emitResult.emitOutputResult = EmitOutputResult.Succeeded;
|
||||
}
|
||||
|
||||
// Reset writter back to underfined to make sure that we produce an error message if CompilerHost.writeFile method is called when we are not in an emitting stage
|
||||
this.writter = undefined;
|
||||
// Reset writer back to underfined to make sure that we produce an error message if CompilerHost.writeFile method is called when we are not in an emitting stage
|
||||
this.writer = undefined;
|
||||
return emitResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -368,6 +368,7 @@ module ts {
|
||||
getDefaultLibFilename(): string {
|
||||
return this.shimHost.getDefaultLibFilename();
|
||||
}
|
||||
|
||||
getCurrentDirectory(): string {
|
||||
return this.shimHost.getCurrentDirectory();
|
||||
}
|
||||
|
||||
@@ -46,10 +46,10 @@ enum TypingFidelity {
|
||||
|
||||
// We have to duplicate EmitOutputResult from Services.ts to expose the enum to getEmitOutput testcases in fourslah
|
||||
enum EmitOutputResult {
|
||||
Succeeded,
|
||||
FailedBecauseOfSyntaxErrors,
|
||||
FailedBecauseOfCompilerOptionsErrors,
|
||||
FailedToGenerateDeclarationsBecauseOfSemanticErrors
|
||||
Succeeded,
|
||||
FailedBecauseOfSyntaxErrors,
|
||||
FailedBecauseOfCompilerOptionsErrors,
|
||||
FailedToGenerateDeclarationsBecauseOfSemanticErrors
|
||||
}
|
||||
|
||||
module FourSlashInterface {
|
||||
|
||||
Reference in New Issue
Block a user