Skip to content

Commit

Permalink
wip - fix irnode.from_list
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Sep 21, 2023
1 parent 79303fc commit 563ffe4
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions vyper/codegen/ir_node.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import contextlib
import copy
import re
from enum import Enum, auto
from functools import cached_property
Expand Down Expand Up @@ -181,12 +182,14 @@ def __init__(
source_pos: Optional[Tuple[int, int]] = None,
annotation: Optional[str] = None,
error_msg: Optional[str] = None,
encoding: Encoding = None,
mutable: bool = True,
add_gas_estimate: int = 0,
encoding: Encoding = Encoding.VYPER,
):
if args is None:
args = []
if encoding is None:
encoding = Encoding.VYPER

self.value = value
self.args = args
Expand Down Expand Up @@ -596,26 +599,30 @@ def from_list(
error_msg: Optional[str] = None,
mutable: bool = True,
add_gas_estimate: int = 0,
encoding: Encoding = Encoding.VYPER,
encoding: Encoding = None,
) -> "IRnode":
if isinstance(typ, str):
raise CompilerPanic(f"Expected type, not string: {typ}")

if isinstance(obj, IRnode):
ret = copy.copy(obj)
# note: this modify-and-returnclause is a little weird since
# the input gets modified. CC 20191121.
if typ is not None:
obj.typ = typ
if obj.source_pos is None:
if source_pos is not None:
obj.source_pos = source_pos
if obj.location is None:
if location is not None:
obj.location = location
if obj.encoding is None:
if encoding is not None:
obj.encoding = encoding
if obj.error_msg is None:
if error_msg is not None:
obj.error_msg = error_msg
if add_gas_estimate != 0:
obj.add_gas_estimate = add_gas_estimate

return obj

elif not isinstance(obj, list):
return cls(
obj,
Expand Down

0 comments on commit 563ffe4

Please sign in to comment.