Skip to content

Commit 30c794b

Browse files
dmitriplotnikovcopybara-github
authored andcommitted
[Pratt Parser] Inline the ParsePrimary function
PiperOrigin-RevId: 953551347
1 parent 155ad1e commit 30c794b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

parser/internal/pratt_parser_worker.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <utility>
2525
#include <vector>
2626

27+
#include "absl/base/attributes.h"
2728
#include "absl/base/nullability.h"
2829
#include "absl/base/optimization.h"
2930
#include "absl/container/flat_hash_map.h"
@@ -257,7 +258,7 @@ class PrattParserWorker : public ParserWorker {
257258
// Example (`(a + b)`): Consumes `(`, recurses to `ParseExpr()`, and expects
258259
// `)`. Example (`has(x.y)`): Consumes `has`, parses arguments `(x.y)`, and
259260
// expands the `has` macro.
260-
ExprNode ParsePrimary();
261+
ABSL_ATTRIBUTE_ALWAYS_INLINE inline ExprNode ParsePrimary();
261262

262263
ExprNode ParseList();
263264
ExprNode ParseMap();
@@ -621,7 +622,8 @@ ExprNode PrattParserWorker<ExprNode>::ParseIdentOrCall() {
621622
// (`[...]`, `{...}`), and identifiers/global function calls (`foo`,
622623
// `has(x.y)`).
623624
template <typename ExprNode>
624-
ExprNode PrattParserWorker<ExprNode>::ParsePrimary() {
625+
ABSL_ATTRIBUTE_ALWAYS_INLINE inline ExprNode
626+
PrattParserWorker<ExprNode>::ParsePrimary() {
625627
ExprNode expr;
626628
TokenType tok_type = peek_token_.type;
627629
if (tok_type == TokenType::kLeftParen) {

0 commit comments

Comments
 (0)