[svn:parrot] r47355 - in branches/gsoc_past_optimization: runtime/parrot/library/PAST t/library
tcurtis at svn.parrot.org
tcurtis at svn.parrot.org
Fri Jun 4 18:52:19 UTC 2010
Author: tcurtis
Date: Fri Jun 4 18:52:18 2010
New Revision: 47355
URL: https://trac.parrot.org/parrot/changeset/47355
Log:
Fix my pir:: ops to use the appropriate signature syntax. Previously, they has been working purely by accident, seemingly.
Modified:
branches/gsoc_past_optimization/runtime/parrot/library/PAST/Pattern.nqp
branches/gsoc_past_optimization/t/library/pastpattern.t
branches/gsoc_past_optimization/t/library/pasttransformerdynamic.t
Modified: branches/gsoc_past_optimization/runtime/parrot/library/PAST/Pattern.nqp
==============================================================================
--- branches/gsoc_past_optimization/runtime/parrot/library/PAST/Pattern.nqp Fri Jun 4 15:52:18 2010 (r47354)
+++ branches/gsoc_past_optimization/runtime/parrot/library/PAST/Pattern.nqp Fri Jun 4 18:52:18 2010 (r47355)
@@ -18,35 +18,35 @@
}
method name ($val?) {
- self.attr("name", $val, !pir::isnull__i_p($val));
+ self.attr("name", $val, !pir::isnull__iP($val));
}
method source ($val?) {
- self.attr("source", $val, !pir::isnull__i_p($val));
+ self.attr("source", $val, !pir::isnull__iP($val));
}
method pos ($val?) {
- self.attr("pos", $val, !pir::isnull__i_p($val));
+ self.attr("pos", $val, !pir::isnull__iP($val));
}
method returns ($val?) {
- self.attr("returns", $val, !pir::isnull__i_p($val));
+ self.attr("returns", $val, !pir::isnull__iP($val));
}
method arity ($val?) {
- self.attr("arity", $val, !pir::isnull__i_p($val));
+ self.attr("arity", $val, !pir::isnull__iP($val));
}
method named ($val?) {
- self.attr("named", $val, !pir::isnull__i_p($val));
+ self.attr("named", $val, !pir::isnull__iP($val));
}
method flat ($val?) {
- self.attr("flat", $val, !pir::isnull__i_p($val));
+ self.attr("flat", $val, !pir::isnull__iP($val));
}
method lvalue ($val?) {
- self.attr("lvalue", $val, !pir::isnull__i_p($val));
+ self.attr("lvalue", $val, !pir::isnull__iP($val));
}
method new (*@children, *%attrs) {
@@ -66,7 +66,13 @@
}
sub check ($patt, $val) {
- pir::iseq__i_p_p($patt, $val);
+ my $result := 0;
+ if (pir::does__IPs($val, "ACCEPTS")) {
+ $result := $val ~~ $patt;
+ } else {
+ $result := pir::iseq__IPP($patt, $val);
+ }
+ $result;
}
@@ -124,59 +130,59 @@
class PAST::Pattern::Block is PAST::Pattern {
method blocktype ($val?) {
- self.attr("blocktype", $val, !pir::isnull__i_p($val));
+ self.attr("blocktype", $val, !pir::isnull__iP($val));
}
method closure ($val?) {
- self.attr("closure", $val, !pir::isnull__i_p($val));
+ self.attr("closure", $val, !pir::isnull__iP($val));
}
method control ($val?) {
- self.attr("control", $val, !pir::isnull__i_p($val));
+ self.attr("control", $val, !pir::isnull__iP($val));
}
method loadinit ($val?) {
- self.attr("loadinit", $val, !pir::isnull__i_p($val));
+ self.attr("loadinit", $val, !pir::isnull__iP($val));
}
method namespace ($val?) {
- self.attr("namespace", $val, !pir::isnull__i_p($val));
+ self.attr("namespace", $val, !pir::isnull__iP($val));
}
method multi ($val?) {
- self.attr("multi", $val, !pir::isnull__i_p($val));
+ self.attr("multi", $val, !pir::isnull__iP($val));
}
method hll ($val?) {
- self.attr("hll", $val, !pir::isnull__i_p($val));
+ self.attr("hll", $val, !pir::isnull__iP($val));
}
method nsentry ($val?) {
- self.attr("nsentry", $val, !pir::isnull__i_p($val));
+ self.attr("nsentry", $val, !pir::isnull__iP($val));
}
method symtable ($val?) {
- self.attr("symtable", $val, !pir::isnull__i_p($val));
+ self.attr("symtable", $val, !pir::isnull__iP($val));
}
method lexical ($val?) {
- self.attr("lexical", $val, !pir::isnull__i_p($val));
+ self.attr("lexical", $val, !pir::isnull__iP($val));
}
method compiler ($val?) {
- self.attr("compiler", $val, !pir::isnull__i_p($val));
+ self.attr("compiler", $val, !pir::isnull__iP($val));
}
method compiler_args ($val?) {
- self.attr("compiler_args", $val, !pir::isnull__i_p($val));
+ self.attr("compiler_args", $val, !pir::isnull__iP($val));
}
method subid ($val?) {
- self.attr("subid", $val, !pir::isnull__i_p($val));
+ self.attr("subid", $val, !pir::isnull__iP($val));
}
method pirflags ($val?) {
- self.attr("pirflags", $val, !pir::isnull__i_p($val));
+ self.attr("pirflags", $val, !pir::isnull__iP($val));
}
sub check_block_attributes($pattern, $node) {
@@ -207,15 +213,15 @@
class PAST::Pattern::Op is PAST::Pattern {
method pasttype ($val?) {
- self.attr("pasttype", $val, !pir::isnull__i_p($val));
+ self.attr("pasttype", $val, !pir::isnull__iP($val));
}
method pirop ($val?) {
- self.attr("pirop", $val, !pir::isnull__i_p($val));
+ self.attr("pirop", $val, !pir::isnull__iP($val));
}
method inline ($val?) {
- self.attr("inline", $val, !pir::isnull__i_p($val));
+ self.attr("inline", $val, !pir::isnull__iP($val));
}
sub check_op_attributes ($pattern, $node) {
@@ -242,7 +248,7 @@
class PAST::Pattern::Val is PAST::Pattern {
method value ($val?) {
- self.attr("value", $val, !pir::isnull__i_p($val));
+ self.attr("value", $val, !pir::isnull__iP($val));
}
method ACCEPTS ($node) {
@@ -255,35 +261,35 @@
class PAST::Pattern::Var is PAST::Pattern {
method scope ($val?) {
- self.attr("scope", $val, !pir::isnull__i_p($val));
+ self.attr("scope", $val, !pir::isnull__iP($val));
}
method isdecl ($val?) {
- self.attr("isdecl", $val, !pir::isnull__i_p($val));
+ self.attr("isdecl", $val, !pir::isnull__iP($val));
}
method namespace ($val?) {
- self.attr("namespace", $val, !pir::isnull__i_p($val));
+ self.attr("namespace", $val, !pir::isnull__iP($val));
}
method slurpy ($val?) {
- self.attr("slurpy", $val, !pir::isnull__i_p($val));
+ self.attr("slurpy", $val, !pir::isnull__iP($val));
}
method call_sig ($val?) {
- self.attr("call_sig", $val, !pir::isnull__i_p($val));
+ self.attr("call_sig", $val, !pir::isnull__iP($val));
}
method viviself ($val?) {
- self.attr("viviself", $val, !pir::isnull__i_p($val));
+ self.attr("viviself", $val, !pir::isnull__iP($val));
}
method vivibase ($val?) {
- self.attr("vivibase", $val, !pir::isnull__i_p($val));
+ self.attr("vivibase", $val, !pir::isnull__iP($val));
}
method multitype ($val?) {
- self.attr("multitype", $val, !pir::isnull__i_p($val));
+ self.attr("multitype", $val, !pir::isnull__iP($val));
}
method ACCEPTS ($node) {
Modified: branches/gsoc_past_optimization/t/library/pastpattern.t
==============================================================================
--- branches/gsoc_past_optimization/t/library/pastpattern.t Fri Jun 4 15:52:18 2010 (r47354)
+++ branches/gsoc_past_optimization/t/library/pastpattern.t Fri Jun 4 18:52:18 2010 (r47355)
@@ -45,7 +45,7 @@
}
else {
ok(!($_ ~~ $blockPat),
- ~pir::class__p_p($_) ~ " !~~ PAST::Pattern::Block.");
+ ~pir::class__PP($_) ~ " !~~ PAST::Pattern::Block.");
}
if $_ ~~ PAST::Op {
@@ -53,7 +53,7 @@
}
else {
ok(!($_ ~~ $opPat),
- ~pir::class__p_p($_) ~ " !~~ PAST::Pattern::Op.");
+ ~pir::class__PP($_) ~ " !~~ PAST::Pattern::Op.");
}
if $_ ~~ PAST::Stmts {
@@ -61,7 +61,7 @@
}
else {
ok(!($_ ~~ $stmtsPat),
- ~pir::class__p_p($_) ~ " !~~ PAST::Pattern::Stmts.");
+ ~pir::class__PP($_) ~ " !~~ PAST::Pattern::Stmts.");
}
if $_ ~~ PAST::Val {
@@ -69,7 +69,7 @@
}
else {
ok(!($_ ~~ $valPat),
- ~pir::class__p_p($_) ~ " !~~ PAST::Pattern::Val.");
+ ~pir::class__PP($_) ~ " !~~ PAST::Pattern::Val.");
}
if $_ ~~ PAST::Var {
@@ -77,7 +77,7 @@
}
else {
ok(!($_ ~~ $varPat),
- ~pir::class__p_p($_) ~ " !~~ PAST::Pattern::Var.");
+ ~pir::class__PP($_) ~ " !~~ PAST::Pattern::Var.");
}
if $_ ~~ PAST::VarList {
@@ -86,7 +86,7 @@
}
else {
ok(!($_ ~~ $varListPat),
- ~pir::class__p_p($_) ~ " !~~ PAST::Pattern::VarList.");
+ ~pir::class__PP($_) ~ " !~~ PAST::Pattern::VarList.");
}
}
}
@@ -145,8 +145,8 @@
for @classes {
my $otherClass := $_[1];
- unless (pir::issame__i_p_p($class, $otherClass)) {
- pir::push_p_p(@wrong, node_with_attr_set($otherClass,
+ unless (pir::issame__IPP($class, $otherClass)) {
+ pir::push(@wrong, node_with_attr_set($otherClass,
$attr,
"foo"));
}
@@ -195,7 +195,7 @@
"$rightBegin with same name first.");
for @right {
- ok($_ ~~ $pattern, pir::shift__s_p(@rightMessages));
+ ok($_ ~~ $pattern, pir::shift__SP(@rightMessages));
}
my @wrong := [ $class.new(),
@@ -209,7 +209,7 @@
for @wrong {
ok(!($_ ~~ $pattern),
- pir::shift__p_p(@wrongMessages));
+ pir::shift__PP(@wrongMessages));
}
}
Modified: branches/gsoc_past_optimization/t/library/pasttransformerdynamic.t
==============================================================================
--- branches/gsoc_past_optimization/t/library/pasttransformerdynamic.t Fri Jun 4 15:52:18 2010 (r47354)
+++ branches/gsoc_past_optimization/t/library/pasttransformerdynamic.t Fri Jun 4 18:52:18 2010 (r47355)
@@ -33,7 +33,7 @@
PAST::Val.new(:value(25)),
PAST::Block.new(PAST::Val.new(:value(6)),
PAST::Val.new(:value(13))));
- ok(pir::iseq__i_p_p($result, $target),
+ ok(pir::iseq__IPP($result, $target),
"Node attributes can be changed by PAST::Transformers.");
}
@@ -67,13 +67,13 @@
PAST::Val.new(:value(5)),
PAST::Op.new(PAST::Val.new(:value(32)),
:pirop<neg>));
- ok(pir::iseq__i_p_p($result, $target),
+ ok(pir::iseq__IPP($result, $target),
"Node types can be changed by PAST::Transformers.")
}
sub trim ($walker, $node) {
my $result;
- my $length := pir::elements__i_p($node);
+ my $length := pir::elements__IP($node);
if ($length <= 1) {
$result := $node;
my $children := PAST::Walker::walkChildren($walker, $node);
@@ -101,7 +101,7 @@
PAST::Block.new(PAST::Stmts.new(PAST::Var.new(),
PAST::Block.new(PAST::Val.new())));
- ok(pir::iseq__i_p_p($result, $target),
+ ok(pir::iseq__IPP($result, $target),
"Nodes can be deleted by PAST::Transformers.");
}
More information about the parrot-commits
mailing list