Stack underflow with meta links on message nodes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Stack underflow with meta links on message nodes

Uko2
Hi, I’m trying to use methinks on message nodes that are executed before the node itself and have receiver and the node as arguments. But sadly I’m getting ’stack underflow’ error when the annotated method is executed. You can use this code snippet to reproduce the error:


| link class |

link := MetaLink new
        metaObject: [ :v1 :v2 | ];
        control: #before;
        selector: #value:value:;
        arguments: #(receiver node).

class := Object newAnonymousSubclass.
class compile: 'method 1+1'.
(class >> #method) ast statements first link: link.

class new method.

link uninstall


Is there any workaround for this issue? Or maybe someone knows how to fix this. Because the issue is present both in Pharo 5 and the latest Pharo 6.

Cheers.
Uko
Reply | Threaded
Open this post in threaded view
|

Re: Stack underflow with meta links on message nodes

Marcus Denker-4
Hi,

This looks like a bug, I will check (but tomorrow).

        Marcus

> On 29 Nov 2016, at 16:52, Yuriy Tymchuk <[hidden email]> wrote:
>
> Hi, I’m trying to use methinks on message nodes that are executed before the node itself and have receiver and the node as arguments. But sadly I’m getting ’stack underflow’ error when the annotated method is executed. You can use this code snippet to reproduce the error:
>
>
> | link class |
>
> link := MetaLink new
> metaObject: [ :v1 :v2 | ];
> control: #before;
> selector: #value:value:;
> arguments: #(receiver node).
>
> class := Object newAnonymousSubclass.
> class compile: 'method 1+1'.
> (class >> #method) ast statements first link: link.
>
> class new method.
>
> link uninstall
>
>
> Is there any workaround for this issue? Or maybe someone knows how to fix this. Because the issue is present both in Pharo 5 and the latest Pharo 6.
>
> Cheers.
> Uko


Reply | Threaded
Open this post in threaded view
|

Re: Stack underflow with meta links on message nodes

Denis Kudriashov
In reply to this post by Uko2

2016-11-29 16:52 GMT+01:00 Yuriy Tymchuk <[hidden email]>:
Is there any workaround for this issue? Or maybe someone knows how to fix this. Because the issue is present both in Pharo 5 and the latest Pharo 6.

Probably meta level is not defined somewhere on MetaLink's part. 
When MetaLink start execution it checks current meta level and if it is higher than where it was installed then link should be ignored.
For example recursion could happen if #value:value is used to resolve some #control object and meta level not defined for this part.