SeasideSt / Seaside

The framework for developing sophisticated web applications in Smalltalk.
MIT License
519 stars 71 forks source link

WAPharoInspector cannot evaluate (compile) expressions in Pharo 11 #1372

Closed eMaringolo closed 1 year ago

eMaringolo commented 1 year ago

Every time you attempt to evaluate something in the WAPharoInspector you get Error: Receiver is not same as context receiver, this might be due to some changes in the Opal Compiler.

It can be fixed by adding a semantic scope to the compiler:

WAPharoInspector>>#evaluate

    ^self object class compilerClass new
       source: input;
       context: thisContext;
       semanticScope: (OCReceiverDoItSemanticScope targetingReceiver: self object); "<-- this"
       receiver: self object;
       evaluate
jbrichau commented 1 year ago

Thanks @eMaringolo for reporting and proposing a solution.

I'm looking into this and notice that it works without the change in Pharo12 because the receiver: method is essentially doing the same thing. In Pharo 11, it fails because the context was set to thisContext which actually does not make sense to me though it has been like this for over 10 years 🙄