Skip to content

Commit

Permalink
Reduce syntax noice - use postfix for.
Browse files Browse the repository at this point in the history
  • Loading branch information
bacek committed Jan 8, 2011
1 parent 932e899 commit 5f8dedf
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions src/POST/Compiler.pm
Expand Up @@ -30,9 +30,7 @@ method pbc($post, %adverbs) {
# PCC call handling.
self.enumerate_subs($post, %context);

for @($post) -> $s {
self.to_pbc($s, %context);
}
self.to_pbc($_, %context) for @($post);

%context<packfile>;
};
Expand Down Expand Up @@ -78,9 +76,7 @@ our multi method to_pbc(POST::Sub $sub, %context) {
}

# Emit ops.
for @($sub) {
self.to_pbc($_, %context);
}
self.to_pbc($_, %context) for @($sub);

self.debug("Middle { +$bc }") if %context<DEBUG>;

Expand Down Expand Up @@ -169,18 +165,15 @@ our multi method to_pbc(POST::Op $op, %context) {
%context<opcode_fullname> := $fullname;

my @op := list($fullname);
for @($op) {
@op.push(self.to_op($_, %context));
}
@op.push(self.to_op($_, %context)) for @($op);

self.debug("Op size { +@op }") if %context<DEBUG>;
%context<bytecode>.push(@op);
}

# Some PIR sugar produces nested Nodes.
our multi method to_pbc(POST::Node $node, %context) {
for @($node) {
self.to_pbc($_, %context);
}
self.to_pbc($_, %context) for @($node);
}

our multi method to_pbc(POST::Label $l, %context) {
Expand All @@ -192,9 +185,7 @@ our multi method to_pbc(POST::Label $l, %context) {
# Declaration of Label. Update offset in Sub.labels.
$l.position($pos);
# We can have "enclosed" ops. Process them now.
for @($l) {
self.to_pbc($_, %context);
}
self.to_pbc($_, %context) for @($l);
}

our multi method to_pbc(POST::Call $call, %context) {
Expand Down Expand Up @@ -620,9 +611,7 @@ our method get_register($name, %context) {
}

method debug(*@args) {
for @args {
pir::say($_);
}
pir::say($_) for @args;
}

our method create_context($past, %adverbs) {
Expand Down

0 comments on commit 5f8dedf

Please sign in to comment.