[前][次][番号順一覧][スレッド一覧]

ruby-changes:70207

From: Nobuyoshi <ko1@a...>
Date: Wed, 15 Dec 2021 01:52:27 +0900 (JST)
Subject: [ruby-changes:70207] 637c3cfc5d (master): Turn SET_LEX_STATE macro into an inline function call

https://git.ruby-lang.org/ruby.git/commit/?id=637c3cfc5d

From 637c3cfc5dc2c044c6eeb2793bf399b6745daa8b Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 15 Dec 2021 00:37:45 +0900
Subject: Turn SET_LEX_STATE macro into an inline function call

---
 parse.y | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/parse.y b/parse.y
index 2be892d5ec0..c57de18f97d 100644
--- a/parse.y
+++ b/parse.y
@@ -165,10 +165,8 @@ enum lex_state_e { https://github.com/ruby/ruby/blob/trunk/parse.y#L165
 #define IS_lex_state_all(ls)	IS_lex_state_all_for(p->lex.state, (ls))
 
 # define SET_LEX_STATE(ls) \
-    (p->lex.state = \
-     (p->debug ? \
-      rb_parser_trace_lex_state(p, p->lex.state, (ls), __LINE__) : \
-      (enum lex_state_e)(ls)))
+    parser_set_lex_state(p, ls, __LINE__)
+static inline enum lex_state_e parser_set_lex_state(struct parser_params *p, enum lex_state_e ls, int line);
 
 typedef VALUE stack_type;
 
@@ -10694,6 +10692,14 @@ new_regexp(struct parser_params *p, VALUE re, VALUE opt, const YYLTYPE *loc) https://github.com/ruby/ruby/blob/trunk/parse.y#L10692
 }
 #endif /* !RIPPER */
 
+static inline enum lex_state_e
+parser_set_lex_state(struct parser_params *p, enum lex_state_e ls, int line)
+{
+    if (p->debug) {
+	ls = rb_parser_trace_lex_state(p, p->lex.state, ls, line);
+    }
+    return p->lex.state = ls;
+}
 
 #ifndef RIPPER
 static const char rb_parser_lex_state_names[][8] = {
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]