This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 43e7676ba2 [Script] Remove deprecated attributes from Constant AST 
node (#18066)
43e7676ba2 is described below

commit 43e7676ba29d62baec7de9ab1dadf64de36060a8
Author: Siyuan Feng <hzfen...@sjtu.edu.cn>
AuthorDate: Tue Jun 17 20:25:27 2025 +0800

    [Script] Remove deprecated attributes from Constant AST node (#18066)
    
    [ARITH] Remove deprecated attributes from Constant AST node
    
    Remove the deprecated `s` and `n` attributes from the `Constant` AST node
    class in the script parser. These attributes were previously used for
    string and numeric constants but are no longer needed in the current
    AST implementation.
    
    Updated all code that creates `Constant` objects to remove the
    corresponding parameters:
    - Removed `s` and `n` parameters from `Constant.__init__`
    - Updated `_FIELDS` list to exclude deprecated attributes
    - Fixed calls in `evaluator.py` and `parser.py` to remove extra arguments
    
    This change simplifies the AST structure and removes unused legacy code.
---
 python/tvm/script/parser/core/doc.py       | 2 --
 python/tvm/script/parser/core/doc_core.py  | 6 ++----
 python/tvm/script/parser/core/evaluator.py | 2 --
 python/tvm/script/parser/tir/parser.py     | 2 --
 4 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/python/tvm/script/parser/core/doc.py 
b/python/tvm/script/parser/core/doc.py
index 1c5241dc8d..8b5c46e5a6 100644
--- a/python/tvm/script/parser/core/doc.py
+++ b/python/tvm/script/parser/core/doc.py
@@ -332,8 +332,6 @@ def _register_constant_handling():
             return doc.Constant(
                 value=getattr(x, f) if isinstance(f, str) else f(x),
                 kind=None,
-                s=None,
-                n=None,
                 lineno=x.lineno,
                 col_offset=x.col_offset,
                 end_lineno=x.lineno,
diff --git a/python/tvm/script/parser/core/doc_core.py 
b/python/tvm/script/parser/core/doc_core.py
index b88eef9a0e..37e6c18253 100644
--- a/python/tvm/script/parser/core/doc_core.py
+++ b/python/tvm/script/parser/core/doc_core.py
@@ -514,14 +514,12 @@ class JoinedStr(expr):
 
 
 class Constant(expr):
-    _FIELDS = ["value", "kind", "s", "n", "lineno", "col_offset", 
"end_lineno", "end_col_offset"]
+    _FIELDS = ["value", "kind", "lineno", "col_offset", "end_lineno", 
"end_col_offset"]
 
-    def __init__(self, value, kind, s, n, lineno, col_offset, end_lineno, 
end_col_offset):
+    def __init__(self, value, kind, lineno, col_offset, end_lineno, 
end_col_offset):
         super().__init__(lineno, col_offset, end_lineno, end_col_offset)
         self.value = value
         self.kind = kind
-        self.s = s
-        self.n = n
 
 
 class NamedExpr(expr):
diff --git a/python/tvm/script/parser/core/evaluator.py 
b/python/tvm/script/parser/core/evaluator.py
index 7a194c779d..f979bb84b1 100644
--- a/python/tvm/script/parser/core/evaluator.py
+++ b/python/tvm/script/parser/core/evaluator.py
@@ -204,8 +204,6 @@ class ExprEvaluator:
                         s.step = doc.Constant(
                             1,
                             None,
-                            1,
-                            1,
                             s.upper.lineno,
                             s.upper.end_col_offset + 1,
                             s.upper.lineno,
diff --git a/python/tvm/script/parser/tir/parser.py 
b/python/tvm/script/parser/tir/parser.py
index 9cc3e785fe..ed59606158 100644
--- a/python/tvm/script/parser/tir/parser.py
+++ b/python/tvm/script/parser/tir/parser.py
@@ -240,8 +240,6 @@ def visit_assign(self: Parser, node: doc.Assign) -> None:
                 s.step = doc.Constant(
                     1,
                     None,
-                    1,
-                    1,
                     s.upper.lineno,
                     s.upper.end_col_offset + 1,
                     s.upper.lineno,

Reply via email to