|
@@ -113,7 +113,7 @@ exportDefinitionOf: aClass on: aStream
|
|
nextPutAll: 'smalltalk.';
|
|
nextPutAll: 'smalltalk.';
|
|
nextPutAll: (self classNameFor: aClass);
|
|
nextPutAll: (self classNameFor: aClass);
|
|
nextPutAll: '.comment=';
|
|
nextPutAll: '.comment=';
|
|
- nextPutAll: 'unescape(''', aClass comment escaped, ''')'].
|
|
|
|
|
|
+ nextPutAll: aClass comment asJavascript].
|
|
aStream lf
|
|
aStream lf
|
|
!
|
|
!
|
|
|
|
|
|
@@ -131,13 +131,13 @@ exportMetaDefinitionOf: aClass on: aStream
|
|
exportMethod: aMethod of: aClass on: aStream
|
|
exportMethod: aMethod of: aClass on: aStream
|
|
aStream
|
|
aStream
|
|
nextPutAll: 'smalltalk.addMethod(';lf;
|
|
nextPutAll: 'smalltalk.addMethod(';lf;
|
|
- nextPutAll: 'unescape(''', aMethod selector asSelector escaped, '''),';lf;
|
|
|
|
|
|
+ nextPutAll: aMethod selector asSelector asJavascript, ',';lf;
|
|
nextPutAll: 'smalltalk.method({';lf;
|
|
nextPutAll: 'smalltalk.method({';lf;
|
|
- nextPutAll: 'selector: unescape(''', aMethod selector escaped, '''),';lf;
|
|
|
|
|
|
+ nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;
|
|
nextPutAll: 'category: ''', aMethod category, ''',';lf;
|
|
nextPutAll: 'category: ''', aMethod category, ''',';lf;
|
|
nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;
|
|
nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;
|
|
nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;
|
|
nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;
|
|
- nextPutAll: 'source: unescape(''', aMethod source escaped, '''),';lf;
|
|
|
|
|
|
+ nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;
|
|
nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;
|
|
nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;
|
|
nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.
|
|
nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.
|
|
aStream
|
|
aStream
|
|
@@ -314,9 +314,9 @@ exportDefinitionOf: aClass on: aStream
|
|
exportMethod: aMethod of: aClass on: aStream
|
|
exportMethod: aMethod of: aClass on: aStream
|
|
aStream
|
|
aStream
|
|
nextPutAll: 'smalltalk.addMethod(';lf;
|
|
nextPutAll: 'smalltalk.addMethod(';lf;
|
|
- nextPutAll: 'unescape(''', aMethod selector asSelector escaped, '''),';lf;
|
|
|
|
|
|
+ nextPutAll: aMethod selector asSelector asJavascript, ',';lf;
|
|
nextPutAll: 'smalltalk.method({';lf;
|
|
nextPutAll: 'smalltalk.method({';lf;
|
|
- nextPutAll: 'selector: unescape(''', aMethod selector escaped, '''),';lf;
|
|
|
|
|
|
+ nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;
|
|
nextPutAll: 'fn: ', aMethod fn compiledSource;lf;
|
|
nextPutAll: 'fn: ', aMethod fn compiledSource;lf;
|
|
nextPutAll: '}),';lf;
|
|
nextPutAll: '}),';lf;
|
|
nextPutAll: 'smalltalk.', (self classNameFor: aClass);
|
|
nextPutAll: 'smalltalk.', (self classNameFor: aClass);
|
|
@@ -732,7 +732,7 @@ visitBlockNode: aNode
|
|
!
|
|
!
|
|
|
|
|
|
visitBlockSequenceNode: aNode
|
|
visitBlockSequenceNode: aNode
|
|
- self visitSequenceNode: aNode
|
|
|
|
|
|
+ self visitNode: aNode
|
|
!
|
|
!
|
|
|
|
|
|
visitCascadeNode: aNode
|
|
visitCascadeNode: aNode
|
|
@@ -740,9 +740,7 @@ visitCascadeNode: aNode
|
|
!
|
|
!
|
|
|
|
|
|
visitClassReferenceNode: aNode
|
|
visitClassReferenceNode: aNode
|
|
- self
|
|
|
|
- nextPutAll: 'smalltalk.';
|
|
|
|
- nextPutAll: aNode value
|
|
|
|
|
|
+ self visitNode: aNode
|
|
!
|
|
!
|
|
|
|
|
|
visitDynamicArrayNode: aNode
|
|
visitDynamicArrayNode: aNode
|
|
@@ -754,10 +752,7 @@ visitDynamicDictionaryNode: aNode
|
|
!
|
|
!
|
|
|
|
|
|
visitJSStatementNode: aNode
|
|
visitJSStatementNode: aNode
|
|
- self
|
|
|
|
- nextPutAll: 'function(){';
|
|
|
|
- nextPutAll: aNode source;
|
|
|
|
- nextPutAll: '})()'
|
|
|
|
|
|
+ self visitNode: aNode
|
|
!
|
|
!
|
|
|
|
|
|
visitMethodNode: aNode
|
|
visitMethodNode: aNode
|
|
@@ -784,6 +779,7 @@ visitValueNode: aNode
|
|
!
|
|
!
|
|
|
|
|
|
visitVariableNode: aNode
|
|
visitVariableNode: aNode
|
|
|
|
+ self visitNode: aNode
|
|
! !
|
|
! !
|
|
|
|
|
|
NodeVisitor subclass: #Compiler
|
|
NodeVisitor subclass: #Compiler
|
|
@@ -1310,7 +1306,7 @@ visitMethodNode: aNode
|
|
stream
|
|
stream
|
|
nextPutAll: 'smalltalk.method({'; lf;
|
|
nextPutAll: 'smalltalk.method({'; lf;
|
|
nextPutAll: 'selector: "', aNode selector, '",'; lf.
|
|
nextPutAll: 'selector: "', aNode selector, '",'; lf.
|
|
- stream nextPutAll: 'source: unescape("', self source escaped, '"),';lf.
|
|
|
|
|
|
+ stream nextPutAll: 'source: ', self source asJavascript, ',';lf.
|
|
stream nextPutAll: 'fn: function('.
|
|
stream nextPutAll: 'fn: function('.
|
|
aNode arguments
|
|
aNode arguments
|
|
do: [:each |
|
|
do: [:each |
|