Skip to content

Commit 156bee8

Browse files
committed
fix: Big-endian support does not work with optimizations
1 parent caabcdb commit 156bee8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/acorn-optimizer.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,9 +1219,10 @@ function isGrowHEAPAccess(node) {
12191219
if (
12201220
node.type !== 'MemberExpression' ||
12211221
!node.computed || // notice a[X] but not a.X
1222-
node.object.type !== 'ParenthesizedExpression')
1222+
(node.object.type !== 'ParenthesizedExpression' && node.object.type !== 'SequenceExpression')
1223+
)
12231224
return false;
1224-
const obj = node.object.expression;
1225+
const obj = node.object.type === 'ParenthesizedExpression' ? node.object.expression : node.object;
12251226
return (
12261227
obj.type === 'SequenceExpression' &&
12271228
obj.expressions.length === 2 &&

0 commit comments

Comments
 (0)