Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

refactor[lang]: remove translated fields for constant nodes #4287

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions vyper/ast/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,6 @@ class DocStr(VyperNode):
"""

__slots__ = ("value",)
_translated_fields = {"s": "value"}


class arguments(VyperNode):
Expand Down Expand Up @@ -887,7 +886,6 @@ def bytes_value(self):

class Str(Constant):
__slots__ = ()
_translated_fields = {"s": "value"}

def validate(self):
for c in self.value:
Expand All @@ -897,7 +895,6 @@ def validate(self):

class Bytes(Constant):
__slots__ = ()
_translated_fields = {"s": "value"}

def __init__(self, parent: Optional["VyperNode"] = None, **kwargs: dict):
super().__init__(parent, **kwargs)
Expand All @@ -911,14 +908,9 @@ def to_dict(self):
ast_dict["value"] = f"0x{self.value.hex()}"
return ast_dict

@property
def s(self):
return self.value


class HexBytes(Constant):
__slots__ = ()
_translated_fields = {"s": "value"}

def __init__(self, parent: Optional["VyperNode"] = None, **kwargs: dict):
super().__init__(parent, **kwargs)
Expand All @@ -930,10 +922,6 @@ def to_dict(self):
ast_dict["value"] = f"0x{self.value.hex()}"
return ast_dict

@property
def s(self):
return self.value


class List(ExprNode):
__slots__ = ("elements",)
Expand Down
19 changes: 4 additions & 15 deletions vyper/ast/nodes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ class ExprNode(VyperNode):
class Constant(ExprNode):
value: Any = ...

class Num(Constant):
@property
def n(self): ...
class Num(Constant): ...

class Int(Num):
value: int = ...
Expand All @@ -123,18 +121,9 @@ class Hex(Num):
@property
def n_bytes(self): ...

class Str(Constant):
@property
def s(self): ...

class Bytes(Constant):
@property
def s(self): ...

class HexBytes(Constant):
@property
def s(self): ...
charles-cooper marked this conversation as resolved.
Show resolved Hide resolved

class Str(Constant): ...
class Bytes(Constant): ...
class HexBytes(Constant): ...
class NameConstant(Constant): ...
class Ellipsis(Constant): ...

Expand Down
Loading