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@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