Skip to content

Commit

Permalink
Fix placement of inserted semicolon when using SystemJS (#2529)
Browse files Browse the repository at this point in the history
* Fix ordering of inserted semicolons

* Update insertion of SystemJS export, revert change to semicolons
  • Loading branch information
kyle1320 authored and lukastaegert committed Oct 28, 2018
1 parent c4715ee commit 817580d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ast/nodes/AssignmentExpression.ts
Expand Up @@ -52,7 +52,7 @@ export default class AssignmentExpression extends NodeBase {
code.original.indexOf('=', this.left.end) + 1,
` exports('${this.left.variable.exportName}',`
);
code.prependRight(this.right.end, `)`);
code.appendLeft(this.right.end, `)`);
}
}
}
4 changes: 4 additions & 0 deletions test/form/samples/modify-export-semi/_config.js
@@ -0,0 +1,4 @@
module.exports = {
description: 'inserts semicolons correctly when modifying SystemJS exports',
formats: ['system']
};
12 changes: 12 additions & 0 deletions test/form/samples/modify-export-semi/_expected/system.js
@@ -0,0 +1,12 @@
System.register([], function (exports, module) {
'use strict';
return {
execute: function () {

let foo = exports('foo', 'foo');

foo = exports('foo', 'bar');

}
};
});
3 changes: 3 additions & 0 deletions test/form/samples/modify-export-semi/main.js
@@ -0,0 +1,3 @@
export let foo = 'foo'

foo = 'bar'

0 comments on commit 817580d

Please sign in to comment.