| | 189 | |
| | 190 | } else if (identifier == SMOP__ID__REPR_DESTROY) { |
| | 191 | |
| | 192 | if (SMOP_RI(capture) == (SMOP__ResponderInterface*)SMOP__NATIVE__capture) { |
| | 193 | SMOP__Object* invocant = SMOP__NATIVE__capture_invocant(interpreter,capture); |
| | 194 | |
| | 195 | if (invocant == SMOP__p6opaque__RI) { |
| | 196 | ret = SMOP__NATIVE__bool_false; |
| | 197 | } else if (SMOP_RI(invocant) != (SMOP__ResponderInterface*)SMOP__p6opaque__RI) { |
| | 198 | fprintf(stderr, "[SMOP p6opaque] call to repr method with non p6opaque invocant\n"); |
| | 199 | ret = SMOP__NATIVE__bool_false; |
| | 200 | } else { |
| | 201 | smop_lowlevel_wrlock(invocant); |
| | 202 | SMOP__p6opaque_LOWL_metadata* m = ((SMOP__p6opaque_struct*)invocant)->metadata; |
| | 203 | ((SMOP__p6opaque_struct*)invocant)->metadata = NULL; |
| | 204 | smop_lowlevel_unlock(invocant); |
| | 205 | SMOP_RELEASE(interpreter,m->how); |
| | 206 | free(m); |
| | 207 | } |
| | 208 | |
| | 209 | SMOP_RELEASE(interpreter,invocant); |
| | 210 | } else { |
| | 211 | fprintf(stderr, "[SMOP p6opaque] TODO: non-native captures\n"); |
| | 212 | } |
| | 213 | } else if (identifier == SMOP__ID__DESTROYALL) { |
| | 214 | |
| | 215 | ret = SMOP__NATIVE__bool_true; |
| | 216 | SMOP__Object* frame; |
| | 217 | SMOP__Object* continuation = SMOP_DISPATCH(interpreter, SMOP_RI(interpreter), |
| | 218 | SMOP__ID__continuation, |
| | 219 | SMOP_REFERENCE(interpreter,interpreter)); |
| | 220 | |
| | 221 | if (SMOP_RI(capture) == (SMOP__ResponderInterface*)SMOP__p6opaque__RI) { |
| | 222 | SMOP__Object* invocant = capture; |
| | 223 | $frame = q:sm0p { |
| | 224 | $capture; |
| | 225 | $identifier; |
| | 226 | $invocant; |
| | 227 | $invocant.SMOP__ID__REPR_how(); |
| | 228 | SMOP__SLIME__CurrentFrame.copy(1); |
| | 229 | SMOP__SLIME__CurrentFrame.move_responder(2,2); |
| | 230 | SMOP__SLIME__CurrentFrame.move_capturize(SMOP__SLIME__Capturize.new(2,(4,5,6),(),1)); |
| | 231 | SMOP__NATIVE__bool_true.SMOP__ID__dispatch(); |
| | 232 | $invocant.SMOP__ID__REPR_DESTROY(); |
| | 233 | $interpreter.goto(|$continuation); |
| | 234 | }; |
| | 235 | } else { |
| | 236 | $frame = q:sm0p { |
| | 237 | $capture; |
| | 238 | $identifier; |
| | 239 | $capture.SMOP__ID__invocant(); |
| | 240 | $capture.SMOP__ID__invocant(); |
| | 241 | SMOP__SLIME__CurrentFrame.move_capturize(SMOP__SLIME__Capturize.new(1,(),(),1)); |
| | 242 | SMOP__p6opaque__RI.SMOP__ID__REPR_how(); |
| | 243 | SMOP__SLIME__CurrentFrame.copy(1); |
| | 244 | SMOP__SLIME__CurrentFrame.move_responder(2,2); |
| | 245 | SMOP__SLIME__CurrentFrame.move_capturize(SMOP__SLIME__Capturize.new(2,(6,7,8),(),1)); |
| | 246 | SMOP__NATIVE__bool_true.SMOP__ID__dispatch(); |
| | 247 | $capture.SMOP__ID__invocant(); |
| | 248 | SMOP__SLIME__CurrentFrame.move_responder(1,3); |
| | 249 | $capture.SMOP__ID__invocant(); |
| | 250 | SMOP__SLIME__CurrentFrame.move_capturize(SMOP__SLIME__Capturize.new(1,(),(),1)); |
| | 251 | SMOP__p6opaque__RI.SMOP__ID__REPR_DESTROY(); |
| | 252 | $interpreter.goto(|$continuation); |
| | 253 | }; |
| | 254 | } |
| | 255 | |
| | 256 | SMOP_DISPATCH(interpreter, SMOP_RI(interpreter), |
| | 257 | SMOP__ID__goto, |
| | 258 | frame); |
| | 259 | |