Skip to content

Commit

Permalink
fix: revert detect statement level sequence expression (#7071)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk authored Jul 8, 2024
1 parent 36673f2 commit 1593dbe
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -535,18 +535,18 @@ impl<'parser> JavascriptParser<'parser> {

fn walk_sequence_expression(&mut self, expr: &SeqExpr) {
let exprs = expr.exprs.iter().map(|expr| &**expr);
if self.is_statement_level_expression(expr.span())
&& let Some(old) = self.statement_path.pop()
{
for expr in exprs {
self.statement_path.push(expr.span().into());
self.walk_expression(expr);
self.statement_path.pop();
}
self.statement_path.push(old);
} else {
self.walk_expressions(exprs);
}
// if self.is_statement_level_expression(expr.span())
// && let Some(old) = self.statement_path.pop()
// {
// for expr in exprs {
// self.statement_path.push(expr.span().into());
// self.walk_expression(expr);
// self.statement_path.pop();
// }
// self.statement_path.push(old);
// } else {
self.walk_expressions(exprs);
// }
}

fn walk_object_expression(&mut self, expr: &ObjectLit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Asset Files
- Bundle: bundle.js
- Manifest: main.LAST_HASH.hot-update.json, size: 28
- Update: main.LAST_HASH.hot-update.js, size: 5180
- Update: main.LAST_HASH.hot-update.js, size: 5353

## Manifest

Expand Down Expand Up @@ -38,6 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
App: function() { return App; }
});
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */var preact_compat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! preact/compat */ "../../../../../../node_modules/preact/compat/dist/compat.js");
/* harmony import */var preact_compat__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(preact_compat__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */var preact_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! preact/hooks */ "../../../../../../node_modules/preact/hooks/dist/hooks.js");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Asset Files
- Bundle: bundle.js
- Manifest: main.LAST_HASH.hot-update.json, size: 28
- Update: main.LAST_HASH.hot-update.js, size: 5489
- Update: main.LAST_HASH.hot-update.js, size: 5662

## Manifest

Expand Down Expand Up @@ -38,6 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
App: function() { return App; }
});
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */var preact_compat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! preact/compat */ "../../../../../../node_modules/preact/compat/dist/compat.js");
/* harmony import */var preact_compat__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(preact_compat__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */var preact_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! preact/hooks */ "../../../../../../node_modules/preact/hooks/dist/hooks.js");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Asset Files
- Bundle: bundle.js
- Manifest: main.LAST_HASH.hot-update.json, size: 28
- Update: main.LAST_HASH.hot-update.js, size: 5502
- Update: main.LAST_HASH.hot-update.js, size: 5675

## Manifest

Expand Down Expand Up @@ -38,6 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
App: function() { return App; }
});
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */var preact_compat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! preact/compat */ "../../../../../../node_modules/preact/compat/dist/compat.js");
/* harmony import */var preact_compat__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(preact_compat__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */var preact_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! preact/hooks */ "../../../../../../node_modules/preact/hooks/dist/hooks.js");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Asset Files
- Bundle: bundle.js
- Manifest: main.LAST_HASH.hot-update.json, size: 28
- Update: main.LAST_HASH.hot-update.js, size: 4606
- Update: main.LAST_HASH.hot-update.js, size: 4779

## Manifest

Expand Down Expand Up @@ -39,6 +39,7 @@ __webpack_require__.d(__webpack_exports__, {
});
/* harmony import */var _swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @swc/helpers/_/_sliced_to_array */ "../../../../../../node_modules/@swc/helpers/esm/_sliced_to_array.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */var preact_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! preact/hooks */ "../../../../../../node_modules/preact/hooks/dist/hooks.js");
/* module decorator */ module = __webpack_require__.hmd(module);
/* provided dependency */ var __prefresh_utils__ = __webpack_require__(/*! ../../../../client/prefresh.cjs */ "../../../../client/prefresh.cjs");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Asset Files
- Bundle: bundle.js
- Manifest: main.LAST_HASH.hot-update.json, size: 28
- Update: main.LAST_HASH.hot-update.js, size: 4497
- Update: main.LAST_HASH.hot-update.js, size: 4670

## Manifest

Expand Down Expand Up @@ -39,6 +39,7 @@ __webpack_require__.d(__webpack_exports__, {
});
/* harmony import */var _swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @swc/helpers/_/_sliced_to_array */ "../../../../../../node_modules/@swc/helpers/esm/_sliced_to_array.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */var preact_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! preact/hooks */ "../../../../../../node_modules/preact/hooks/dist/hooks.js");
/* module decorator */ module = __webpack_require__.hmd(module);
/* provided dependency */ var __prefresh_utils__ = __webpack_require__(/*! ../../../../client/prefresh.cjs */ "../../../../client/prefresh.cjs");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Asset Files
- Bundle: bundle.js
- Manifest: main.LAST_HASH.hot-update.json, size: 28
- Update: main.LAST_HASH.hot-update.js, size: 3787
- Update: main.LAST_HASH.hot-update.js, size: 3960

## Manifest

Expand Down Expand Up @@ -38,6 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
App: function() { return App; }
});
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* module decorator */ module = __webpack_require__.hmd(module);
/* provided dependency */ var __prefresh_utils__ = __webpack_require__(/*! ../../../../client/prefresh.cjs */ "../../../../client/prefresh.cjs");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Asset Files
- Bundle: bundle.js
- Manifest: main.LAST_HASH.hot-update.json, size: 28
- Update: main.LAST_HASH.hot-update.js, size: 3787
- Update: main.LAST_HASH.hot-update.js, size: 3960

## Manifest

Expand Down Expand Up @@ -38,6 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
App: function() { return App; }
});
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* module decorator */ module = __webpack_require__.hmd(module);
/* provided dependency */ var __prefresh_utils__ = __webpack_require__(/*! ../../../../client/prefresh.cjs */ "../../../../client/prefresh.cjs");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Asset Files
- Bundle: bundle.js
- Manifest: main.LAST_HASH.hot-update.json, size: 28
- Update: main.LAST_HASH.hot-update.js, size: 7210
- Update: main.LAST_HASH.hot-update.js, size: 7556

## Manifest

Expand Down Expand Up @@ -40,6 +40,7 @@ __webpack_require__.d(__webpack_exports__, {
App: function() { return App; }
});
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */var _child__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./child */ "./child.jsx");
/* module decorator */ module = __webpack_require__.hmd(module);
/* provided dependency */ var __prefresh_utils__ = __webpack_require__(/*! ../../../../client/prefresh.cjs */ "../../../../client/prefresh.cjs");
Expand Down Expand Up @@ -143,6 +144,7 @@ __webpack_require__.d(__webpack_exports__, {
Child: function() { return Child; }
});
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* module decorator */ module = __webpack_require__.hmd(module);
/* provided dependency */ var __prefresh_utils__ = __webpack_require__(/*! ../../../../client/prefresh.cjs */ "../../../../client/prefresh.cjs");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Asset Files
- Bundle: bundle.js
- Manifest: main.LAST_HASH.hot-update.json, size: 28
- Update: main.LAST_HASH.hot-update.js, size: 3523
- Update: main.LAST_HASH.hot-update.js, size: 3696

## Manifest

Expand Down Expand Up @@ -38,6 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
Child: function() { return Child; }
});
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* module decorator */ module = __webpack_require__.hmd(module);
/* provided dependency */ var __prefresh_utils__ = __webpack_require__(/*! ../../../../client/prefresh.cjs */ "../../../../client/prefresh.cjs");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Asset Files
- Bundle: bundle.js
- Manifest: main.LAST_HASH.hot-update.json, size: 28
- Update: main.LAST_HASH.hot-update.js, size: 3810
- Update: main.LAST_HASH.hot-update.js, size: 3983

## Manifest

Expand Down Expand Up @@ -38,6 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
App: function() { return App; }
});
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* module decorator */ module = __webpack_require__.hmd(module);
/* provided dependency */ var __prefresh_utils__ = __webpack_require__(/*! ../../../../client/prefresh.cjs */ "../../../../client/prefresh.cjs");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Asset Files
- Bundle: bundle.js
- Manifest: main.LAST_HASH.hot-update.json, size: 28
- Update: main.LAST_HASH.hot-update.js, size: 3810
- Update: main.LAST_HASH.hot-update.js, size: 3983

## Manifest

Expand Down Expand Up @@ -38,6 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
App: function() { return App; }
});
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "../../../../../../node_modules/preact/compat/jsx-dev-runtime.js");
/* harmony import */var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* module decorator */ module = __webpack_require__.hmd(module);
/* provided dependency */ var __prefresh_utils__ = __webpack_require__(/*! ../../../../client/prefresh.cjs */ "../../../../client/prefresh.cjs");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const foo = function(f) {
f()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var s=0;
import { foo as b } from "./a";
b(()=>{s++}),b(()=>{s++}),b(()=>{s++}),b(()=>{
it("should generate correct code", () => {
expect(s).toBe(3)
})
})

2 comments on commit 1593dbe

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs ❌ failure
_selftest ✅ success
nx ✅ success
rspress ✅ success
rsbuild ✅ success
examples ✅ success

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-07-08 d14720d) Current Change
10000_development-mode + exec 2.16 s ± 25 ms 2.14 s ± 23 ms -0.55 %
10000_development-mode_hmr + exec 692 ms ± 2.9 ms 696 ms ± 11 ms +0.47 %
10000_production-mode + exec 2.73 s ± 23 ms 2.76 s ± 23 ms +1.15 %
arco-pro_development-mode + exec 1.91 s ± 87 ms 1.88 s ± 58 ms -1.25 %
arco-pro_development-mode_hmr + exec 435 ms ± 3.2 ms 435 ms ± 3.3 ms -0.05 %
arco-pro_production-mode + exec 3.42 s ± 95 ms 3.49 s ± 67 ms +1.84 %
threejs_development-mode_10x + exec 1.58 s ± 19 ms 1.6 s ± 15 ms +1.22 %
threejs_development-mode_10x_hmr + exec 798 ms ± 6.9 ms 822 ms ± 11 ms +3.13 %
threejs_production-mode_10x + exec 5.58 s ± 29 ms 5.6 s ± 23 ms +0.50 %

Please sign in to comment.