Commit fd67d0cb authored by Nils Braun's avatar Nils Braun

Make it possible to pass the type together with the index into...

Make it possible to pass the type together with the index into _index_type_code, as this is needed during type interference
parent 0ea33ac6
...@@ -66,7 +66,8 @@ def _index_access(index_code, indices): ...@@ -66,7 +66,8 @@ def _index_access(index_code, indices):
return ('[%s]' if len(indices) == 1 else '(%s)') % indexing return ('[%s]' if len(indices) == 1 else '(%s)') % indexing
def _index_type_code(idx): def _index_type_code(index_with_type):
idx, index_type = index_with_type
if idx.is_slice: if idx.is_slice:
if idx.step.is_none: if idx.step.is_none:
func = "contiguous_slice" func = "contiguous_slice"
...@@ -76,11 +77,11 @@ def _index_type_code(idx): ...@@ -76,11 +77,11 @@ def _index_type_code(idx):
n = 3 n = 3
return "pythonic::types::%s(%s)" % ( return "pythonic::types::%s(%s)" % (
func, ",".join(["0"]*n)) func, ",".join(["0"]*n))
elif idx.type.is_int: elif index_type.is_int:
return "std::declval<%s>()" % idx.type.sign_and_name() return "std::declval<%s>()" % index_type.sign_and_name()
elif idx.type.is_pythran_expr: elif index_type.is_pythran_expr:
return "std::declval<%s>()" % idx.type.pythran_type return "std::declval<%s>()" % index_type.pythran_type
raise ValueError("unsupported indexing type %s!" % idx.type) raise ValueError("unsupported indexing type %s!" % index_type)
def _index_code(idx): def _index_code(idx):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment