Class: IDL::AST::Attribute
- Defined in:
- lib/ridl/node.rb,
lib/ridl/node.rb
Overview
Operation
Instance Attribute Summary collapse
-
#get_raises ⇒ Object
Returns the value of attribute get_raises.
-
#idltype ⇒ Object
readonly
Returns the value of attribute idltype.
-
#readonly ⇒ Object
readonly
Returns the value of attribute readonly.
-
#set_raises ⇒ Object
Returns the value of attribute set_raises.
Attributes inherited from Leaf
#annotations, #enclosure, #intern, #name, #prefix, #scopes
Instance Method Summary collapse
- #expanded_copy(name_pfx, enc) ⇒ Object
-
#initialize(_name, _enclosure, params) ⇒ Attribute
constructor
A new instance of Attribute.
- #instantiate(instantiation_context, _enclosure) ⇒ Object
- #marshal_dump ⇒ Object
- #marshal_load(vars) ⇒ Object
Methods inherited from Leaf
#has_annotations?, #is_local?, #is_template?, #lm_name, #lm_scopes, #replace_prefix, #repository_id, #resolve, #scoped_lm_name, #scoped_name, #set_repo_id, #set_repo_version, #typename, #unescaped_name
Constructor Details
#initialize(_name, _enclosure, params) ⇒ Attribute
Returns a new instance of Attribute.
2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 |
# File 'lib/ridl/node.rb', line 2425 def initialize(_name, _enclosure, params) super(_name, _enclosure) @idltype = params[:type] @get_raises = [] @set_raises = [] unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam) raise "Anonymous type definitions are not allowed!" if @idltype.is_anonymous? raise "Exception #{@idltype.typename} is not allowed as an attribute!" if @idltype.is_node?(IDL::AST::Exception) if @idltype.is_local? if _enclosure.is_a?(IDL::AST::Interface) && !_enclosure.is_local? raise "Local type #{@idltype.typename} not allowed for operation on unrestricted interface" end ## IDL_Valuetype: no problem as valuetype operations are local end unless @idltype.is_complete? if _enclosure.is_a?(IDL::AST::Interface) raise "Incomplete type #{@idltype.typename} not allowed here!" end ## IDL_Valuetype: no problem as valuetype operations are local end end @readonly = params[:readonly] end |
Instance Attribute Details
#get_raises ⇒ Object
Returns the value of attribute get_raises.
2423 2424 2425 |
# File 'lib/ridl/node.rb', line 2423 def get_raises @get_raises end |
#idltype ⇒ Object (readonly)
Returns the value of attribute idltype.
2423 2424 2425 |
# File 'lib/ridl/node.rb', line 2423 def idltype @idltype end |
#readonly ⇒ Object (readonly)
Returns the value of attribute readonly.
2423 2424 2425 |
# File 'lib/ridl/node.rb', line 2423 def readonly @readonly end |
#set_raises ⇒ Object
Returns the value of attribute set_raises.
2423 2424 2425 |
# File 'lib/ridl/node.rb', line 2423 def set_raises @set_raises end |
Instance Method Details
#expanded_copy(name_pfx, enc) ⇒ Object
2493 2494 2495 2496 2497 2498 |
# File 'lib/ridl/node.rb', line 2493 def (name_pfx, enc) att = IDL::AST::Attribute.new("#{name_pfx}_#{self.name}", enc, {type: @idltype, readonly: @readonly}) att.get_raises = @get_raises unless @get_raises.empty? att.set_raises = @set_raises unless @set_raises.empty? att end |
#instantiate(instantiation_context, _enclosure) ⇒ Object
2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 |
# File 'lib/ridl/node.rb', line 2462 def instantiate(instantiation_context, _enclosure) _params = { type: @idltype.instantiate(instantiation_context), readonly: @readonly } _att = super(instantiation_context, _enclosure, _params) _att.get_raises = self.concrete_get_raises(instantiation_context) _att.set_raises = self.concrete_set_raises(instantiation_context) _att end |
#marshal_dump ⇒ Object
2450 2451 2452 |
# File 'lib/ridl/node.rb', line 2450 def marshal_dump super() << @idltype << @readonly << @get_raises << @set_raises end |
#marshal_load(vars) ⇒ Object
2454 2455 2456 2457 2458 2459 2460 |
# File 'lib/ridl/node.rb', line 2454 def marshal_load(vars) @set_raises = vars.pop @get_raises = vars.pop @readonly = vars.pop @idltype = vars.pop super(vars) end |