[svn:parrot] r47889 - branches/gsoc_past_optimization/runtime/parrot/library/POST

tcurtis at svn.parrot.org tcurtis at svn.parrot.org
Sun Jun 27 07:39:46 UTC 2010


Author: tcurtis
Date: Sun Jun 27 07:39:46 2010
New Revision: 47889
URL: https://trac.parrot.org/parrot/changeset/47889

Log:
Make POST::Node actually useful.

Modified:
   branches/gsoc_past_optimization/runtime/parrot/library/POST/Pattern.nqp

Modified: branches/gsoc_past_optimization/runtime/parrot/library/POST/Pattern.nqp
==============================================================================
--- branches/gsoc_past_optimization/runtime/parrot/library/POST/Pattern.nqp	Sun Jun 27 03:50:51 2010	(r47888)
+++ branches/gsoc_past_optimization/runtime/parrot/library/POST/Pattern.nqp	Sun Jun 27 07:39:46 2010	(r47889)
@@ -11,27 +11,51 @@
         self.attr("result", $value, pir::defined__iPP($value));
     }
 
-    method check_post_node_attributes ($node, $/) {
-        self.check_attribute("result", $node, $/);
+    my @attributes := pir::clone__PP(PCT::Pattern.attributes());
+    pir::push(@attributes, 'result');
+    method attributes () {
+        @attributes;
+    }
+
+    method target_class () {
+        POST::Node;
     }
 }
 
-INIT {
-    POST::Pattern.new_subtype('POST::Pattern::Op',
-                              POST::Op,
-                              :attr(<pirop inline>));
-    POST::Pattern.new_subtype('POST::Pattern::Ops',
-                              POST::Ops);
-    POST::Pattern.new_subtype('POST::Pattern::Label',
-                              POST::Label);
-    POST::Pattern.new_subtype('POST::Pattern::Sub',
-                              POST::Sub,
-                              :attr(<blocktype namespace hll outer
-                                     multi subid pirflags compiler
-                                     compiler_args paramlist
-                                     directives>));
+class POST::Pattern::Op is POST::Pattern {
+    method pirop ($value?) {
+        self.attr('value', $value, !pir::isnull__IP($value));
+    }
+    method inline ($value?) {
+        self.attr('value', $value, !pir::isnull__IP($value));
+    }
+
+    my @attributes := pir::clone__PP(POST::Pattern.attributes());
+    pir::push(@attributes, 'pirop');
+    pir::push(@attributes, 'inline');
+    method attributes () { @attributes; }
+
+    method target_class () { POST::Op; }
 }
 
+class POST::Pattern::Ops is POST::Pattern {
+    method target_class () { POST::Ops; }
+}
+
+class POST::Pattern::Label is POST::Pattern {
+    method target_class () { POST::Label; }
+}
+
+class POST::Pattern::Sub is POST::Pattern {
+    my @attributes := pir::clone__PP(POST::Pattern.attributes());
+    for (<blocktype namespace hll outer multi subid pirflags compiler
+         compiler_args paramlist directives>) {
+        pir::push(@attributes, $_);
+    }
+    method attributes () { @attributes; }
+
+    method target_class () { POST::Sub; }
+}
 
 # Local Variables:
 #   mode: cperl


More information about the parrot-commits mailing list