help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] method categories


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] method categories
Date: Tue, 07 Jul 2009 14:57:33 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2


Soo... even if (compiler visitNode: methodNode) defined the category
correctly, it would get overwritten by the non-set curCategory ivar
value passed in from STEvaluationDriver.

Now, the question to the experts: Where and how should that be fixed?

The fix is so easy that missing it is also easy:

--- a/packages/stinst/parser/STCompiler.st
+++ b/packages/stinst/parser/STCompiler.st
@@ -154,13 +154,13 @@ indexed'' bytecode. The resulting stream is

STCompiler class >> compile: methodNode asMethodOf: aBehavior classified: aString parser: aParser environment: aNamespace [
        <category: 'compilation'>
-       | compiler |
+       | compiler method |
        compiler := self new.
        compiler class: aBehavior parser: aParser.
        aNamespace isNil ifFalse: [compiler addPool: aNamespace].
-       ^(compiler visitNode: methodNode)
-           methodCategory: aString;
-           yourself
+       method := compiler visitNode: methodNode.
+       aString isNil ifFalse: [ method methodCategory: aString ].
+       ^method
     ]

     class: aBehavior parser: aParser [

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]