Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Add an NQPModuleHOW.
  • Loading branch information
jnthn committed Feb 5, 2011
1 parent 594f186 commit 8f6ca5a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build/Makefile.in
Expand Up @@ -165,7 +165,8 @@ METAMODEL_OBJS = ../metamodel/rakudoobject$(O) ../metamodel/repr_registry$(O)
HOW_SOURCES = src/metamodel/how/KnowHOWAttribute.pm src/metamodel/how/NQPClassHOW.pm \
src/metamodel/how/NQPNativeHOW.pm src/metamodel/how/NQPAttribute.pm \
src/metamodel/how/NQPConcreteRoleHOW.pm src/metamodel/how/NQPParametricRoleHOW.pm \
src/metamodel/how/NQPMu.pm src/metamodel/how/NativeTypes.pm
src/metamodel/how/NQPModuleHOW.pm src/metamodel/how/NQPMu.pm \
src/metamodel/how/NativeTypes.pm

HOW_COMBINED = src/gen/how.pm

Expand Down
43 changes: 43 additions & 0 deletions src/metamodel/how/NQPModuleHOW.pm
@@ -0,0 +1,43 @@
knowhow NQPModuleHOW {
has $!name;
has $!composed;

method new(:$name) {
my $obj := pir::repr_instance_of__PP(self);
$obj.BUILD(:name($name));
$obj
}

method BUILD(:$name) {
$!name := $name;
}

# Create a new meta-class instance, and then a new type object
# to go with it, and return that.
method new_type(:$name = '<anon>', :$repr = 'P6opaque') {
my $metaclass := self.new(:name($name));
pir::repr_type_object_for__PPS($metaclass, $repr);
}

method add_method($obj, $name, $code_obj) {
# XXX Commented out as in some places, module is used to try to
# shove methods into Parrot classes (which doesn't work any, mind).
#pir::die("Modules may not have methods");
}

method add_multi_method($obj, $name, $code_obj) {
pir::die("Modules may not have methods");
}

method add_attribute($obj, $meta_attr) {
pir::die("Modules may not have attributes");
}

method compose($obj) {
$!composed := 1;
}

method name($obj) {
$!name
}
}

0 comments on commit 8f6ca5a

Please sign in to comment.