ridl 2.7.1 → 2.8.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87ce802ae63d060ff0417d998795740726aaf67f631484735aa56191404bf78d
4
- data.tar.gz: 888f4de7ff1a2146928c42b60298d6662d765dd7406c43287457182a81deb4ab
3
+ metadata.gz: be5b79c10b3a4bb8e2f0404004ec5201332bef859fc69c636c4750e8eb6f6b13
4
+ data.tar.gz: 0a23918976bfb9b7db6595409d974fc80be2b5a686f8b40220fa689edd9cc791
5
5
  SHA512:
6
- metadata.gz: d3c4384299da19d91f593c578003615949962270392ee9293296341bd15ccf72c29cd8e304feefc777d2d408b36b67c830f44154b27d86589c98b79e32ec9e7d
7
- data.tar.gz: 8717656df74c22c74e23acbf8e80748e646ece8be1e68131126c5d58e64ce093c038e9687b44c8042a119bc66bbb2b77ab73001a7678b234ca1b7f6c8d5710e0
6
+ metadata.gz: a187e41cc1d3c1d77f79f2ed9e43dccc4b83bc89b98ed4e2771627b2b1b771ba26390624f9abf779e1e2c5c89d7776698045408ca3ceb8ca9f10ecf87c6d0db6
7
+ data.tar.gz: b90d9a055d29d2de3dcee867df3ca57a26c8ddefd5b77fc3ff1a8a3ab7f645b395d8359c93b8a8a65122b006a76cd9f89815141239cd8e335cf21a78916b89b7
@@ -1,5 +1,5 @@
1
1
  {<img src="https://badge.fury.io/rb/ridl.svg" alt="Gem Version" />}[https://badge.fury.io/rb/ridl]
2
- {<img src="https://dev.azure.com/remedyit/axcioma/_apis/build/status/ridl?branchName=master" alt="Azure pipeline" />}[https://dev.azure.com/remedyit/axcioma/_build?definitionId=7&_a=summary]
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
3
  {<img src="https://www.codefactor.io/repository/github/remedyit/ridl/badge" alt="CodeFactor" />}[https://www.codefactor.io/repository/github/remedyit/ridl]
4
4
 
5
5
  = RIDL Compiler
@@ -205,10 +205,6 @@ class Delegator
205
205
  end
206
206
  end
207
207
 
208
- def cur_parsed_name_scope
209
- @cur ? @cur.parsed_name_scope : ''
210
- end
211
-
212
208
  def is_included?(s)
213
209
  @includes.has_key?(s)
214
210
  end
@@ -288,8 +284,8 @@ class Delegator
288
284
 
289
285
  def define_module(name)
290
286
  @cur = @cur.define(IDL::AST::Module, name)
291
- @cur.annotations.concat(@annotation_stack) unless @annotation_stack.empty?
292
- @annotation_stack.clear
287
+ @cur.annotations.concat(@annotation_stack)
288
+ @annotation_stack = IDL::AST::Annotations.new
293
289
  set_last
294
290
  @cur
295
291
  end
@@ -307,8 +303,8 @@ class Delegator
307
303
  raise "no scoped identifier allowed for template module: #{(global ? '::' : '')+names.join('::')}"
308
304
  end
309
305
  @cur = @cur.define(IDL::AST::TemplateModule, names[0])
310
- @cur.annotations.concat(@annotation_stack) unless @annotation_stack.empty?
311
- @annotation_stack.clear
306
+ @cur.annotations.concat(@annotation_stack)
307
+ @annotation_stack = IDL::AST::Annotations.new
312
308
  set_last
313
309
  @cur
314
310
  end
@@ -321,8 +317,8 @@ class Delegator
321
317
  define_template_module(*tmp)
322
318
  end
323
319
  params = { :type => type }
324
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
325
- @annotation_stack.clear
320
+ params[:annotations] = @annotation_stack
321
+ @annotation_stack = IDL::AST::Annotations.new
326
322
  set_last(@cur.define(IDL::AST::TemplateParam, name, params))
327
323
  @cur
328
324
  end
@@ -336,8 +332,8 @@ class Delegator
336
332
  end
337
333
  params = { :template => template_type.node, :template_params => parameters }
338
334
  mod_inst = @cur.define(IDL::AST::Module, name, params)
339
- mod_inst.annotations.concat(@annotation_stack) unless @annotation_stack.empty?
340
- @annotation_stack.clear
335
+ mod_inst.annotations.concat(@annotation_stack)
336
+ @annotation_stack = IDL::AST::Annotations.new
341
337
  set_last(mod_inst.template.instantiate(mod_inst))
342
338
  @cur
343
339
  end
@@ -346,8 +342,8 @@ class Delegator
346
342
  params = {}
347
343
  params[:tpl_type] = type
348
344
  params[:tpl_params] = tpl_params || []
349
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
350
- @annotation_stack.clear
345
+ params[:annotations] = @annotation_stack
346
+ @annotation_stack = IDL::AST::Annotations.new
351
347
  set_last(@cur.define(IDL::AST::TemplateModuleReference, name, params))
352
348
  @cur
353
349
  end
@@ -371,8 +367,8 @@ class Delegator
371
367
  params[:pseudo] = attrib == :pseudo
372
368
  params[:forward] = false
373
369
  params[:inherits] = inherits
374
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
375
- @annotation_stack.clear
370
+ params[:annotations] = @annotation_stack
371
+ @annotation_stack = IDL::AST::Annotations.new
376
372
  set_last
377
373
  @cur = @cur.define(IDL::AST::Interface, name, params)
378
374
  end
@@ -387,8 +383,8 @@ class Delegator
387
383
  params[:component] = component
388
384
  params[:key] = key
389
385
  params[:supports] = supports || []
390
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
391
- @annotation_stack.clear
386
+ params[:annotations] = @annotation_stack
387
+ @annotation_stack = IDL::AST::Annotations.new
392
388
  set_last
393
389
  @cur = @cur.define(IDL::AST::Home, name, params)
394
390
  end
@@ -410,8 +406,8 @@ class Delegator
410
406
  params = {}
411
407
  params[:base] = base
412
408
  params[:supports] = supports || []
413
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
414
- @annotation_stack.clear
409
+ params[:annotations] = @annotation_stack
410
+ @annotation_stack = IDL::AST::Annotations.new
415
411
  set_last
416
412
  @cur = @cur.define(IDL::AST::Component, name, params)
417
413
  end
@@ -424,8 +420,8 @@ class Delegator
424
420
  def define_connector(name, base = nil)
425
421
  params = {}
426
422
  params[:base] = base
427
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
428
- @annotation_stack.clear
423
+ params[:annotations] = @annotation_stack
424
+ @annotation_stack = IDL::AST::Annotations.new
429
425
  set_last
430
426
  @cur = @cur.define(IDL::AST::Connector, name, params)
431
427
  end
@@ -437,8 +433,8 @@ class Delegator
437
433
 
438
434
  def define_porttype(name)
439
435
  params = {}
440
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
441
- @annotation_stack.clear
436
+ params[:annotations] = @annotation_stack
437
+ @annotation_stack = IDL::AST::Annotations.new
442
438
  set_last
443
439
  @cur = @cur.define(IDL::AST::Porttype, name, params)
444
440
  end
@@ -453,8 +449,8 @@ class Delegator
453
449
  params[:porttype] = porttype
454
450
  params[:type] = type
455
451
  params[:multiple] = multiple
456
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
457
- @annotation_stack.clear
452
+ params[:annotations] = @annotation_stack
453
+ @annotation_stack = IDL::AST::Annotations.new
458
454
  set_last(@cur.define(IDL::AST::Port, name, params))
459
455
  @cur
460
456
  end
@@ -475,8 +471,8 @@ class Delegator
475
471
  params[:custom] = attrib == :custom
476
472
  params[:forward] = false
477
473
  params[:inherits] = inherits
478
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
479
- @annotation_stack.clear
474
+ params[:annotations] = @annotation_stack
475
+ @annotation_stack = IDL::AST::Annotations.new
480
476
  set_last
481
477
  @cur = @cur.define(IDL::AST::Eventtype, name, params)
482
478
  @cur
@@ -498,8 +494,8 @@ class Delegator
498
494
  params[:custom] = attrib == :custom
499
495
  params[:forward] = false
500
496
  params[:inherits] = inherits
501
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
502
- @annotation_stack.clear
497
+ params[:annotations] = @annotation_stack
498
+ @annotation_stack = IDL::AST::Annotations.new
503
499
  set_last
504
500
  @cur = @cur.define(IDL::AST::Valuetype, name, params)
505
501
  @cur
@@ -518,16 +514,16 @@ class Delegator
518
514
  params = {}
519
515
  params[:type] = type
520
516
  params[:visibility] = (public_ ? :public : :private)
521
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
522
- @annotation_stack.clear
517
+ params[:annotations] = @annotation_stack
518
+ @annotation_stack = IDL::AST::Annotations.new
523
519
  set_last(@cur.define(IDL::AST::StateMember, name, params))
524
520
  @cur
525
521
  end
526
522
 
527
523
  def define_valuebox(name, type)
528
524
  params = { :type => type }
529
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
530
- @annotation_stack.clear
525
+ params[:annotations] = @annotation_stack
526
+ @annotation_stack = IDL::AST::Annotations.new
531
527
  set_last(@cur.define(IDL::AST::Valuebox, name, params))
532
528
  @cur
533
529
  end
@@ -536,8 +532,8 @@ class Delegator
536
532
  params = {}
537
533
  params[:params] = params_
538
534
  params[:raises] = raises_
539
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
540
- @annotation_stack.clear
535
+ params[:annotations] = @annotation_stack
536
+ @annotation_stack = IDL::AST::Annotations.new
541
537
  set_last(@cur.define(IDL::AST::Initializer, name, params))
542
538
  @cur
543
539
  end
@@ -546,8 +542,8 @@ class Delegator
546
542
  params = {}
547
543
  params[:params] = params_
548
544
  params[:raises] = raises_
549
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
550
- @annotation_stack.clear
545
+ params[:annotations] = @annotation_stack
546
+ @annotation_stack = IDL::AST::Annotations.new
551
547
  set_last(@cur.define(IDL::AST::Finder, name, params))
552
548
  @cur
553
549
  end
@@ -636,8 +632,8 @@ class Delegator
636
632
 
637
633
  def define_const(_type, _name, _expression)
638
634
  params = { :type => _type, :expression => _expression }
639
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
640
- @annotation_stack.clear
635
+ params[:annotations] = @annotation_stack
636
+ @annotation_stack = IDL::AST::Annotations.new
641
637
  set_last(@cur.define(IDL::AST::Const, _name, params))
642
638
  @cur
643
639
  end
@@ -646,8 +642,8 @@ class Delegator
646
642
  params = Hash.new
647
643
  params[:oneway] = (_oneway == :oneway)
648
644
  params[:type] = _type
649
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
650
- @annotation_stack.clear
645
+ params[:annotations] = @annotation_stack
646
+ @annotation_stack = IDL::AST::Annotations.new
651
647
  set_last
652
648
  @cur = @cur.define(IDL::AST::Operation, _name, params)
653
649
  end
@@ -655,14 +651,14 @@ class Delegator
655
651
  params = Hash.new
656
652
  params[:attribute] = _attribute
657
653
  params[:type] = _type
658
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
659
- @annotation_stack.clear
654
+ params[:annotations] = @annotation_stack
655
+ @annotation_stack = IDL::AST::Annotations.new
660
656
  set_last(@cur.define(IDL::AST::Parameter, _name, params))
661
657
  @cur
662
658
  end
663
- def declare_op_footer(_raises, _context)
659
+ def declare_op_footer(_raises, instantiation_context)
664
660
  @cur.raises = _raises || []
665
- @cur.context = _context
661
+ @cur.context = instantiation_context
666
662
  if not @cur.context.nil?
667
663
  raise "context phrase's not supported"
668
664
  end
@@ -674,8 +670,8 @@ class Delegator
674
670
  params = Hash.new
675
671
  params[:type] = _type
676
672
  params[:readonly] = _readonly
677
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
678
- @annotation_stack.clear
673
+ params[:annotations] = @annotation_stack
674
+ @annotation_stack = IDL::AST::Annotations.new
679
675
  set_last(@cur.define(IDL::AST::Attribute, _name, params))
680
676
  end
681
677
 
@@ -688,16 +684,16 @@ class Delegator
688
684
  end
689
685
  def define_struct(_name)
690
686
  params = { :forward => false }
691
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
692
- @annotation_stack.clear
687
+ params[:annotations] = @annotation_stack
688
+ @annotation_stack = IDL::AST::Annotations.new
693
689
  set_last
694
690
  @cur = @cur.define(IDL::AST::Struct, _name, params)
695
691
  end
696
692
  def declare_member(_type, _name)
697
693
  params = Hash.new
698
694
  params[:type] = _type
699
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
700
- @annotation_stack.clear
695
+ params[:annotations] = @annotation_stack
696
+ @annotation_stack = IDL::AST::Annotations.new
701
697
  set_last(@cur.define(IDL::AST::Member, _name, params))
702
698
  @cur
703
699
  end
@@ -710,8 +706,8 @@ class Delegator
710
706
  end
711
707
  def define_exception(_name)
712
708
  params = { :forward => false }
713
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
714
- @annotation_stack.clear
709
+ params[:annotations] = @annotation_stack
710
+ @annotation_stack = IDL::AST::Annotations.new
715
711
  set_last
716
712
  @cur = @cur.define(IDL::AST::Exception, _name, params)
717
713
  end
@@ -731,23 +727,23 @@ class Delegator
731
727
  end
732
728
  def define_union(_name)
733
729
  params = { :forward => false }
734
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
735
- @annotation_stack.clear
730
+ params[:annotations] = @annotation_stack
731
+ @annotation_stack = IDL::AST::Annotations.new
736
732
  set_last
737
733
  @cur = @cur.define(IDL::AST::Union, _name, params)
738
734
  end
739
735
  def define_union_switchtype(union_node, switchtype)
740
736
  union_node.set_switchtype(switchtype)
741
- union_node.annotations.concat(@annotation_stack) unless @annotation_stack.empty?
742
- @annotation_stack.clear
737
+ union_node.annotations.concat(@annotation_stack)
738
+ @annotation_stack = IDL::AST::Annotations.new
743
739
  union_node
744
740
  end
745
741
  def define_case(_labels, _type, _name)
746
742
  params = Hash.new
747
743
  params[:type] = _type
748
744
  params[:labels] = _labels
749
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
750
- @annotation_stack.clear
745
+ params[:annotations] = @annotation_stack
746
+ @annotation_stack = IDL::AST::Annotations.new
751
747
  set_last(@cur.define(IDL::AST::UnionMember, _name, params))
752
748
  @cur
753
749
  end
@@ -762,8 +758,8 @@ class Delegator
762
758
 
763
759
  def define_enum(_name)
764
760
  params = {}
765
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
766
- @annotation_stack.clear
761
+ params[:annotations] = @annotation_stack
762
+ @annotation_stack = IDL::AST::Annotations.new
767
763
  set_last
768
764
  @cur = @cur.define(IDL::AST::Enum, _name, params)
769
765
  end
@@ -773,8 +769,8 @@ class Delegator
773
769
  :value => n,
774
770
  :enum => @cur
775
771
  }
776
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
777
- @annotation_stack.clear
772
+ params[:annotations] = @annotation_stack
773
+ @annotation_stack = IDL::AST::Annotations.new
778
774
  set_last(@cur.enclosure.define(IDL::AST::Enumerator, _name, params))
779
775
  @cur
780
776
  end
@@ -788,8 +784,8 @@ class Delegator
788
784
  def declare_typedef(_type, _name)
789
785
  params = Hash.new
790
786
  params[:type] = _type
791
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
792
- @annotation_stack.clear
787
+ params[:annotations] = @annotation_stack
788
+ @annotation_stack = IDL::AST::Annotations.new
793
789
  set_last(@cur.define(IDL::AST::Typedef, _name, params))
794
790
  @cur
795
791
  end
@@ -21,7 +21,7 @@ module IDL
21
21
  false
22
22
  end
23
23
 
24
- def instantiate(_context)
24
+ def instantiate(_)
25
25
  self
26
26
  end
27
27
 
@@ -47,9 +47,9 @@ module IDL
47
47
  def is_template?
48
48
  @node.is_template?
49
49
  end
50
- def instantiate(_context)
50
+ def instantiate(instantiation_context)
51
51
  if self.is_template?
52
- cp = IDL::AST::TemplateParam.concrete_param(_context, @node)
52
+ cp = IDL::AST::TemplateParam.concrete_param(instantiation_context, @node)
53
53
  cp.is_a?(Expression) ? cp : ScopedName.new(cp)
54
54
  else
55
55
  self
@@ -104,8 +104,8 @@ module IDL
104
104
  @operands.any? { |o| o.is_template? }
105
105
  end
106
106
 
107
- def instantiate(_context)
108
- self.is_template? ? self.class.new(*@operands.collect { |o| o.instantiate(_context) }) : self
107
+ def instantiate(instantiation_context)
108
+ self.is_template? ? self.class.new(*@operands.collect { |o| o.instantiate(instantiation_context) }) : self
109
109
  end
110
110
 
111
111
  def Operation.suite_type(*types)
@@ -48,9 +48,9 @@ module IDL::AST
48
48
  end
49
49
 
50
50
  class Annotations
51
- def initialize(stack = [], index = {})
52
- @index = index
53
- @stack = stack
51
+ def initialize
52
+ @index = {}
53
+ @stack = []
54
54
  end
55
55
 
56
56
  def empty?
@@ -74,23 +74,13 @@ module IDL::AST
74
74
  self[annid].each(&block)
75
75
  end
76
76
 
77
- def clear
78
- @index.clear
79
- @stack.clear
80
- end
81
-
82
77
  def concat(anns)
83
- (anns || []).each {|_ann| self << _ann }
84
- end
85
-
86
- def dup
87
- self.class.new(@stack.dup, @index.dup)
78
+ anns.each {|_ann| self << _ann } if anns
88
79
  end
89
80
  end
90
81
 
91
82
  class Leaf
92
83
  attr_reader :name, :intern
93
- attr_reader :lm_name
94
84
  attr_accessor :enclosure
95
85
  attr_reader :scopes
96
86
  attr_reader :prefix
@@ -104,26 +94,26 @@ module IDL::AST
104
94
  _name ||= ''
105
95
  _name = IDL::Scanner::Identifier.new(_name, _name) unless IDL::Scanner::Identifier === _name
106
96
  @name = _name
107
- @lm_name = self.class.mk_name(_name.checked_name, _enclosure.nil? ? false : _enclosure.scopes.size>0).freeze
97
+ @lm_name = nil
108
98
  @intern = _name.rjust(1).downcase.intern
109
99
  @enclosure = _enclosure
110
- @scopes = if @enclosure.nil? then [] else (@enclosure.scopes.dup << self) end
100
+ @scopes = if @enclosure then (@enclosure.scopes.dup << self) else [] end
111
101
  @prefix = ''
112
102
  @repo_id = nil
113
103
  @repo_ver = nil
114
104
  @annotations = Annotations.new
115
105
  end
116
106
 
117
- def unescaped_name
118
- @name.unescaped_name
107
+ def lm_name
108
+ @lm_name ||= @name.checked_name.dup
119
109
  end
120
110
 
121
- def parsed_name_scope
122
- (@enclosure ? @enclosure.parsed_name_scope : '') + '::' + @name
111
+ def lm_scopes
112
+ @lm_scopes ||= if @enclosure then (@enclosure.lm_scopes.dup << lm_name) else [] end
123
113
  end
124
114
 
125
- def lm_name_for_scope
126
- lm_name
115
+ def unescaped_name
116
+ @name.unescaped_name
127
117
  end
128
118
 
129
119
  def scoped_name
@@ -131,29 +121,26 @@ module IDL::AST
131
121
  end
132
122
 
133
123
  def scoped_lm_name
134
- @scoped_lm_name ||= @scopes.collect{|s| s.lm_name_for_scope }.join('::').freeze
124
+ @scoped_lm_name ||= lm_scopes.join("::").freeze
135
125
  end
136
126
 
137
127
  def marshal_dump
138
- [@name, @lm_name, @intern, @enclosure, @scopes, @prefix, @repo_id, @repo_ver, @annotations]
128
+ [@name, lm_name, @intern, @enclosure, @scopes, @prefix, @repo_id, @repo_ver, @annotations]
139
129
  end
140
130
 
141
131
  def marshal_load(vars)
142
132
  @name, @lm_name, @intern, @enclosure, @scopes, @prefix, @repo_id, @repo_ver, @annotations = vars
143
133
  @scoped_name = nil
144
134
  @scoped_lm_name = nil
145
- end
146
-
147
- def repo_scopes
148
- @repo_scopes ||= (@enclosure.nil? ? [] : (@enclosure.repo_scopes.dup << self))
135
+ @lm_scopes = nil
149
136
  end
150
137
 
151
138
  def is_template?
152
139
  @enclosure && @enclosure.is_template?
153
140
  end
154
141
 
155
- def instantiate(_context, _enclosure, _params = {})
156
- (_context[self] = self.class.new(self.name, _enclosure, _params)).copy_from(self, _context)
142
+ def instantiate(instantiation_context, _enclosure, _params = {})
143
+ (instantiation_context[self] = self.class.new(self.name, _enclosure, _params)).copy_from(self, instantiation_context)
157
144
  end
158
145
 
159
146
  def set_repo_id(id)
@@ -201,30 +188,26 @@ module IDL::AST
201
188
  raise "ID prefix should not start with one of '#{REPO_ID_XCHARS.join("', '")}'" if REPO_ID_XCHARS.include?(pfx[0,1])
202
189
  raise 'Invalid ID prefix! Only a..z, A..Z, 0..9, \'.\', \'-\', \'_\' or \'\/\' allowed' unless REPO_ID_RE =~ pfx
203
190
  end
204
- self._set_prefix(pfx)
191
+ self.set_prefix(pfx)
205
192
  end
206
193
 
207
194
  def replace_prefix(pfx)
208
195
  self.prefix = pfx
209
196
  end
210
197
 
211
- def _set_prefix(pfx)
212
- @prefix = pfx.to_s
213
- end
214
-
215
198
  def repository_id
216
199
  if @repo_id.nil?
217
200
  @repo_ver = "1.0" unless @repo_ver
218
201
  format("IDL:%s%s:%s",
219
202
  if @prefix.empty? then "" else @prefix+"/" end,
220
- self.repo_scopes.collect{|s| s.name}.join("/"),
203
+ self.scopes.collect{|s| s.name}.join("/"),
221
204
  @repo_ver)
222
205
  else
223
206
  @repo_id
224
207
  end
225
208
  end
226
209
 
227
- def has_annotations?()
210
+ def has_annotations?
228
211
  !@annotations.empty?
229
212
  end
230
213
 
@@ -237,11 +220,16 @@ module IDL::AST
237
220
  end
238
221
 
239
222
  protected
240
- def copy_from(_template, _context)
241
- @prefix = _template.instance_variable_get(:@prefix)
242
- @repo_id = _template.instance_variable_get(:@repo_id)
243
- @repo_ver = _template.instance_variable_get(:@repo_ver)
244
- @annotations = _template.instance_variable_get(:@annotations)
223
+
224
+ def set_prefix(pfx)
225
+ @prefix = pfx.to_s
226
+ end
227
+
228
+ def copy_from(template, _)
229
+ @prefix = template.instance_variable_get(:@prefix)
230
+ @repo_id = template.instance_variable_get(:@repo_id)
231
+ @repo_ver = template.instance_variable_get(:@repo_ver)
232
+ @annotations = template.instance_variable_get(:@annotations)
245
233
  self
246
234
  end
247
235
  end # Leaf
@@ -352,10 +340,10 @@ module IDL::AST
352
340
  self.walk_members(&block)
353
341
  end
354
342
 
355
- def copy_from(_template, _context)
343
+ def copy_from(_template, instantiation_context)
356
344
  super
357
345
  _template.__send__(:walk_members_for_copy) do |child|
358
- _child_copy = child.instantiate(_context, self)
346
+ _child_copy = child.instantiate(instantiation_context, self)
359
347
  @children << _child_copy
360
348
  # introduce unless already introduced (happens with module chains)
361
349
  @introduced[_child_copy.intern] = _child_copy unless @introduced.has_key?(_child_copy.intern)
@@ -397,7 +385,6 @@ module IDL::AST
397
385
  class Enumerator < Leaf; end
398
386
 
399
387
  class Module < Node
400
- NAMETYPE = :class
401
388
  DEFINABLE = [
402
389
  IDL::AST::Module, IDL::AST::Interface, IDL::AST::Valuebox, IDL::AST::Valuetype, IDL::AST::Const, IDL::AST::Struct,
403
390
  IDL::AST::Union, IDL::AST::Enum, IDL::AST::Enumerator, IDL::AST::Typedef, IDL::AST::Include,
@@ -408,7 +395,6 @@ module IDL::AST
408
395
  super(_name, _enclosure)
409
396
  @anchor = params[:anchor]
410
397
  @prefix = params[:prefix] || @prefix
411
- @not_in_repo_id = params[:not_in_repo_id]
412
398
  @template = params[:template]
413
399
  @template_params = (params[:template_params] || []).dup
414
400
  @next = nil
@@ -449,12 +435,8 @@ module IDL::AST
449
435
  super(vars)
450
436
  end
451
437
 
452
- def instantiate(_context, _enclosure)
453
- super(_context, _enclosure, {})
454
- end
455
-
456
- def repo_scopes
457
- @repo_scopes ||= (@enclosure.nil? ? [] : (@not_in_repo_id ? @enclosure.repo_scopes.dup : (@enclosure.repo_scopes.dup << self)))
438
+ def instantiate(instantiation_context, _enclosure)
439
+ super(instantiation_context, _enclosure, {})
458
440
  end
459
441
 
460
442
  def redefine(node, params)
@@ -568,49 +550,52 @@ module IDL::AST
568
550
  def replace_prefix(pfx)
569
551
  self.prefix = pfx # handles validation
570
552
  if @anchor.nil?
571
- self.replace_prefix_(pfx)
553
+ self.replace_prefix_i(pfx)
572
554
  else
573
- @anchor.replace_prefix_(pfx)
555
+ @anchor.replace_prefix_i(pfx)
574
556
  end
575
557
  end
576
558
 
577
- def _set_prefix(pfx)
559
+ protected
560
+
561
+ def set_prefix(pfx)
578
562
  if @anchor.nil?
579
- self._set_prefix_(pfx)
563
+ self.set_prefix_i(pfx)
580
564
  else
581
- @anchor._set_prefix_(pfx)
565
+ @anchor.set_prefix_i(pfx)
582
566
  end
583
567
  end
584
568
 
585
- protected
586
-
587
569
  def get_annotations
588
570
  @annotations
589
571
  end
590
572
 
591
- def copy_from(_template, _context)
573
+ def copy_from(_template, instantiation_context)
592
574
  super
593
575
  if _template.has_anchor?
594
576
  # module anchor is first to be copied/instantiated and
595
- # should be registered in _context
596
- @anchor = IDL::AST::TemplateParam.concrete_param(_context, _template.anchor)
597
- # link ourself into module chain
577
+ # should be registered in instantiation_context
578
+ cp = IDL::AST::TemplateParam.concrete_param(instantiation_context, _template.anchor)
579
+ # concrete param must be a IDL::Type::NodeType and it's node a Module (should never fail)
580
+ raise "Invalid concrete anchor found" unless cp.is_a?(IDL::Type::NodeType) && cp.node.is_a?(IDL::AST::Module)
581
+ @anchor = cp.node
582
+ # link our self into module chain
598
583
  @anchor.find_last.set_next(self)
599
584
  end
600
585
  @next = nil # to be sure
601
586
  self
602
587
  end
603
588
 
604
- def replace_prefix_(pfx)
589
+ def replace_prefix_i(pfx)
605
590
  walk_members { |m| m.replace_prefix(pfx) }
606
591
  # propagate along chain using fast method
607
- @next.replace_prefix_(pfx) unless @next.nil?
592
+ @next.replace_prefix_i(pfx) unless @next.nil?
608
593
  end
609
594
 
610
- def _set_prefix_(pfx)
595
+ def set_prefix_i(pfx)
611
596
  @prefix = pfx
612
597
  # propagate along chain
613
- self.next._set_prefix_(pfx) unless self.next.nil?
598
+ self.next.set_prefix_i(pfx) unless self.next.nil?
614
599
  end
615
600
 
616
601
  def search_self(_name)
@@ -647,7 +632,6 @@ module IDL::AST
647
632
  end # Module
648
633
 
649
634
  class TemplateParam < Leaf
650
- NAMETYPE = :class
651
635
  attr_reader :idltype, :concrete
652
636
  def initialize(_name, _enclosure, params)
653
637
  super(_name, _enclosure)
@@ -680,24 +664,27 @@ module IDL::AST
680
664
  false
681
665
  end
682
666
 
683
- def self.concrete_param(_context, _node)
684
- if _node.is_template?
685
- _cnode = if _node.is_a?(IDL::AST::TemplateParam)
686
- _node.concrete
667
+ def self.concrete_param(instantiation_context, tpl_elem)
668
+ # is this an element from the template's scope
669
+ if tpl_elem.is_template?
670
+ celem = if tpl_elem.is_a?(IDL::AST::TemplateParam) # an actual template parameter?
671
+ tpl_elem.concrete # get the template parameter's concrete (instantiation argument) value
687
672
  else
688
- # referenced template node should have been instantiated already and available through context
689
- _context[_node]
673
+ # referenced template elements should have been instantiated already and available through context
674
+ ctxelem = instantiation_context[tpl_elem]
675
+ # all items in the context are AST elements but for a concrete parameter value only constants and type
676
+ # elements will be referenced; return accordingly
677
+ ctxelem.is_a?(IDL::AST::Const) ? ctxelem.expression : ctxelem.idltype
690
678
  end
691
- raise "cannot resolve concrete node for template #{_node.typename} #{_node.scoped_lm_name}" unless _cnode
692
- _cnode
679
+ raise "cannot resolve concrete node for template #{tpl_elem.typename} #{tpl_elem.scoped_lm_name}" unless celem
680
+ celem
693
681
  else
694
- _node
682
+ tpl_elem.idltype # just return the element's idltype if not from the template scope
695
683
  end
696
684
  end
697
685
  end
698
686
 
699
687
  class TemplateModule < Module
700
- NAMETYPE = :class
701
688
  DEFINABLE = [
702
689
  IDL::AST::Include, IDL::AST::Module, IDL::AST::Interface, IDL::AST::Valuebox, IDL::AST::Valuetype,
703
690
  IDL::AST::Const, IDL::AST::Struct, IDL::AST::Union, IDL::AST::Enum, IDL::AST::Enumerator, IDL::AST::Typedef,
@@ -725,7 +712,7 @@ module IDL::AST
725
712
  @template_params
726
713
  end
727
714
 
728
- def instantiate(_module_instance, _context = {})
715
+ def instantiate(_module_instance, instantiation_context = {})
729
716
  # process concrete parameters
730
717
  @template_params.each_with_index do |_tp, _ix|
731
718
  raise "missing template parameter for #{typename} #{scoped_lm_name}: #{_tp.name}" unless _ix < _module_instance.template_params.size
@@ -769,11 +756,11 @@ module IDL::AST
769
756
  else
770
757
  raise "invalid instantiation parameter for #{typename} #{scoped_lm_name}: #{_cp.class.name}"
771
758
  end
772
- # if we get here all is well -> store concrete param
773
- _tp.set_concrete_param(_cp.is_a?(IDL::Type::ScopedName) ? _cp.node : _cp)
759
+ # if we get here all is well -> store concrete param (either IDL type or expression)
760
+ _tp.set_concrete_param(_cp)
774
761
  end
775
762
  # instantiate template by copying template module state to module instance
776
- _module_instance.copy_from(self, _context)
763
+ _module_instance.copy_from(self, instantiation_context)
777
764
  end
778
765
 
779
766
  protected
@@ -784,7 +771,6 @@ module IDL::AST
784
771
  end # TemplateModule
785
772
 
786
773
  class TemplateModuleReference < Leaf
787
- NAMETYPE = :class
788
774
  def initialize(_name, _enclosure, _params)
789
775
  super(_name, _enclosure)
790
776
  unless _params[:tpl_type].is_a?(IDL::Type::ScopedName) && _params[:tpl_type].is_node?(IDL::AST::TemplateModule)
@@ -809,14 +795,13 @@ module IDL::AST
809
795
  super(vars)
810
796
  end
811
797
 
812
- def instantiate(_context, _enclosure)
798
+ def instantiate(instantiation_context, _enclosure)
813
799
  inst_params = @params.collect do |tp|
814
- # concrete objects are either Expression or Node; latter needs to be repacked as IDL::Type::ScopedName
815
- # as that is what the TemplateModule#instantiate expects
816
- tp.concrete.is_a?(IDL::Expression) ? tp.concrete : IDL::Type::ScopedName.new(tp.concrete)
800
+ # concrete objects are either Expression or Type
801
+ tp.concrete
817
802
  end
818
803
  mod_inst = IDL::AST::Module.new(self.name, _enclosure, { :template => @template, :template_params => inst_params })
819
- @template.instantiate(mod_inst, _context)
804
+ @template.instantiate(mod_inst, instantiation_context)
820
805
  mod_inst
821
806
  end
822
807
 
@@ -836,7 +821,10 @@ module IDL::AST
836
821
  #overrule
837
822
  @scopes = @enclosure.scopes
838
823
  @scoped_name = @scopes.collect{|s| s.name}.join("::")
839
- @scoped_lm_name = @scopes.collect{|s| s.lm_name}.join("::")
824
+ end
825
+
826
+ def lm_scopes
827
+ @lm_scopes ||= @enclosure.lm_scopes
840
828
  end
841
829
 
842
830
  def marshal_dump
@@ -851,16 +839,11 @@ module IDL::AST
851
839
  #overrule
852
840
  @scopes = @enclosure.scopes || []
853
841
  @scoped_name = @scopes.collect{|s| s.name}.join("::")
854
- @scoped_lm_name = @scopes.collect{|s| s.lm_name}.join("::")
855
842
  end
856
843
 
857
844
  def is_defined?; @defined; end
858
845
  def is_preprocessed?; @preprocessed; end
859
846
 
860
- def repo_scopes
861
- @repo_scopes ||= (@enclosure.nil? ? [] : @enclosure.repo_scopes.dup)
862
- end
863
-
864
847
  def introduce(node)
865
848
  @enclosure.introduce(node) unless node == self
866
849
  end
@@ -874,7 +857,7 @@ module IDL::AST
874
857
  end
875
858
 
876
859
  protected
877
- def copy_from(_template, _context)
860
+ def copy_from(_template, instantiation_context)
878
861
  super
879
862
  @filename = _template.filename
880
863
  @defined = _template.is_defined?
@@ -882,7 +865,6 @@ module IDL::AST
882
865
  #overrule
883
866
  @scopes = @enclosure.scopes
884
867
  @scoped_name = @scopes.collect{|s| s.name}.join("::")
885
- @scoped_lm_name = @scopes.collect{|s| s.lm_name}.join("::")
886
868
  self
887
869
  end
888
870
 
@@ -961,7 +943,6 @@ module IDL::AST
961
943
  end # Derivable
962
944
 
963
945
  class Interface < Derivable
964
- NAMETYPE = :class
965
946
  DEFINABLE = [IDL::AST::Const, IDL::AST::Operation, IDL::AST::Attribute,
966
947
  IDL::AST::Struct, IDL::AST::Union, IDL::AST::Typedef, IDL::AST::Enum, IDL::AST::Enumerator]
967
948
  attr_reader :bases
@@ -994,17 +975,17 @@ module IDL::AST
994
975
  super(vars)
995
976
  end
996
977
 
997
- def instantiate(_context, _enclosure)
978
+ def instantiate(instantiation_context, _enclosure)
998
979
  _params = {
999
980
  :forward => self.is_forward?,
1000
981
  :abstract => self.is_abstract?,
1001
982
  :pseudo => self.is_pseudo?,
1002
983
  :local => self.is_local?,
1003
- :inherits => self.concrete_bases(_context)
984
+ :inherits => self.concrete_bases(instantiation_context)
1004
985
  }
1005
986
  # instantiate concrete interface def and validate
1006
987
  # concrete bases
1007
- super(_context, _enclosure, _params)
988
+ super(instantiation_context, _enclosure, _params)
1008
989
  end
1009
990
 
1010
991
  def is_abstract?; @abstract; end
@@ -1016,7 +997,7 @@ module IDL::AST
1016
997
  def add_bases(inherits_)
1017
998
  inherits_.each do |tc|
1018
999
  unless tc.is_a?(IDL::Type::ScopedName) && tc.is_node?(IDL::AST::TemplateParam)
1019
- unless (tc.is_a?(IDL::Type::ScopedName) && tc.is_node?(IDL::AST::Interface))
1000
+ unless (tc.is_a?(IDL::Type::NodeType) && tc.is_node?(IDL::AST::Interface))
1020
1001
  raise "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{tc.typename}"
1021
1002
  end
1022
1003
  rtc = tc.resolved_type
@@ -1121,10 +1102,10 @@ module IDL::AST
1121
1102
 
1122
1103
  protected
1123
1104
 
1124
- def concrete_bases(_context)
1105
+ def concrete_bases(instantiation_context)
1125
1106
  # collect all bases and resolve any template param types
1126
- @bases.collect do |_base|
1127
- IDL::Type::ScopedName.new(IDL::AST::TemplateParam.concrete_param(_context, _base))
1107
+ @bases.collect do |base|
1108
+ IDL::AST::TemplateParam.concrete_param(instantiation_context, base)
1128
1109
  end
1129
1110
  end
1130
1111
 
@@ -1134,7 +1115,6 @@ module IDL::AST
1134
1115
  end # Interface
1135
1116
 
1136
1117
  class ComponentBase < Derivable
1137
- NAMETYPE = :class
1138
1118
  DEFINABLE = []
1139
1119
  attr_reader :base
1140
1120
  attr_reader :interfaces
@@ -1163,18 +1143,18 @@ module IDL::AST
1163
1143
  super(vars)
1164
1144
  end
1165
1145
 
1166
- def instantiate(_context, _enclosure, _params = {})
1146
+ def instantiate(instantiation_context, _enclosure, _params = {})
1167
1147
  _params.merge!({
1168
- :base => @base ? IDL::Type::ScopedName.new(IDL::AST::TemplateParam.concrete_param(_context, @base)) : @base,
1169
- :supports => self.concrete_interfaces(_context)
1148
+ :base => @base ? IDL::AST::TemplateParam.concrete_param(instantiation_context, @base) : @base,
1149
+ :supports => self.concrete_interfaces(instantiation_context)
1170
1150
  })
1171
1151
  # instantiate concrete def and validate
1172
- super(_context, _enclosure, _params)
1152
+ super(instantiation_context, _enclosure, _params)
1173
1153
  end
1174
1154
 
1175
1155
  def set_base(parent)
1176
1156
  unless parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(IDL::AST::TemplateParam)
1177
- unless (parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(self.class))
1157
+ unless (parent.is_a?(IDL::Type::NodeType) && parent.is_node?(self.class))
1178
1158
  raise "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{parent.typename}"
1179
1159
  end
1180
1160
  if parent.resolved_type.node.has_base?(self)
@@ -1290,16 +1270,15 @@ module IDL::AST
1290
1270
  (@resolved_base ? [@resolved_base] : []).concat(@resolved_interfaces)
1291
1271
  end
1292
1272
 
1293
- def concrete_interfaces(_context)
1273
+ def concrete_interfaces(instantiation_context)
1294
1274
  # collect all bases and resolve any template param types
1295
1275
  @interfaces.collect do |_intf|
1296
- IDL::Type::ScopedName.new(IDL::AST::TemplateParam.concrete_param(_context, _intf))
1276
+ IDL::AST::TemplateParam.concrete_param(instantiation_context, _intf)
1297
1277
  end
1298
1278
  end
1299
1279
  end # ComponentBase
1300
1280
 
1301
1281
  class Home < ComponentBase
1302
- NAMETYPE = :class
1303
1282
  DEFINABLE = [IDL::AST::Const, IDL::AST::Operation, IDL::AST::Attribute, IDL::AST::Initializer, IDL::AST::Finder,
1304
1283
  IDL::AST::Struct, IDL::AST::Union, IDL::AST::Typedef, IDL::AST::Enum, IDL::AST::Enumerator]
1305
1284
  attr_reader :component
@@ -1327,13 +1306,13 @@ module IDL::AST
1327
1306
  super(vars)
1328
1307
  end
1329
1308
 
1330
- def instantiate(_context, _enclosure)
1309
+ def instantiate(instantiation_context, _enclosure)
1331
1310
  _params = {
1332
- :component => IDL::Type::ScopedName.new(IDL::AST::TemplateParam.concrete_param(_context, @component)),
1333
- :primarykey => @primarykey ? IDL::Type::ScopedName.new(IDL::AST::TemplateParam.concrete_param(_context, @primarykey)) : @primarykey
1311
+ :component => IDL::AST::TemplateParam.concrete_param(instantiation_context, @component),
1312
+ :primarykey => @primarykey ? IDL::AST::TemplateParam.concrete_param(instantiation_context, @primarykey) : @primarykey
1334
1313
  }
1335
1314
  # instantiate concrete home def and validate
1336
- super(_context, _enclosure, _params)
1315
+ super(instantiation_context, _enclosure, _params)
1337
1316
  end
1338
1317
 
1339
1318
  def set_component_and_key(comp, key)
@@ -1374,7 +1353,6 @@ module IDL::AST
1374
1353
  end # Home
1375
1354
 
1376
1355
  class Connector < ComponentBase
1377
- NAMETYPE = :class
1378
1356
  DEFINABLE = [IDL::AST::Attribute, IDL::AST::Port]
1379
1357
 
1380
1358
  def initialize(_name, _enclosure, params)
@@ -1390,9 +1368,9 @@ module IDL::AST
1390
1368
  super(vars)
1391
1369
  end
1392
1370
 
1393
- def instantiate(_context, _enclosure)
1371
+ def instantiate(instantiation_context, _enclosure)
1394
1372
  # instantiate concrete connector def and validate
1395
- super(_context, _enclosure, {})
1373
+ super(instantiation_context, _enclosure, {})
1396
1374
  end
1397
1375
 
1398
1376
  def is_defined?; true; end
@@ -1404,7 +1382,7 @@ module IDL::AST
1404
1382
 
1405
1383
  def set_base(parent)
1406
1384
  unless parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(IDL::AST::TemplateParam)
1407
- if not (parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(self.class))
1385
+ unless (parent.is_a?(IDL::Type::NodeType) && parent.is_node?(self.class))
1408
1386
  raise "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{parent.typename}"
1409
1387
  end
1410
1388
  @resolved_base = parent.resolved_type.node
@@ -1453,7 +1431,6 @@ module IDL::AST
1453
1431
  end # Connector
1454
1432
 
1455
1433
  class Component < ComponentBase
1456
- NAMETYPE = :class
1457
1434
  DEFINABLE = [IDL::AST::Attribute, IDL::AST::Port]
1458
1435
 
1459
1436
  def initialize(_name, _enclosure, params)
@@ -1471,9 +1448,9 @@ module IDL::AST
1471
1448
  super(vars)
1472
1449
  end
1473
1450
 
1474
- def instantiate(_context, _enclosure)
1451
+ def instantiate(instantiation_context, _enclosure)
1475
1452
  # instantiate concrete component def and validate
1476
- super(_context, _enclosure, { :forward => self.is_forward? })
1453
+ super(instantiation_context, _enclosure, { :forward => self.is_forward? })
1477
1454
  end
1478
1455
 
1479
1456
  def is_defined?; @defined; end
@@ -1481,7 +1458,7 @@ module IDL::AST
1481
1458
 
1482
1459
  def set_base(parent)
1483
1460
  unless parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(IDL::AST::TemplateParam)
1484
- if not (parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(self.class))
1461
+ unless (parent.is_a?(IDL::Type::NodeType) && parent.is_node?(self.class))
1485
1462
  raise "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{parent.typename}"
1486
1463
  end
1487
1464
  @resolved_base = parent.resolved_type.node
@@ -1537,7 +1514,6 @@ module IDL::AST
1537
1514
  end # Component
1538
1515
 
1539
1516
  class Porttype < Node
1540
- NAMETYPE = :class
1541
1517
  DEFINABLE = [IDL::AST::Attribute, IDL::AST::Port]
1542
1518
  attr_reader :idltype
1543
1519
  def initialize(_name, _enclosure, params)
@@ -1553,13 +1529,12 @@ module IDL::AST
1553
1529
  @children.select {|c| IDL::AST::Attribute === c}
1554
1530
  end
1555
1531
 
1556
- def instantiate(_context, _enclosure)
1557
- super(_context, _enclosure, {})
1532
+ def instantiate(instantiation_context, _enclosure)
1533
+ super(instantiation_context, _enclosure, {})
1558
1534
  end
1559
1535
  end # Porttype
1560
1536
 
1561
1537
  class Port < Leaf
1562
- NAMETYPE = :member
1563
1538
  PORTTYPES = [:facet, :receptacle, :emitter, :publisher, :consumer, :port, :mirrorport]
1564
1539
  PORT_MIRRORS = {:facet => :receptacle, :receptacle => :facet}
1565
1540
  EXTPORTDEF_ANNOTATION = 'ExtendedPortDef'
@@ -1573,28 +1548,28 @@ module IDL::AST
1573
1548
  case @porttype
1574
1549
  when :facet, :receptacle
1575
1550
  unless @idltype.is_a?(IDL::Type::Object) ||
1576
- (@idltype.is_a?(IDL::Type::ScopedName) && (@idltype.is_node?(IDL::AST::Interface) || @idltype.is_node?(IDL::AST::TemplateParam)))
1551
+ (@idltype.is_a?(IDL::Type::NodeType) && (@idltype.is_node?(IDL::AST::Interface) || @idltype.is_node?(IDL::AST::TemplateParam)))
1577
1552
  raise "invalid type for #{typename} #{scoped_lm_name}: #{@idltype.typename}"
1578
1553
  end
1579
1554
  when :port, :mirrorport
1580
- unless @idltype.is_a?(IDL::Type::ScopedName) && (@idltype.is_node?(IDL::AST::Porttype) || @idltype.is_node?(IDL::AST::TemplateParam))
1555
+ unless @idltype.is_a?(IDL::Type::NodeType) && (@idltype.is_node?(IDL::AST::Porttype) || @idltype.is_node?(IDL::AST::TemplateParam))
1581
1556
  raise "invalid type for #{typename} #{scoped_lm_name}: #{@idltype.typename}"
1582
1557
  end
1583
1558
  else
1584
- unless @idltype.is_a?(IDL::Type::ScopedName) && (@idltype.is_node?(IDL::AST::Eventtype) || @idltype.is_node?(IDL::AST::TemplateParam))
1559
+ unless @idltype.is_a?(IDL::Type::NodeType) && (@idltype.is_node?(IDL::AST::Eventtype) || @idltype.is_node?(IDL::AST::TemplateParam))
1585
1560
  raise "invalid type for #{typename} #{scoped_lm_name}: #{@idltype.typename}"
1586
1561
  end
1587
1562
  end
1588
1563
  @multiple = params[:multiple] ? true : false
1589
1564
  end
1590
1565
 
1591
- def instantiate(_context, _enclosure)
1566
+ def instantiate(instantiation_context, _enclosure)
1592
1567
  _params = {
1593
- :type => @idltype.instantiate(_context),
1568
+ :type => @idltype.instantiate(instantiation_context),
1594
1569
  :porttype => @porttype,
1595
1570
  :multiple => @multiple
1596
1571
  }
1597
- super(_context, _enclosure, _params)
1572
+ super(instantiation_context, _enclosure, _params)
1598
1573
  end
1599
1574
 
1600
1575
  def multiple?
@@ -1639,7 +1614,6 @@ module IDL::AST
1639
1614
  end # Port
1640
1615
 
1641
1616
  class Valuebox < Leaf
1642
- NAMETYPE = :class
1643
1617
  attr_reader :idltype, :boxed_type
1644
1618
  def initialize(_name, _enclosure, params)
1645
1619
  super(_name, _enclosure)
@@ -1666,16 +1640,15 @@ module IDL::AST
1666
1640
  super(vars)
1667
1641
  end
1668
1642
 
1669
- def instantiate(_context, _enclosure)
1643
+ def instantiate(instantiation_context, _enclosure)
1670
1644
  _params = {
1671
- :type => @boxed_type.instantiate(_context)
1645
+ :type => @boxed_type.instantiate(instantiation_context)
1672
1646
  }
1673
- super(_context, _enclosure, _params)
1647
+ super(instantiation_context, _enclosure, _params)
1674
1648
  end
1675
1649
  end # Valuebox
1676
1650
 
1677
1651
  class Valuetype < Derivable
1678
- NAMETYPE = :class
1679
1652
  DEFINABLE = [IDL::AST::Include, IDL::AST::Const, IDL::AST::Operation, IDL::AST::Attribute, IDL::AST::StateMember, IDL::AST::Initializer,
1680
1653
  IDL::AST::Struct, IDL::AST::Union, IDL::AST::Typedef, IDL::AST::Enum, IDL::AST::Enumerator]
1681
1654
  attr_reader :bases, :interfaces
@@ -1732,7 +1705,7 @@ module IDL::AST
1732
1705
  super(vars)
1733
1706
  end
1734
1707
 
1735
- def instantiate(_context, _enclosure)
1708
+ def instantiate(instantiation_context, _enclosure)
1736
1709
  _params = {
1737
1710
  :forward => self.is_forward?,
1738
1711
  :abstract => self.is_abstract?,
@@ -1740,12 +1713,12 @@ module IDL::AST
1740
1713
  :inherits => {
1741
1714
  :base => {
1742
1715
  :truncatable => self.is_truncatable?,
1743
- :list => self.concrete_bases(_context)
1716
+ :list => self.concrete_bases(instantiation_context)
1744
1717
  },
1745
- :supports => self.concrete_interfaces(_context)
1718
+ :supports => self.concrete_interfaces(instantiation_context)
1746
1719
  }
1747
1720
  }
1748
- inst = super(_context, _enclosure, _params)
1721
+ inst = super(instantiation_context, _enclosure, _params)
1749
1722
  inst.defined = true
1750
1723
  inst
1751
1724
  end
@@ -1945,16 +1918,16 @@ module IDL::AST
1945
1918
  @resolved_bases
1946
1919
  end
1947
1920
 
1948
- def concrete_bases(_context)
1921
+ def concrete_bases(instantiation_context)
1949
1922
  # collect all bases and resolve any template param types
1950
1923
  @bases.collect do |_base|
1951
- IDL::Type::ScopedName.new(IDL::AST::TemplateParam.concrete_param(_context, _base))
1924
+ IDL::AST::TemplateParam.concrete_param(instantiation_context, _base)
1952
1925
  end
1953
1926
  end
1954
1927
 
1955
- def concrete_interfaces(_context)
1928
+ def concrete_interfaces(instantiation_context)
1956
1929
  @interfaces.collect do |_intf|
1957
- IDL::Type::ScopedName.new(IDL::AST::TemplateParam.concrete_param(_context, _intf))
1930
+ IDL::AST::TemplateParam.concrete_param(instantiation_context, _intf)
1958
1931
  end
1959
1932
  end
1960
1933
  end # Valuetype
@@ -1968,7 +1941,6 @@ module IDL::AST
1968
1941
  end # Eventtype
1969
1942
 
1970
1943
  class StateMember < Leaf
1971
- NAMETYPE = :member
1972
1944
  attr_reader :idltype, :visibility
1973
1945
  def initialize(_name, _enclosure, params)
1974
1946
  @is_recursive = false
@@ -2050,12 +2022,12 @@ module IDL::AST
2050
2022
  super(vars)
2051
2023
  end
2052
2024
 
2053
- def instantiate(_context, _enclosure)
2025
+ def instantiate(instantiation_context, _enclosure)
2054
2026
  _params = {
2055
- :type => @idltype.instantiate(_context),
2027
+ :type => @idltype.instantiate(instantiation_context),
2056
2028
  :visibility => self.visibility
2057
2029
  }
2058
- super(_context, _enclosure, _params)
2030
+ super(instantiation_context, _enclosure, _params)
2059
2031
  end
2060
2032
 
2061
2033
  def is_local?(recurstk)
@@ -2076,7 +2048,6 @@ module IDL::AST
2076
2048
  end # StateMember
2077
2049
 
2078
2050
  class Initializer < Leaf
2079
- NAMETYPE = :member
2080
2051
  attr_reader :raises, :params
2081
2052
  def initialize(_name, _enclosure, params)
2082
2053
  super(_name, _enclosure)
@@ -2107,28 +2078,28 @@ module IDL::AST
2107
2078
  super(vars)
2108
2079
  end
2109
2080
 
2110
- def instantiate(_context, _enclosure)
2081
+ def instantiate(instantiation_context, _enclosure)
2111
2082
  _params = {
2112
- :raises => self.concrete_raises(_context)
2083
+ :raises => self.concrete_raises(instantiation_context)
2113
2084
  }
2114
- _init = super(_context, _enclosure, _params)
2115
- _init.set_concrete_parameters(_context, @params)
2085
+ _init = super(instantiation_context, _enclosure, _params)
2086
+ _init.set_concrete_parameters(instantiation_context, @params)
2116
2087
  _init
2117
2088
  end
2118
2089
 
2119
2090
  protected
2120
2091
 
2121
- def concrete_raises(_context)
2092
+ def concrete_raises(instantiation_context)
2122
2093
  @raises.collect do |ex|
2123
- ex.instantiate(_context)
2094
+ ex.instantiate(instantiation_context)
2124
2095
  end
2125
2096
  end
2126
2097
 
2127
- def set_concrete_parameters(_context, parms)
2098
+ def set_concrete_parameters(instantiation_context, parms)
2128
2099
  @params = parms.collect do |parm|
2129
2100
  IDL::AST::Parameter.new(parm.name, self,
2130
2101
  { :attribute => :in,
2131
- :type => parm.idltype.instantiate(_context) })
2102
+ :type => parm.idltype.instantiate(instantiation_context) })
2132
2103
  end
2133
2104
  end
2134
2105
 
@@ -2138,7 +2109,6 @@ module IDL::AST
2138
2109
  end # Finder
2139
2110
 
2140
2111
  class Const < Leaf
2141
- NAMETYPE = :class
2142
2112
  attr_reader :idltype, :expression, :value
2143
2113
  def initialize(_name, _enclosure, params)
2144
2114
  super(_name, _enclosure)
@@ -2169,17 +2139,16 @@ module IDL::AST
2169
2139
  end
2170
2140
  end
2171
2141
 
2172
- def instantiate(_context, _enclosure)
2142
+ def instantiate(instantiation_context, _enclosure)
2173
2143
  _params = {
2174
- :type => @idltype.instantiate(_context),
2175
- :expression => @expression.instantiate(_context)
2144
+ :type => @idltype.instantiate(instantiation_context),
2145
+ :expression => @expression.instantiate(instantiation_context)
2176
2146
  }
2177
- super(_context, _enclosure, _params)
2147
+ super(instantiation_context, _enclosure, _params)
2178
2148
  end
2179
2149
  end # Const
2180
2150
 
2181
2151
  class Parameter < Leaf
2182
- NAMETYPE = :member
2183
2152
  IN, OUT, INOUT = 0, 1, 2
2184
2153
  ATTRIBUTE_MAP = {
2185
2154
  :in => IN,
@@ -2225,17 +2194,16 @@ module IDL::AST
2225
2194
  super(vars)
2226
2195
  end
2227
2196
 
2228
- def instantiate(_context, _enclosure)
2197
+ def instantiate(instantiation_context, _enclosure)
2229
2198
  _params = {
2230
- :type => @idltype.instantiate(_context),
2199
+ :type => @idltype.instantiate(instantiation_context),
2231
2200
  :attribute => @attribute
2232
2201
  }
2233
- super(_context, _enclosure, _params)
2202
+ super(instantiation_context, _enclosure, _params)
2234
2203
  end
2235
2204
  end # Parameter
2236
2205
 
2237
2206
  class Operation < Node
2238
- NAMETYPE = :member
2239
2207
  DEFINABLE = [IDL::AST::Parameter]
2240
2208
  attr_reader :idltype, :oneway, :raises
2241
2209
  attr_accessor :context
@@ -2279,13 +2247,13 @@ module IDL::AST
2279
2247
  super(vars)
2280
2248
  end
2281
2249
 
2282
- def instantiate(_context, _enclosure)
2250
+ def instantiate(instantiation_context, _enclosure)
2283
2251
  _params = {
2284
- :type => @idltype.instantiate(_context),
2252
+ :type => @idltype.instantiate(instantiation_context),
2285
2253
  :oneway => @oneway,
2286
2254
  }
2287
- _op = super(_context, _enclosure, _params)
2288
- _op.raises = self.concrete_raises(_context)
2255
+ _op = super(instantiation_context, _enclosure, _params)
2256
+ _op.raises = self.concrete_raises(instantiation_context)
2289
2257
  _op.context = @context
2290
2258
  _op
2291
2259
  end
@@ -2326,13 +2294,13 @@ module IDL::AST
2326
2294
 
2327
2295
  protected
2328
2296
 
2329
- def concrete_raises(_context)
2297
+ def concrete_raises(instantiation_context)
2330
2298
  @raises.collect do |ex|
2331
- ex.instantiate(_context)
2299
+ ex.instantiate(instantiation_context)
2332
2300
  end
2333
2301
  end
2334
2302
 
2335
- def copy_from(_template, _context)
2303
+ def copy_from(_template, instantiation_context)
2336
2304
  super
2337
2305
  self.walk_members do |param|
2338
2306
  case param.attribute
@@ -2352,7 +2320,6 @@ module IDL::AST
2352
2320
  class Attribute < Leaf
2353
2321
  attr_reader :idltype, :readonly
2354
2322
  attr_reader :get_raises, :set_raises
2355
- NAMETYPE = :member
2356
2323
  def initialize(_name, _enclosure, params)
2357
2324
  super(_name, _enclosure)
2358
2325
  @idltype = params[:type]
@@ -2388,14 +2355,14 @@ module IDL::AST
2388
2355
  super(vars)
2389
2356
  end
2390
2357
 
2391
- def instantiate(_context, _enclosure)
2358
+ def instantiate(instantiation_context, _enclosure)
2392
2359
  _params = {
2393
- :type => @idltype.instantiate(_context),
2360
+ :type => @idltype.instantiate(instantiation_context),
2394
2361
  :readonly => @readonly
2395
2362
  }
2396
- _att = super(_context, _enclosure, _params)
2397
- _att.get_raises = self.concrete_get_raises(_context)
2398
- _att.set_raises = self.concrete_set_raises(_context)
2363
+ _att = super(instantiation_context, _enclosure, _params)
2364
+ _att.get_raises = self.concrete_get_raises(instantiation_context)
2365
+ _att.set_raises = self.concrete_set_raises(instantiation_context)
2399
2366
  _att
2400
2367
  end
2401
2368
 
@@ -2428,21 +2395,20 @@ module IDL::AST
2428
2395
 
2429
2396
  protected
2430
2397
 
2431
- def concrete_get_raises(_context)
2398
+ def concrete_get_raises(instantiation_context)
2432
2399
  @get_raises.collect do |ex|
2433
- ex.instantiate(_context)
2400
+ ex.instantiate(instantiation_context)
2434
2401
  end
2435
2402
  end
2436
2403
 
2437
- def concrete_set_raises(_context)
2404
+ def concrete_set_raises(instantiation_context)
2438
2405
  @set_raises.collect do |ex|
2439
- ex.instantiate(_context)
2406
+ ex.instantiate(instantiation_context)
2440
2407
  end
2441
2408
  end
2442
2409
  end # Attribute
2443
2410
 
2444
2411
  class Struct < Node
2445
- NAMETYPE = :class
2446
2412
  DEFINABLE = [IDL::AST::Member, IDL::AST::Struct, IDL::AST::Union, IDL::AST::Enum, IDL::AST::Enumerator]
2447
2413
  attr_reader :idltype
2448
2414
  def initialize(_name, _enclosure, params)
@@ -2488,11 +2454,11 @@ module IDL::AST
2488
2454
  super(vars)
2489
2455
  end
2490
2456
 
2491
- def instantiate(_context, _enclosure)
2457
+ def instantiate(instantiation_context, _enclosure)
2492
2458
  _params = {
2493
2459
  :forward => @forward
2494
2460
  }
2495
- _s = super(_context, _enclosure, _params)
2461
+ _s = super(instantiation_context, _enclosure, _params)
2496
2462
  _s.defined = self.is_defined?
2497
2463
  _s
2498
2464
  end
@@ -2514,7 +2480,6 @@ module IDL::AST
2514
2480
 
2515
2481
  class Member < Leaf
2516
2482
  attr_reader :idltype
2517
- NAMETYPE = :member
2518
2483
  def initialize(_name, _enclosure, params)
2519
2484
  super(_name, _enclosure)
2520
2485
  @idltype = params[:type]
@@ -2571,16 +2536,15 @@ module IDL::AST
2571
2536
  super(vars)
2572
2537
  end
2573
2538
 
2574
- def instantiate(_context, _enclosure, _params = {})
2539
+ def instantiate(instantiation_context, _enclosure, _params = {})
2575
2540
  _params.merge!({
2576
- :type => @idltype.instantiate(_context),
2541
+ :type => @idltype.instantiate(instantiation_context),
2577
2542
  })
2578
- super(_context, _enclosure, _params)
2543
+ super(instantiation_context, _enclosure, _params)
2579
2544
  end
2580
2545
  end # Member
2581
2546
 
2582
2547
  class Union < Node
2583
- NAMETYPE = :class
2584
2548
  DEFINABLE = [IDL::AST::UnionMember, IDL::AST::Struct, IDL::AST::Union, IDL::AST::Enum, IDL::AST::Enumerator]
2585
2549
  attr_reader :idltype
2586
2550
  attr_accessor :switchtype
@@ -2679,12 +2643,12 @@ module IDL::AST
2679
2643
  super(vars)
2680
2644
  end
2681
2645
 
2682
- def instantiate(_context, _enclosure)
2646
+ def instantiate(instantiation_context, _enclosure)
2683
2647
  _params = {
2684
2648
  :forward => @forward
2685
2649
  }
2686
- _u = super(_context, _enclosure, _params)
2687
- _u.set_switchtype(@switchtype.instantiate(_context))
2650
+ _u = super(instantiation_context, _enclosure, _params)
2651
+ _u.set_switchtype(@switchtype.instantiate(instantiation_context))
2688
2652
  _u.validate_labels
2689
2653
  _u.defined = self.is_defined?
2690
2654
  _u
@@ -2698,7 +2662,6 @@ module IDL::AST
2698
2662
  end # Union
2699
2663
 
2700
2664
  class UnionMember < Member
2701
- NAMETYPE = :member
2702
2665
  attr_reader :labels
2703
2666
  def initialize(_name, _enclosure, params)
2704
2667
  super(_name, _enclosure, params)
@@ -2719,16 +2682,15 @@ module IDL::AST
2719
2682
  super(vars)
2720
2683
  end
2721
2684
 
2722
- def instantiate(_context, _enclosure)
2685
+ def instantiate(instantiation_context, _enclosure)
2723
2686
  _params = {
2724
- :labels => @labels.collect { |l| l == :default ? l : l.instantiate(_context) },
2687
+ :labels => @labels.collect { |l| l == :default ? l : l.instantiate(instantiation_context) },
2725
2688
  }
2726
- super(_context, _enclosure, _params)
2689
+ super(instantiation_context, _enclosure, _params)
2727
2690
  end
2728
2691
  end # UnionMember
2729
2692
 
2730
2693
  class Enum < Leaf
2731
- NAMETYPE = :class
2732
2694
  attr_reader :idltype
2733
2695
  def initialize(_name, _enclosure, params)
2734
2696
  super(_name, _enclosure)
@@ -2754,14 +2716,13 @@ module IDL::AST
2754
2716
  @enums << n
2755
2717
  end
2756
2718
 
2757
- def instantiate(_context, _enclosure)
2758
- super(_context, _enclosure, {})
2719
+ def instantiate(instantiation_context, _enclosure)
2720
+ super(instantiation_context, _enclosure, {})
2759
2721
  end
2760
2722
 
2761
2723
  end # Enum
2762
2724
 
2763
2725
  class Enumerator < Leaf
2764
- NAMETYPE = :class
2765
2726
  attr_reader :idltype, :enum, :value
2766
2727
  def initialize(_name, _enclosure, params)
2767
2728
  super(_name, _enclosure)
@@ -2782,17 +2743,16 @@ module IDL::AST
2782
2743
  super(vars)
2783
2744
  end
2784
2745
 
2785
- def instantiate(_context, _enclosure)
2746
+ def instantiate(instantiation_context, _enclosure)
2786
2747
  # find already instantiated Enum parent
2787
2748
  _enum = _enclosure.resolve(@enum.name)
2788
2749
  raise "Unable to resolve instantiated Enum scope for enumerator #{@enum.name}::#{name} instantiation" unless _enum
2789
- super(_context, _enclosure, { :enum => _enum, :value => @value })
2750
+ super(instantiation_context, _enclosure, { :enum => _enum, :value => @value })
2790
2751
  end
2791
2752
  end # Enumerator
2792
2753
 
2793
2754
  class Typedef < Leaf
2794
2755
  attr_reader :idltype
2795
- NAMETYPE = :class
2796
2756
  def initialize(_name, _enclosure, params)
2797
2757
  super(_name, _enclosure)
2798
2758
  @idltype = params[:type]
@@ -2811,8 +2771,8 @@ module IDL::AST
2811
2771
  super(vars)
2812
2772
  end
2813
2773
 
2814
- def instantiate(_context, _enclosure)
2815
- super(_context, _enclosure, { :type => @idltype.instantiate(_context) })
2774
+ def instantiate(instantiation_context, _enclosure)
2775
+ super(instantiation_context, _enclosure, { :type => @idltype.instantiate(instantiation_context) })
2816
2776
  end
2817
2777
  end # Typedef
2818
2778
  end