From 30c794bc07fbf2fa9b1f482ead8213cf1c43ce90 Mon Sep 17 00:00:00 2001 From: Dmitri Plotnikov Date: Fri, 24 Jul 2026 14:16:36 -0700 Subject: [PATCH] [Pratt Parser] Inline the ParsePrimary function PiperOrigin-RevId: 953551347 --- parser/internal/pratt_parser_worker.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/parser/internal/pratt_parser_worker.h b/parser/internal/pratt_parser_worker.h index 8f44979c4..b022ae9ee 100644 --- a/parser/internal/pratt_parser_worker.h +++ b/parser/internal/pratt_parser_worker.h @@ -24,6 +24,7 @@ #include #include +#include "absl/base/attributes.h" #include "absl/base/nullability.h" #include "absl/base/optimization.h" #include "absl/container/flat_hash_map.h" @@ -257,7 +258,7 @@ class PrattParserWorker : public ParserWorker { // Example (`(a + b)`): Consumes `(`, recurses to `ParseExpr()`, and expects // `)`. Example (`has(x.y)`): Consumes `has`, parses arguments `(x.y)`, and // expands the `has` macro. - ExprNode ParsePrimary(); + ABSL_ATTRIBUTE_ALWAYS_INLINE inline ExprNode ParsePrimary(); ExprNode ParseList(); ExprNode ParseMap(); @@ -621,7 +622,8 @@ ExprNode PrattParserWorker::ParseIdentOrCall() { // (`[...]`, `{...}`), and identifiers/global function calls (`foo`, // `has(x.y)`). template -ExprNode PrattParserWorker::ParsePrimary() { +ABSL_ATTRIBUTE_ALWAYS_INLINE inline ExprNode +PrattParserWorker::ParsePrimary() { ExprNode expr; TokenType tok_type = peek_token_.type; if (tok_type == TokenType::kLeftParen) {