Skip to content

Commit e893f09

Browse files
committed
Rewrite Deadcode::Reference as a bare Ruby class
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
1 parent 4c29a1f commit e893f09

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

lib/spoom/model/reference.rb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Model
77
#
88
# Constants could be classes, modules, or actual constants.
99
# Methods could be accessors, instance or class methods, aliases, etc.
10-
class Reference < T::Struct
10+
class Reference
1111
class Kind < T::Enum
1212
enums do
1313
Constant = new("constant")
@@ -27,9 +27,21 @@ def method(name, location)
2727
end
2828
end
2929

30-
const :kind, Kind
31-
const :name, String
32-
const :location, Spoom::Location
30+
#: Kind
31+
attr_reader :kind
32+
33+
#: String
34+
attr_reader :name
35+
36+
#: Spoom::Location
37+
attr_reader :location
38+
39+
#: (kind: Kind, name: String, location: Spoom::Location) -> void
40+
def initialize(kind:, name:, location:)
41+
@kind = kind
42+
@name = name
43+
@location = location
44+
end
3345

3446
#: -> bool
3547
def constant?

0 commit comments

Comments
 (0)