Output auxiliaryCommentAfter before trail comment

Quick fix for the case where generated comment is the terminal leaf in a subtree that is followed by a trailing comment.

Partial for #3034
This commit is contained in:
kpdecker
2015-11-13 14:11:45 -06:00
parent d2e07cffb9
commit 1286200712
3 changed files with 10 additions and 4 deletions

View File

@@ -48,6 +48,9 @@ export default class Printer extends Buffer {
this._print(node, parent);
// Check again if any of our children may have left an aux comment on the stack
if (node.loc) this.printAuxAfterComment();
this.printTrailingComments(node, parent);
if (needsParens) this.push(")");

View File

@@ -9,6 +9,8 @@ import {foo as bar2} from "foo5";
export {test};
export var test = 5;
bar;
bar(foo);
/* my comment */
bar2;
foo;

View File

@@ -26,7 +26,8 @@ var _foo5 = require("foo5");
exports. /*after*/test = test;
var test = /*before*/exports. /*after*/test = 5;
/*before*/_foo4. /*after*/bar;
/*before*/(0, _foo4. /*after*/bar)( /*before*/_foo2.default) /*after*/;
/* my comment */
/*before*/_foo5. /*after*/foo;
/*before*/_foo2.default;
/*after*/
/*before*/_foo2.default; /*after*/