Skip to content

Commit

Permalink
[errors] Add error location to value.Place
Browse files Browse the repository at this point in the history
Issue #1864
  • Loading branch information
Andy C committed Mar 15, 2024
1 parent 8774abe commit 4ef2d38
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ def TokenForExpr(node):
node = cast(expr.Var, UP_node)
return node.left

elif case(expr_e.Place):
node = cast(expr.Place, UP_node)
return node.blame_tok

elif case(expr_e.CommandSub):
node = cast(CommandSub, UP_node)
return node.left_token
Expand Down
9 changes: 9 additions & 0 deletions spec/ysh-builtin-ctx.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,12 @@ json write (spec)
]
}
## END

#### ctx with value.Place, not List/Dict (error location bug fix)

ctx push (&p) {
true
}
## status: 3
## STDOUT:
## END

0 comments on commit 4ef2d38

Please sign in to comment.