Compilation code in grease not compatible with Pharo 3.0
Hi, how can I make the following code compile in Pharo 3.0? This is part of Grease ( https://ci.inria.fr/pharo-contribution/job/Grease/PHARO=30,VERSION=stable,VM... ): GRPharoPlatform>>compile: aString into: aClass classified: aSymbol "The trick here is to be as silently a possible so that the package is not marked dirty when running WAFileLibrary test. This also makes running tests much faster." | methodNode compiledMethod selector methodAndNode | methodNode := aClass compilerClass new compile: aString in: aClass notifying: nil ifFail: [ GRError signal: 'syntax error' ]. selector := methodNode selector. methodAndNode := CompiledMethodWithNode generateMethodFromNode: methodNode trailer: aClass defaultMethodTrailer. compiledMethod := methodAndNode method. compiledMethod putSource: aString fromParseNode: methodAndNode node inFile: 2 withPreamble: [ :file | aClass printCategoryChunk: aSymbol asString on: file priorMethod: (aClass compiledMethodAt: selector ifAbsent: [ nil ]). file cr ]. aClass addSelectorSilently: selector withMethod: compiledMethod. self doSilently: [ aClass organization classify: selector under: aSymbol ] -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill
I didn't check (I'm not on my laptop) but I would say the problem is that CompiledMethodWithNode does not exist any more. Something like that would fix it: GRPharoPlatform>>compile: aString into: aClass classified: aSymbol "The trick here is to be as silently a possible so that the package is not marked dirty when running WAFileLibrary test. This also makes running tests much faster." | methodNode compiledMethod selector methodAndNode | methodNode := aClass compilerClass new source: aString; class: aClass; failBlock: [ GRError signal: 'syntax error' ]; translate. compiledMethod := methodNode generate: aClass defaultMethodTrailer. selector := methodNode selector. compiledMethod putSource: aString fromParseNode: methodNode inFile: 2 withPreamble: [ :file | aClass printCategoryChunk: aSymbol asString on: file priorMethod: (aClass compiledMethodAt: selector ifAbsent: [ nil ]). file cr ]. aClass addSelectorSilently: selector withMethod: compiledMethod. self doSilently: [ aClass organization classify: selector under: aSymbol ] 2013/8/27 Damien Cassou <damien.cassou@gmail.com>
Hi,
how can I make the following code compile in Pharo 3.0? This is part of Grease ( https://ci.inria.fr/pharo-contribution/job/Grease/PHARO=30,VERSION=stable,VM... ):
GRPharoPlatform>>compile: aString into: aClass classified: aSymbol "The trick here is to be as silently a possible so that the package is not marked dirty when running WAFileLibrary test. This also makes running tests much faster." | methodNode compiledMethod selector methodAndNode | methodNode := aClass compilerClass new compile: aString in: aClass notifying: nil ifFail: [ GRError signal: 'syntax error' ]. selector := methodNode selector. methodAndNode := CompiledMethodWithNode generateMethodFromNode: methodNode trailer: aClass defaultMethodTrailer. compiledMethod := methodAndNode method. compiledMethod putSource: aString fromParseNode: methodAndNode node inFile: 2 withPreamble: [ :file | aClass printCategoryChunk: aSymbol asString on: file priorMethod: (aClass compiledMethodAt: selector ifAbsent: [ nil ]). file cr ]. aClass addSelectorSilently: selector withMethod: compiledMethod. self doSilently: [ aClass organization classify: selector under: aSymbol ]
-- Damien Cassou http://damiencassou.seasidehosting.st
"Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill
thank you Clément. That's what I came up with. Now, there is always the call to #putSource:fromParseNode:inFile:withPreamble: that is not implemented anymore: On Tue, Aug 27, 2013 at 7:53 PM, Clément Bera <bera.clement@gmail.com>wrote:
putSource: aString fromParseNode: methodNode
inFile: 2 withPreamble:
-- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill
On Aug 27, 2013, at 9:12 PM, Damien Cassou <damien.cassou@gmail.com> wrote:
thank you Clément. That's what I came up with. Now, there is always the call to #putSource:fromParseNode:inFile:withPreamble: that is not implemented anymore:
The parameter was remove : #putSource:inFile:withPreamble:
On Tue, Aug 27, 2013 at 7:53 PM, Clément Bera <bera.clement@gmail.com> wrote: putSource: aString fromParseNode: methodNode
inFile: 2 withPreamble:
-- Damien Cassou http://damiencassou.seasidehosting.st
"Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill
thank you Marcus. Now, this does not work because #printCategoryChunk:on: does not exist anymore: aClass printCategoryChunk: aSymbol asString on: file priorMethod: (aClass compiledMethodAt: selector ifAbsent: [ nil ] On Tue, Aug 27, 2013 at 7:19 PM, Damien Cassou <damien.cassou@gmail.com>wrote:
Hi,
how can I make the following code compile in Pharo 3.0? This is part of Grease ( https://ci.inria.fr/pharo-contribution/job/Grease/PHARO=30,VERSION=stable,VM... ):
GRPharoPlatform>>compile: aString into: aClass classified: aSymbol "The trick here is to be as silently a possible so that the package is not marked dirty when running WAFileLibrary test. This also makes running tests much faster." | methodNode compiledMethod selector methodAndNode | methodNode := aClass compilerClass new compile: aString in: aClass notifying: nil ifFail: [ GRError signal: 'syntax error' ]. selector := methodNode selector. methodAndNode := CompiledMethodWithNode generateMethodFromNode: methodNode trailer: aClass defaultMethodTrailer. compiledMethod := methodAndNode method. compiledMethod putSource: aString fromParseNode: methodAndNode node inFile: 2 withPreamble: [ :file | aClass printCategoryChunk: aSymbol asString on: file priorMethod: (aClass compiledMethodAt: selector ifAbsent: [ nil ]). file cr ]. aClass addSelectorSilently: selector withMethod: compiledMethod. self doSilently: [ aClass organization classify: selector under: aSymbol ]
-- Damien Cassou http://damiencassou.seasidehosting.st
"Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill
-- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill
On Wed, Aug 28, 2013 at 9:56 AM, Damien Cassou <damien.cassou@gmail.com>wrote:
thank you Marcus. Now, this does not work because #printCategoryChunk:on: does not exist anymore:
we found the solution, thank you -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill
participants (3)
-
Clément Bera -
Damien Cassou -
Marcus Denker