ridl 2.8.2 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 880d87c66c5e6542fd7a61744fd2c10db2344e75849e73efbc45e26f8c33511a
4
- data.tar.gz: 3d8b9e40f5d9220f5a677e4ebee507042f31246a0cbdc680166512985a1ba6ee
3
+ metadata.gz: 25c3bce199d061c1831b488200a21eb0406c7b373d3343d07c9c30de95b75618
4
+ data.tar.gz: e69b6f0ae05819f53315ca9853b989c3710adb4a226d941d1f3905eaa8d4767c
5
5
  SHA512:
6
- metadata.gz: a79c369f080a3e914de2df4899bd523c312814abd400726c9315043495bbfa4b3870f9ebc696019804487c86b5b1edc4791c1252dd616ac342da214849764304
7
- data.tar.gz: a136ede546812cafba12a925d7c86415d5e453f2ad4d513f65be54751434c2bbd43fca0bbcea36bc898d522a2bd644da71dedd56029c26473ca77645a1827cfd
6
+ metadata.gz: ffc5501446d39835035a8a88005daf4a9ada39c2edb6124cfabdc3645f0fa5b8327e6c7671c232f46e7aede73c4252ad784131da1222f70c8752dc90d127c648
7
+ data.tar.gz: d29f08458378ef6b36516984f8f6d67ff556fb4553c542848e932dc786c7c852e2b2ed91fff7e38684bbedf5e923d2f5a5314980418769e047967a08c8d1a2ac
data/README.rdoc CHANGED
@@ -1,6 +1,8 @@
1
- {<img src="https://badge.fury.io/rb/ridl.svg" alt="Gem Version" />}[https://badge.fury.io/rb/ridl]
2
- {<img src="https://github.com/RemedyIT/ridl/workflows/linux/badge.svg" alt="Linux CI" />}[https://github.com/RemedyIT/ridl/actions?query=workflow%3Alinux]
3
- {<img src="https://www.codefactor.io/repository/github/remedyit/ridl/badge" alt="CodeFactor" />}[https://www.codefactor.io/repository/github/remedyit/ridl]
1
+ {rdoc-image:https://badge.fury.io/rb/ridl.svg}[https://badge.fury.io/rb/ridl]
2
+ {rdoc-image:https://github.com/RemedyIT/ridl/workflows/r2corba/badge.svg}[https://github.com/RemedyIT/ridl/actions?query=workflow%3Ar2corba]
3
+ {rdoc-image:https://github.com/RemedyIT/ridl/workflows/taox11/badge.svg}[https://github.com/RemedyIT/ridl/actions?query=workflow%3Ataox11]
4
+ {rdoc-image:https://github.com/RemedyIT/ridl/workflows/ciaox11/badge.svg}[https://github.com/RemedyIT/ridl/actions?query=workflow%3Aciaox11]
5
+ {rdoc-image:https://www.codefactor.io/repository/github/remedyit/ridl/badge}[https://www.codefactor.io/repository/github/remedyit/ridl]
4
6
 
5
7
  = RIDL Compiler
6
8
 
data/lib/ridl/backend.rb CHANGED
@@ -11,15 +11,14 @@
11
11
  #--------------------------------------------------------------------
12
12
 
13
13
  module IDL
14
-
15
14
  class Backend
16
-
17
15
  @@backends = {}
18
16
 
19
17
  class ProcessStop < RuntimeError; end
20
18
 
21
19
  class Configurator
22
20
  attr_reader :backend
21
+
23
22
  def initialize(be_name, root, title, copyright, version)
24
23
  @backend = IDL::Backend.new(be_name, root, title, copyright, version)
25
24
  @be_ext_klass = class << @backend; self; end
@@ -47,10 +46,10 @@ module IDL
47
46
  IDL.log(1, "> loaded RIDL backend :#{be_name} from #{@@backends[be_name.to_sym].root}")
48
47
  # return backend
49
48
  return @@backends[be_name.to_sym]
50
- rescue LoadError => ex
49
+ rescue LoadError => e
51
50
  IDL.error "ERROR: Cannot load RIDL backend [:#{be_name}]"
52
- IDL.error ex.inspect
53
- IDL.error(ex.backtrace.join("\n")) if IDL.verbose_level > 0
51
+ IDL.error e.inspect
52
+ IDL.error(e.backtrace.join("\n")) if IDL.verbose_level.positive?
54
53
  exit 1
55
54
  end
56
55
  end
@@ -62,7 +61,7 @@ module IDL
62
61
  end
63
62
 
64
63
  # stop processing of current input and skip to next or exit RIDL
65
- def self.stop_processing(msg='')
64
+ def self.stop_processing(msg = '')
66
65
  raise ProcessStop, msg, caller(1).first
67
66
  end
68
67
 
@@ -71,7 +70,7 @@ module IDL
71
70
  @root = root
72
71
  @title = ttl
73
72
  @copyright = cpr
74
- @version = (Hash === ver ? ver : { :major => ver.to_i, :minor => 0, :release => 0 })
73
+ @version = (Hash === ver ? ver : { major: ver.to_i, minor: 0, release: 0 })
75
74
  @base_backends = []
76
75
  end
77
76
 
@@ -84,24 +83,25 @@ module IDL
84
83
  def print_version
85
84
  puts "#{title} #{version}"
86
85
  puts copyright
87
- @base_backends.each {|be| puts '---'; be.print_version }
86
+ @base_backends.each { |be| puts '---'
87
+ be.print_version }
88
88
  end
89
89
 
90
90
  def lookup_path
91
- @base_backends.inject([@root]) {|paths, bbe| paths.concat(bbe.lookup_path) }
91
+ @base_backends.inject([@root]) { |paths, bbe| paths.concat(bbe.lookup_path) }
92
92
  end
93
93
 
94
94
  def setup_be(optlist, idl_options)
95
95
  # initialize base backends in reverse order so each dependent BE can overrule its
96
96
  # base settings
97
- @base_backends.reverse.each {|be| be.setup_be(optlist, idl_options) }
97
+ @base_backends.reverse.each { |be| be.setup_be(optlist, idl_options) }
98
98
  # initialize this backend
99
99
  _setup_be(optlist, idl_options) if self.respond_to?(:_setup_be, true)
100
100
  end
101
101
 
102
102
  def process_input(parser, params)
103
103
  # process input bottom-up
104
- @base_backends.reverse.each {|be| be.process_input(parser, params) }
104
+ @base_backends.reverse.each { |be| be.process_input(parser, params) }
105
105
  _process_input(parser, params) if self.respond_to?(:_process_input, true)
106
106
  end
107
107
 
@@ -115,6 +115,5 @@ module IDL
115
115
  end
116
116
  end
117
117
  end
118
-
119
118
  end
120
119
  end
data/lib/ridl/delegate.rb CHANGED
@@ -13,11 +13,9 @@ require 'ridl/node'
13
13
  require 'ridl/expression'
14
14
 
15
15
  module IDL
16
-
17
16
  ORB_PIDL = 'orb.pidlc'.freeze
18
17
 
19
18
  class Delegator
20
-
21
19
  # #pragma handler registry
22
20
  # each keyed entry a callable object:
23
21
  # - responds to #call(delegator, cur_node, pragma_string)
@@ -26,6 +24,7 @@ class Delegator
26
24
 
27
25
  def self.add_pragma_handler(key, h = nil, &block)
28
26
  raise 'add_pragma_handler requires a callable object or a block' unless h&.respond_to?(:call) || block_given?
27
+
29
28
  @@pragma_handlers[key] = block_given? ? block : h
30
29
  end
31
30
 
@@ -41,7 +40,7 @@ class Delegator
41
40
  @preprocout = params[:output] if @preprocess
42
41
  @ignore_pidl = params[:ignore_pidl] || false
43
42
  @root_namespace = nil
44
- if not params[:namespace].nil?
43
+ unless params[:namespace].nil?
45
44
  @root_namespace = IDL::AST::Module.new(params[:namespace], nil, {})
46
45
  end
47
46
  end
@@ -58,8 +57,8 @@ class Delegator
58
57
  begin
59
58
  @root, @includes = Marshal.load(f)
60
59
  @cur = @root
61
- rescue Exception => ex
62
- IDL.error("RIDL - failed to load ORB pidlc [#{ex}]\n You probably need to rebuild the bootstrap file (compile orb.idl to orb.pidlc).")
60
+ rescue Exception => e
61
+ IDL.error("RIDL - failed to load ORB pidlc [#{e}]\n You probably need to rebuild the bootstrap file (compile orb.idl to orb.pidlc).")
63
62
  exit(1)
64
63
  ensure
65
64
  f.close
@@ -73,6 +72,7 @@ class Delegator
73
72
  @last = nil
74
73
  @last_pos = nil
75
74
  end
75
+
76
76
  def post_parse
77
77
  if @preprocess
78
78
  Marshal.dump([@root, @includes], @preprocout)
@@ -100,7 +100,7 @@ class Delegator
100
100
  def walk_member(m, w)
101
101
  case m
102
102
  when IDL::AST::Include
103
- if !m.is_preprocessed?
103
+ unless m.is_preprocessed?
104
104
  if @expand_includes
105
105
  if m.is_defined?
106
106
  w.enter_include(m)
@@ -131,6 +131,7 @@ class Delegator
131
131
  _te = w.respond_to?(:enter_home)
132
132
  _tl = w.respond_to?(:leave_home)
133
133
  return unless _te || _tl
134
+
134
135
  w.enter_home(m) if _te
135
136
  m.walk_members { |cm| walk_member(cm, w) }
136
137
  w.leave_home(m) if _tl
@@ -141,6 +142,7 @@ class Delegator
141
142
  _te = w.respond_to?(:enter_component)
142
143
  _tl = w.respond_to?(:leave_component)
143
144
  return unless _te || _tl
145
+
144
146
  w.enter_component(m) if _te
145
147
  m.walk_members { |cm| walk_member(cm, w) }
146
148
  w.leave_component(m) if _tl
@@ -149,6 +151,7 @@ class Delegator
149
151
  _te = w.respond_to?(:enter_connector)
150
152
  _tl = w.respond_to?(:leave_connector)
151
153
  return unless _te || _tl
154
+
152
155
  w.enter_connector(m) if _te
153
156
  m.walk_members { |cm| walk_member(cm, w) }
154
157
  w.leave_connector(m) if _tl
@@ -210,7 +213,7 @@ class Delegator
210
213
  end
211
214
 
212
215
  def enter_include(s, fullpath)
213
- params = { :filename => s, :fullpath => fullpath }
216
+ params = { filename: s, fullpath: fullpath }
214
217
  params[:defined] = true
215
218
  params[:preprocessed] = @preprocess
216
219
  @cur = @cur.define(IDL::AST::Include, "$INC:" + s, params)
@@ -219,13 +222,13 @@ class Delegator
219
222
  @cur
220
223
  end
221
224
 
222
- def leave_include()
225
+ def leave_include
223
226
  set_last
224
227
  @cur = @cur.enclosure
225
228
  end
226
229
 
227
230
  def declare_include(s)
228
- params = { :filename => s, :fullpath => @includes[s].fullpath }
231
+ params = { filename: s, fullpath: @includes[s].fullpath }
229
232
  params[:defined] = false
230
233
  params[:preprocessed] = @includes[s].is_preprocessed?
231
234
  @cur.define(IDL::AST::Include, "$INC:" + s, params)
@@ -258,7 +261,7 @@ class Delegator
258
261
  end
259
262
 
260
263
  def handle_pragma(pragma_string)
261
- unless @@pragma_handlers.values.reduce(false) {|rc, h| h.call(self, @cur, pragma_string) || rc }
264
+ unless @@pragma_handlers.values.reduce(false) { |rc, h| h.call(self, @cur, pragma_string) || rc }
262
265
  IDL.log(1, "RIDL - unrecognized pragma encountered: #{pragma_string}.")
263
266
  end
264
267
  end
@@ -289,7 +292,8 @@ class Delegator
289
292
  set_last
290
293
  @cur
291
294
  end
292
- def end_module(node)
295
+
296
+ def end_module(_node)
293
297
  set_last(@cur)
294
298
  @cur = @cur.enclosure # must equals to argument mod
295
299
  end
@@ -302,6 +306,7 @@ class Delegator
302
306
  if global || names.size > 1
303
307
  raise "no scoped identifier allowed for template module: #{(global ? '::' : '') + names.join('::')}"
304
308
  end
309
+
305
310
  @cur = @cur.define(IDL::AST::TemplateModule, names[0])
306
311
  @cur.annotations.concat(@annotation_stack)
307
312
  @annotation_stack = IDL::AST::Annotations.new
@@ -316,7 +321,7 @@ class Delegator
316
321
  @template_module_name = nil # reset
317
322
  define_template_module(*tmp)
318
323
  end
319
- params = { :type => type }
324
+ params = { type: type }
320
325
  params[:annotations] = @annotation_stack
321
326
  @annotation_stack = IDL::AST::Annotations.new
322
327
  set_last(@cur.define(IDL::AST::TemplateParam, name, params))
@@ -330,7 +335,8 @@ class Delegator
330
335
  unless template_type.node.is_a?(IDL::AST::TemplateModule)
331
336
  raise "invalid module template specification: #{template_type.node.typename} #{template_type.node.scoped_lm_name}"
332
337
  end
333
- params = { :template => template_type.node, :template_params => parameters }
338
+
339
+ params = { template: template_type.node, template_params: parameters }
334
340
  mod_inst = @cur.define(IDL::AST::Module, name, params)
335
341
  mod_inst.annotations.concat(@annotation_stack)
336
342
  @annotation_stack = IDL::AST::Annotations.new
@@ -348,13 +354,14 @@ class Delegator
348
354
  @cur
349
355
  end
350
356
 
351
- def declare_interface(name, attrib=nil)
357
+ def declare_interface(name, attrib = nil)
352
358
  params = {}
353
359
  params[:abstract] = attrib == :abstract
354
360
  params[:local] = attrib == :local
355
361
  params[:forward] = true
356
362
  params[:pseudo] = false
357
363
  raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
364
+
358
365
  @cur.define(IDL::AST::Interface, name, params)
359
366
  set_last
360
367
  @cur
@@ -372,7 +379,8 @@ class Delegator
372
379
  set_last
373
380
  @cur = @cur.define(IDL::AST::Interface, name, params)
374
381
  end
375
- def end_interface(node)
382
+
383
+ def end_interface(_node)
376
384
  set_last(@cur)
377
385
  @cur = @cur.enclosure # must equals to argument mod
378
386
  end
@@ -389,7 +397,7 @@ class Delegator
389
397
  @cur = @cur.define(IDL::AST::Home, name, params)
390
398
  end
391
399
 
392
- def end_home(node)
400
+ def end_home(_node)
393
401
  set_last(@cur)
394
402
  @cur = @cur.enclosure
395
403
  end
@@ -398,6 +406,7 @@ class Delegator
398
406
  params = {}
399
407
  params[:forward] = true
400
408
  raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
409
+
401
410
  set_last
402
411
  @cur.define(IDL::AST::Component, name, params)
403
412
  end
@@ -412,7 +421,7 @@ class Delegator
412
421
  @cur = @cur.define(IDL::AST::Component, name, params)
413
422
  end
414
423
 
415
- def end_component(node)
424
+ def end_component(_node)
416
425
  set_last(@cur)
417
426
  @cur = @cur.enclosure
418
427
  end
@@ -426,7 +435,7 @@ class Delegator
426
435
  @cur = @cur.define(IDL::AST::Connector, name, params)
427
436
  end
428
437
 
429
- def end_connector(node)
438
+ def end_connector(_node)
430
439
  set_last(@cur)
431
440
  @cur = @cur.enclosure
432
441
  end
@@ -439,7 +448,7 @@ class Delegator
439
448
  @cur = @cur.define(IDL::AST::Porttype, name, params)
440
449
  end
441
450
 
442
- def end_porttype(node)
451
+ def end_porttype(_node)
443
452
  set_last(@cur)
444
453
  @cur = @cur.enclosure
445
454
  end
@@ -455,17 +464,18 @@ class Delegator
455
464
  @cur
456
465
  end
457
466
 
458
- def declare_eventtype(name, attrib=nil)
467
+ def declare_eventtype(name, attrib = nil)
459
468
  params = {}
460
469
  params[:abstract] = attrib == :abstract
461
470
  params[:forward] = true
462
471
  raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
472
+
463
473
  set_last
464
474
  @cur.define(IDL::AST::Eventtype, name, params)
465
475
  @cur
466
476
  end
467
477
 
468
- def define_eventtype(name, attrib, inherits={})
478
+ def define_eventtype(name, attrib, inherits = {})
469
479
  params = {}
470
480
  params[:abstract] = attrib == :abstract
471
481
  params[:custom] = attrib == :custom
@@ -478,17 +488,18 @@ class Delegator
478
488
  @cur
479
489
  end
480
490
 
481
- def declare_valuetype(name, attrib=nil)
491
+ def declare_valuetype(name, attrib = nil)
482
492
  params = {}
483
493
  params[:abstract] = attrib == :abstract
484
494
  params[:forward] = true
485
495
  raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
496
+
486
497
  set_last
487
498
  @cur.define(IDL::AST::Valuetype, name, params)
488
499
  @cur
489
500
  end
490
501
 
491
- def define_valuetype(name, attrib, inherits={})
502
+ def define_valuetype(name, attrib, inherits = {})
492
503
  params = {}
493
504
  params[:abstract] = attrib == :abstract
494
505
  params[:custom] = attrib == :custom
@@ -521,7 +532,7 @@ class Delegator
521
532
  end
522
533
 
523
534
  def define_valuebox(name, type)
524
- params = { :type => type }
535
+ params = { type: type }
525
536
  params[:annotations] = @annotation_stack
526
537
  @annotation_stack = IDL::AST::Annotations.new
527
538
  set_last(@cur.define(IDL::AST::Valuebox, name, params))
@@ -556,6 +567,7 @@ class Delegator
556
567
  if n.nil?
557
568
  raise "cannot find type name '#{nm}' in scope '#{node.scoped_name}'"
558
569
  end
570
+
559
571
  node = n
560
572
  first = node if first.nil?
561
573
  end
@@ -594,11 +606,12 @@ class Delegator
594
606
  Type::Short,
595
607
  Type::Long,
596
608
  Type::LongLong,
597
- Type::ULongLong,
598
- ].detect {|t| t::Range === _value }
609
+ Type::ULongLong
610
+ ].detect { |t| t::Range === _value }
599
611
  if _type.nil?
600
612
  raise "it's not a valid integer: #{v.to_s}"
601
613
  end
614
+
602
615
  k.new(_type.new, _value)
603
616
  when :string
604
617
  k.new(Type::String.new, _value)
@@ -623,15 +636,16 @@ class Delegator
623
636
  else
624
637
  if not ::Integer === _expression.value
625
638
  raise "must be integer: #{_expression.value.inspect}"
626
- elsif _expression.value < 0
627
- raise "must be positive integer: #{_expression.value.to_s}"
639
+ elsif _expression.value.negative?
640
+ raise "must be positive integer: #{_expression.value}"
628
641
  end
642
+
629
643
  _expression.value
630
644
  end
631
645
  end
632
646
 
633
647
  def define_const(_type, _name, _expression)
634
- params = { :type => _type, :expression => _expression }
648
+ params = { type: _type, expression: _expression }
635
649
  params[:annotations] = @annotation_stack
636
650
  @annotation_stack = IDL::AST::Annotations.new
637
651
  set_last(@cur.define(IDL::AST::Const, _name, params))
@@ -639,7 +653,7 @@ class Delegator
639
653
  end
640
654
 
641
655
  def declare_op_header(_oneway, _type, _name)
642
- params = Hash.new
656
+ params = {}
643
657
  params[:oneway] = (_oneway == :oneway)
644
658
  params[:type] = _type
645
659
  params[:annotations] = @annotation_stack
@@ -647,8 +661,9 @@ class Delegator
647
661
  set_last
648
662
  @cur = @cur.define(IDL::AST::Operation, _name, params)
649
663
  end
664
+
650
665
  def declare_op_parameter(_attribute, _type, _name)
651
- params = Hash.new
666
+ params = {}
652
667
  params[:attribute] = _attribute
653
668
  params[:type] = _type
654
669
  params[:annotations] = @annotation_stack
@@ -656,18 +671,20 @@ class Delegator
656
671
  set_last(@cur.define(IDL::AST::Parameter, _name, params))
657
672
  @cur
658
673
  end
674
+
659
675
  def declare_op_footer(_raises, instantiation_context)
660
676
  @cur.raises = _raises || []
661
677
  @cur.context = instantiation_context
662
- if not @cur.context.nil?
678
+ unless @cur.context.nil?
663
679
  raise "context phrase's not supported"
664
680
  end
681
+
665
682
  set_last(@cur)
666
683
  @cur = @cur.enclosure
667
684
  end
668
685
 
669
- def declare_attribute(_type, _name, _readonly=false)
670
- params = Hash.new
686
+ def declare_attribute(_type, _name, _readonly = false)
687
+ params = {}
671
688
  params[:type] = _type
672
689
  params[:readonly] = _readonly
673
690
  params[:annotations] = @annotation_stack
@@ -675,28 +692,32 @@ class Delegator
675
692
  set_last(@cur.define(IDL::AST::Attribute, _name, params))
676
693
  end
677
694
 
678
- def declare_struct(_name)
679
- params = { :forward => true }
695
+ def declare_struct(name)
696
+ params = { forward: true }
680
697
  raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
698
+
681
699
  set_last
682
- @cur.define(IDL::AST::Struct, _name, params)
700
+ @cur.define(IDL::AST::Struct, name, params)
683
701
  @cur
684
702
  end
685
- def define_struct(_name)
686
- params = { :forward => false }
703
+
704
+ def define_struct(name)
705
+ params = { forward: false }
687
706
  params[:annotations] = @annotation_stack
688
707
  @annotation_stack = IDL::AST::Annotations.new
689
708
  set_last
690
- @cur = @cur.define(IDL::AST::Struct, _name, params)
709
+ @cur = @cur.define(IDL::AST::Struct, name, params)
691
710
  end
692
- def declare_member(_type, _name)
693
- params = Hash.new
711
+
712
+ def declare_member(_type, name)
713
+ params = {}
694
714
  params[:type] = _type
695
715
  params[:annotations] = @annotation_stack
696
716
  @annotation_stack = IDL::AST::Annotations.new
697
- set_last(@cur.define(IDL::AST::Member, _name, params))
717
+ set_last(@cur.define(IDL::AST::Member, name, params))
698
718
  @cur
699
719
  end
720
+
700
721
  def end_struct(node)
701
722
  node.defined = true
702
723
  set_last(@cur)
@@ -704,42 +725,48 @@ class Delegator
704
725
  @cur = @cur.enclosure
705
726
  ret
706
727
  end
707
- def define_exception(_name)
708
- params = { :forward => false }
728
+
729
+ def define_exception(name)
730
+ params = { forward: false }
709
731
  params[:annotations] = @annotation_stack
710
732
  @annotation_stack = IDL::AST::Annotations.new
711
733
  set_last
712
- @cur = @cur.define(IDL::AST::Exception, _name, params)
734
+ @cur = @cur.define(IDL::AST::Exception, name, params)
713
735
  end
714
- def end_exception(node)
736
+
737
+ def end_exception(_node)
715
738
  set_last(@cur)
716
739
  ret = IDL::Type::ScopedName.new(@cur)
717
740
  @cur = @cur.enclosure
718
741
  ret
719
742
  end
720
743
 
721
- def declare_union(_name)
722
- params = { :forward => true }
744
+ def declare_union(name)
745
+ params = { forward: true }
723
746
  raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
747
+
724
748
  set_last
725
- @cur.define(IDL::AST::Union, _name, params)
749
+ @cur.define(IDL::AST::Union, name, params)
726
750
  @cur
727
751
  end
728
- def define_union(_name)
729
- params = { :forward => false }
752
+
753
+ def define_union(name)
754
+ params = { forward: false }
730
755
  params[:annotations] = @annotation_stack
731
756
  @annotation_stack = IDL::AST::Annotations.new
732
757
  set_last
733
- @cur = @cur.define(IDL::AST::Union, _name, params)
758
+ @cur = @cur.define(IDL::AST::Union, name, params)
734
759
  end
760
+
735
761
  def define_union_switchtype(union_node, switchtype)
736
762
  union_node.set_switchtype(switchtype)
737
763
  union_node.annotations.concat(@annotation_stack)
738
764
  @annotation_stack = IDL::AST::Annotations.new
739
765
  union_node
740
766
  end
767
+
741
768
  def define_case(_labels, _type, _name)
742
- params = Hash.new
769
+ params = {}
743
770
  params[:type] = _type
744
771
  params[:labels] = _labels
745
772
  params[:annotations] = @annotation_stack
@@ -747,6 +774,7 @@ class Delegator
747
774
  set_last(@cur.define(IDL::AST::UnionMember, _name, params))
748
775
  @cur
749
776
  end
777
+
750
778
  def end_union(node)
751
779
  node.validate_labels
752
780
  node.defined = true
@@ -763,18 +791,20 @@ class Delegator
763
791
  set_last
764
792
  @cur = @cur.define(IDL::AST::Enum, _name, params)
765
793
  end
794
+
766
795
  def declare_enumerator(_name)
767
796
  n = @cur.enumerators.length
768
797
  params = {
769
- :value => n,
770
- :enum => @cur
798
+ value: n,
799
+ enum: @cur
771
800
  }
772
801
  params[:annotations] = @annotation_stack
773
802
  @annotation_stack = IDL::AST::Annotations.new
774
803
  set_last(@cur.enclosure.define(IDL::AST::Enumerator, _name, params))
775
804
  @cur
776
805
  end
777
- def end_enum(node)
806
+
807
+ def end_enum(_node)
778
808
  set_last(@cur)
779
809
  ret = IDL::Type::ScopedName.new(@cur)
780
810
  @cur = @cur.enclosure
@@ -782,7 +812,7 @@ class Delegator
782
812
  end
783
813
 
784
814
  def declare_typedef(_type, _name)
785
- params = Hash.new
815
+ params = {}
786
816
  params[:type] = _type
787
817
  params[:annotations] = @annotation_stack
788
818
  @annotation_stack = IDL::AST::Annotations.new