Method: Puppet::Pops::Types::PObjectType.register_ptype

Defined in:
lib/puppet/pops/types/p_object_type.rb

.register_ptype(loader, ir) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/puppet/pops/types/p_object_type.rb', line 87

def self.register_ptype(loader, ir)
  type = create_ptype(loader, ir, 'AnyType', '_pcore_init_hash' => TYPE_OBJECT_I12N)

  # Now, when the Object type exists, add annotations with keys derived from Annotation and freeze the types.
  annotations = TypeFactory.optional(PHashType.new(PTypeType.new(Annotation._pcore_type), TypeFactory.hash_kv(Pcore::TYPE_MEMBER_NAME, PAnyType::DEFAULT)))
  TYPE_ATTRIBUTE.hashed_elements[KEY_ANNOTATIONS].replace_value_type(annotations)
  TYPE_FUNCTION.hashed_elements[KEY_ANNOTATIONS].replace_value_type(annotations)
  TYPE_OBJECT_I12N.hashed_elements[KEY_ANNOTATIONS].replace_value_type(annotations)
  PTypeSetType::TYPE_TYPESET_I12N.hashed_elements[KEY_ANNOTATIONS].replace_value_type(annotations)
  PTypeSetType::TYPE_TYPE_REFERENCE_I12N.hashed_elements[KEY_ANNOTATIONS].replace_value_type(annotations)
  type
end