Permalink
Browse files
Move comment to where it belongs.
- Loading branch information...
Showing
with
7 additions
and
19 deletions.
-
+1
−17
core/expr_eval.py
-
+6
−2
core/state.py
|
|
@@ -102,23 +102,7 @@ def _StringToInteger(s, word=None): |
|
|
|
|
|
|
|
|
def _ValToArith(val, word=None):
|
|
|
"""Convert runtime.value to Python int or list.
|
|
|
|
|
|
NOTE: We could have a runtime.arith_value and get rid of the isinstance()
|
|
|
check. But this means our array indexing is lazy, which I think is fine.
|
|
|
|
|
|
PROBLEM: array[1000000]=1 could use up a lot of memory.
|
|
|
|
|
|
But I think that is OK, at least until there's evidence that people want
|
|
|
to use arrays that way.
|
|
|
|
|
|
But what about hash tables? That should be a separate type.
|
|
|
|
|
|
Representation could be:
|
|
|
|
|
|
['1', 2, 3, None, None, '4', None]
|
|
|
Then length counts the entries that are not None.
|
|
|
"""
|
|
|
"""Convert runtime.value to a Python int or list of strings."""
|
|
|
assert isinstance(val, runtime.value), '%r %r' % (val, type(val))
|
|
|
if val.tag == value_e.Undef:
|
|
|
return 0
|
|
|
|
|
|
@@ -375,9 +375,13 @@ def SetVar(self, lval, value, new_flags, lookup_mode): |
|
|
try:
|
|
|
strs[lval.index] = value.s
|
|
|
except IndexError:
|
|
|
# TODO: strict-array won't support this. For Oil arrays.
|
|
|
# Fill it in with None. It could look like this:
|
|
|
# ['1', 2, 3, None, None, '4', None]
|
|
|
# Then ${#a[@]} counts the entries that are not None.
|
|
|
#
|
|
|
# TODO: strict-array for Oil arrays won't auto-fill.
|
|
|
n = len(strs) - lval.index + 1
|
|
|
strs.extend([None] * n) # Fill it in with None
|
|
|
strs.extend([None] * n)
|
|
|
strs[lval.index] = value.s
|
|
|
else:
|
|
|
# TODO:
|
|
|
|
0 comments on commit
0d3f679