$instance->$initializer($value, $callback, $self);
}
-sub associated_class { $_[0]->{'associated_class'} }
-sub associated_methods { $_[0]->{'associated_methods'} }
-
sub get_read_method {
my $self = shift;
my $reader = $self->reader || $self->accessor;
return $meta;
}
-## Attribute readers
-
-# NOTE:
-# all these attribute readers will be bootstrapped
-# away in the Class::MOP bootstrap section
-
-sub instance_metaclass { $_[0]->{'instance_metaclass'} }
-sub immutable_trait { $_[0]->{'immutable_trait'} }
-sub constructor_class { $_[0]->{'constructor_class'} }
-sub constructor_name { $_[0]->{'constructor_name'} }
-sub destructor_class { $_[0]->{'destructor_class'} }
-
# Instance Construction & Cloning
sub new_object {
sub _class_name { $_[0]->{_class_name} ||= $_[0]->associated_metaclass->name }
-sub associated_metaclass { $_[0]{'associated_metaclass'} }
-
sub create_instance {
my $self = shift;
bless {}, $self->_class_name;
confess __PACKAGE__ . " is an abstract base class, you must provide a constructor.";
}
-sub is_inline { $_[0]{is_inline} }
-
-sub definition_context { $_[0]{definition_context} }
-
sub _initialize_body {
confess "No body to initialize, " . __PACKAGE__ . " is an abstract base class";
}
use base 'Class::MOP::Method::Generated';
-sub _expected_method_class { $_[0]{_expected_method_class} }
-
sub _uninlined_body {
my $self = shift;
sub has_initializer { defined $_[0]->{'initializer'} }
sub has_insertion_order { defined $_[0]->{'insertion_order'} }
-sub accessor { $_[0]->{'accessor'} }
-sub reader { $_[0]->{'reader'} }
-sub writer { $_[0]->{'writer'} }
-sub predicate { $_[0]->{'predicate'} }
-sub clearer { $_[0]->{'clearer'} }
-sub builder { $_[0]->{'builder'} }
-sub init_arg { $_[0]->{'init_arg'} }
-sub initializer { $_[0]->{'initializer'} }
-sub definition_context { $_[0]->{'definition_context'} }
-sub insertion_order { $_[0]->{'insertion_order'} }
sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] }
sub has_read_method { $_[0]->has_reader || $_[0]->has_accessor }
use base 'Class::MOP::Mixin';
-sub _attribute_map { $_[0]->{'attributes'} }
-sub attribute_metaclass { $_[0]->{'attribute_metaclass'} }
-
sub add_attribute {
my $self = shift;
use base 'Class::MOP::Mixin';
-sub method_metaclass { $_[0]->{'method_metaclass'} }
-sub wrapped_method_metaclass { $_[0]->{'wrapped_method_metaclass'} }
sub _meta_method_class { 'Class::MOP::Method::Meta' }
sub _add_meta_method {
SV *key;
U32 hash;
} prehashed_keys[key_last] = {
+ DECLARE_KEY(_expected_method_class),
+ DECLARE_KEY(ISA),
+ DECLARE_KEY(VERSION),
+ DECLARE_KEY(accessor),
+ DECLARE_KEY(associated_class),
+ DECLARE_KEY(associated_metaclass),
+ DECLARE_KEY(associated_methods),
+ DECLARE_KEY(attribute_metaclass),
+ DECLARE_KEY(attributes),
+ DECLARE_KEY(body),
+ DECLARE_KEY(builder),
+ DECLARE_KEY(clearer),
+ DECLARE_KEY(constructor_class),
+ DECLARE_KEY(constructor_name),
+ DECLARE_KEY(definition_context),
+ DECLARE_KEY(destructor_class),
+ DECLARE_KEY(immutable_trait),
+ DECLARE_KEY(init_arg),
+ DECLARE_KEY(initializer),
+ DECLARE_KEY(insertion_order),
+ DECLARE_KEY(instance_metaclass),
+ DECLARE_KEY(is_inline),
+ DECLARE_KEY(method_metaclass),
+ DECLARE_KEY(methods),
DECLARE_KEY(name),
DECLARE_KEY(package),
DECLARE_KEY(package_name),
- DECLARE_KEY(body),
+ DECLARE_KEY(predicate),
+ DECLARE_KEY(reader),
+ DECLARE_KEY(wrapped_method_metaclass),
+ DECLARE_KEY(writer),
DECLARE_KEY_WITH_VALUE(package_cache_flag, "_package_cache_flag"),
- DECLARE_KEY(methods),
- DECLARE_KEY(VERSION),
- DECLARE_KEY(ISA),
DECLARE_KEY_WITH_VALUE(_version, "-version")
};
void mop_call_xs (pTHX_ XSPROTO(subaddr), CV *cv, SV **mark);
typedef enum {
+ KEY__expected_method_class,
+ KEY_ISA,
+ KEY_VERSION,
+ KEY_accessor,
+ KEY_associated_class,
+ KEY_associated_metaclass,
+ KEY_associated_methods,
+ KEY_attribute_metaclass,
+ KEY_attributes,
+ KEY_body,
+ KEY_builder,
+ KEY_clearer,
+ KEY_constructor_class,
+ KEY_constructor_name,
+ KEY_definition_context,
+ KEY_destructor_class,
+ KEY_immutable_trait,
+ KEY_init_arg,
+ KEY_initializer,
+ KEY_insertion_order,
+ KEY_instance_metaclass,
+ KEY_is_inline,
+ KEY_method_metaclass,
+ KEY_methods,
KEY_name,
KEY_package,
KEY_package_name,
- KEY_body,
+ KEY_predicate,
+ KEY_reader,
+ KEY_wrapped_method_metaclass,
+ KEY_writer,
KEY_package_cache_flag,
- KEY_methods,
- KEY_VERSION,
- KEY_ISA,
KEY__version,
key_last,
} mop_prehashed_key_t;
--- /dev/null
+#include "mop.h"
+
+MODULE = Class::MOP::Attribute PACKAGE = Class::MOP::Attribute
+
+PROTOTYPES: DISABLE
+
+BOOT:
+ INSTALL_SIMPLE_READER(Attribute, associated_class);
+ INSTALL_SIMPLE_READER(Attribute, associated_methods);
BOOT:
INSTALL_SIMPLE_READER(Mixin::AttributeCore, name);
+ INSTALL_SIMPLE_READER(Mixin::AttributeCore, accessor);
+ INSTALL_SIMPLE_READER(Mixin::AttributeCore, reader);
+ INSTALL_SIMPLE_READER(Mixin::AttributeCore, writer);
+ INSTALL_SIMPLE_READER(Mixin::AttributeCore, predicate);
+ INSTALL_SIMPLE_READER(Mixin::AttributeCore, clearer);
+ INSTALL_SIMPLE_READER(Mixin::AttributeCore, builder);
+ INSTALL_SIMPLE_READER(Mixin::AttributeCore, init_arg);
+ INSTALL_SIMPLE_READER(Mixin::AttributeCore, initializer);
+ INSTALL_SIMPLE_READER(Mixin::AttributeCore, definition_context);
+ INSTALL_SIMPLE_READER(Mixin::AttributeCore, insertion_order);
--- /dev/null
+#include "mop.h"
+
+MODULE = Class::MOP::Class PACKAGE = Class::MOP::Class
+
+PROTOTYPES: DISABLE
+
+BOOT:
+ INSTALL_SIMPLE_READER(Class, instance_metaclass);
+ INSTALL_SIMPLE_READER(Class, immutable_trait);
+ INSTALL_SIMPLE_READER(Class, constructor_class);
+ INSTALL_SIMPLE_READER(Class, constructor_name);
+ INSTALL_SIMPLE_READER(Class, destructor_class);
--- /dev/null
+#include "mop.h"
+
+MODULE = Class::MOP::Method::Generated PACKAGE = Class::MOP::Method::Generated
+
+PROTOTYPES: DISABLE
+
+BOOT:
+ INSTALL_SIMPLE_READER(Method::Generated, is_inline);
+ INSTALL_SIMPLE_READER(Method::Generated, definition_context);
--- /dev/null
+#include "mop.h"
+
+MODULE = Class::MOP::Mixin::HasAttributes PACKAGE = Class::MOP::Mixin::HasAttributes
+
+PROTOTYPES: DISABLE
+
+BOOT:
+ INSTALL_SIMPLE_READER(Mixin::HasAttributes, attribute_metaclass);
+ INSTALL_SIMPLE_READER_WITH_KEY(Mixin::HasAttributes, _attribute_map, attributes);
mop_method_metaclass = newSVpvs("method_metaclass");
mop_associated_metaclass = newSVpvs("associated_metaclass");
mop_wrap = newSVpvs("wrap");
+ INSTALL_SIMPLE_READER(Mixin::HasMethods, method_metaclass);
+ INSTALL_SIMPLE_READER(Mixin::HasMethods, wrapped_method_metaclass);
--- /dev/null
+#include "mop.h"
+
+MODULE = Class::MOP::Method::Inlined PACKAGE = Class::MOP::Method::Inlined
+
+PROTOTYPES: DISABLE
+
+BOOT:
+ INSTALL_SIMPLE_READER(Method::Inlined, _expected_method_class);
--- /dev/null
+#include "mop.h"
+
+MODULE = Class::MOP::Instance PACKAGE = Class::MOP::Instance
+
+PROTOTYPES: DISABLE
+
+BOOT:
+ INSTALL_SIMPLE_READER(Instance, associated_metaclass);
return ret;
}
+EXTERN_C XS(boot_Class__MOP__Mixin__HasAttributes);
EXTERN_C XS(boot_Class__MOP__Mixin__HasMethods);
EXTERN_C XS(boot_Class__MOP__Package);
EXTERN_C XS(boot_Class__MOP__Mixin__AttributeCore);
EXTERN_C XS(boot_Class__MOP__Method);
+EXTERN_C XS(boot_Class__MOP__Method__Inlined);
+EXTERN_C XS(boot_Class__MOP__Method__Generated);
+EXTERN_C XS(boot_Class__MOP__Class);
+EXTERN_C XS(boot_Class__MOP__Attribute);
+EXTERN_C XS(boot_Class__MOP__Instance);
MODULE = Class::MOP PACKAGE = Class::MOP
BOOT:
mop_prehash_keys();
+ MOP_CALL_BOOT (boot_Class__MOP__Mixin__HasAttributes);
MOP_CALL_BOOT (boot_Class__MOP__Mixin__HasMethods);
MOP_CALL_BOOT (boot_Class__MOP__Package);
MOP_CALL_BOOT (boot_Class__MOP__Mixin__AttributeCore);
MOP_CALL_BOOT (boot_Class__MOP__Method);
+ MOP_CALL_BOOT (boot_Class__MOP__Method__Inlined);
+ MOP_CALL_BOOT (boot_Class__MOP__Method__Generated);
+ MOP_CALL_BOOT (boot_Class__MOP__Class);
+ MOP_CALL_BOOT (boot_Class__MOP__Attribute);
+ MOP_CALL_BOOT (boot_Class__MOP__Instance);
# use prototype here to be compatible with get_code_info from Sub::Identify
void