diff --git a/pkg/printer/printer.go b/pkg/printer/printer.go index ecd386cf..75c11981 100644 --- a/pkg/printer/printer.go +++ b/pkg/printer/printer.go @@ -4272,9 +4272,10 @@ func (p *Printer) emitPropertyAssignment(node *ast.PropertyAssignment) { // "comment1" is not considered to be leading comment for node.initializer // but rather a trailing comment on the previous node. initializer := node.Initializer - - // !!! emit trailing comments of initializer - + if p.emitContext.EmitFlags(initializer)&EFNoLeadingComments == 0 { + commentRange := getCommentRange(initializer) + p.emitTrailingComments(commentRange.Pos(), commentSeparatorAfter) + } p.emitExpression(initializer, ast.OperatorPrecedenceDisallowComma) p.exitNode(node.AsNode(), state) } diff --git a/testdata/baselines/reference/submodule/compiler/commentsBeforeFunctionExpression1.js b/testdata/baselines/reference/submodule/compiler/commentsBeforeFunctionExpression1.js index 7af390fb..ead9db1f 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsBeforeFunctionExpression1.js +++ b/testdata/baselines/reference/submodule/compiler/commentsBeforeFunctionExpression1.js @@ -8,5 +8,5 @@ var v = { //// [commentsBeforeFunctionExpression1.js] var v = { - f: (a) => 0 + f: /**own f*/ (a) => 0 }; diff --git a/testdata/baselines/reference/submodule/compiler/commentsBeforeFunctionExpression1.js.diff b/testdata/baselines/reference/submodule/compiler/commentsBeforeFunctionExpression1.js.diff deleted file mode 100644 index c8222c9e..00000000 --- a/testdata/baselines/reference/submodule/compiler/commentsBeforeFunctionExpression1.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.commentsBeforeFunctionExpression1.js -+++ new.commentsBeforeFunctionExpression1.js -@@= skipped -7, +7 lines =@@ - - //// [commentsBeforeFunctionExpression1.js] - var v = { -- f: /**own f*/ (a) => 0 -+ f: (a) => 0 - }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsInterface.js b/testdata/baselines/reference/submodule/compiler/commentsInterface.js index ee3059a0..b9c26537 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsInterface.js +++ b/testdata/baselines/reference/submodule/compiler/commentsInterface.js @@ -91,7 +91,7 @@ var i2_i_nc_fnfoo = i2_i.nc_fnfoo; var i2_i_nc_fnfoo_r = i2_i.nc_fnfoo(10); var i3_i; i3_i = { - f: (/**i3_i a*/ a) => "Hello" + a, + f: /**own f*/ (/**i3_i a*/ a) => "Hello" + a, l: this.f, /** own x*/ x: this.f(10), diff --git a/testdata/baselines/reference/submodule/compiler/commentsInterface.js.diff b/testdata/baselines/reference/submodule/compiler/commentsInterface.js.diff deleted file mode 100644 index 0b90da52..00000000 --- a/testdata/baselines/reference/submodule/compiler/commentsInterface.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.commentsInterface.js -+++ new.commentsInterface.js -@@= skipped -90, +90 lines =@@ - var i2_i_nc_fnfoo_r = i2_i.nc_fnfoo(10); - var i3_i; - i3_i = { -- f: /**own f*/ (/**i3_i a*/ a) => "Hello" + a, -+ f: (/**i3_i a*/ a) => "Hello" + a, - l: this.f, - /** own x*/ - x: this.f(10), \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnPropertyOfObjectLiteral1.js b/testdata/baselines/reference/submodule/compiler/commentsOnPropertyOfObjectLiteral1.js index 53eaf982..9a7518f8 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnPropertyOfObjectLiteral1.js +++ b/testdata/baselines/reference/submodule/compiler/commentsOnPropertyOfObjectLiteral1.js @@ -17,8 +17,8 @@ var resolve = { //// [commentsOnPropertyOfObjectLiteral1.js] var resolve = { - id: (details) => details.id, - id1: "hello", + id: /*! @ngInject */ (details) => details.id, + id1: /* c1 */ "hello", id2: /*! @ngInject */ (details) => details.id, id3: diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnPropertyOfObjectLiteral1.js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnPropertyOfObjectLiteral1.js.diff deleted file mode 100644 index 90ad646a..00000000 --- a/testdata/baselines/reference/submodule/compiler/commentsOnPropertyOfObjectLiteral1.js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.commentsOnPropertyOfObjectLiteral1.js -+++ new.commentsOnPropertyOfObjectLiteral1.js -@@= skipped -16, +16 lines =@@ - - //// [commentsOnPropertyOfObjectLiteral1.js] - var resolve = { -- id: /*! @ngInject */ (details) => details.id, -- id1: /* c1 */ "hello", -+ id: (details) => details.id, -+ id1: "hello", - id2: - /*! @ngInject */ (details) => details.id, - id3: \ No newline at end of file diff --git a/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js b/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js index 83977174..89ed6551 100644 --- a/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js +++ b/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js @@ -207,7 +207,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.getVar = getVar; const index_1 = require("../sub-project/index"); const variable = { - key: 'value', + key: /** @type {MyNominal} */ 'value', }; /** * @return {keyof typeof variable}