Skip to content

Commit d88aca8

Browse files
Earlopainmatzbot
authored andcommitted
[ruby/prism] Add keyword_loc to ForwardingSuperNode
They can take a block and so the keyword location is not always the entirety of the node. You can get it by constructing a location that is just the first 5 characters but why not have it be provided by prism? ruby/prism@878d79eb8c
1 parent 05f856f commit d88aca8

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

prism/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2627,6 +2627,14 @@ nodes:
26272627
end
26282628
- name: ForwardingSuperNode
26292629
fields:
2630+
- name: keyword_loc
2631+
type: location
2632+
comment: |
2633+
super
2634+
^^^^^
2635+
2636+
super { 123 }
2637+
^^^^^
26302638
- name: block
26312639
type: node?
26322640
kind: BlockNode

prism/prism.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4379,6 +4379,7 @@ pm_forwarding_super_node_create(pm_parser_t *parser, const pm_token_t *token, pm
43794379
++parser->node_id,
43804380
0,
43814381
(block == NULL) ? PM_LOCATION_INIT_TOKEN(parser, token) : PM_LOCATION_INIT_TOKEN_NODE(parser, token, block),
4382+
PM_LOCATION_INIT_TOKEN(parser, token),
43824383
block
43834384
);
43844385
}

0 commit comments

Comments
 (0)