Skip to content

Commit

Permalink
fix more codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Jan 7, 2024
1 parent ef7841f commit 1caba88
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions vyper/codegen/stmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
)
from vyper.semantics.types import DArrayT, MemberFunctionT
from vyper.semantics.types.function import ContractFunctionT
from vyper.semantics.types.shortcuts import INT256_T, UINT256_T
from vyper.semantics.types.shortcuts import UINT256_T


class Stmt:
Expand Down Expand Up @@ -231,11 +231,8 @@ def parse_For(self):
return self._parse_For_list()

def _parse_For_range(self):
# TODO make sure type always gets annotated
if "type" in self.stmt.target._metadata:
iter_typ = self.stmt.target._metadata["type"]
else:
iter_typ = INT256_T
assert "type" in self.stmt.target.target._metadata
iter_typ = self.stmt.target.target._metadata["type"]

# Get arg0
for_iter: vy_ast.Call = self.stmt.iter
Expand Down Expand Up @@ -271,7 +268,7 @@ def _parse_For_range(self):
raise TypeCheckFailure("unreachable: unchecked 0 bound")

varname = self.stmt.target.target.id
i = IRnode.from_list(self.context.fresh_varname("range_ix"), typ=UINT256_T)
i = IRnode.from_list(self.context.fresh_varname("range_ix"), typ=iter_typ)
iptr = self.context.new_variable(varname, iter_typ)

self.context.forvars[varname] = True
Expand Down

0 comments on commit 1caba88

Please sign in to comment.