Spaces:
Running
Running
File size: 709 Bytes
8f3f8db |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
translating builtins
generateAsIfVar: aNode on: aStream indent: anInteger
| cName fName class index |
cName := String streamContents:
[:scStr | self emitJSExpression: aNode args first on: scStr].
class := Smalltalk
at: (cName asSymbol)
ifAbsent: [nil].
(class isNil not and: [class isBehavior]) ifFalse:
[^self error: 'first arg must identify class'].
fName := aNode args second value.
index := class allInstVarNames
indexOf: fName
ifAbsent: [^self error: 'second arg must be instVar'].
aStream
nextPutAll: 'interpreterProxy->fetchPointerofObject(';
nextPutAll: (index - 1) asString;
nextPutAll: ','.
self emitJSExpression: aNode receiver on: aStream.
aStream nextPutAll: ')'. |