From e2947fac1c7c5c81549b72a85c48760116ae448f Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Wed, 7 Nov 2018 16:12:48 +0000 Subject: [PATCH 1/2] remove even more redundant internal comments --- src/compiler/binder.ts | 2 -- src/compiler/core.ts | 1 - src/compiler/sourcemapDecoder.ts | 2 -- src/compiler/tsbuild.ts | 20 ++++++++++---------- src/compiler/types.ts | 1 - src/compiler/watch.ts | 1 - src/jsTyping/jsTyping.ts | 3 --- src/jsTyping/shared.ts | 1 - src/server/project.ts | 2 +- src/server/scriptInfo.ts | 1 - src/server/scriptVersionCache.ts | 1 - src/server/utilities.ts | 2 -- src/services/formatting/formatting.ts | 1 - src/services/organizeImports.ts | 4 ++-- src/services/patternMatcher.ts | 4 ++-- src/services/suggestionDiagnostics.ts | 2 -- src/services/utilities.ts | 7 ------- 17 files changed, 15 insertions(+), 40 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index eae59db1bc686..3a2e3ff0b2a08 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2921,7 +2921,6 @@ namespace ts { } } - /* @internal */ export function isExportsOrModuleExportsOrAlias(sourceFile: SourceFile, node: Expression): boolean { return isExportsIdentifier(node) || isModuleExportsPropertyAccessExpression(node) || @@ -3898,7 +3897,6 @@ namespace ts { * For performance reasons, `computeTransformFlagsForNode` uses local constant values rather * than calling this function. */ - /* @internal */ export function getTransformFlagsSubtreeExclusions(kind: SyntaxKind) { if (kind >= SyntaxKind.FirstTypeNode && kind <= SyntaxKind.LastTypeNode) { return TransformFlags.TypeExcludes; diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 8c976cee9ee56..bbc9098407138 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -2052,7 +2052,6 @@ namespace ts { } /** Represents a "prefix*suffix" pattern. */ - /* @internal */ export interface Pattern { prefix: string; suffix: string; diff --git a/src/compiler/sourcemapDecoder.ts b/src/compiler/sourcemapDecoder.ts index dd0d65c809286..ef48c9d1c6904 100644 --- a/src/compiler/sourcemapDecoder.ts +++ b/src/compiler/sourcemapDecoder.ts @@ -150,14 +150,12 @@ namespace ts.sourcemaps { } } - /*@internal*/ export interface MappingsDecoder extends Iterator { readonly decodingIndex: number; readonly error: string | undefined; readonly lastSpan: SourceMapSpan; } - /*@internal*/ export function decodeMappings(map: SourceMapData): MappingsDecoder { const state: DecoderState = { encodedText: map.mappings, diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 4b9e75102b6af..9e1c7c1bf420b 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -22,9 +22,9 @@ namespace ts { force?: boolean; verbose?: boolean; - /*@internal*/ clean?: boolean; - /*@internal*/ watch?: boolean; - /*@internal*/ help?: boolean; + clean?: boolean; + watch?: boolean; + help?: boolean; preserveWatchOutput?: boolean; listEmittedFiles?: boolean; @@ -340,18 +340,18 @@ namespace ts { cleanAllProjects(): ExitStatus; // TODO:: All the below ones should technically only be in watch mode. but thats for later time - /*@internal*/ resolveProjectName(name: string): ResolvedConfigFileName; - /*@internal*/ getUpToDateStatusOfFile(configFileName: ResolvedConfigFileName): UpToDateStatus; - /*@internal*/ getBuildGraph(configFileNames: ReadonlyArray): DependencyGraph; + resolveProjectName(name: string): ResolvedConfigFileName; + getUpToDateStatusOfFile(configFileName: ResolvedConfigFileName): UpToDateStatus; + getBuildGraph(configFileNames: ReadonlyArray): DependencyGraph; - /*@internal*/ invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel): void; - /*@internal*/ buildInvalidatedProject(): void; + invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel): void; + buildInvalidatedProject(): void; - /*@internal*/ resetBuildContext(opts?: BuildOptions): void; + resetBuildContext(opts?: BuildOptions): void; } export interface SolutionBuilderWithWatch extends SolutionBuilder { - /*@internal*/ startWatching(): void; + startWatching(): void; } /** diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f5c996eed8787..91954352fda13 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5225,7 +5225,6 @@ namespace ts { useCaseSensitiveFileNames(): boolean; getCurrentDirectory(): string; - /* @internal */ isSourceFileFromExternalLibrary(file: SourceFile): boolean; getLibFileFromReference(ref: FileReference): SourceFile | undefined; diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 345991baefcf6..d7373b8d4dcc1 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -43,7 +43,6 @@ namespace ts { return false; } - /** @internal */ export const screenStartingMessageCodes: number[] = [ Diagnostics.Starting_compilation_in_watch_mode.code, Diagnostics.File_change_detected_Starting_incremental_compilation.code, diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index ad21068d578ef..379ca6491a61c 100644 --- a/src/jsTyping/jsTyping.ts +++ b/src/jsTyping/jsTyping.ts @@ -24,13 +24,11 @@ namespace ts.JsTyping { version: Version; } - /* @internal */ export function isTypingUpToDate(cachedTyping: CachedTyping, availableTypingVersions: MapLike) { const availableVersion = new Version(getProperty(availableTypingVersions, `ts${versionMajorMinor}`) || getProperty(availableTypingVersions, "latest")!); return availableVersion.compareTo(cachedTyping.version) <= 0; } - /* @internal */ export const nodeCoreModuleList: ReadonlyArray = [ "assert", "async_hooks", @@ -70,7 +68,6 @@ namespace ts.JsTyping { "zlib" ]; - /* @internal */ export const nodeCoreModules = arrayToSet(nodeCoreModuleList); /** diff --git a/src/jsTyping/shared.ts b/src/jsTyping/shared.ts index 78e9fe051b7e7..8dc4c02e9c444 100644 --- a/src/jsTyping/shared.ts +++ b/src/jsTyping/shared.ts @@ -34,7 +34,6 @@ namespace ts.server { : undefined; } - /*@internal*/ export function nowString() { // E.g. "12:34:56.789" const d = new Date(); diff --git a/src/server/project.ts b/src/server/project.ts index 89bac4060bb72..b2e7bb8e5c230 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -204,7 +204,7 @@ namespace ts.server { /*@internal*/ constructor( - /*@internal*/readonly projectName: string, + readonly projectName: string, readonly projectKind: ProjectKind, readonly projectService: ProjectService, private documentRegistry: DocumentRegistry, diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index ea029f3d9d0c6..4e3a67748ddb5 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -6,7 +6,6 @@ namespace ts.server { /* @internal */ export class TextStorage { - /*@internal*/ version: ScriptInfoVersion; /** diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index d7ac25062d021..0ffb3a195aded 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -382,7 +382,6 @@ namespace ts.server { } } - /* @internal */ export class LineIndex { root: LineNode; // set this to true to check each edit for accuracy diff --git a/src/server/utilities.ts b/src/server/utilities.ts index 4eac1730b7704..15b217822c0b6 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -208,13 +208,11 @@ namespace ts.server { const indentStr = "\n "; - /* @internal */ export function indent(str: string): string { return indentStr + str.replace(/\n/g, indentStr); } /** Put stringified JSON on the next line, indented. */ - /* @internal */ export function stringifyIndented(json: {}): string { return indentStr + JSON.stringify(json); } diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 215585f238ec1..a3acdbdafaa9c 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -334,7 +334,6 @@ namespace ts.formatting { return 0; } - /* @internal */ export function formatNodeGivenIndentation(node: Node, sourceFileLike: SourceFileLike, languageVariant: LanguageVariant, initialIndentation: number, delta: number, formatContext: FormatContext): TextChange[] { const range = { pos: 0, end: sourceFileLike.text.length }; return getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end, scanner => formatSpanWorker( diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index 460cb3dd5a282..9c504357102e8 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -146,7 +146,7 @@ namespace ts.OrganizeImports { : undefined; } - /* @internal */ // Internal for testing + // Internal for testing /** * @param importGroup a list of ImportDeclarations, all with the same module name. */ @@ -266,7 +266,7 @@ namespace ts.OrganizeImports { } } - /* @internal */ // Internal for testing + // Internal for testing /** * @param exportGroup a list of ExportDeclarations, all with the same module name. */ diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index f81900e28e75e..1020c97b432cc 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -461,11 +461,11 @@ namespace ts { }; } - /* @internal */ export function breakIntoCharacterSpans(identifier: string): TextSpan[] { + export function breakIntoCharacterSpans(identifier: string): TextSpan[] { return breakIntoSpans(identifier, /*word:*/ false); } - /* @internal */ export function breakIntoWordSpans(identifier: string): TextSpan[] { + export function breakIntoWordSpans(identifier: string): TextSpan[] { return breakIntoSpans(identifier, /*word:*/ true); } diff --git a/src/services/suggestionDiagnostics.ts b/src/services/suggestionDiagnostics.ts index b7b2ce8466df0..5c175146e3462 100644 --- a/src/services/suggestionDiagnostics.ts +++ b/src/services/suggestionDiagnostics.ts @@ -140,13 +140,11 @@ namespace ts { return !!forEachReturnStatement(body, isReturnStatementWithFixablePromiseHandler); } - /* @internal */ export function isReturnStatementWithFixablePromiseHandler(node: Node): node is ReturnStatement { return isReturnStatement(node) && !!node.expression && isFixablePromiseHandler(node.expression); } // Should be kept up to date with transformExpression in convertToAsyncFunction.ts - /* @internal */ export function isFixablePromiseHandler(node: Node): boolean { // ensure outermost call exists and is a promise handler if (!isPromiseHandler(node) || !node.arguments.every(isFixablePromiseArgument)) { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 61f6e6e60872c..91b18a015cc5c 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1410,7 +1410,6 @@ namespace ts { return node.modifiers && find(node.modifiers, m => m.kind === kind); } - /* @internal */ export function insertImport(changes: textChanges.ChangeTracker, sourceFile: SourceFile, importDecl: Statement): void { const lastImportDeclaration = findLast(sourceFile.statements, isAnyImportSyntax); if (lastImportDeclaration) { @@ -1598,7 +1597,6 @@ namespace ts { return displayPart("\n", SymbolDisplayPartKind.lineBreak); } - /* @internal */ export function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[] { try { writeDisplayParts(displayPartWriter); @@ -1751,7 +1749,6 @@ namespace ts { /** * Sets EmitFlags to suppress leading and trailing trivia on the node. */ - /* @internal */ export function suppressLeadingAndTrailingTrivia(node: Node) { suppressLeadingTrivia(node); suppressTrailingTrivia(node); @@ -1760,7 +1757,6 @@ namespace ts { /** * Sets EmitFlags to suppress leading trivia on the node. */ - /* @internal */ export function suppressLeadingTrivia(node: Node) { addEmitFlagsRecursively(node, EmitFlags.NoLeadingComments, getFirstChild); } @@ -1768,7 +1764,6 @@ namespace ts { /** * Sets EmitFlags to suppress trailing trivia on the node. */ - /* @internal */ export function suppressTrailingTrivia(node: Node) { addEmitFlagsRecursively(node, EmitFlags.NoTrailingComments, getLastChild); } @@ -1783,7 +1778,6 @@ namespace ts { return node.forEachChild(child => child); } - /* @internal */ export function getUniqueName(baseName: string, sourceFile: SourceFile): string { let nameText = baseName; for (let i = 1; !isFileLevelUniqueName(sourceFile, nameText); i++) { @@ -1797,7 +1791,6 @@ namespace ts { * to be on the reference, rather than the declaration, because it's closer to where the * user was before extracting it. */ - /* @internal */ export function getRenameLocation(edits: ReadonlyArray, renameFilename: string, name: string, preferLastLocation: boolean): number { let delta = 0; let lastPos = -1; From bcc4e648321f78a4ea75b2daf99c8742e1c2e61e Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Thu, 8 Nov 2018 23:36:54 +0100 Subject: [PATCH 2/2] revert changes to tsbuild.ts --- src/compiler/tsbuild.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 9e1c7c1bf420b..4b9e75102b6af 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -22,9 +22,9 @@ namespace ts { force?: boolean; verbose?: boolean; - clean?: boolean; - watch?: boolean; - help?: boolean; + /*@internal*/ clean?: boolean; + /*@internal*/ watch?: boolean; + /*@internal*/ help?: boolean; preserveWatchOutput?: boolean; listEmittedFiles?: boolean; @@ -340,18 +340,18 @@ namespace ts { cleanAllProjects(): ExitStatus; // TODO:: All the below ones should technically only be in watch mode. but thats for later time - resolveProjectName(name: string): ResolvedConfigFileName; - getUpToDateStatusOfFile(configFileName: ResolvedConfigFileName): UpToDateStatus; - getBuildGraph(configFileNames: ReadonlyArray): DependencyGraph; + /*@internal*/ resolveProjectName(name: string): ResolvedConfigFileName; + /*@internal*/ getUpToDateStatusOfFile(configFileName: ResolvedConfigFileName): UpToDateStatus; + /*@internal*/ getBuildGraph(configFileNames: ReadonlyArray): DependencyGraph; - invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel): void; - buildInvalidatedProject(): void; + /*@internal*/ invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel): void; + /*@internal*/ buildInvalidatedProject(): void; - resetBuildContext(opts?: BuildOptions): void; + /*@internal*/ resetBuildContext(opts?: BuildOptions): void; } export interface SolutionBuilderWithWatch extends SolutionBuilder { - startWatching(): void; + /*@internal*/ startWatching(): void; } /**