poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/5] pkl: Mark offset as literal if its components are literals


From: Mohammad-Reza Nabipoor
Subject: [PATCH 2/5] pkl: Mark offset as literal if its components are literals
Date: Sat, 22 Jan 2022 23:37:39 +0330

2022-01-22  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>

        * libpoke/pkl-ast.c (pkl_ast_make_offset): An offset value
        is literal if the magnitude and unit are also literals.
---
 ChangeLog         | 5 +++++
 libpoke/pkl-ast.c | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index fc088bc9..6c540dda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-22  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
+
+       * libpoke/pkl-ast.c (pkl_ast_make_offset): An offset value
+       is literal if the magnitude and unit are also literals.
+
 2022-01-22  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
 
        * libpoke/pkl-typify.c (pkl_typify1_ps_struct): Postpone type
diff --git a/libpoke/pkl-ast.c b/libpoke/pkl-ast.c
index a032bfc6..0bb9389f 100644
--- a/libpoke/pkl-ast.c
+++ b/libpoke/pkl-ast.c
@@ -1565,6 +1565,10 @@ pkl_ast_make_offset (pkl_ast ast,
   if (magnitude != NULL)
     PKL_AST_OFFSET_MAGNITUDE (offset) = ASTREF (magnitude);
   PKL_AST_OFFSET_UNIT (offset) = ASTREF (unit);
+  PKL_AST_LITERAL_P (offset)
+    = magnitude ? PKL_AST_LITERAL_P (PKL_AST_OFFSET_MAGNITUDE (offset))
+                    && PKL_AST_LITERAL_P (PKL_AST_OFFSET_UNIT (offset))
+                : 0;
 
   return offset;
 }
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]