@@ -65,14 +65,16 @@ module Prism
6565 class OptionalLocationField < Field
6666 end
6767
68- # A uint8 field represents an unsigned 8-bit integer value on a node. It
69- # resolves to an Integer in Ruby.
70- class UInt8Field < Field
68+ # An integer field represents an integer value. It is used to represent the
69+ # value of an integer literal, the depth of local variables, and the number
70+ # of a numbered reference. It resolves to an Integer in Ruby.
71+ class IntegerField < Field
7172 end
7273
73- # A uint32 field represents an unsigned 32-bit integer value on a node. It
74- # resolves to an Integer in Ruby.
75- class UInt32Field < Field
74+ # A float field represents a double-precision floating point value. It is
75+ # used exclusively to represent the value of a floating point literal. It
76+ # resolves to a Float in Ruby.
77+ class FloatField < Field
7678 end
7779
7880 # A flags field represents a bitset of flags on a node. It resolves to an
@@ -90,18 +92,6 @@ module Prism
9092 end
9193 end
9294
93- # An integer field represents an arbitrarily-sized integer value. It is used
94- # exclusively to represent the value of an integer literal. It resolves to
95- # an Integer in Ruby.
96- class IntegerField < Field
97- end
98-
99- # A double field represents a double-precision floating point value. It is
100- # used exclusively to represent the value of a floating point literal. It
101- # resolves to a Float in Ruby.
102- class DoubleField < Field
103- end
104-
10595 # Returns the fields for the given node.
10696 def self.fields_for(node)
10797 case node.type
@@ -127,17 +117,13 @@ module Prism
127117 "LocationField.new(:#{ field . name } )"
128118 when Prism ::Template ::OptionalLocationField
129119 "OptionalLocationField.new(:#{ field . name } )"
130- when Prism ::Template ::UInt8Field
131- "UInt8Field .new(:#{ field . name } )"
132- when Prism ::Template ::UInt32Field
133- "UInt32Field .new(:#{ field . name } )"
120+ when Prism ::Template ::UInt8Field , Prism :: Template :: UInt32Field , Prism :: Template :: IntegerField
121+ "Integer .new(:#{ field . name } )"
122+ when Prism ::Template ::DoubleField
123+ "FloatField .new(:#{ field . name } )"
134124 when Prism ::Template ::FlagsField
135125 found = flags . find { |flag | flag . name == field . kind } . tap { |found | raise "Expected to find #{ field . kind } " unless found }
136126 "FlagsField.new(:#{ field . name } , [#{ found . values . map { |value | ":#{ value . name . downcase } ?" } . join ( ", " ) } ])"
137- when Prism ::Template ::IntegerField
138- "IntegerField.new(:#{ field . name } )"
139- when Prism ::Template ::DoubleField
140- "DoubleField.new(:#{ field . name } )"
141127 else
142128 raise field . class . name
143129 end
0 commit comments