Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion internal/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4384,14 +4384,21 @@ func (p *Printer) emitSourceFile(node *ast.SourceFile) {

p.writeLine()

state := p.emitDetachedCommentsBeforeStatementList(node.AsNode(), node.Statements.Loc)
p.pushNameGenerationScope(node.AsNode())
p.generateAllNames(node.Statements)

index := 0
var state *commentState
if node.ScriptKind != core.ScriptKindJSON {
p.emitShebangIfNeeded(node)
index = p.emitPrologueDirectives(node.Statements)
// Emit detached comments after prologue directives but before helpers
if !p.writer.IsAtStartOfLine() {
p.writeLine()
}
p.emitDetachedCommentsAndUpdateCommentsInfo(node.Statements.Loc)
emitFlags := p.emitContext.EmitFlags(node.AsNode())
state = &commentState{emitFlags, node.Statements.Loc, p.containerPos, p.containerEnd, p.declarationListContainerEnd}
p.emitHelpers(node.AsNode())
if node.IsDeclarationFile {
p.emitTripleSlashDirectives(node)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function test(param) {

//// [emitEndOfFileJSDocComments2.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** @typedef {number} A */
Object.defineProperty(exports, "__esModule", { value: true });
/**
* JSDoc comment for function
* @param {string} param - A string parameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ watchMain();

//// [APISample_Watch.js]
"use strict";
/*
* Note: This test is a public API sample. The sample sources can be found
* at: https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md#writing-an-incremental-program-watcher
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
const ts = require("typescript");
const formatHost = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
--- old.APISample_Watch.js
+++ new.APISample_Watch.js
@@= skipped -84, +84 lines =@@

//// [APISample_Watch.js]
"use strict";
-/*
- * Note: This test is a public API sample. The sample sources can be found
- * at: https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md#writing-an-incremental-program-watcher
- * Please log a "breaking change" issue for any API breaking change affecting this issue
- */
@@= skipped -90, +90 lines =@@
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
-var ts = require("typescript");
+const ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ watchMain();

//// [APISample_WatchWithDefaults.js]
"use strict";
/*
* Note: This test is a public API sample. This uses default sys interface without having to pass anything
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
const ts = require("typescript");
function watchMain() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
--- old.APISample_WatchWithDefaults.js
+++ new.APISample_WatchWithDefaults.js
@@= skipped -57, +57 lines =@@

//// [APISample_WatchWithDefaults.js]
"use strict";
-/*
- * Note: This test is a public API sample. This uses default sys interface without having to pass anything
- * Please log a "breaking change" issue for any API breaking change affecting this issue
- */
@@= skipped -62, +62 lines =@@
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
-var ts = require("typescript");
+const ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ watchMain();

//// [APISample_WatchWithOwnWatchHost.js]
"use strict";
/*
* Note: This test is a public API sample. This sample verifies creating abstract builder to watch list of root files
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
const ts = require("typescript");
function watchMain() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
--- old.APISample_WatchWithOwnWatchHost.js
+++ new.APISample_WatchWithOwnWatchHost.js
@@= skipped -64, +64 lines =@@

//// [APISample_WatchWithOwnWatchHost.js]
"use strict";
-/*
- * Note: This test is a public API sample. This sample verifies creating abstract builder to watch list of root files
- * Please log a "breaking change" issue for any API breaking change affecting this issue
- */
@@= skipped -69, +69 lines =@@
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
-var ts = require("typescript");
+const ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ compile(process.argv.slice(2), {

//// [APISample_compile.js]
"use strict";
/*
* Note: This test is a public API sample. The sample sources can be found
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.compile = compile;
const ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
--- old.APISample_compile.js
+++ new.APISample_compile.js
@@= skipped -47, +47 lines =@@

//// [APISample_compile.js]
"use strict";
-/*
- * Note: This test is a public API sample. The sample sources can be found
- * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler
- * Please log a "breaking change" issue for any API breaking change affecting this issue
- */
@@= skipped -54, +54 lines =@@
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.compile = compile;
-var ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ function getSomeOtherTags(node: ts.Node) {

//// [APISample_jsdoc.js]
"use strict";
/*
* Note: This test is a public API sample. The original sources can be found
* at: https://github.com/YousefED/typescript-json-schema
* https://github.com/vega/ts-json-schema-generator
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
const ts = require("typescript");
// excerpted from https://github.com/YousefED/typescript-json-schema
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
--- old.APISample_jsdoc.js
+++ new.APISample_jsdoc.js
@@= skipped -122, +122 lines =@@

//// [APISample_jsdoc.js]
"use strict";
-/*
- * Note: This test is a public API sample. The original sources can be found
- * at: https://github.com/YousefED/typescript-json-schema
- * https://github.com/vega/ts-json-schema-generator
- * Please log a "breaking change" issue for any API breaking change affecting this issue
- */
@@= skipped -129, +129 lines =@@
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
-var ts = require("typescript");
+const ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ fileNames.forEach(fileName => {

//// [APISample_linter.js]
"use strict";
/*
* Note: This test is a public API sample. The sample sources can be found
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.delint = delint;
const ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
--- old.APISample_linter.js
+++ new.APISample_linter.js
@@= skipped -73, +73 lines =@@

//// [APISample_linter.js]
"use strict";
-/*
- * Note: This test is a public API sample. The sample sources can be found
- * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter
- * Please log a "breaking change" issue for any API breaking change affecting this issue
- */
@@= skipped -80, +80 lines =@@
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.delint = delint;
-var ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export function createProgram(rootFiles: string[], compilerOptionsJson: string):

//// [APISample_parseConfig.js]
"use strict";
/*
* Note: This test is a public API sample. The sample sources can be found
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.createProgram = createProgram;
const ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
--- old.APISample_parseConfig.js
+++ new.APISample_parseConfig.js
@@= skipped -45, +45 lines =@@

//// [APISample_parseConfig.js]
"use strict";
-/*
- * Note: This test is a public API sample. The sample sources can be found
- * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler
- * Please log a "breaking change" issue for any API breaking change affecting this issue
- */
@@= skipped -52, +52 lines =@@
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.createProgram = createProgram;
-var ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ console.log(JSON.stringify(result));

//// [APISample_transform.js]
"use strict";
/*
* Note: This test is a public API sample. The sample sources can be found
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
const ts = require("typescript");
const source = "let x: string = 'string'";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
--- old.APISample_transform.js
+++ new.APISample_transform.js
@@= skipped -25, +25 lines =@@

//// [APISample_transform.js]
"use strict";
-/*
- * Note: This test is a public API sample. The sample sources can be found
- * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function
- * Please log a "breaking change" issue for any API breaking change affecting this issue
- */
@@= skipped -31, +31 lines =@@
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
-var ts = require("typescript");
+const ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS });

//// [APISample_watcher.js]
"use strict";
/*
* Note: This test is a public API sample. The sample sources can be found
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
const ts = require("typescript");
function watch(rootFileNames, options) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
--- old.APISample_watcher.js
+++ new.APISample_watcher.js
@@= skipped -120, +120 lines =@@

//// [APISample_watcher.js]
"use strict";
-/*
- * Note: This test is a public API sample. The sample sources can be found
- * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services
- * Please log a "breaking change" issue for any API breaking change affecting this issue
- */
@@= skipped -126, +126 lines =@@
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
Object.defineProperty(exports, "__esModule", { value: true });
-var ts = require("typescript");
+const ts = require("typescript");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ m1.f();

//// [amdDependencyComment1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
///<amd-dependency path='bar'/>
Object.defineProperty(exports, "__esModule", { value: true });
const m1 = require("m2");
m1.f();
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
--- old.amdDependencyComment1.js
+++ new.amdDependencyComment1.js
@@= skipped -7, +7 lines =@@

//// [amdDependencyComment1.js]
@@= skipped -9, +9 lines =@@
"use strict";
-///<amd-dependency path='bar'/>
///<amd-dependency path='bar'/>
Object.defineProperty(exports, "__esModule", { value: true });
-var m1 = require("m2");
+///<amd-dependency path='bar'/>
+const m1 = require("m2");
m1.f();
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ m1.f();

//// [amdDependencyCommentName1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
///<amd-dependency path='bar' name='b'/>
Object.defineProperty(exports, "__esModule", { value: true });
const m1 = require("m2");
m1.f();
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
--- old.amdDependencyCommentName1.js
+++ new.amdDependencyCommentName1.js
@@= skipped -7, +7 lines =@@

//// [amdDependencyCommentName1.js]
@@= skipped -9, +9 lines =@@
"use strict";
-///<amd-dependency path='bar' name='b'/>
///<amd-dependency path='bar' name='b'/>
Object.defineProperty(exports, "__esModule", { value: true });
-var m1 = require("m2");
+///<amd-dependency path='bar' name='b'/>
+const m1 = require("m2");
m1.f();
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ createInstance(MenuWorkbenchToolBar, {

//// [cachedContextualTypes.js]
"use strict";
// Repro from #52198
Object.defineProperty(exports, "__esModule", { value: true });
class MenuWorkbenchToolBar {
constructor(options) { }
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ a;
//// [checkJsdocTypeTagOnExportAssignment1.js]
//// [a.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @typedef {Object} Foo
* @property {boolean} a
* @property {boolean} b
*/
Object.defineProperty(exports, "__esModule", { value: true });
/** @type {Foo} */
exports.default = { c: false };
//// [b.js]
Expand Down
Loading
Loading