[Pharo-project] Compiling a method taking wrong source

Guillermo Polito guillermopolito at gmail.com
Sun Jun 19 15:21:31 EDT 2011


Mmm, maybe I'm using an old image.  Let me check,

thanks!

On Sun, Jun 19, 2011 at 4:17 PM, Lukas Renggli <renggli at gmail.com> wrote:

> This is a bug introduced by the TextEditor changes. I thought it was
> fixed in the latest Pharo 1.2.1?
>
> Lukas
>
> On 19 June 2011 20:37, Guillermo Polito <guillermopolito at gmail.com> wrote:
> > Well, replacing:
> >
> > self logMethodSource: text forMethodWithNode: methodAndNode
> >             inCategory: category withStamp: changeStamp notifying:
> > requestor.
> >
> > by
> >
> > self logMethodSource: methodAndNode node printString forMethodWithNode:
> > methodAndNode
> >             inCategory: category withStamp: changeStamp notifying:
> > requestor.
> >
> > Works well :).  But for sure I smell I'm doing something veeery wrong :S
> >
> > Has it something to do with using a mutable text instead of a string?
> >
> > On Sun, Jun 19, 2011 at 3:32 PM, Guillermo Polito
> > <guillermopolito at gmail.com> wrote:
> >>
> >> Hi, I have a simple snippet of code which says:
> >>
> >> someObject class compile: aMethod classified: someCategory notifying:
> >> aRequestor.
> >>
> >> where aRequestor is a PluggableTextMorph.
> >>
> >> Actually, when I try to compile a method with a temp var, letting the
> >> compiler notify me when a temp var is needed, I always see the final
> >> CompiledMethod with the wrong source.  For example, compiling
> >>
> >> someMethod
> >>   ^someTemp
> >>
> >> Is correctly updated to be
> >>
> >> someMethod
> >>   | someTemp |
> >>   ^someTemp
> >>
> >> But, after the compilation process, when I get the compiled method
> source,
> >> It just have
> >>
> >> someMethod
> >>   ^someTemp
> >>
> >>
> >> Debugging, I ended up in
> >>
> >> ClassDescriptioncompile: text classified: category withStamp:
> changeStamp
> >> notifying: requestor logSource: logSource
> >>     | methodAndNode |
> >>     methodAndNode := self compile: text asString classified: category
> >> notifying: requestor
> >>                             trailer: self defaultMethodTrailer ifFail:
> >> [^nil].
> >>     logSource ifTrue: [
> >>         self logMethodSource: text forMethodWithNode: methodAndNode
> >>             inCategory: category withStamp: changeStamp notifying:
> >> requestor.
> >>     ].
> >>     self addAndClassifySelector: methodAndNode selector withMethod:
> >> methodAndNode
> >>         method inProtocol: category notifying: requestor.
> >>     self instanceSide noteCompilationOf: methodAndNode selector meta:
> self
> >> isClassSide.
> >>     ^ methodAndNode selector
> >>
> >> Which is saving as the CompiledMethod source, the original text, not the
> >> one which was changed in the PluggableTextMorph and compiled in the
> >> methodAndNode object.
> >>
> >>
> >> Well, I was looking how the Browser works, and I didn't realize the
> >> difference...  Can someone enlight me?
> >>
> >> Thanks,
> >> Guille
> >
> >
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20110619/38506beb/attachment-0001.html>


More information about the Pharo-dev mailing list