esrap 1.0.1 → 1.0.3
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 +3 -1
package/package.json
CHANGED
package/src/handlers.js
CHANGED
|
@@ -186,7 +186,7 @@ function needs_parens(node, parent, is_right) {
|
|
|
186
186
|
/** @param {import('estree').Node} node */
|
|
187
187
|
function has_call_expression(node) {
|
|
188
188
|
while (node) {
|
|
189
|
-
if (node.type
|
|
189
|
+
if (node.type === 'CallExpression') {
|
|
190
190
|
return true;
|
|
191
191
|
} else if (node.type === 'MemberExpression') {
|
|
192
192
|
node = node.object;
|
|
@@ -408,6 +408,8 @@ const shared = {
|
|
|
408
408
|
* @param {import('./types').State} state
|
|
409
409
|
*/
|
|
410
410
|
'BlockStatement|ClassBody': (node, state) => {
|
|
411
|
+
if (node.body.length === 0) return [c('{}')];
|
|
412
|
+
|
|
411
413
|
return [
|
|
412
414
|
c(`{\n${state.indent}\t`),
|
|
413
415
|
...handle_body(node.body, { ...state, indent: state.indent + '\t' }),
|