Skip to content

Commit

Permalink
[refactor] Make note of place for decaying
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Chu committed Jul 13, 2019
1 parent 1a27c13 commit 714a80b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions osh/word_eval.py
Expand Up @@ -613,8 +613,7 @@ def _EvalBracedVarSub(self, part, part_vals, quoted):
op_id = part.bracket_op.op_id

if op_id == Id.Lit_At:
if not quoted:
maybe_decay_array = True # ${a[@]} decays but "${a[@]}" doesn't
maybe_decay_array = not quoted # ${a[@]} decays but "${a[@]}" doesn't
if val.tag == value_e.Undef:
val = self._EmptyStrArrayOrError(part.token)
elif val.tag == value_e.Str:
Expand Down Expand Up @@ -685,6 +684,8 @@ def _EvalBracedVarSub(self, part, part_vals, quoted):

if part.prefix_op:
val = self._EmptyStrOrError(val) # maybe error

# TODO: maybe_decay_array for "${!assoc[@]}" vs. ${!assoc[*]}
val = self._ApplyPrefixOp(val, part.prefix_op, token=part.token)
# NOTE: When applying the length operator, we can't have a test or
# suffix afterward. And we don't want to decay the array
Expand Down

0 comments on commit 714a80b

Please sign in to comment.