Index: compilers/pct/src/PAST/Compiler.pir
===================================================================
--- compilers/pct/src/PAST/Compiler.pir	(revision 25462)
+++ compilers/pct/src/PAST/Compiler.pir	(working copy)
@@ -1311,15 +1311,42 @@
     .local int isdecl
     isdecl = node.'isdecl'()
 
+    ## handle the first child, which is the object of this attribute.
+  handle_object:
+    .local pmc objpast, objpost
+    .local string objresult
+    ## get the first child of this node, which is the PAST for the
+    ## object on which the attribute is set/get. If it's not available,
+    ## 'self' is implied.
+    objpast = node[0]
+    if null objpast goto self_obj
+
+    ## get the POST of this PAST:
+    objpost = self.'as_post'(objpast, 'rtype'=>'P')
+    ## save the result location of the evaluation of the object PAST
+    objresult = objpost.'result'()
+    goto handle_object_end
+
+  self_obj:
+    ## there was no child node representing the object, this implies 'self'.
+    objresult = 'self'
+  handle_object_end:
+
+
     if has_bindpost goto attribute_bind
 
   attribute_post:
     if isdecl goto attribute_decl
     .local pmc ops, fetchop, storeop
     ops = $P0.'new'('node'=>node)
+
+    if null objpost goto no_obj
+    ops.'push'(objpost)
+  no_obj:
+
     $P0 = get_hll_global ['POST'], 'Op'
-    fetchop = $P0.'new'(ops, 'self', name, 'pirop'=>'getattribute')
-    storeop = $P0.'new'('self', name, ops, 'pirop'=>'setattribute')
+    fetchop = $P0.'new'(ops, objresult, name, 'pirop'=>'getattribute')
+    storeop = $P0.'new'(objresult, name, ops, 'pirop'=>'setattribute')
     .return self.'vivify'(node, ops, fetchop, storeop)
 
   attribute_decl:
@@ -1329,9 +1356,9 @@
   attribute_bind:
     $P0 = get_hll_global ['POST'], 'Op'
     if isdecl goto attribute_bind_decl
-    .return $P0.'new'('self', name, bindpost, 'pirop'=>'setattribute', 'result'=>bindpost)
+    .return $P0.'new'(objresult, name, bindpost, 'pirop'=>'setattribute', 'result'=>bindpost)
   attribute_bind_decl:
-    .return $P0.'new'('self', name, bindpost, 'pirop'=>'setattribute', 'result'=>bindpost)
+    .return $P0.'new'(objresult, name, bindpost, 'pirop'=>'setattribute', 'result'=>bindpost)
 .end
 
 
