Permalink
Browse files

Start VMArrayHOW, expose it in the grammar.

  • Loading branch information...
1 parent c2910e2 commit c54039faa5fc27fcf16860fedf6f97c80a72547f @arnsholt arnsholt committed Feb 28, 2013
View
@@ -1465,6 +1465,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
method package_declarator:sym<role>($/) { make $<package_def>.ast; }
method package_declarator:sym<knowhow>($/) { make $<package_def>.ast; }
method package_declarator:sym<native>($/) { make $<package_def>.ast; }
+ method package_declarator:sym<vmarray>($/) { make $<package_def>.ast; }
method package_declarator:sym<trusts>($/) {
$*W.apply_trait($/, '&trait_mod:<trusts>', $*PACKAGE, $<typename>.ast);
View
@@ -1679,6 +1679,11 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
:my $*PKGDECL := 'native';
<sym> <.end_keyword> <package_def>
}
+ token package_declarator:sym<vmarray> {
+ :my $*OUTERPACKAGE := $*PACKAGE;
+ :my $*PKGDECL := 'vmarray';
+ <sym> <.end_keyword> <package_def>
+ }
token package_declarator:sym<slang> {
:my $*OUTERPACKAGE := $*PACKAGE;
:my $*PKGDECL := 'slang';
@@ -829,6 +829,7 @@ BEGIN {
Perl6::Metamodel::PackageHOW.set_stash_type(Stash, EnumMap);
Perl6::Metamodel::ModuleHOW.set_stash_type(Stash, EnumMap);
Perl6::Metamodel::NativeHOW.set_stash_type(Stash, EnumMap);
+ Perl6::Metamodel::VMArrayHOW.set_stash_type(Stash, EnumMap);
Perl6::Metamodel::ClassHOW.set_stash_type(Stash, EnumMap);
Perl6::Metamodel::GrammarHOW.set_stash_type(Stash, EnumMap);
Perl6::Metamodel::ParametricRoleHOW.set_stash_type(Stash, EnumMap);
@@ -1043,6 +1044,7 @@ Perl6::Metamodel::ClassHOW.set_invoke_forwarder(
Perl6::Metamodel::PackageHOW.set_stash_type(Stash, EnumMap);
Perl6::Metamodel::ModuleHOW.set_stash_type(Stash, EnumMap);
Perl6::Metamodel::NativeHOW.set_stash_type(Stash, EnumMap);
+Perl6::Metamodel::VMArrayHOW.set_stash_type(Stash, EnumMap);
Perl6::Metamodel::ClassHOW.set_stash_type(Stash, EnumMap);
Perl6::Metamodel::GrammarHOW.set_stash_type(Stash, EnumMap);
Perl6::Metamodel::ParametricRoleHOW.set_stash_type(Stash, EnumMap);
@@ -14,4 +14,5 @@ my module EXPORTHOW {
($?PACKAGE.WHO)<native> := Perl6::Metamodel::NativeHOW;
($?PACKAGE.WHO)<subset> := Perl6::Metamodel::SubsetHOW;
($?PACKAGE.WHO)<enum> := Perl6::Metamodel::EnumHOW;
+ ($?PACKAGE.WHO)<vmarray> := Perl6::Metamodel::VMArrayHOW;
}
@@ -0,0 +1,35 @@
+class Perl6::Metamodel::VMArrayHOW
+ does Perl6::Metamodel::Naming
+ does Perl6::Metamodel::Versioning
+ does Perl6::Metamodel::Stashing
+ does Perl6::Metamodel::MethodContainer
+ does Perl6::Metamodel::PrivateMethodContainer
+{
+ has $!element-type;
+ has $!composed;
+
+ method new(*%named) {
+ nqp::findmethod(NQPMu, 'BUILDALL')(nqp::create(self), |%named)
+ }
+
+ method new_type(:$name = '<anon>', :$ver, :$auth) {
+ my $metaclass := self.new();
+ my $obj := pir::repr_type_object_for__PPS($metaclass, 'VMArray');
+ self.add_stash($obj);
+ $metaclass.set_name($obj, $name);
+ $metaclass.set_ver($obj, $ver) if $ver;
+ $metaclass.set_auth($obj, $auth) if $auth;
+ $obj
+ }
+
+ method compose($obj) {
+ if !$!composed && $!element-type {
+ nqp::composetype($obj, hash(array => hash(type => $!element-type)));
+ $!composed := 1;
+ }
+ }
+
+ method parametrize($obj, $type) {
+ $!element-type := $type;
+ }
+}
View
@@ -14,4 +14,5 @@ my module EXPORTHOW {
nqp::bindkey($?PACKAGE.WHO, 'native', Perl6::Metamodel::NativeHOW);
nqp::bindkey($?PACKAGE.WHO, 'subset', Perl6::Metamodel::SubsetHOW);
nqp::bindkey($?PACKAGE.WHO, 'enum', Perl6::Metamodel::EnumHOW);
+ nqp::bindkey($?PACKAGE.WHO, 'vmarray', Perl6::Metamodel::VMArrayHOW);
}
View
@@ -11,6 +11,7 @@ BEGIN {
Perl6::Metamodel::ParametricRoleGroupHOW.HOW.reparent(Perl6::Metamodel::ParametricRoleGroupHOW, Any);
Perl6::Metamodel::ParametricRoleHOW.HOW.reparent(Perl6::Metamodel::ParametricRoleHOW, Any);
Perl6::Metamodel::SubsetHOW.HOW.reparent(Perl6::Metamodel::SubsetHOW, Any);
+ Perl6::Metamodel::VMArrayHOW.HOW.reparent(Perl6::Metamodel::VMArrayHOW, Any);
Perl6::Metamodel::GrammarHOW.HOW.compose(Perl6::Metamodel::GrammarHOW);
}
View
@@ -138,6 +138,7 @@ METAMODEL_SOURCES = \
src/Perl6/Metamodel/NativeHOW.pm \
src/Perl6/Metamodel/SubsetHOW.pm \
src/Perl6/Metamodel/EnumHOW.pm \
+ src/Perl6/Metamodel/VMArrayHOW.pm \
src/Perl6/Metamodel/ContainerDescriptor.pm \
src/Perl6/Metamodel/StaticLexPad.pm \
src/Perl6/Metamodel/Dispatchers.pm \

0 comments on commit c54039f

Please sign in to comment.