@@ -60,6 +60,53 @@ Select a single past child based on rtype.
60
60
cpost = self.' as_post ' (cpast, options :flat :named)
61
61
.return (cpost)
62
62
.end
63
+
64
+
65
+ =item lexotic(PAST::Op node)
66
+
67
+ Establish a lexotic label (continuation) that can be invoked
68
+ via a lexical lookup. The C<name> attribute gives the name of
69
+ the lexical to be used to hold the continuation. The result
70
+ of this node is any argument passed when invoking the continuation,
71
+ or the result of the last child node if the continuation isn' t
72
+ invoked .
73
+
74
+ = cut
75
+
76
+ . sub ' lexotic' :method :multi (_ , [' PAST' ;' Op' ])
77
+ .param pmc node
78
+ .param pmc options :slurpy :named
79
+
80
+ .local pmc label1 , label2
81
+ $P0 = get_hll_global [' POST' ], ' Label'
82
+ label1 = $P0 . ' new' (' name' = >' lexotic_' )
83
+ label2 = $P0 . ' new' (' name' = >' lexotic_' )
84
+
85
+ .local string lexname
86
+ lexname = node . ' name' ()
87
+ lexname = self . ' escape' (lexname )
88
+
89
+ .local pmc ops , handler , cpost
90
+ $P0 = get_hll_global [' POST' ], ' Ops'
91
+ ops = $P0 . ' new' (' node' = >node )
92
+ handler = self . ' uniquereg' (' P' )
93
+ ops . ' push_pirop' (' root_new' , handler , " ['parrot';'Continuation']" )
94
+ ops . ' push_pirop' (' set_label' , handler , label1 )
95
+ ops . ' push_pirop' (' .lex' , lexname , handler )
96
+ .local pmc cpost
97
+ cpost = self . ' stmts' (node , ' rtype' = >' P' )
98
+ ops . ' push' (cpost )
99
+ ops . ' result' (cpost )
100
+ .local string result
101
+ ops . ' push_pirop' (' goto' , label2 )
102
+ ops . ' push' (label1 )
103
+ result = ops . ' result' ()
104
+ $S0 = concat ' (' , result
105
+ $S0 = concat $S0 , ' )'
106
+ ops . ' push_pirop' (' .get_results' , $S0 )
107
+ ops . ' push' (label2 )
108
+ .return (ops )
109
+ .end
63
110
64
111
65
112
= item map_add (mapid , [hash ])
@@ -296,7 +343,7 @@ entry to produce the node to be returned.
296
343
# object opcodes
297
344
maphash [' bindattr' ] = ' setattribute__3PPsP'
298
345
maphash [' getattr' ] = ' getattribute__PPPs'
299
- maphash [' create' ] = ' repr_instance_of '
346
+ maphash [' create' ] = ' repr_instance_of__PP '
300
347
maphash [' clone' ] = ' clone__PP'
301
348
maphash [' isconcrete' ] = ' repr_defined__IP'
302
349
maphash [' iscont' ] = ' is_container__IP'
0 commit comments