Skip to content

[Bug] Call location doesn't include closing ) if there's a block pass argument #3708

Description

@amomchilov
 foo(&nil)
#        ^ closing_loc
#^^^^^^^^  Incorrect CallNode loc
#^^^^^^^^^ Correct CallNode loc
Prism.parse "foo(&nil)"
=>
# ...
@ CallNode (location: (1,0)-(1,8)) # ❌
├── flags: newline, ignore_visibility
├── receiver: ∅
├── call_operator_loc: ∅
├── name: :foo
├── message_loc: (1,0)-(1,3) = "foo"
├── opening_loc: (1,3)-(1,4) = "("
├── arguments: ∅
├── closing_loc: (1,8)-(1,9) = ")" # ℹ️
└── block:
    @ BlockArgumentNode (location: (1,4)-(1,8))
    ├── flags: ∅
    ├── expression:
    │   @ NilNode (location: (1,5)-(1,8))
    │   └── flags: static_literal
    └── operator_loc: (1,4)-(1,5) = "&"

Just documenting this for now. I'll take a stab at fixing it in the near future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions