Skip to content

Commit c56c6d8

Browse files
authored
Merge pull request #2595 from ruby/ast-name-locations
Add name locations to AST
2 parents 352b567 + f81efb3 commit c56c6d8

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

lib/rbs/ast/ruby/declarations.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ def type_params = []
4646
def location
4747
rbs_location(node.location)
4848
end
49+
50+
def name_location
51+
rbs_location(node.constant_path.location)
52+
end
4953
end
5054

5155
class ModuleDecl < Base
@@ -79,6 +83,10 @@ def self_types = []
7983
def location
8084
rbs_location(node.location)
8185
end
86+
87+
def name_location
88+
rbs_location(node.constant_path.location)
89+
end
8290
end
8391
end
8492
end

lib/rbs/ast/ruby/members.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ def overloading?
206206
def annotations
207207
[]
208208
end
209+
210+
def name_location
211+
rbs_location(node.name_loc)
212+
end
209213
end
210214
end
211215
end

sig/ast/ruby/declarations.rbs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ module RBS
3232
def type_params: () -> Array[AST::TypeParam]
3333

3434
def location: () -> Location
35+
36+
def name_location: () -> Location
3537
end
3638

3739
class ModuleDecl < Base
@@ -53,6 +55,8 @@ module RBS
5355
def location: () -> Location
5456

5557
def self_types: () -> Array[AST::Declarations::Module::Self]
58+
59+
def name_location: () -> Location
5660
end
5761
end
5862
end

sig/ast/ruby/members.rbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ module RBS
6565
def overloading?: () -> bool
6666

6767
def annotations: () -> Array[AST::Annotation]
68+
69+
def name_location: () -> Location
6870
end
6971
end
7072
end

0 commit comments

Comments
 (0)