help-smalltalk
[Top][All Lists]
Advanced

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

Re: [Help-smalltalk] STCompiler input bug?


From: Gwenaël Casaccio
Subject: Re: [Help-smalltalk] STCompiler input bug?
Date: Sat, 24 Sep 2011 13:38:21 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 Thunderbird/3.1.13

On 24/09/2011 11:27, Holger Hans Peter Freyther wrote:
Hi,

when using the STCompiler I end up with a MessageNotUnderstood error:

STInST.STEvaluationDriver new parseSmalltalk: '[:each :ablock | (each) ifTrue:
ablock]!' with: STInST.STFileInParser


In STCompiler>>#compileBoolean: aNode will be '(each) ifTrue:..' the arguments
is the RBVariableNode and RBVariableNode does not understand arguments/body.
So somehow the bytecode for STCompiler>>#acceptVariableNode would need to end
up in bc1 and bc2?




_______________________________________________
help-smalltalk mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Hi Zecke,

Can you try the following patch (ok not perfect but it works for me)
I've made some other changes for the compiler:

STInST.STCompiler class extend [
    evaluate: aNode parser: aParser [
<category: 'evaluation'>
        | cm methodNode sequenceNode |
sequenceNode := aNode isSequence ifFalse: [ RBSequenceNode statements: {aNode} ] ifTrue: [ aNode ].
        sequenceNode addReturn.
        methodNode := (RBMethodNode new)
                    arguments: #();
                    body: sequenceNode;
                    selector: #Doit;
                    source: nil;
                    yourself.
        cm := self
                    compile: methodNode
                    asMethodOf: UndefinedObject
                    classified: nil
                    parser: aParser
                    environment: Namespace current.
    ^nil perform: cm
    ]
]

STInST.STCompiler evaluate: (STInST.RBParser parseExpression: '[:each :ablock | (each) ifTrue: ablock]') parser: STInST.RBParser new

Gwen

Attachment: stcompiler.patch
Description: Text Data


reply via email to

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