Skip to content

Commit 6d4c09c

Browse files
authored
refactor[ux]: remove deprecated VyperNode properties (#3999)
This commit removes the `n` property from `Num` vyper node and the `s` property from `Str` vyper node as they have been deprecated in the python AST (and it is clearer to use the `value` property anyways)
1 parent ef2d535 commit 6d4c09c

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

vyper/ast/nodes.py

-10
Original file line numberDiff line numberDiff line change
@@ -788,11 +788,6 @@ class Num(Constant):
788788
# inherited class for all numeric constant node types
789789
__slots__ = ()
790790

791-
@property
792-
def n(self):
793-
# TODO phase out use of Num.n and remove this
794-
return self.value
795-
796791
def validate(self):
797792
if self.value < SizeLimits.MIN_INT256:
798793
raise OverflowException("Value is below lower bound for all numeric types", self)
@@ -894,11 +889,6 @@ def validate(self):
894889
if ord(c) >= 256:
895890
raise InvalidLiteral(f"'{c}' is not an allowed string literal character", self)
896891

897-
@property
898-
def s(self):
899-
# TODO phase out use of Str.s and remove this
900-
return self.value
901-
902892

903893
class Bytes(Constant):
904894
__slots__ = ()

vyper/codegen/expr.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(self, node, context, is_stmt=False):
8989

9090
def parse_Int(self):
9191
typ = self.expr._metadata["type"]
92-
return IRnode.from_list(self.expr.n, typ=typ)
92+
return IRnode.from_list(self.expr.value, typ=typ)
9393

9494
def parse_Decimal(self):
9595
val = self.expr.value * DECIMAL_DIVISOR
@@ -133,8 +133,8 @@ def parse_Str(self):
133133

134134
# Byte literals
135135
def parse_Bytes(self):
136-
bytez = self.expr.s
137-
bytez_length = len(self.expr.s)
136+
bytez = self.expr.value
137+
bytez_length = len(self.expr.value)
138138
typ = BytesT(bytez_length)
139139
return self._make_bytelike(typ, bytez, bytez_length)
140140

@@ -345,7 +345,7 @@ def parse_Subscript(self):
345345
elif is_tuple_like(sub.typ):
346346
# should we annotate expr.slice in the frontend with the
347347
# folded value instead of calling reduced() here?
348-
index = self.expr.slice.reduced().n
348+
index = self.expr.slice.reduced().value
349349
# note: this check should also happen in get_element_ptr
350350
if not 0 <= index < len(sub.typ.member_types):
351351
raise TypeCheckFailure("unreachable")

0 commit comments

Comments
 (0)