--- a/JavaNativeMethod.st Mon Aug 04 15:43:51 2014 +0100
+++ b/JavaNativeMethod.st Mon Aug 04 16:13:14 2014 +0100
@@ -212,59 +212,69 @@
!JavaNativeMethod methodsFor:'private'!
-compileNativeImplementation: sel dispatchingTo: oldSel
+compileNativeImplementation:sel dispatchingTo:oldSel
+ | src arg converted header |
- | src arg converted header |
- src := (JavaVM class compiledMethodAt: oldSel) source.
+ src := (JavaVM class compiledMethodAt:oldSel) source.
src := src asStringCollection.
- (src first includesString: 'aJavaContext') ifTrue:[
+ (src first includesString:'aJavaContext') ifTrue:[
arg := 'aJavaContext'
] ifFalse:[
- (src first includesString: 'nativeContext') ifTrue:[
+ (src first includesString:'nativeContext') ifTrue:[
arg := 'nativeContext'
]
].
- arg ifNotNil:[
- src removeFirst asString.
- converted := true.
- ] ifNil:[
+ arg isNil ifTrue:[
arg := 'nativeContext'.
src := ' self breakPoint: #jv info: ''Convert it to new-style natives''.
- ^ self ', oldSel, ' nativeContext'.
- converted := false.
- ].
-
- header := String streamContents:[:s|
- sel numArgs == 2 ifTrue:[
- s nextPutAll: sel; space; nextPutAll: 'this '.
- ] ifFalse:[
- | kw |
+ ^ self '
+ , oldSel , ' nativeContext'.
+ converted := false.
+ ] ifFalse:[
+ src removeFirst asString.
+ converted := true.
+ ].
+ header := String
+ streamContents:[:s |
+ sel numArgs == 2 ifTrue:[
+ s
+ nextPutAll:sel;
+ space;
+ nextPutAll:'this '.
+ ] ifFalse:[
+ | kw |
- kw := sel keywords.
- s nextPutAll: kw first.
- s nextPutAll: ' this '.
- 2 to: kw size - 1 do:[:i|
- sel nextPutAll: (kw at: i); space; nextPut:$a; nextPutAll: i printString; space.
- ].
- ]
- ].
-
- (JavaVM class
- compile:
- (self nativeMethodTemplate bindWith:header with: arg with: src asString)
- classified:
- 'native - ', ((javaClass javaPackage upTo:$$) replaceAll:$/ with:$. ))
- package: JavaVM package.
-
+ kw := sel keywords.
+ s nextPutAll:kw first.
+ s nextPutAll:' this '.
+ 2 to:kw size - 1 do:[:i |
+ sel
+ nextPutAll:(kw at:i);
+ space;
+ nextPut:$a;
+ nextPutAll:i printString;
+ space.
+ ].
+ ]
+ ].
+ (JavaVM class compile:(self nativeMethodTemplate
+ bindWith:header
+ with:arg
+ with:src asString)
+ classified:'native - '
+ , ((javaClass javaPackage upTo:$$) replaceAll:$/ with:$.))
+ package:JavaVM package.
converted ifTrue:[
- (JavaVM class compiledMethodAt: oldSel) category: 'native - old-style (converted)'
+ (JavaVM class compiledMethodAt:oldSel)
+ category:'native - old-style (converted)'
] ifFalse:[
- (JavaVM class compiledMethodAt: oldSel) category: 'native - old-style (FAILED to convert)'
+ (JavaVM class compiledMethodAt:oldSel)
+ category:'native - old-style (FAILED to convert)'
]
"Created: / 01-05-2011 / 00:08:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-01-2013 / 23:29:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-08-2014 / 15:51:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
compileNativeImplementationStub: sel