rbs 1.1.1 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +5 -1
  3. data/.gitignore +2 -0
  4. data/CHANGELOG.md +81 -0
  5. data/README.md +1 -1
  6. data/Rakefile +11 -0
  7. data/Steepfile +1 -0
  8. data/core/array.rbs +2 -2
  9. data/core/basic_object.rbs +1 -1
  10. data/core/enumerable.rbs +1 -1
  11. data/core/hash.rbs +13 -5
  12. data/core/io.rbs +4 -4
  13. data/core/kernel.rbs +2 -2
  14. data/core/marshal.rbs +4 -3
  15. data/core/module.rbs +1 -1
  16. data/core/numeric.rbs +10 -0
  17. data/core/proc.rbs +1 -1
  18. data/core/random.rbs +4 -2
  19. data/core/range.rbs +2 -2
  20. data/core/struct.rbs +3 -2
  21. data/core/thread.rbs +1 -1
  22. data/docs/CONTRIBUTING.md +5 -3
  23. data/docs/rbs_by_example.md +328 -0
  24. data/docs/sigs.md +21 -2
  25. data/docs/stdlib.md +1 -1
  26. data/docs/syntax.md +11 -14
  27. data/lib/rbs.rb +1 -0
  28. data/lib/rbs/ast/annotation.rb +2 -2
  29. data/lib/rbs/ast/comment.rb +2 -2
  30. data/lib/rbs/ast/declarations.rb +37 -22
  31. data/lib/rbs/ast/members.rb +26 -26
  32. data/lib/rbs/cli.rb +3 -0
  33. data/lib/rbs/constant_table.rb +4 -1
  34. data/lib/rbs/definition.rb +1 -1
  35. data/lib/rbs/definition_builder.rb +16 -18
  36. data/lib/rbs/definition_builder/ancestor_builder.rb +10 -2
  37. data/lib/rbs/definition_builder/method_builder.rb +4 -2
  38. data/lib/rbs/errors.rb +36 -0
  39. data/lib/rbs/location.rb +106 -2
  40. data/lib/rbs/locator.rb +205 -0
  41. data/lib/rbs/method_type.rb +2 -2
  42. data/lib/rbs/parser.rb +1315 -962
  43. data/lib/rbs/parser.y +411 -75
  44. data/lib/rbs/prototype/rb.rb +7 -3
  45. data/lib/rbs/prototype/runtime.rb +118 -42
  46. data/lib/rbs/test/hook.rb +8 -2
  47. data/lib/rbs/type_name.rb +2 -3
  48. data/lib/rbs/type_name_resolver.rb +1 -1
  49. data/lib/rbs/types.rb +36 -34
  50. data/lib/rbs/version.rb +1 -1
  51. data/lib/rbs/writer.rb +4 -2
  52. data/rbs.gemspec +1 -1
  53. data/sig/ancestor_builder.rbs +2 -0
  54. data/sig/annotation.rbs +1 -1
  55. data/sig/cli.rbs +31 -21
  56. data/sig/comment.rbs +1 -1
  57. data/sig/declarations.rbs +106 -21
  58. data/sig/environment.rbs +2 -2
  59. data/sig/errors.rbs +15 -0
  60. data/sig/location.rbs +84 -3
  61. data/sig/locator.rbs +44 -0
  62. data/sig/members.rbs +76 -12
  63. data/sig/method_builder.rbs +1 -1
  64. data/sig/method_types.rbs +1 -1
  65. data/sig/namespace.rbs +1 -1
  66. data/sig/polyfill.rbs +4 -17
  67. data/sig/rbs.rbs +8 -4
  68. data/sig/typename.rbs +1 -1
  69. data/sig/types.rbs +60 -19
  70. data/sig/util.rbs +0 -4
  71. data/sig/writer.rbs +8 -2
  72. data/stdlib/dbm/0/dbm.rbs +43 -30
  73. data/stdlib/mutex_m/0/mutex_m.rbs +1 -1
  74. data/stdlib/net-http/0/net-http.rbs +1846 -0
  75. data/stdlib/optparse/0/optparse.rbs +1214 -0
  76. data/stdlib/resolv/0/resolv.rbs +1504 -0
  77. data/stdlib/rubygems/0/requirement.rbs +84 -2
  78. data/stdlib/rubygems/0/version.rbs +2 -1
  79. data/stdlib/shellwords/0/shellwords.rbs +252 -0
  80. data/stdlib/socket/0/addrinfo.rbs +469 -0
  81. data/stdlib/socket/0/basic_socket.rbs +503 -0
  82. data/stdlib/socket/0/ip_socket.rbs +72 -0
  83. data/stdlib/socket/0/socket.rbs +2687 -0
  84. data/stdlib/socket/0/tcp_server.rbs +177 -0
  85. data/stdlib/socket/0/tcp_socket.rbs +35 -0
  86. data/stdlib/socket/0/udp_socket.rbs +111 -0
  87. data/stdlib/socket/0/unix_server.rbs +154 -0
  88. data/stdlib/socket/0/unix_socket.rbs +132 -0
  89. data/stdlib/timeout/0/timeout.rbs +5 -0
  90. data/steep/Gemfile.lock +19 -16
  91. metadata +18 -11
  92. data/bin/annotate-with-rdoc +0 -153
  93. data/bin/console +0 -14
  94. data/bin/query-rdoc +0 -103
  95. data/bin/rbs-prof +0 -9
  96. data/bin/run_in_md.rb +0 -49
  97. data/bin/setup +0 -8
  98. data/bin/sort +0 -89
  99. data/bin/steep +0 -4
  100. data/bin/test_runner.rb +0 -29
@@ -148,7 +148,7 @@ module RBS
148
148
  types = [
149
149
  MethodType.new(
150
150
  type_params: [],
151
- type: function_type_from_body(def_body),
151
+ type: function_type_from_body(def_body, def_name),
152
152
  block: block_from_body(def_body),
153
153
  location: nil
154
154
  )
@@ -377,12 +377,16 @@ module RBS
377
377
  each_node node.children, &block
378
378
  end
379
379
 
380
- def function_type_from_body(node)
380
+ def function_type_from_body(node, def_name)
381
381
  table_node, args_node, *_ = node.children
382
382
 
383
383
  pre_num, _pre_init, opt, _first_post, post_num, _post_init, rest, kw, kwrest, _block = args_from_node(args_node)
384
384
 
385
- return_type = function_return_type_from_body(node)
385
+ return_type = if def_name == :initialize
386
+ Types::Bases::Void.new(location: nil)
387
+ else
388
+ function_return_type_from_body(node)
389
+ end
386
390
 
387
391
  fun = Types::Function.empty(return_type)
388
392
 
@@ -9,6 +9,7 @@ module RBS
9
9
  def initialize(patterns:, env:, merge:, owners_included: [])
10
10
  @patterns = patterns
11
11
  @decls = nil
12
+ @modules = []
12
13
  @env = env
13
14
  @merge = merge
14
15
  @owners_included = owners_included.map do |name|
@@ -39,7 +40,8 @@ module RBS
39
40
  def decls
40
41
  unless @decls
41
42
  @decls = []
42
- ObjectSpace.each_object(Module).select {|mod| target?(mod) }.sort_by{|mod| const_name(mod) }.each do |mod|
43
+ @modules = ObjectSpace.each_object(Module).to_a
44
+ @modules.select {|mod| target?(mod) }.sort_by{|mod| const_name(mod) }.each do |mod|
43
45
  case mod
44
46
  when Class
45
47
  generate_class mod
@@ -48,16 +50,21 @@ module RBS
48
50
  end
49
51
  end
50
52
  end
53
+
51
54
  @decls
52
55
  end
53
56
 
54
- def to_type_name(name)
57
+ def to_type_name(name, full_name: false)
55
58
  *prefix, last = name.split(/::/)
56
59
 
57
- if prefix.empty?
58
- TypeName.new(name: last.to_sym, namespace: Namespace.empty)
60
+ if full_name
61
+ if prefix.empty?
62
+ TypeName.new(name: last.to_sym, namespace: Namespace.empty)
63
+ else
64
+ TypeName.new(name: last.to_sym, namespace: Namespace.parse(prefix.join("::")))
65
+ end
59
66
  else
60
- TypeName.new(name: last.to_sym, namespace: Namespace.parse(prefix.join("::")))
67
+ TypeName.new(name: last.to_sym, namespace: Namespace.empty)
61
68
  end
62
69
  end
63
70
 
@@ -131,6 +138,11 @@ module RBS
131
138
  end
132
139
  end
133
140
 
141
+ return_type = if method.name == :initialize
142
+ Types::Bases::Void.new(location: nil)
143
+ else
144
+ untyped
145
+ end
134
146
  method_type = Types::Function.new(
135
147
  required_positionals: required_positionals,
136
148
  optional_positionals: optional_positionals,
@@ -139,7 +151,7 @@ module RBS
139
151
  required_keywords: required_keywords,
140
152
  optional_keywords: optional_keywords,
141
153
  rest_keywords: rest_keywords,
142
- return_type: untyped
154
+ return_type: return_type,
143
155
  )
144
156
 
145
157
  MethodType.new(
@@ -300,7 +312,7 @@ module RBS
300
312
  end
301
313
  end
302
314
 
303
- def generate_constants(mod)
315
+ def generate_constants(mod, decls)
304
316
  mod.constants(false).sort.each do |name|
305
317
  value = mod.const_get(name)
306
318
 
@@ -324,8 +336,8 @@ module RBS
324
336
  Types::ClassInstance.new(name: value_type_name, args: args, location: nil)
325
337
  end
326
338
 
327
- @decls << AST::Declarations::Constant.new(
328
- name: "#{const_name(mod)}::#{name}",
339
+ decls << AST::Declarations::Constant.new(
340
+ name: name,
329
341
  type: type,
330
342
  location: nil,
331
343
  comment: nil
@@ -333,28 +345,38 @@ module RBS
333
345
  end
334
346
  end
335
347
 
348
+ def generate_super_class(mod)
349
+ if mod.superclass == ::Object
350
+ nil
351
+ elsif const_name(mod.superclass).nil?
352
+ RBS.logger.warn("Skipping anonymous superclass #{mod.superclass} of #{mod}")
353
+ nil
354
+ else
355
+ super_name = to_type_name(const_name(mod.superclass), full_name: true)
356
+ super_args = type_args(super_name)
357
+ AST::Declarations::Class::Super.new(name: super_name, args: super_args, location: nil)
358
+ end
359
+ end
360
+
336
361
  def generate_class(mod)
337
362
  type_name = to_type_name(const_name(mod))
338
- super_class = if mod.superclass == ::Object
339
- nil
340
- elsif const_name(mod.superclass).nil?
341
- RBS.logger.warn("Skipping anonymous superclass #{mod.superclass} of #{mod}")
342
- nil
343
- else
344
- super_name = to_type_name(const_name(mod.superclass))
345
- super_args = type_args(super_name)
346
- AST::Declarations::Class::Super.new(name: super_name, args: super_args, location: nil)
347
- end
363
+ outer_decls = ensure_outer_module_declarations(mod)
364
+
365
+ # Check if a declaration exists for the actual module
366
+ decl = outer_decls.detect { |decl| decl.is_a?(AST::Declarations::Class) && decl.name.name == only_name(mod).to_sym }
367
+ unless decl
368
+ decl = AST::Declarations::Class.new(
369
+ name: to_type_name(only_name(mod)),
370
+ type_params: AST::Declarations::ModuleTypeParams.empty,
371
+ super_class: generate_super_class(mod),
372
+ members: [],
373
+ annotations: [],
374
+ location: nil,
375
+ comment: nil
376
+ )
348
377
 
349
- decl = AST::Declarations::Class.new(
350
- name: type_name,
351
- type_params: AST::Declarations::ModuleTypeParams.empty,
352
- super_class: super_class,
353
- members: [],
354
- annotations: [],
355
- location: nil,
356
- comment: nil
357
- )
378
+ outer_decls << decl
379
+ end
358
380
 
359
381
  each_included_module(type_name, mod) do |module_name, module_full_name, _|
360
382
  args = type_args(module_full_name)
@@ -380,9 +402,7 @@ module RBS
380
402
 
381
403
  generate_methods(mod, type_name, decl.members)
382
404
 
383
- @decls << decl
384
-
385
- generate_constants mod
405
+ generate_constants mod, decl.members
386
406
  end
387
407
 
388
408
  def generate_module(mod)
@@ -394,16 +414,23 @@ module RBS
394
414
  end
395
415
 
396
416
  type_name = to_type_name(name)
417
+ outer_decls = ensure_outer_module_declarations(mod)
418
+
419
+ # Check if a declaration exists for the actual class
420
+ decl = outer_decls.detect { |decl| decl.is_a?(AST::Declarations::Module) && decl.name.name == only_name(mod).to_sym }
421
+ unless decl
422
+ decl = AST::Declarations::Module.new(
423
+ name: to_type_name(only_name(mod)),
424
+ type_params: AST::Declarations::ModuleTypeParams.empty,
425
+ self_types: [],
426
+ members: [],
427
+ annotations: [],
428
+ location: nil,
429
+ comment: nil
430
+ )
397
431
 
398
- decl = AST::Declarations::Module.new(
399
- name: type_name,
400
- type_params: AST::Declarations::ModuleTypeParams.empty,
401
- self_types: [],
402
- members: [],
403
- annotations: [],
404
- location: nil,
405
- comment: nil
406
- )
432
+ outer_decls << decl
433
+ end
407
434
 
408
435
  each_included_module(type_name, mod) do |module_name, module_full_name, _|
409
436
  args = type_args(module_full_name)
@@ -429,9 +456,58 @@ module RBS
429
456
 
430
457
  generate_methods(mod, type_name, decl.members)
431
458
 
432
- @decls << decl
459
+ generate_constants mod, decl.members
460
+ end
461
+
462
+ # Generate/find outer module declarations
463
+ # This is broken down into another method to comply with `DRY`
464
+ # This generates/finds declarations in nested form & returns the last array of declarations
465
+ def ensure_outer_module_declarations(mod)
466
+ *outer_module_names, _ = const_name(mod).split(/::/) #=> parent = [A, B], mod = C
467
+ destination = @decls # Copy the entries in ivar @decls, not .dup
468
+
469
+ outer_module_names&.each do |outer_module_name|
470
+ outer_module = @modules.detect { |x| const_name(x) == outer_module_name }
471
+ outer_decl = destination.detect { |decl| decl.is_a?(outer_module.is_a?(Class) ? AST::Declarations::Class : AST::Declarations::Module) && decl.name.name == outer_module_name.to_sym }
472
+
473
+ # Insert AST::Declarations if declarations are not added previously
474
+ unless outer_decl
475
+ if outer_module.is_a?(Class)
476
+ outer_decl = AST::Declarations::Class.new(
477
+ name: to_type_name(outer_module_name),
478
+ type_params: AST::Declarations::ModuleTypeParams.empty,
479
+ super_class: generate_super_class(outer_module),
480
+ members: [],
481
+ annotations: [],
482
+ location: nil,
483
+ comment: nil
484
+ )
485
+ else
486
+ outer_decl = AST::Declarations::Module.new(
487
+ name: to_type_name(outer_module_name),
488
+ type_params: AST::Declarations::ModuleTypeParams.empty,
489
+ self_types: [],
490
+ members: [],
491
+ annotations: [],
492
+ location: nil,
493
+ comment: nil
494
+ )
495
+ end
496
+
497
+ destination << outer_decl
498
+ end
499
+
500
+ destination = outer_decl.members
501
+ end
502
+
503
+ # Return the array of declarations checked out at the end
504
+ destination
505
+ end
433
506
 
434
- generate_constants mod
507
+ # Returns the exact name & not compactly declared name
508
+ def only_name(mod)
509
+ # No nil check because this method is invoked after checking if the module exists
510
+ const_name(mod).split(/::/).last # (A::B::C) => C
435
511
  end
436
512
 
437
513
  def const_name(const)
data/lib/rbs/test/hook.rb CHANGED
@@ -25,7 +25,11 @@ module RBS
25
25
  :! => "not",
26
26
  :<< => "lshift",
27
27
  :>> => "rshift",
28
- :~ => "tilda"
28
+ :~ => "tilda",
29
+ :=~ => "eqtilda",
30
+ :% => "percent",
31
+ :+@ => "unary_plus",
32
+ :-@ => "unary_minus"
29
33
  }
30
34
  def self.alias_names(target, random)
31
35
  suffix = "#{RBS::Test.suffix}_#{random}"
@@ -71,7 +75,9 @@ module RBS
71
75
  with_name, without_name = alias_names(method_name, random)
72
76
  full_method_name = "#{prefix}#{method_name}"
73
77
 
74
- param_source = params.take_while {|param| param[0] == :req }.map(&:last) + ["*rest_args__#{random}"]
78
+ param_source = params.take_while {|param| param[0] == :req }
79
+ .map.with_index {|pair, index| pair[1] || "__req__#{random}__#{index}" }
80
+ param_source.push("*rest_args__#{random}")
75
81
  block_param = "block__#{random}"
76
82
 
77
83
  RBS.logger.debug {
data/lib/rbs/type_name.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module RBS
3
2
  class TypeName
4
3
  attr_reader :namespace
@@ -35,8 +34,8 @@ module RBS
35
34
  "#{namespace.to_s}#{name}"
36
35
  end
37
36
 
38
- def to_json(*a)
39
- to_s.to_json(*a)
37
+ def to_json(state = _ = nil)
38
+ to_s.to_json(state)
40
39
  end
41
40
 
42
41
  def to_namespace
@@ -39,7 +39,7 @@ module RBS
39
39
  raise unless path_head
40
40
 
41
41
  name_head = TypeName.new(name: path_head, namespace: Namespace.empty)
42
-
42
+
43
43
  absolute_head = context.find do |namespace|
44
44
  # @type break: TypeName
45
45
  full_name = name_head.with_prefix(namespace)
data/lib/rbs/types.rb CHANGED
@@ -52,9 +52,9 @@ module RBS
52
52
  include EmptyEachType
53
53
  include NoTypeName
54
54
 
55
- def to_json(*a)
55
+ def to_json(state = _ = nil)
56
56
  klass = to_s.to_sym
57
- { class: klass, location: location }.to_json(*a)
57
+ { class: klass, location: location }.to_json(state)
58
58
  end
59
59
 
60
60
  def to_s(level = 0)
@@ -125,8 +125,8 @@ module RBS
125
125
  end
126
126
  end
127
127
 
128
- def to_json(*a)
129
- { class: :variable, name: name, location: location }.to_json(*a)
128
+ def to_json(state = _ = nil)
129
+ { class: :variable, name: name, location: location }.to_json(state)
130
130
  end
131
131
 
132
132
  def sub(s)
@@ -177,8 +177,8 @@ module RBS
177
177
  include NoFreeVariables
178
178
  include NoSubst
179
179
 
180
- def to_json(*a)
181
- { class: :class_singleton, name: name, location: location }.to_json(*a)
180
+ def to_json(state = _ = nil)
181
+ { class: :class_singleton, name: name, location: location }.to_json(state)
182
182
  end
183
183
 
184
184
  def to_s(level = 0)
@@ -245,8 +245,8 @@ module RBS
245
245
  @location = location
246
246
  end
247
247
 
248
- def to_json(*a)
249
- { class: :interface, name: name, args: args, location: location }.to_json(*a)
248
+ def to_json(state = _ = nil)
249
+ { class: :interface, name: name, args: args, location: location }.to_json(state)
250
250
  end
251
251
 
252
252
  def sub(s)
@@ -275,8 +275,8 @@ module RBS
275
275
  @location = location
276
276
  end
277
277
 
278
- def to_json(*a)
279
- { class: :class_instance, name: name, args: args, location: location }.to_json(*a)
278
+ def to_json(state = _ = nil)
279
+ { class: :class_instance, name: name, args: args, location: location }.to_json(state)
280
280
  end
281
281
 
282
282
  def sub(s)
@@ -316,8 +316,8 @@ module RBS
316
316
  include NoFreeVariables
317
317
  include NoSubst
318
318
 
319
- def to_json(*a)
320
- { class: :alias, name: name, location: location }.to_json(*a)
319
+ def to_json(state = _ = nil)
320
+ { class: :alias, name: name, location: location }.to_json(state)
321
321
  end
322
322
 
323
323
  def to_s(level = 0)
@@ -361,8 +361,8 @@ module RBS
361
361
  end
362
362
  end
363
363
 
364
- def to_json(*a)
365
- { class: :tuple, types: types, location: location }.to_json(*a)
364
+ def to_json(state = _ = nil)
365
+ { class: :tuple, types: types, location: location }.to_json(state)
366
366
  end
367
367
 
368
368
  def sub(s)
@@ -421,8 +421,8 @@ module RBS
421
421
  end
422
422
  end
423
423
 
424
- def to_json(*a)
425
- { class: :record, fields: fields, location: location }.to_json(*a)
424
+ def to_json(state = _ = nil)
425
+ { class: :record, fields: fields, location: location }.to_json(state)
426
426
  end
427
427
 
428
428
  def sub(s)
@@ -482,8 +482,8 @@ module RBS
482
482
  type.free_variables(set)
483
483
  end
484
484
 
485
- def to_json(*a)
486
- { class: :optional, type: type, location: location }.to_json(*a)
485
+ def to_json(state = _ = nil)
486
+ { class: :optional, type: type, location: location }.to_json(state)
487
487
  end
488
488
 
489
489
  def sub(s)
@@ -545,8 +545,8 @@ module RBS
545
545
  end
546
546
  end
547
547
 
548
- def to_json(*a)
549
- { class: :union, types: types, location: location }.to_json(*a)
548
+ def to_json(state = _ = nil)
549
+ { class: :union, types: types, location: location }.to_json(state)
550
550
  end
551
551
 
552
552
  def sub(s)
@@ -613,8 +613,8 @@ module RBS
613
613
  end
614
614
  end
615
615
 
616
- def to_json(*a)
617
- { class: :intersection, types: types, location: location }.to_json(*a)
616
+ def to_json(state = _ = nil)
617
+ { class: :intersection, types: types, location: location }.to_json(state)
618
618
  end
619
619
 
620
620
  def sub(s)
@@ -659,10 +659,12 @@ module RBS
659
659
  class Param
660
660
  attr_reader :type
661
661
  attr_reader :name
662
+ attr_reader :location
662
663
 
663
- def initialize(type:, name:)
664
+ def initialize(type:, name:, location: nil)
664
665
  @type = type
665
666
  @name = name
667
+ @location = location
666
668
  end
667
669
 
668
670
  def ==(other)
@@ -677,14 +679,14 @@ module RBS
677
679
 
678
680
  def map_type(&block)
679
681
  if block
680
- Param.new(name: name, type: yield(type))
682
+ Param.new(name: name, type: yield(type), location: location)
681
683
  else
682
684
  enum_for :map_type
683
685
  end
684
686
  end
685
687
 
686
- def to_json(*a)
687
- { type: type, name: name }.to_json(*a)
688
+ def to_json(state = _ = nil)
689
+ { type: type, name: name }.to_json(state)
688
690
  end
689
691
 
690
692
  def to_s
@@ -826,7 +828,7 @@ module RBS
826
828
  end
827
829
  end
828
830
 
829
- def to_json(*a)
831
+ def to_json(state = _ = nil)
830
832
  {
831
833
  required_positionals: required_positionals,
832
834
  optional_positionals: optional_positionals,
@@ -836,7 +838,7 @@ module RBS
836
838
  optional_keywords: optional_keywords,
837
839
  rest_keywords: rest_keywords,
838
840
  return_type: return_type
839
- }.to_json(*a)
841
+ }.to_json(state)
840
842
  end
841
843
 
842
844
  def sub(s)
@@ -966,11 +968,11 @@ module RBS
966
968
  other.required == required
967
969
  end
968
970
 
969
- def to_json(*a)
971
+ def to_json(state = _ = nil)
970
972
  {
971
973
  type: type,
972
974
  required: required
973
- }.to_json(*a)
975
+ }.to_json(state)
974
976
  end
975
977
 
976
978
  def sub(s)
@@ -1015,13 +1017,13 @@ module RBS
1015
1017
  set
1016
1018
  end
1017
1019
 
1018
- def to_json(*a)
1020
+ def to_json(state = _ = nil)
1019
1021
  {
1020
1022
  class: :proc,
1021
1023
  type: type,
1022
1024
  block: block,
1023
1025
  location: location
1024
- }.to_json(*a)
1026
+ }.to_json(state)
1025
1027
  end
1026
1028
 
1027
1029
  def sub(s)
@@ -1083,8 +1085,8 @@ module RBS
1083
1085
  include EmptyEachType
1084
1086
  include NoTypeName
1085
1087
 
1086
- def to_json(*a)
1087
- { class: :literal, literal: literal.inspect, location: location }.to_json(*a)
1088
+ def to_json(state = _ = nil)
1089
+ { class: :literal, literal: literal.inspect, location: location }.to_json(state)
1088
1090
  end
1089
1091
 
1090
1092
  def to_s(level = 0)