code-ruby 3.0.6 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -0
  3. data/Gemfile.lock +1 -1
  4. data/VERSION +1 -1
  5. data/bin/code +27 -3
  6. data/lib/code/error.rb +10 -5
  7. data/lib/code/extensions/active_support.rb +9 -0
  8. data/lib/code/extensions/array.rb +7 -0
  9. data/lib/code/extensions/big_decimal.rb +9 -0
  10. data/lib/code/extensions/class.rb +7 -0
  11. data/lib/code/extensions/false_class.rb +7 -0
  12. data/lib/code/extensions/float.rb +9 -0
  13. data/lib/code/extensions/hash.rb +7 -0
  14. data/lib/code/extensions/integer.rb +9 -0
  15. data/lib/code/extensions/module.rb +7 -0
  16. data/lib/code/extensions/nil_class.rb +7 -0
  17. data/lib/code/extensions/nokogiri.rb +11 -0
  18. data/lib/code/extensions/object.rb +9 -0
  19. data/lib/code/extensions/string.rb +7 -0
  20. data/lib/code/extensions/symbol.rb +7 -0
  21. data/lib/code/extensions/true_class.rb +7 -0
  22. data/lib/code/extensions/word_number_comparaisons.rb +407 -0
  23. data/lib/code/format.rb +73 -56
  24. data/lib/code/node/code.rb +2 -1
  25. data/lib/code/node/statement.rb +4 -2
  26. data/lib/code/node/string.rb +1 -1
  27. data/lib/code/node/while.rb +8 -10
  28. data/lib/code/object/date.rb +37 -17
  29. data/lib/code/object/function.rb +23 -11
  30. data/lib/code/object/global.rb +5 -4
  31. data/lib/code/object/html.rb +169 -52
  32. data/lib/code/object/http.rb +8 -8
  33. data/lib/code/object/ics.rb +22 -18
  34. data/lib/code/object/identifier_list.rb +12 -10
  35. data/lib/code/object/list.rb +1 -5
  36. data/lib/code/object/super.rb +2 -1
  37. data/lib/code/object/time.rb +46 -44
  38. data/lib/code/parser.rb +342 -121
  39. data/lib/code-ruby.rb +16 -149
  40. data/spec/bin/code_spec.rb +32 -0
  41. data/spec/code/format_spec.rb +7 -10
  42. data/spec/code/node/call_spec.rb +1 -3
  43. data/spec/code/object/function_spec.rb +4 -8
  44. data/spec/code/object/http_spec.rb +20 -0
  45. data/spec/code/object/ics_spec.rb +5 -5
  46. data/spec/code/object/list_spec.rb +1 -1
  47. data/spec/code/parser_spec.rb +22 -0
  48. data/spec/code_spec.rb +347 -328
  49. metadata +18 -2
  50. data/applies +0 -0
data/lib/code/format.rb CHANGED
@@ -37,7 +37,11 @@ class Code
37
37
  statements
38
38
  .map do |statement|
39
39
  formatted = format_statement(statement, indent: indent)
40
- pre_indented_statement?(statement) ? formatted : "#{INDENT * indent}#{formatted}"
40
+ if pre_indented_statement?(statement)
41
+ formatted
42
+ else
43
+ "#{INDENT * indent}#{formatted}"
44
+ end
41
45
  end
42
46
  .join(separator)
43
47
  end
@@ -45,7 +49,9 @@ class Code
45
49
  def format_code_inline(code, indent:)
46
50
  statements = Array(code)
47
51
  return "nothing" if statements.empty?
48
- return format_statement(statements.first, indent: indent) if statements.one?
52
+ if statements.one?
53
+ return format_statement(statements.first, indent: indent)
54
+ end
49
55
 
50
56
  body = format_code(statements, indent: indent + 1)
51
57
  "begin\n#{body}\n#{INDENT * indent}end"
@@ -151,6 +157,7 @@ class Code
151
157
 
152
158
  def format_string(parts, indent:)
153
159
  return '""' if parts == "" || parts.nil?
160
+
154
161
  symbol = symbolizable_string(parts)
155
162
  return symbol if symbol
156
163
 
@@ -160,7 +167,10 @@ class Code
160
167
  if part.is_a?(Hash) && part.key?(:text)
161
168
  { type: :text, value: escape_string_text(part[:text].to_s) }
162
169
  elsif part.is_a?(Hash) && part.key?(:code)
163
- { type: :code, value: "{#{format_code_inline(part[:code], indent: indent)}}" }
170
+ {
171
+ type: :code,
172
+ value: "{#{format_code_inline(part[:code], indent: indent)}}"
173
+ }
164
174
  else
165
175
  { type: :text, value: escape_string_text(part.to_s) }
166
176
  end
@@ -189,10 +199,7 @@ class Code
189
199
  end
190
200
 
191
201
  def escape_string_text(text)
192
- text
193
- .gsub("\\", "\\\\")
194
- .gsub('"', '\"')
195
- .gsub("{", "\\{")
202
+ text.gsub("\\", "\\\\").gsub('"', '\"').gsub("{", "\\{")
196
203
  end
197
204
 
198
205
  def format_string_literal(content, components:, indent:, allow_split:)
@@ -210,9 +217,10 @@ class Code
210
217
  continuation_indent = INDENT * (indent + 1)
211
218
  lines = chunks.map { |chunk| %("#{chunk}") }
212
219
 
213
- ([lines.first] +
214
- lines[1..].to_a.map { |line| "#{continuation_indent}+ #{line}" })
215
- .join("\n")
220
+ (
221
+ [lines.first] +
222
+ lines[1..].to_a.map { |line| "#{continuation_indent}+ #{line}" }
223
+ ).join("\n")
216
224
  end
217
225
 
218
226
  def split_string_chunks(components, limit)
@@ -258,13 +266,17 @@ class Code
258
266
  end
259
267
 
260
268
  def string_inline_limit(indent)
261
- [MIN_WIDTH, [MAX_INLINE_STRING_LENGTH, MAX_LINE_LENGTH - (INDENT * indent).length].min].max
269
+ [
270
+ MAX_INLINE_STRING_LENGTH,
271
+ MAX_LINE_LENGTH - (INDENT * indent).length
272
+ ].min.clamp(MIN_WIDTH, MAX_INLINE_STRING_LENGTH)
262
273
  end
263
274
 
264
275
  def chunk_limit(indent)
265
- [MIN_WIDTH,
266
- [MAX_INLINE_STRING_LENGTH,
267
- MAX_LINE_LENGTH - (INDENT * (indent + 1)).length - CONTINUATION_PADDING].min].max
276
+ [
277
+ MAX_INLINE_STRING_LENGTH,
278
+ MAX_LINE_LENGTH - (INDENT * (indent + 1)).length - CONTINUATION_PADDING
279
+ ].min.clamp(MIN_WIDTH, MAX_INLINE_STRING_LENGTH)
268
280
  end
269
281
 
270
282
  def format_list(elements, indent:)
@@ -272,7 +284,7 @@ class Code
272
284
 
273
285
  values =
274
286
  Array(elements).map { |element| format_code_inline(element, indent: 0) }
275
- return "[#{values.join(', ')}]" unless multiline_collection?(values)
287
+ return "[#{values.join(", ")}]" unless multiline_collection?(values)
276
288
 
277
289
  body = values.map { |value| indent_lines(value, indent + 1) }.join(",\n")
278
290
  "[\n#{body}\n#{INDENT * indent}]"
@@ -294,7 +306,7 @@ class Code
294
306
  end
295
307
  end
296
308
 
297
- return "{ #{values.join(', ')} }" unless multiline_collection?(values)
309
+ return "{ #{values.join(", ")} }" unless multiline_collection?(values)
298
310
 
299
311
  body = values.map { |value| indent_lines(value, indent + 1) }.join(",\n")
300
312
  "{\n#{body}\n#{INDENT * indent}}"
@@ -326,10 +338,11 @@ class Code
326
338
  elsif arguments.empty?
327
339
  "#{name}()"
328
340
  elsif multiline_call_arguments?(raw_arguments, arguments)
329
- body = arguments.map { |arg| indent_lines(arg, indent + 1) }.join(",\n")
341
+ body =
342
+ arguments.map { |arg| indent_lines(arg, indent + 1) }.join(",\n")
330
343
  "#{name}(\n#{body}\n#{INDENT * indent})"
331
344
  else
332
- "#{name}(#{arguments.join(', ')})"
345
+ "#{name}(#{arguments.join(", ")})"
333
346
  end
334
347
 
335
348
  return statement unless call.key?(:block)
@@ -338,7 +351,9 @@ class Code
338
351
  end
339
352
 
340
353
  def format_call_argument(argument)
341
- return format_code_inline(Array(argument), indent: 0) unless argument.is_a?(Hash)
354
+ unless argument.is_a?(Hash)
355
+ return format_code_inline(Array(argument), indent: 0)
356
+ end
342
357
 
343
358
  value = format_code_inline(argument[:value], indent: 0)
344
359
  return value unless argument.key?(:name)
@@ -347,22 +362,28 @@ class Code
347
362
  end
348
363
 
349
364
  def format_block(block, indent:)
350
- parameters = Array(block[:parameters]).map { |parameter| format_parameter(parameter, indent: indent) }
365
+ parameters =
366
+ Array(block[:parameters]).map do |parameter|
367
+ format_parameter(parameter, indent: indent)
368
+ end
351
369
  inline_body = format_inline_block_body(block[:body], indent: indent)
352
370
  if inline_body
353
- prefix = parameters.empty? ? "" : " |#{parameters.join(', ')}|"
371
+ prefix = parameters.empty? ? "" : " |#{parameters.join(", ")}|"
354
372
  return "{#{prefix} #{inline_body} }"
355
373
  end
356
374
 
357
- header = parameters.empty? ? "{" : "{ |#{parameters.join(', ')}|"
375
+ header = parameters.empty? ? "{" : "{ |#{parameters.join(", ")}|"
358
376
  body = format_code(Array(block[:body]), indent: indent + 1)
359
377
  "#{header}\n#{body}\n#{INDENT * indent}}"
360
378
  end
361
379
 
362
380
  def format_function(function, indent:)
363
- parameters = Array(function[:parameters]).map { |parameter| format_parameter(parameter, indent: indent) }
381
+ parameters =
382
+ Array(function[:parameters]).map do |parameter|
383
+ format_parameter(parameter, indent: indent)
384
+ end
364
385
  body = format_code(Array(function[:body]), indent: indent + 1)
365
- "(#{parameters.join(', ')}) => {\n#{body}\n#{INDENT * indent}}"
386
+ "(#{parameters.join(", ")}) => {\n#{body}\n#{INDENT * indent}}"
366
387
  end
367
388
 
368
389
  def format_parameter(parameter, indent:)
@@ -398,7 +419,8 @@ class Code
398
419
  end
399
420
 
400
421
  def format_left_operation(operation, indent:)
401
- merged_string = extract_string_concatenation_parts(left_operation: operation)
422
+ merged_string =
423
+ extract_string_concatenation_parts(left_operation: operation)
402
424
  return format_string(merged_string, indent: indent) if merged_string
403
425
 
404
426
  expression = format_nested_statement(operation[:first], indent: indent)
@@ -423,11 +445,7 @@ class Code
423
445
  right_lines.each_with_index.map do |line, index|
424
446
  content = line.lstrip
425
447
  prefix =
426
- if content.start_with?("#{operator} ")
427
- ""
428
- else
429
- "#{operator} "
430
- end
448
+ (content.start_with?("#{operator} ") ? "" : "#{operator} ")
431
449
  "#{INDENT * (indent + 1)}#{prefix}#{content}"
432
450
  end
433
451
  "#{expression}\n#{continuation_lines.join("\n")}"
@@ -443,9 +461,7 @@ class Code
443
461
  def extract_string_concatenation_parts(statement)
444
462
  return nil unless statement.is_a?(Hash)
445
463
 
446
- if statement.key?(:string)
447
- return Array(statement[:string]).deep_dup
448
- end
464
+ return Array(statement[:string]).deep_dup if statement.key?(:string)
449
465
 
450
466
  return nil unless statement.key?(:left_operation)
451
467
 
@@ -475,7 +491,7 @@ class Code
475
491
  end
476
492
 
477
493
  def compact_operator?(operator)
478
- [".", "::", "&.", "..", "..."].include?(operator)
494
+ %w[. :: &. .. ...].include?(operator)
479
495
  end
480
496
 
481
497
  def format_ternary(ternary, indent:)
@@ -505,9 +521,11 @@ class Code
505
521
  def format_square_bracket(square_bracket, indent:)
506
522
  left = format_nested_statement(square_bracket[:left], indent: indent)
507
523
  suffix =
508
- Array(square_bracket[:statements]).map do |statement|
509
- "[#{format_nested_statement(statement, indent: indent)}]"
510
- end.join
524
+ Array(square_bracket[:statements])
525
+ .map do |statement|
526
+ "[#{format_nested_statement(statement, indent: indent)}]"
527
+ end
528
+ .join
511
529
  "#{left}#{suffix}"
512
530
  end
513
531
 
@@ -544,7 +562,10 @@ class Code
544
562
  format_code(branch[:body], indent: indent + 1)
545
563
  ]
546
564
  else
547
- ["#{INDENT * indent}else", format_code(branch[:body], indent: indent + 1)]
565
+ [
566
+ "#{INDENT * indent}else",
567
+ format_code(branch[:body], indent: indent + 1)
568
+ ]
548
569
  end
549
570
  end
550
571
 
@@ -556,7 +577,8 @@ class Code
556
577
  return "#{INDENT * indent}loop {\n#{body}\n#{INDENT * indent}}"
557
578
  end
558
579
 
559
- statement = format_nested_statement(while_statement[:statement], indent: indent)
580
+ statement =
581
+ format_nested_statement(while_statement[:statement], indent: indent)
560
582
  body = format_code(while_statement[:body], indent: indent + 1)
561
583
  "#{INDENT * indent}#{operator} #{statement}\n#{body}\n#{INDENT * indent}end"
562
584
  end
@@ -575,7 +597,9 @@ class Code
575
597
  def multiline_call_arguments?(raw_arguments, arguments)
576
598
  return true if arguments.any? { |argument| argument.include?("\n") }
577
599
  return true if arguments.size > MAX_INLINE_COLLECTION_ITEMS
578
- return true if arguments.join(", ").length > MAX_INLINE_CALL_ARGUMENTS_LENGTH
600
+ if arguments.join(", ").length > MAX_INLINE_CALL_ARGUMENTS_LENGTH
601
+ return true
602
+ end
579
603
 
580
604
  raw_arguments.any? do |argument|
581
605
  named_value = argument[:value]
@@ -593,8 +617,10 @@ class Code
593
617
  value.split("\n").map { |line| "#{prefix}#{line}" }.join("\n")
594
618
  end
595
619
 
596
- def statement_separator(inline:, indent: _indent)
620
+ def statement_separator(inline:, indent: nil)
621
+ _indent = indent
597
622
  return " " if inline
623
+
598
624
  "\n\n"
599
625
  end
600
626
 
@@ -614,10 +640,7 @@ class Code
614
640
  end
615
641
 
616
642
  def enforce_line_width(formatted)
617
- formatted
618
- .split("\n")
619
- .flat_map { |line| wrap_line(line) }
620
- .join("\n")
643
+ formatted.split("\n").flat_map { |line| wrap_line(line) }.join("\n")
621
644
  end
622
645
 
623
646
  def wrap_line(line)
@@ -625,16 +648,11 @@ class Code
625
648
 
626
649
  indent = line[/\A */].to_s
627
650
  split =
628
- find_split(line, " and ") ||
629
- find_split(line, " or ") ||
630
- find_split(line, " ? ") ||
631
- find_split(line, " : ") ||
632
- find_split(line, " <=> ") ||
633
- find_split(line, " >= ") ||
634
- find_split(line, " <= ") ||
635
- find_split(line, " == ") ||
636
- find_split(line, " = ") ||
637
- find_split(line, ".")
651
+ find_split(line, " and ") || find_split(line, " or ") ||
652
+ find_split(line, " ? ") || find_split(line, " : ") ||
653
+ find_split(line, " <=> ") || find_split(line, " >= ") ||
654
+ find_split(line, " <= ") || find_split(line, " == ") ||
655
+ find_split(line, " = ") || find_split(line, ".")
638
656
 
639
657
  return [line] unless split
640
658
 
@@ -692,6 +710,5 @@ class Code
692
710
 
693
711
  quote_count.even?
694
712
  end
695
-
696
713
  end
697
714
  end
@@ -24,7 +24,8 @@ class Code
24
24
 
25
25
  begin
26
26
  (@statements || []).each do |statement|
27
- last = statement.evaluate(**statement_args, object: Object::Global.new)
27
+ last =
28
+ statement.evaluate(**statement_args, object: Object::Global.new)
28
29
  end
29
30
  rescue Error::Retry
30
31
  retry if control_flow_scope == :group
@@ -58,8 +58,10 @@ class Code
58
58
 
59
59
  def evaluate(**args)
60
60
  if @control_flow_scope == :group
61
- @statement&.evaluate(**args, control_flow_scope: @control_flow_scope) ||
62
- Object::Nothing.new
61
+ @statement&.evaluate(
62
+ **args,
63
+ control_flow_scope: @control_flow_scope
64
+ ) || Object::Nothing.new
63
65
  else
64
66
  @statement&.evaluate(**args) || Object::Nothing.new
65
67
  end
@@ -62,7 +62,7 @@ class Code
62
62
 
63
63
  def evaluate(**args)
64
64
  ::Code::Object::String.new(
65
- (@parts || []).map { |part| part.evaluate(**args) }.map(&:to_s).join
65
+ (@parts || []).map { |part| part.evaluate(**args) }.join
66
66
  )
67
67
  end
68
68
  end
@@ -55,16 +55,14 @@ class Code
55
55
  last = Object::Nothing.new
56
56
 
57
57
  loop do
58
- begin
59
- last = @body&.evaluate(**args) || Object::Nothing.new
60
- rescue Error::Next, Error::Continue => e
61
- last = e.code_value
62
- next
63
- rescue Error::Retry
64
- retry
65
- rescue Error::Break => e
66
- return e.code_value
67
- end
58
+ last = @body&.evaluate(**args) || Object::Nothing.new
59
+ rescue Error::Next, Error::Continue => e
60
+ last = e.code_value
61
+ next
62
+ rescue Error::Retry
63
+ retry
64
+ rescue Error::Break => e
65
+ return e.code_value
68
66
  end
69
67
 
70
68
  last
@@ -63,19 +63,22 @@ class Code
63
63
  def initialize(*args, **_kargs, &_block)
64
64
  ::Time.zone ||= DEFAULT_ZONE
65
65
 
66
- if args.first.is_a?(String) || args.first.is_a?(::String)
67
- self.raw = ::Date.parse(args.first.to_s)
68
- elsif args.first.is_a?(Time)
69
- self.raw = args.first.raw.to_date
70
- elsif args.first.is_a?(::Time)
71
- self.raw = args.first.to_date
72
- elsif args.first.is_a?(Date)
73
- self.raw = args.first.raw.dup
74
- elsif args.first.is_a?(::Date)
75
- self.raw = args.first.dup
76
- else
77
- self.raw = ::Date.current
78
- end
66
+ first = args.first
67
+ self.raw =
68
+ case first
69
+ when String, ::String
70
+ ::Date.parse(first.to_s)
71
+ when Time
72
+ first.raw.to_date
73
+ when ::Time
74
+ first.to_date
75
+ when Date
76
+ first.raw.dup
77
+ when ::Date
78
+ first.dup
79
+ else
80
+ ::Date.current
81
+ end
79
82
  end
80
83
 
81
84
  def self.call(**args)
@@ -718,10 +721,15 @@ class Code
718
721
  requested_locale = code_locale.raw&.to_s
719
722
  locale = requested_locale&.presence_in(LOCALES)&.to_sym
720
723
  locale ||= ::I18n.locale
721
- locale = ::I18n.locale unless ::I18n.available_locales.include?(locale.to_sym)
724
+ locale = ::I18n.locale unless ::I18n.available_locales.include?(
725
+ locale.to_sym
726
+ )
722
727
 
723
728
  format = code_format.raw || :default
724
- format = format.to_sym if ::I18n.exists?("date.formats.#{format}", locale)
729
+ format = format.to_sym if ::I18n.exists?(
730
+ "date.formats.#{format}",
731
+ locale
732
+ )
725
733
 
726
734
  String.new(::I18n.l(raw, format: format, locale: locale))
727
735
  end
@@ -803,7 +811,13 @@ class Code
803
811
  code_week_days.code_to_integer.raw + code_week_day.code_to_integer.raw
804
812
  week = code_weeks.code_to_integer.raw + code_week.code_to_integer.raw
805
813
 
806
- code_change(year:, month:, day:, week_day:, week:)
814
+ code_change(
815
+ year: year,
816
+ month: month,
817
+ day: day,
818
+ week_day: week_day,
819
+ week: week
820
+ )
807
821
  end
808
822
 
809
823
  def code_substract(
@@ -832,7 +846,13 @@ class Code
832
846
  code_week_days.code_to_integer.raw - code_week_day.code_to_integer.raw
833
847
  week = code_weeks.code_to_integer.raw - code_week.code_to_integer.raw
834
848
 
835
- code_change(year:, month:, day:, week_day:, week:)
849
+ code_change(
850
+ year: year,
851
+ month: month,
852
+ day: day,
853
+ week_day: week_day,
854
+ week: week
855
+ )
836
856
  end
837
857
 
838
858
  def code_change(
@@ -55,7 +55,12 @@ class Code
55
55
  end
56
56
  end
57
57
 
58
- def code_call(*arguments, explicit_arguments: true, bound_self: nil, **globals)
58
+ def code_call(
59
+ *arguments,
60
+ explicit_arguments: true,
61
+ bound_self: nil,
62
+ **globals
63
+ )
59
64
  code_arguments = arguments.to_code
60
65
  code_context = Context.new({}, definition_context || globals[:context])
61
66
  code_self = bound_self.to_code
@@ -79,9 +84,7 @@ class Code
79
84
 
80
85
  code_parameters.raw.each.with_index do |code_parameter, index|
81
86
  code_argument =
82
- if code_parameter.spread?
83
- code_arguments
84
- elsif code_parameter.regular_splat?
87
+ if code_parameter.spread? || code_parameter.regular_splat?
85
88
  code_arguments
86
89
  elsif code_parameter.keyword_splat?
87
90
  code_arguments.raw.detect do |code_argument|
@@ -95,7 +98,7 @@ class Code
95
98
  elsif code_parameter.keyword?
96
99
  code_arguments
97
100
  .raw
98
- .select { |code_argument| code_argument.is_a?(Dictionary) }
101
+ .grep(Dictionary)
99
102
  .detect do |code_dictionary|
100
103
  code_dictionary.code_has_key?(
101
104
  code_parameter.code_name
@@ -121,14 +124,12 @@ class Code
121
124
  code_parameters
122
125
  .raw
123
126
  .inject([]) do |signature, code_parameter|
124
- if code_parameter.spread?
127
+ if code_parameter.spread? || code_parameter.regular_splat?
125
128
  signature + [Object.repeat]
126
129
  elsif code_parameter.block?
127
130
  signature + [Function]
128
131
  elsif code_parameter.keyword_splat?
129
132
  signature + [Dictionary.maybe]
130
- elsif code_parameter.regular_splat?
131
- signature + [Object.repeat]
132
133
  elsif code_parameter.keyword? && code_parameter.required?
133
134
  if signature.last.is_a?(::Hash)
134
135
  signature.last[code_parameter.code_name] = Object
@@ -157,7 +158,10 @@ class Code
157
158
  [
158
159
  {
159
160
  function: {
160
- parameters: code_parameters.raw.map { |parameter| parameter_to_raw(parameter) },
161
+ parameters:
162
+ code_parameters.raw.map do |parameter|
163
+ parameter_to_raw(parameter)
164
+ end,
161
165
  body: code_body.raw.to_raw
162
166
  }
163
167
  }
@@ -206,7 +210,9 @@ class Code
206
210
  current = context
207
211
 
208
212
  while current
209
- return current.code_fetch("self") if current.code_has_key?("self").truthy?
213
+ if current.code_has_key?("self").truthy?
214
+ return current.code_fetch("self")
215
+ end
210
216
 
211
217
  current = current.parent
212
218
  end
@@ -231,7 +237,13 @@ class Code
231
237
  end
232
238
 
233
239
  unless code_parameter.code_default.nothing?
234
- raw_parameter[:default] = code_parameter.code_default.code_to_string.raw == "nothing" ? [] : Code.parse(code_parameter.code_default.to_s)
240
+ raw_parameter[:default] = (
241
+ if code_parameter.code_default.code_to_string.raw == "nothing"
242
+ []
243
+ else
244
+ Code.parse(code_parameter.code_default.to_s)
245
+ end
246
+ )
235
247
  end
236
248
 
237
249
  raw_parameter
@@ -202,10 +202,11 @@ class Code
202
202
  code_context = code_context.code_lookup!(code_operator)
203
203
  code_result = code_context.code_fetch(code_operator)
204
204
 
205
- if code_result.is_a?(Super)
206
- code_result.call(**args, operator: nil)
207
- elsif code_result.is_a?(Function) &&
208
- args.fetch(:explicit_arguments, false)
205
+ if code_result.is_a?(Super) ||
206
+ (
207
+ code_result.is_a?(Function) &&
208
+ args.fetch(:explicit_arguments, false)
209
+ )
209
210
  code_result.call(**args, operator: nil)
210
211
  else
211
212
  sig(args)