esrap 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/handlers.js +17 -7
package/package.json
CHANGED
package/src/handlers.js
CHANGED
|
@@ -656,16 +656,26 @@ const shared = {
|
|
|
656
656
|
* @param {State} state
|
|
657
657
|
*/
|
|
658
658
|
'BlockStatement|ClassBody': (node, state) => {
|
|
659
|
-
if (node.
|
|
660
|
-
|
|
661
|
-
|
|
659
|
+
if (node.loc) {
|
|
660
|
+
const { line, column } = node.loc.start;
|
|
661
|
+
state.commands.push(l(line, column), '{', l(line, column + 1));
|
|
662
|
+
} else {
|
|
663
|
+
state.commands.push('{');
|
|
662
664
|
}
|
|
663
665
|
|
|
664
|
-
|
|
666
|
+
if (node.body.length > 0) {
|
|
667
|
+
state.multiline = true;
|
|
668
|
+
state.commands.push(indent, newline);
|
|
669
|
+
handle_body(node.body, state);
|
|
670
|
+
state.commands.push(dedent, newline);
|
|
671
|
+
}
|
|
665
672
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
673
|
+
if (node.loc) {
|
|
674
|
+
const { line, column } = node.loc.end;
|
|
675
|
+
state.commands.push(l(line, column - 1), '}', l(line, column));
|
|
676
|
+
} else {
|
|
677
|
+
state.commands.push('}');
|
|
678
|
+
}
|
|
669
679
|
},
|
|
670
680
|
|
|
671
681
|
/**
|