From 0eea288cb81251c1f36453ba55e6658a6678f30e Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Sat, 28 Oct 2023 12:43:48 -0400 Subject: [PATCH] add more review comments, OrderedSet hygiene --- vyper/ir/ir_to_bb_pass.py | 8 ++++++-- vyper/utils.py | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/vyper/ir/ir_to_bb_pass.py b/vyper/ir/ir_to_bb_pass.py index 8c7c8f2442..20587b5003 100644 --- a/vyper/ir/ir_to_bb_pass.py +++ b/vyper/ir/ir_to_bb_pass.py @@ -243,14 +243,17 @@ def _convert_ir_basicblock( frame_info = ir.passthrough_metadata.get("frame_info", None) if frame_info is not None: - vars = {v: True for v in frame_info.frame_vars.values()} # FIXME - variables |= vars + local_vars = OrderedSet(frame_info.frame_vars.values()) + variables |= local_vars + + assert isinstance(variables, OrderedSet) if ir.value in BINARY_IR_INSTRUCTIONS: return _convert_binary_op( ctx, ir, symbols, variables, allocated_variables, ir.value in ["sha3_64"] ) + # REVIEW: no need for .keys() elif ir.value in MAPPED_IR_INSTRUCTIONS.keys(): org_value = ir.value ir.value = MAPPED_IR_INSTRUCTIONS[ir.value] @@ -261,6 +264,7 @@ def _convert_ir_basicblock( elif ir.value in ["iszero", "ceil32", "calldataload", "extcodesize", "extcodehash", "balance"]: return _convert_ir_simple_node(ctx, ir, symbols, variables, allocated_variables) + # REVIEW: make this a global constant elif ir.value in [ "chainid", "basefee", diff --git a/vyper/utils.py b/vyper/utils.py index db5ec2c8c7..5018fc7192 100644 --- a/vyper/utils.py +++ b/vyper/utils.py @@ -44,7 +44,10 @@ def difference(self, other): return ret def union(self, other): - return self.__class__(self | other) + return self | other + + def __or__(self, other): + return self.__class__(super().__or__(other)) def copy(self): return self.__class__(super().copy())