--- a/compiler/PPCCompiler.st Mon May 11 18:31:26 2015 +0100
+++ b/compiler/PPCCompiler.st Tue May 12 01:33:33 2015 +0100
@@ -48,6 +48,10 @@
^ compiledParserSuperclass ifNil: [ PPCompiledParser ]
!
+currentMethod
+ ^ currentMethod
+!
+
currentNonInlineMethod
^ compilerStack
detect:[:m | m isInline not ]
@@ -67,12 +71,12 @@
!PPCCompiler methodsFor:'cleaning'!
clean: class
-" Transcript crShow: 'Cleaning time: ',
+" Transcript show: ('Cleaning time: ',
[
" self cleanGeneratedMethods: class.
self cleanInstVars: class.
self cleanConstants: class.
-" ] timeToRun asMilliSeconds asString, 'ms'."
+" ] timeToRun asMilliSeconds asString, 'ms'); cr. "
!
cleanConstants: class
@@ -82,13 +86,16 @@
cleanGeneratedMethods: class
((Smalltalk respondsTo:#isSmalltalkX) and:[ Smalltalk isSmalltalkX ]) ifTrue:[
class methodsDo: [ :mthd |
- mthd category = #generated ifTrue:[
+ (mthd category beginsWith: 'generated') ifTrue:[
class removeSelector: mthd selector.
]
]
] ifFalse: [
- (class allSelectorsInProtocol: #generated) do: [ :selector |
- class removeSelectorSilently: selector ].
+ (class allProtocolsUpTo: class) do: [ :protocol |
+ (protocol beginsWith: 'generated') ifTrue: [
+ class removeProtocol: protocol.
+ ]
+ ]
]
!
@@ -171,9 +178,9 @@
(variable == #whatever) ifFalse: [
"Do not assign, if somebody does not care!!"
self add: variable ,' := ', code.
- ] ifTrue: [
+ ] ifTrue: [
"In case code hava a side effect"
- self add: code
+ self add: code
]
!
@@ -208,13 +215,13 @@
codeReturn
currentMethod isInline ifTrue: [
- "If inlined, the return variable already holds the value"
- ] ifFalse: [
- self add: '^ ', currentMethod returnVariable
+ "If inlined, the return variable already holds the value"
+ ] ifFalse: [
+ self add: '^ ', currentMethod returnVariable
].
- "Created: / 23-04-2015 / 18:01:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 23-04-2015 / 20:51:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 23-04-2015 / 18:01:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 23-04-2015 / 20:51:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
codeReturn: code
@@ -442,7 +449,7 @@
installMethods
cache keysAndValuesDo: [ :key :method |
- compiledParser compileSilently: method code classified: 'generated'.
+ compiledParser compileSilently: method code classified: method category.
]
!