develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35323 - in trunk: . languages/perl6/config/makefiles languages/perl6/src/classes languages/perl6/src/parser

From:
jonathan
Date:
January 9, 2009 15:39
Subject:
[svn:parrot] r35323 - in trunk: . languages/perl6/config/makefiles languages/perl6/src/classes languages/perl6/src/parser
Message ID:
20090109233914.472D5CB9F9@x12.develooper.com
Author: jonathan
Date: Fri Jan  9 15:39:13 2009
New Revision: 35323

Added:
   trunk/languages/perl6/src/classes/UnderConstructionProto.pir   (contents, props changed)
Modified:
   trunk/MANIFEST
   trunk/languages/perl6/config/makefiles/root.in
   trunk/languages/perl6/src/classes/Abstraction.pir
   trunk/languages/perl6/src/parser/methods.pir

Log:
[rakudo] Get an UnderConstructionProto class added, and create it. However, don't put it in the namespace just yet - that causes breakage.

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	(original)
+++ trunk/MANIFEST	Fri Jan  9 15:39:13 2009
@@ -2161,6 +2161,7 @@
 languages/perl6/src/classes/Signature.pir                   [perl6]
 languages/perl6/src/classes/Str.pir                         [perl6]
 languages/perl6/src/classes/Sub.pir                         [perl6]
+languages/perl6/src/classes/UnderConstructionProto.pir      [perl6]
 languages/perl6/src/classes/Whatever.pir                    [perl6]
 languages/perl6/src/ops/perl6.ops                           [perl6]
 languages/perl6/src/parser/actions.pm                       [perl6]

Modified: trunk/languages/perl6/config/makefiles/root.in
==============================================================================
--- trunk/languages/perl6/config/makefiles/root.in	(original)
+++ trunk/languages/perl6/config/makefiles/root.in	Fri Jan  9 15:39:13 2009
@@ -54,6 +54,7 @@
   src/classes/Associative.pir \
   src/classes/Callable.pir \
   src/classes/Any.pir \
+  src/classes/UnderConstructionProto.pir \
   src/classes/Bool.pir \
   src/classes/Str.pir \
   src/classes/Num.pir \

Modified: trunk/languages/perl6/src/classes/Abstraction.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Abstraction.pir	(original)
+++ trunk/languages/perl6/src/classes/Abstraction.pir	Fri Jan  9 15:39:13 2009
@@ -20,4 +20,3 @@
 #   fill-column: 100
 # End:
 # vim: expandtab shiftwidth=4 ft=pir:
-

Added: trunk/languages/perl6/src/classes/UnderConstructionProto.pir
==============================================================================
--- (empty file)
+++ trunk/languages/perl6/src/classes/UnderConstructionProto.pir	Fri Jan  9 15:39:13 2009
@@ -0,0 +1,56 @@
+## $Id$
+
+=head1 TITLE
+
+UnderConstructionProto.pir - the UnderConstructionProto class
+
+=head1 DESCRIPTION
+
+Represents a class in the namespace that we're still in the process of
+compiling.
+
+=cut
+
+.namespace ['Perl6' ; 'Compiler' ; 'UnderConstructionProto' ]
+
+.sub 'onload' :anon :init :load
+    .local pmc p6meta, proto
+    p6meta = get_hll_global ['Perl6Object'], '$!P6META'
+    proto = p6meta.'new_class'('Perl6::Compiler::UnderConstructionProto', 'parent'=>'Perl6Object', 'attr'=>'@!ns $!short_name')
+    $P0 = get_hll_global 'Abstraction'
+    p6meta.'add_role'($P0, 'to'=>proto)
+.end
+
+
+=head1 METHODS
+
+=over
+
+=item WHAT
+
+Returns self.
+
+=cut
+
+.sub 'WHAT' :method
+    .return (self)
+.end
+
+
+=item get_string (vtable method)
+
+Returns the name of the class under construction.
+
+=cut
+
+.sub '' :vtable('get_string')
+    $P0 = getattribute self, '$!short_name'
+    .return ($P0)
+.end
+
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:

Modified: trunk/languages/perl6/src/parser/methods.pir
==============================================================================
--- trunk/languages/perl6/src/parser/methods.pir	(original)
+++ trunk/languages/perl6/src/parser/methods.pir	Fri Jan  9 15:39:13 2009
@@ -19,7 +19,19 @@
 .namespace [ "Perl6";"Grammar" ]
 .sub "add_type" :method
     .param string name
-    # XXX TODO
+    
+    # Parse name.
+    .local pmc ns
+    $P0 = compreg 'Perl6'
+    ns = $P0.'parse_name'(name)
+    name = pop ns
+
+    # Create UnderConstructionProto and insert into the namespace.
+    .local pmc proto
+    $P0 = get_hll_global ['Perl6';'Compiler'], 'UnderConstructionProto'
+    proto = $P0.'new'('ns'=>ns, 'short_name'=>name)
+    # XXX Uncomment this to see breakage.
+    # set_hll_global ns, name, proto
 .end
 
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About