Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

War on Q:PIR - PAST::Compiler.register

  • Loading branch information...
commit bfb8aab9729eba0b9366257cea3ce519ed76f769 1 parent 778bc2b
@Benabik Benabik authored
Showing with 19 additions and 35 deletions.
  1. +19 −35 compilers/pct/src/PAST/Compiler.pm
View
54 compilers/pct/src/PAST/Compiler.pm
@@ -2209,45 +2209,29 @@ multi method attribute(PAST::Var $node, $bindpost) {
multi method register(PAST::Var $node, $bindpost) {
- Q:PIR {
- .local pmc node
- node = find_lex '$node'
- .local pmc bindpost
- bindpost = find_lex '$bindpost'
-
- .local string name
- name = node.'name'()
- if name goto have_name
- name = self.'uniquereg'('P')
- node.'name'(name)
- have_name:
-
- .local pmc ops
- $P0 = get_hll_global ['POST'], 'Ops'
- ops = $P0.'new'('result'=>name, 'node'=>node)
-
- .local int isdecl
- isdecl = node.'isdecl'()
- unless isdecl goto decl_done
- ops.'push_pirop'('.local pmc', ops)
- decl_done:
-
- if bindpost goto register_bind
+ my $name := $node.name();
- .local pmc viviself, vivipost
- viviself = node.'viviself'()
- unless viviself goto end
- vivipost = self.'as_vivipost'(viviself, 'rtype'=>'P')
- ops.'push'(vivipost)
- ops.'push_pirop'('set', ops, vivipost)
- goto end
+ unless $name {
+ $name := self.uniquereg('P');
+ $node.name($name);
+ }
+
+ my $ops := POST::Ops.new(result => $name, node => $node);
- register_bind:
- ops.'push_pirop'('set', ops, bindpost)
+ $ops.push_pirop('.local pmc', $ops) if $node.isdecl();
- end:
- .return (ops)
+ if $bindpost {
+ $ops.push_pirop('set', $ops, $bindpost);
+ } else {
+ my $viviself := $node.viviself();
+ if $viviself {
+ my $vivipost := self.as_vivipost($viviself, rtype => 'P');
+ $ops.push($vivipost);
+ $ops.push_pirop('set', $ops, $vivipost);
+ }
}
+
+ $ops;
}
Please sign in to comment.
Something went wrong with that request. Please try again.