Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions crates/oxc_parser/src/js/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,22 @@ impl<'a, C: Config> ParserImpl<'a, C> {
pub(crate) fn parse_lhs_expression_or_higher(&mut self) -> Expression<'a> {
let span = self.start_span();
let mut in_optional_chain = false;
let lhs = self.parse_member_expression_or_higher(&mut in_optional_chain);
let lhs = self.parse_call_expression_rest(span, lhs, &mut in_optional_chain);
// `MemberExpression`
let primary = self.parse_primary_expression();
let member_expression = self.parse_member_expression_rest(
span,
primary,
&mut in_optional_chain,
/* allow_optional_chain */ true,
);
// A fully-parsed `MemberExpression` only extends into a `LeftHandSideExpression` via
// `Arguments` (`(`) or an `OptionalChain` (`?.`); see <https://tc39.es/ecma262/#sec-left-hand-side-expressions>.
// So skip `parse_call_expression_rest` (and its redundant member-rest re-scan) otherwise.
let lhs = if matches!(self.cur_kind(), Kind::LParen | Kind::QuestionDot) {
self.parse_call_expression_rest(span, member_expression, &mut in_optional_chain)
} else {
member_expression
};
if !in_optional_chain {
return lhs;
}
Expand Down Expand Up @@ -763,21 +777,6 @@ impl<'a, C: Config> ParserImpl<'a, C> {
}
}

/// Section 13.3 Member Expression
fn parse_member_expression_or_higher(
&mut self,
in_optional_chain: &mut bool,
) -> Expression<'a> {
let span = self.start_span();
let lhs = self.parse_primary_expression();
self.parse_member_expression_rest(
span,
lhs,
in_optional_chain,
/* allow_optional_chain */ true,
)
}

/// Section 13.3 Super Call
fn parse_super(&mut self) -> Expression<'a> {
let span = self.start_span();
Expand Down
8 changes: 4 additions & 4 deletions tasks/track_memory_allocations/allocs_parser.snap
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
File | File size || Sys allocs | Sys reallocs || Arena allocs | Arena reallocs
---------------------------------------------------------------------------------------------------------------------------
checker.ts | 2.92 MB || 5303 | 10 || 265746 | 22860
checker.ts | 2.92 MB || 2725 | 10 || 264366 | 22860

App.tsx | 415.34 kB || 632 | 13 || 44517 | 3538
App.tsx | 415.34 kB || 520 | 13 || 44464 | 3537

RadixUIAdoptionSection.jsx | 2.52 kB || 1 | 0 || 367 | 66

pdf.mjs | 567.30 kB || 518 | 67 || 90583 | 8153

antd.js | 6.69 MB || 5392 | 221 || 528577 | 55355

binder.ts | 193.08 kB || 281 | 0 || 16699 | 1476
binder.ts | 193.08 kB || 141 | 0 || 16620 | 1476

kitchen-sink.tsx | 732.90 kB || 5027 | 160 || 139162 | 11919
kitchen-sink.tsx | 732.90 kB || 2991 | 160 || 138059 | 11905

Loading