[svn:parrot] r40057 - in branches/ops_pct/compilers/opsc: . ops

bacek at svn.parrot.org bacek at svn.parrot.org
Mon Jul 13 13:59:04 UTC 2009


Author: bacek
Date: Mon Jul 13 13:59:04 2009
New Revision: 40057
URL: https://trac.parrot.org/parrot/changeset/40057

Log:
[opsc] Add hash() to builtins. Made OpLib.BUILD more perlsish

Modified:
   branches/ops_pct/compilers/opsc/builtins.pir
   branches/ops_pct/compilers/opsc/ops/oplib.pm

Modified: branches/ops_pct/compilers/opsc/builtins.pir
==============================================================================
--- branches/ops_pct/compilers/opsc/builtins.pir	Mon Jul 13 13:50:48 2009	(r40056)
+++ branches/ops_pct/compilers/opsc/builtins.pir	Mon Jul 13 13:59:04 2009	(r40057)
@@ -181,6 +181,10 @@
     .return(retv)
 .end
 
+.sub 'hash'
+    $P0 = new ['Hash']
+    .return ($P0)
+.end
 
 
 # Local Variables:

Modified: branches/ops_pct/compilers/opsc/ops/oplib.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/ops/oplib.pm	Mon Jul 13 13:50:48 2009	(r40056)
+++ branches/ops_pct/compilers/opsc/ops/oplib.pm	Mon Jul 13 13:59:04 2009	(r40057)
@@ -73,7 +73,7 @@
 
 =over 4
 
-=item BUILD
+=item C<BUILD>
 
 Build OpLib.
 
@@ -81,21 +81,19 @@
 
 =cut
 
-method BUILD(*%args) {
-    my @files := %args<files>;
+method BUILD(:@files, :$num_file, :$skip_file) {
+    # Process arguments
     if + at files == 0 {
         die("We need some files!")
     }
-    self<files> := @files;
+    self<files>      := @files;
+    self<num_file>   := $num_file  || 'src/ops/ops.num';
+    self<skip_file>  := $skip_file || 'src/ops/ops.skip';
 
+    # Initialize self.
     self<max_op_num> := 0;
-    self<num_file>   := %args<num_file> || 'src/ops/ops.num';
-    self<skip_file>  := %args<skip_file> || 'src/ops/ops.skip';
-
-    my %optable;
-    self<optable>    := %optable;
-    my %skiptable;
-    self<skiptable>  := %skiptable;
+    self<optable>    := hash();
+    self<skiptable>  := hash();
     self<ops>        := <>;
 
     self;


More information about the parrot-commits mailing list