develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33858 - in branches/rakudoreg: . languages/perl6/src/classes

From:
jonathan
Date:
December 13, 2008 06:58
Subject:
[svn:parrot] r33858 - in branches/rakudoreg: . languages/perl6/src/classes
Message ID:
20081213145812.1735FCB9AF@x12.develooper.com
Author: jonathan
Date: Sat Dec 13 06:58:10 2008
New Revision: 33858

Added:
   branches/rakudoreg/languages/perl6/src/classes/UnderConstructionProto.pir   (contents, props changed)
Modified:
   branches/rakudoreg/MANIFEST

Log:
[rakudo] Add file that I forgot to check in to the rakudoreg branch.

Modified: branches/rakudoreg/MANIFEST
==============================================================================
--- branches/rakudoreg/MANIFEST	(original)
+++ branches/rakudoreg/MANIFEST	Sat Dec 13 06:58:10 2008
@@ -2156,6 +2156,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]

Added: branches/rakudoreg/languages/perl6/src/classes/UnderConstructionProto.pir
==============================================================================
--- (empty file)
+++ branches/rakudoreg/languages/perl6/src/classes/UnderConstructionProto.pir	Sat Dec 13 06:58:10 2008
@@ -0,0 +1,96 @@
+## $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'=>'Any', 'attr'=>'@!ns $!short_name $!metaclass')
+    $P0 = get_hll_global 'Abstraction'
+    p6meta.'add_role'($P0, 'to'=>proto)
+.end
+
+
+=head1 METHODS
+
+=over
+
+=item create
+
+Creates a new UnderConstructionProto, puts it in the namespace and returns it.
+
+=cut
+
+.sub 'create' :method
+    .param pmc ns
+    .param pmc name
+
+    # Create new instance.
+    .local pmc ucproto
+    ucproto = self.'new'()
+    setattribute ucproto, '@!ns', ns
+    setattribute ucproto, '$!short_name', name
+
+    # Put in the namespace.
+    $S0 = name
+    set_hll_global ns, $S0, ucproto
+
+    .return (ucproto)
+.end
+
+
+=item cleanup
+
+Removes this UnderConstructionProto from the namespace.
+
+=cut
+
+.sub 'cleanup' :method
+    .local pmc ns, name
+    ns = getattribute self, '@!ns'
+    name = getattribute self, '$!short_name'
+    ns = get_hll_namespace ns
+    $S0 = name
+    delete ns[$S0]
+.end
+
+
+=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:



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