From 543b484ec52371faae2c0ecb8aeba28de5e3695f Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 3 Jun 2016 09:33:17 -0700 Subject: [PATCH] Remove trailing whitespace --- src/compiler/checker.ts | 18 +++++++++--------- src/compiler/declarationEmitter.ts | 6 +++--- src/compiler/sourcemap.ts | 2 +- src/compiler/utilities.ts | 4 ++-- src/harness/projectsRunner.ts | 2 +- src/harness/runnerbase.ts | 2 +- src/services/breakpoints.ts | 18 +++++++++--------- src/services/formatting/formattingScanner.ts | 4 ++-- src/services/formatting/rules.ts | 6 +++--- src/services/formatting/rulesMap.ts | 4 ++-- src/services/navigateTo.ts | 6 +++--- src/services/services.ts | 6 +++--- src/services/shims.ts | 4 ++-- src/services/signatureHelp.ts | 16 ++++++++-------- 14 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c538134e6d8..01945252e55 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11269,7 +11269,7 @@ namespace ts { const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol); const declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol); - // A private or protected constructor can only be instantiated within it's own class + // A private or protected constructor can only be instantiated within it's own class if (!isNodeWithinClass(node, declaringClassDeclaration)) { if (flags & NodeFlags.Private) { error(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); @@ -16132,12 +16132,12 @@ namespace ts { const symbol = getSymbolOfNode(node); const target = resolveAlias(symbol); if (target !== unknownSymbol) { - // For external modules symbol represent local symbol for an alias. + // For external modules symbol represent local symbol for an alias. // This local symbol will merge any other local declarations (excluding other aliases) // and symbol.flags will contains combined representation for all merged declaration. // Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have, - // otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export* - // in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names). + // otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export* + // in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names). const excludedMeanings = (symbol.flags & (SymbolFlags.Value | SymbolFlags.ExportValue) ? SymbolFlags.Value : 0) | (symbol.flags & SymbolFlags.Type ? SymbolFlags.Type : 0) | @@ -16336,7 +16336,7 @@ namespace ts { continue; } const { declarations, flags } = exports[id]; - // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. + // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. // (TS Exceptions: namespaces, function overloads, enums, and interfaces) if (flags & (SymbolFlags.Namespace | SymbolFlags.Interface | SymbolFlags.Enum)) { continue; @@ -17041,10 +17041,10 @@ namespace ts { } // Gets the type of object literal or array literal of destructuring assignment. - // { a } from + // { a } from // for ( { a } of elems) { // } - // [ a ] from + // [ a ] from // [a] = [ some array ...] function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr: Expression): Type { Debug.assert(expr.kind === SyntaxKind.ObjectLiteralExpression || expr.kind === SyntaxKind.ArrayLiteralExpression); @@ -17077,10 +17077,10 @@ namespace ts { } // Gets the property symbol corresponding to the property in destructuring assignment - // 'property1' from + // 'property1' from // for ( { property1: a } of elems) { // } - // 'property1' at location 'a' from: + // 'property1' at location 'a' from: // [a] = [ property1, property2 ] function getPropertySymbolOfDestructuringAssignment(location: Identifier) { // Get the type of the object or array literal and then look for property of given name in the type diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 397b135bf23..bda1c7c0cb6 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -95,7 +95,7 @@ namespace ts { // Emit reference in dts, if the file reference was not already emitted if (referencedFile && !contains(emittedReferencedFiles, referencedFile)) { // Add a reference to generated dts file, - // global file reference is added only + // global file reference is added only // - if it is not bundled emit (because otherwise it would be self reference) // - and it is not already added if (writeReferencePath(referencedFile, !isBundledEmit && !addedGlobalFileReference)) { @@ -148,7 +148,7 @@ namespace ts { if (!isBundledEmit && isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) { // if file was external module with augmentations - this fact should be preserved in .d.ts as well. - // in case if we didn't write any external module specifiers in .d.ts we need to emit something + // in case if we didn't write any external module specifiers in .d.ts we need to emit something // that will force compiler to think that this file is an external module - 'export {}' is a reasonable choice here. write("export {};"); writeLine(); @@ -766,7 +766,7 @@ namespace ts { function emitExternalModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration) { // emitExternalModuleSpecifier is usually called when we emit something in the.d.ts file that will make it an external module (i.e. import/export declarations). - // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered + // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' // so compiler will treat them as external modules. resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== SyntaxKind.ModuleDeclaration; diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 86bad38cb6e..cf7c3d1eaae 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -168,7 +168,7 @@ namespace ts { sourceMapData.sourceMapDecodedMappings[sourceMapData.sourceMapDecodedMappings.length - 1] : defaultLastEncodedSourceMapSpan; - // TODO: Update lastEncodedNameIndex + // TODO: Update lastEncodedNameIndex // Since we dont support this any more, lets not worry about it right now. // When we start supporting nameIndex, we will get back to this diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 74ea3459b23..d246b55556c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -302,8 +302,8 @@ namespace ts { return getTokenPosOfNode(node.jsDocComments[0]); } - // For a syntax list, it is possible that one of its children has JSDocComment nodes, while - // the syntax list itself considers them as normal trivia. Therefore if we simply skip + // For a syntax list, it is possible that one of its children has JSDocComment nodes, while + // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. if (node.kind === SyntaxKind.SyntaxList && (node)._children.length > 0) { diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index 60a0813b05d..64d07b1d88a 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -244,7 +244,7 @@ class ProjectRunner extends RunnerBase { mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? Harness.IO.resolvePath(testCase.mapRoot) : testCase.mapRoot, sourceRoot: testCase.resolveSourceRoot && testCase.sourceRoot ? Harness.IO.resolvePath(testCase.sourceRoot) : testCase.sourceRoot, module: moduleKind, - moduleResolution: ts.ModuleResolutionKind.Classic, // currently all tests use classic module resolution kind, this will change in the future + moduleResolution: ts.ModuleResolutionKind.Classic, // currently all tests use classic module resolution kind, this will change in the future }; // Set the values specified using json const optionNameMap: ts.Map = {}; diff --git a/src/harness/runnerbase.ts b/src/harness/runnerbase.ts index 81da0907714..a16eddcbeec 100644 --- a/src/harness/runnerbase.ts +++ b/src/harness/runnerbase.ts @@ -24,7 +24,7 @@ abstract class RunnerBase { abstract enumerateTestFiles(): string[]; - /** Setup the runner's tests so that they are ready to be executed by the harness + /** Setup the runner's tests so that they are ready to be executed by the harness * The first test should be a describe/it block that sets up the harness's compiler instance appropriately */ public abstract initializeTests(): void; diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 12b127ffd2d..fea4ae6bffa 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// @@ -19,8 +19,8 @@ namespace ts.BreakpointResolver { if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) { // Get previous token if the token is returned starts on new line // eg: let x =10; |--- cursor is here - // let y = 10; - // token at position will return let keyword on second line as the token but we would like to use + // let y = 10; + // token at position will return let keyword on second line as the token but we would like to use // token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line tokenAtLocation = findPrecedingToken(tokenAtLocation.pos, sourceFile); @@ -261,7 +261,7 @@ namespace ts.BreakpointResolver { } // Set breakpoint on identifier element of destructuring pattern - // a or ...c or d: x from + // a or ...c or d: x from // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern if ((node.kind === SyntaxKind.Identifier || node.kind == SyntaxKind.SpreadElementExpression || @@ -275,7 +275,7 @@ namespace ts.BreakpointResolver { const binaryExpression = node; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of - // [a, b, c] = expression or + // [a, b, c] = expression or // {a, b, c} = expression if (isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern( @@ -285,8 +285,8 @@ namespace ts.BreakpointResolver { if (binaryExpression.operatorToken.kind === SyntaxKind.EqualsToken && isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) { // Set breakpoint on assignment expression element of destructuring pattern - // a = expression of - // [a = expression, b, c] = someExpression or + // a = expression of + // [a = expression, b, c] = someExpression or // { a = expression, b, c } = someExpression return textSpan(node); } @@ -403,7 +403,7 @@ namespace ts.BreakpointResolver { const declarations = variableDeclaration.parent.declarations; if (declarations && declarations[0] !== variableDeclaration) { // If we cannot set breakpoint on this declaration, set it on previous one - // Because the variable declaration may be binding pattern and + // Because the variable declaration may be binding pattern and // we would like to set breakpoint in last binding element if that's the case, // use preceding token instead return spanInNode(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent)); @@ -549,7 +549,7 @@ namespace ts.BreakpointResolver { return spanInNode(firstBindingElement); } - // Could be ArrayLiteral from destructuring assignment or + // Could be ArrayLiteral from destructuring assignment or // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index ff003e08007..babf0db3fd5 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -268,9 +268,9 @@ namespace ts.formatting { return startPos < endPos && current !== SyntaxKind.EndOfFileToken && !isTrivia(current); } - // when containing node in the tree is token + // when containing node in the tree is token // but its kind differs from the kind that was returned by the scanner, - // then kind needs to be fixed. This might happen in cases + // then kind needs to be fixed. This might happen in cases // when parser interprets token differently, i.e keyword treated as identifier function fixTokenKind(tokenInfo: TokenInfo, container: Node): TokenInfo { if (isToken(container) && tokenInfo.token.kind !== container.kind) { diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 47a204a5b7e..b4916025af2 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -554,17 +554,17 @@ namespace ts.formatting { static IsSameLineTokenOrBeforeMultilineBlockContext(context: FormattingContext): boolean { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. //// - //// Ex: + //// Ex: //// if (1) { .... //// * ) and { are on the same line so apply the rule. Here we don't care whether it's same or multi block context //// - //// Ex: + //// Ex: //// if (1) //// { ... } //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we don't format. //// //// Ex: - //// if (1) + //// if (1) //// { ... //// } //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format. diff --git a/src/services/formatting/rulesMap.ts b/src/services/formatting/rulesMap.ts index 7f635ea07e3..703ca566bd2 100644 --- a/src/services/formatting/rulesMap.ts +++ b/src/services/formatting/rulesMap.ts @@ -95,9 +95,9 @@ namespace ts.formatting { //// 4- Context rules with any token combination //// 5- Non-context rules with specific token combination //// 6- Non-context rules with any token combination - //// + //// //// The member rulesInsertionIndexBitmap is used to describe the number of rules - //// in each sub-bucket (above) hence can be used to know the index of where to insert + //// in each sub-bucket (above) hence can be used to know the index of where to insert //// the next rule. It's a bitmap which contains 6 different sections each is given 5 bits. //// //// Example: diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index 49707263c1f..e9afb6925b5 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -9,7 +9,7 @@ namespace ts.NavigateTo { // This means "compare in a case insensitive manner." const baseSensitivity: Intl.CollatorOptions = { sensitivity: "base" }; - // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] + // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] forEach(program.getSourceFiles(), sourceFile => { cancellationToken.throwIfCancellationRequested(); @@ -17,7 +17,7 @@ namespace ts.NavigateTo { for (const name in nameToDeclarations) { const declarations = getProperty(nameToDeclarations, name); if (declarations) { - // First do a quick check to see if the name of the declaration matches the + // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. let matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); @@ -26,7 +26,7 @@ namespace ts.NavigateTo { } for (const declaration of declarations) { - // It was a match! If the pattern has dots in it, then also see if the + // It was a match! If the pattern has dots in it, then also see if the // declaration container matches as well. if (patternMatcher.patternContainsDots) { const containers = getContainers(declaration); diff --git a/src/services/services.ts b/src/services/services.ts index 90740b257c6..34b521b3496 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2657,7 +2657,7 @@ namespace ts { return false; } - /** + /** * Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 } */ function getContainingObjectLiteralElement(node: Node): ObjectLiteralElement { @@ -7604,11 +7604,11 @@ namespace ts { function isValidBraceCompletionAtPostion(fileName: string, position: number, openingBrace: number): boolean { - // '<' is currently not supported, figuring out if we're in a Generic Type vs. a comparison is too + // '<' is currently not supported, figuring out if we're in a Generic Type vs. a comparison is too // expensive to do during typing scenarios // i.e. whether we're dealing with: // var x = new foo<| ( with class foo{} ) - // or + // or // var y = 3 <| if (openingBrace === CharacterCodes.lessThan) { return false; diff --git a/src/services/shims.ts b/src/services/shims.ts index eb9c28ff7ac..94ff3367e3c 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -295,7 +295,7 @@ namespace ts { constructor(private shimHost: LanguageServiceShimHost) { // if shimHost is a COM object then property check will become method call with no arguments. - // 'in' does not have this effect. + // 'in' does not have this effect. if ("getModuleResolutionsForFile" in this.shimHost) { this.resolveModuleNames = (moduleNames: string[], containingFile: string) => { const resolutionsInFile = >JSON.parse(this.shimHost.getModuleResolutionsForFile(containingFile)); @@ -966,7 +966,7 @@ namespace ts { return this.forwardJSONCall( "getPreProcessedFileInfo('" + fileName + "')", () => { - // for now treat files as JavaScript + // for now treat files as JavaScript const result = preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); return { referencedFiles: this.convertFileReferences(result.referencedFiles), diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 53fb7a474a7..27077406489 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -3,9 +3,9 @@ namespace ts.SignatureHelp { // A partially written generic type expression is not guaranteed to have the correct syntax tree. the expression could be parsed as less than/greater than expression or a comma expression - // or some other combination depending on what the user has typed so far. For the purposes of signature help we need to consider any location after "<" as a possible generic type reference. - // To do this, the method will back parse the expression starting at the position required. it will try to parse the current expression as a generic type expression, if it did succeed it - // will return the generic identifier that started the expression (e.g. "foo" in "foo'. So, in the case where the last child is a comma, we increase the // arg count by one to compensate. // - // Note: this subtlety only applies to the last comma. If you had "Foo(a,," then - // we'll have: 'a' '' '' + // Note: this subtlety only applies to the last comma. If you had "Foo(a,," then + // we'll have: 'a' '' '' // That will give us 2 non-commas. We then add one for the last comma, givin us an // arg count of 3. const listChildren = argumentsList.getChildren();