# New Ticket Created by I Sop
# Please include the string: [perl #59576]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=59576 >
I just copied the 'attribute' method, renamed everything, and changed the
parameter order for the 'getprop' op.
Index: src/PAST/Compiler.pir
===================================================================
--- src/PAST/Compiler.pir (revision 31566)
+++ src/PAST/Compiler.pir (working copy)
@@ -1927,7 +1927,53 @@
.return $P0.'new'(call_on, name, bindpost, 'pirop'=>'setattribute', 'result'=>bindpost)
.end
+
+.sub 'property' :method :multi(_, ['PAST::Var'])
+ .param pmc node
+ .param pmc bindpost
+ .local string name
+ $P0 = get_hll_global ['POST'], 'Ops'
+ name = node.'name'()
+ name = self.'escape'(name)
+
+ .local int isdecl
+ isdecl = node.'isdecl'()
+
+ .local pmc call_on, ops
+ call_on = node[0]
+ if null call_on goto use_self
+ call_on = self.'as_post'(call_on, 'rtype'=>'P')
+ ops = call_on
+ goto invocant_done
+ use_self:
+ call_on = new 'String'
+ call_on = 'self'
+ ops = $P0.'new'('node'=>node)
+ invocant_done:
+
+ if bindpost goto property_bind
+
+ property_post:
+ if isdecl goto property_decl
+ .local pmc fetchop, storeop
+ $P0 = get_hll_global ['POST'], 'Op'
+ fetchop = $P0.'new'(ops, name, call_on, 'pirop'=>'getprop')
+ storeop = $P0.'new'(call_on, name, ops, 'pirop'=>'setprop')
+ .return self.'vivify'(node, ops, fetchop, storeop)
+
+ property_decl:
+ .return $P0.'new'('node'=>node)
+
+ property_bind:
+ $P0 = get_hll_global ['POST'], 'Op'
+ if isdecl goto property_bind_decl
+ .return $P0.'new'(call_on, name, bindpost, 'pirop'=>'setprop', 'result'=>bindpost)
+ property_bind_decl:
+ .return $P0.'new'(call_on, name, bindpost, 'pirop'=>'setprop', 'result'=>bindpost)
+.end
+
+
.sub 'register' :method :multi(_, ['PAST::Var'])
.param pmc node
.param pmc bindpost