AssignmentNode.st
changeset 1806 0aeedab88cac
parent 1589 e50e9f5bf31b
child 2075 d1a4cd5ab035
equal deleted inserted replaced
1805:d8f8075615dc 1806:0aeedab88cac
   156     (variable type == #WorkspaceVariable) ifTrue:[
   156     (variable type == #WorkspaceVariable) ifTrue:[
   157         "/ this is done by keeping the valueHolder in the literalArray,
   157         "/ this is done by keeping the valueHolder in the literalArray,
   158         "/ and coding a #value: message here.
   158         "/ and coding a #value: message here.
   159 
   159 
   160         litIdx := aCompiler addLiteral:variable token.
   160         litIdx := aCompiler addLiteral:variable token.
   161         aStream nextPut:#pushLitS; nextPut:litIdx.
   161         self emitPushLiteralIndex:litIdx on:aStream for:aCompiler.
       
   162 
   162         expression codeOn:aStream inBlock:b for:aCompiler.
   163         expression codeOn:aStream inBlock:b for:aCompiler.
   163 
   164 
   164         selLitIdx := aCompiler addLiteral:#value:.
   165         selLitIdx := aCompiler addLiteral:#value:.
   165         selLitIdx <= 255 ifTrue:[
   166         self emitSendLiteralIndex:selLitIdx numArgs:1 line:(lineNr ? 1) on:aStream.
   166             aStream nextPut:#send1; nextPut:(lineNr ? 1); nextPut:selLitIdx.
       
   167         ] ifFalse:[
       
   168             aStream nextPut:#sendL; nextPut:(lineNr ? 1); nextPut:selLitIdx; nextPut:0; nextPut:1 "nargs".
       
   169         ].
       
   170         aStream nextPut:#drop.
   167         aStream nextPut:#drop.
   171 
   168 
   172         forValue ifTrue:[
   169         forValue ifTrue:[
   173             (expression isConstant or:[expression isVariable]) ifTrue:[
   170             (expression isConstant or:[expression isVariable]) ifTrue:[
   174                 expression codeOn:aStream inBlock:b for:aCompiler.
   171                 expression codeOn:aStream inBlock:b for:aCompiler.
   175             ] ifFalse:[
   172             ] ifFalse:[
   176                 "/ fetch value from the holder - sigh
   173                 "/ fetch value from the holder - sigh
   177                 aStream nextPut:#pushLitS; nextPut:litIdx.
   174                 self emitPushLiteralIndex:litIdx on:aStream for:aCompiler.
   178 
   175 
   179                 selLitIdx := aCompiler addLiteral:#value.
   176                 selLitIdx := aCompiler addLiteral:#value.
   180                 selLitIdx <= 255 ifTrue:[
   177                 self emitSendLiteralIndex:selLitIdx numArgs:0 line:(lineNr ? 1) on:aStream.
   181                     aStream nextPut:#send0; nextPut:(lineNr ? 1); nextPut:selLitIdx.
       
   182                 ] ifFalse:[
       
   183                     aStream nextPut:#sendL; nextPut:(lineNr ? 1); nextPut:selLitIdx; nextPut:0; nextPut:1 "nargs".
       
   184                 ].
       
   185             ]
   178             ]
   186         ].
   179         ].
   187         ^ self
   180         ^ self
   188     ].
   181     ].
   189 
   182 
   269 ! !
   262 ! !
   270 
   263 
   271 !AssignmentNode class methodsFor:'documentation'!
   264 !AssignmentNode class methodsFor:'documentation'!
   272 
   265 
   273 version
   266 version
   274     ^ '$Header: /cvs/stx/stx/libcomp/AssignmentNode.st,v 1.36 2005-04-20 14:43:10 cg Exp $'
   267     ^ '$Header: /cvs/stx/stx/libcomp/AssignmentNode.st,v 1.37 2006-08-09 11:59:12 cg Exp $'
   275 ! !
   268 ! !