--- a/compiler/PPCMethod.st Fri Jul 24 19:42:09 2015 +0100
+++ b/compiler/PPCMethod.st Mon Jul 27 10:21:41 2015 +0100
@@ -3,7 +3,7 @@
"{ NameSpace: Smalltalk }"
Object subclass:#PPCMethod
- instanceVariableNames:'buffer id variableForReturn category profile'
+ instanceVariableNames:'selector source category variableForReturn'
classVariableNames:''
poolDictionaries:''
category:'PetitCompiler-Compiler-Codegen'
@@ -20,10 +20,6 @@
!PPCMethod methodsFor:'accessing'!
-body
- ^ buffer contents
-!
-
bridge
^ PPCBridge on: self methodName.
!
@@ -39,53 +35,55 @@
category := value
!
-code
- ^ String streamContents: [ :s |
- s nextPutAll: self methodName; cr.
- buffer codeOn: s.
- ]
-
- "Modified: / 01-06-2015 / 21:24:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
id: value
- id := value
+ selector := value
!
indentationLevel
- ^ buffer indentationLevel
+ ^ source indentationLevel
"Created: / 01-06-2015 / 21:38:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
indentationLevel: anInteger
- buffer indentationLevel: anInteger
+ source indentationLevel: anInteger
"Created: / 01-06-2015 / 21:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
methodName
- ^ id
+ ^ selector
!
-profile
- ^ profile
+source
+ ^ source isString ifTrue:[
+ source
+ ] ifFalse:[
+ String streamContents: [ :s |
+ s nextPutAll: self methodName; cr.
+ source sourceOn:s.
+ ]
+ ].
+
+ "Created: / 24-07-2015 / 19:46:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-profile: aBoolean
- profile := aBoolean
+source: aString
+ source := aString
+
+ "Created: / 24-07-2015 / 19:48:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!PPCMethod methodsFor:'as yet unclassified'!
add: string
- buffer add: string
+ source add: string
"Modified: / 01-06-2015 / 21:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
addOnLine: string
- buffer addOnLine: string
+ source addOnLine: string
"Modified: / 01-06-2015 / 21:09:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
@@ -96,14 +94,14 @@
profilingBegin
self profile ifTrue: [
- ^ ' context methodInvoked: #', id, '.'
+ ^ ' context methodInvoked: #', selector, '.'
].
^ ''
!
profilingEnd
self profile ifTrue: [
- ^ ' context methodFinished: #', id, '.'
+ ^ ' context methodFinished: #', selector, '.'
].
^ ''
! !
@@ -111,7 +109,7 @@
!PPCMethod methodsFor:'code generation'!
code: aStringOrBlockOrRBParseNode
- buffer code: aStringOrBlockOrRBParseNode.
+ source code: aStringOrBlockOrRBParseNode.
"Created: / 01-06-2015 / 22:31:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (format): / 01-06-2015 / 23:50:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -120,18 +118,18 @@
codeBlock: contents
| outerBlock innerBlock |
- outerBlock := buffer.
+ outerBlock := source.
innerBlock := PPCCodeBlock new.
innerBlock indentationLevel: outerBlock indentationLevel + 1.
[
outerBlock addOnLine:'['.
- buffer := innerBlock.
+ source := innerBlock.
self code: contents.
] ensure:[
outerBlock
- code: (String streamContents:[:s | innerBlock codeOn: s]);
+ code: (String streamContents:[:s | innerBlock sourceOn:s]);
add:']'.
- buffer := outerBlock.
+ source := outerBlock.
]
"Created: / 01-06-2015 / 22:33:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -141,20 +139,20 @@
!PPCMethod methodsFor:'code generation - indenting'!
dedent
- buffer dedent
+ source dedent
"Created: / 01-06-2015 / 21:32:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
indent
- buffer indent
+ source indent
"Created: / 01-06-2015 / 21:32:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
nl
- buffer nl
+ source nl
"Created: / 01-06-2015 / 21:52:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
@@ -189,7 +187,7 @@
"Allocate a new variable with (preferably) given name.
Returns a real variable name that should be used."
- ^ buffer allocateTemporaryVariableNamed: preferredName
+ ^ source allocateTemporaryVariableNamed: preferredName
"Created: / 23-04-2015 / 17:37:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 01-06-2015 / 21:04:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -215,7 +213,7 @@
!PPCMethod methodsFor:'initialization'!
initialize
- buffer := PPCCodeBlock new.
+ source := PPCCodeBlock new.
"Modified: / 01-06-2015 / 21:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
@@ -227,7 +225,7 @@
super printOn:aStream.
aStream nextPutAll:' id: '.
- id printOn:aStream.
+ selector printOn:aStream.
"Modified: / 23-04-2015 / 12:32:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !