37 |
33 |
38 category: value |
34 category: value |
39 category := value |
35 category := value |
40 ! |
36 ! |
41 |
37 |
42 code |
|
43 ^ String streamContents: [ :s | |
|
44 s nextPutAll: self methodName; cr. |
|
45 buffer codeOn: s. |
|
46 ] |
|
47 |
|
48 "Modified: / 01-06-2015 / 21:24:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
49 ! |
|
50 |
|
51 id: value |
38 id: value |
52 id := value |
39 selector := value |
53 ! |
40 ! |
54 |
41 |
55 indentationLevel |
42 indentationLevel |
56 ^ buffer indentationLevel |
43 ^ source indentationLevel |
57 |
44 |
58 "Created: / 01-06-2015 / 21:38:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
45 "Created: / 01-06-2015 / 21:38:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
59 ! |
46 ! |
60 |
47 |
61 indentationLevel: anInteger |
48 indentationLevel: anInteger |
62 buffer indentationLevel: anInteger |
49 source indentationLevel: anInteger |
63 |
50 |
64 "Created: / 01-06-2015 / 21:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
51 "Created: / 01-06-2015 / 21:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
65 ! |
52 ! |
66 |
53 |
67 methodName |
54 methodName |
68 ^ id |
55 ^ selector |
69 ! |
56 ! |
70 |
57 |
71 profile |
58 source |
72 ^ profile |
59 ^ source isString ifTrue:[ |
73 ! |
60 source |
74 |
61 ] ifFalse:[ |
75 profile: aBoolean |
62 String streamContents: [ :s | |
76 profile := aBoolean |
63 s nextPutAll: self methodName; cr. |
|
64 source sourceOn:s. |
|
65 ] |
|
66 ]. |
|
67 |
|
68 "Created: / 24-07-2015 / 19:46:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
69 ! |
|
70 |
|
71 source: aString |
|
72 source := aString |
|
73 |
|
74 "Created: / 24-07-2015 / 19:48:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
77 ! ! |
75 ! ! |
78 |
76 |
79 !PPCMethod methodsFor:'as yet unclassified'! |
77 !PPCMethod methodsFor:'as yet unclassified'! |
80 |
78 |
81 add: string |
79 add: string |
82 buffer add: string |
80 source add: string |
83 |
81 |
84 "Modified: / 01-06-2015 / 21:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
82 "Modified: / 01-06-2015 / 21:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
85 ! |
83 ! |
86 |
84 |
87 addOnLine: string |
85 addOnLine: string |
88 buffer addOnLine: string |
86 source addOnLine: string |
89 |
87 |
90 "Modified: / 01-06-2015 / 21:09:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
88 "Modified: / 01-06-2015 / 21:09:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
91 ! |
89 ! |
92 |
90 |
93 call |
91 call |
94 ^ 'self ', self methodName, '.'. |
92 ^ 'self ', self methodName, '.'. |
95 ! |
93 ! |
96 |
94 |
97 profilingBegin |
95 profilingBegin |
98 self profile ifTrue: [ |
96 self profile ifTrue: [ |
99 ^ ' context methodInvoked: #', id, '.' |
97 ^ ' context methodInvoked: #', selector, '.' |
100 ]. |
98 ]. |
101 ^ '' |
99 ^ '' |
102 ! |
100 ! |
103 |
101 |
104 profilingEnd |
102 profilingEnd |
105 self profile ifTrue: [ |
103 self profile ifTrue: [ |
106 ^ ' context methodFinished: #', id, '.' |
104 ^ ' context methodFinished: #', selector, '.' |
107 ]. |
105 ]. |
108 ^ '' |
106 ^ '' |
109 ! ! |
107 ! ! |
110 |
108 |
111 !PPCMethod methodsFor:'code generation'! |
109 !PPCMethod methodsFor:'code generation'! |
112 |
110 |
113 code: aStringOrBlockOrRBParseNode |
111 code: aStringOrBlockOrRBParseNode |
114 buffer code: aStringOrBlockOrRBParseNode. |
112 source code: aStringOrBlockOrRBParseNode. |
115 |
113 |
116 "Created: / 01-06-2015 / 22:31:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
114 "Created: / 01-06-2015 / 22:31:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
117 "Modified (format): / 01-06-2015 / 23:50:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
115 "Modified (format): / 01-06-2015 / 23:50:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
118 ! |
116 ! |
119 |
117 |
120 codeBlock: contents |
118 codeBlock: contents |
121 | outerBlock innerBlock | |
119 | outerBlock innerBlock | |
122 |
120 |
123 outerBlock := buffer. |
121 outerBlock := source. |
124 innerBlock := PPCCodeBlock new. |
122 innerBlock := PPCCodeBlock new. |
125 innerBlock indentationLevel: outerBlock indentationLevel + 1. |
123 innerBlock indentationLevel: outerBlock indentationLevel + 1. |
126 [ |
124 [ |
127 outerBlock addOnLine:'['. |
125 outerBlock addOnLine:'['. |
128 buffer := innerBlock. |
126 source := innerBlock. |
129 self code: contents. |
127 self code: contents. |
130 ] ensure:[ |
128 ] ensure:[ |
131 outerBlock |
129 outerBlock |
132 code: (String streamContents:[:s | innerBlock codeOn: s]); |
130 code: (String streamContents:[:s | innerBlock sourceOn:s]); |
133 add:']'. |
131 add:']'. |
134 buffer := outerBlock. |
132 source := outerBlock. |
135 ] |
133 ] |
136 |
134 |
137 "Created: / 01-06-2015 / 22:33:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
135 "Created: / 01-06-2015 / 22:33:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
138 "Modified: / 03-06-2015 / 06:11:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
136 "Modified: / 03-06-2015 / 06:11:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139 ! ! |
137 ! ! |
140 |
138 |
141 !PPCMethod methodsFor:'code generation - indenting'! |
139 !PPCMethod methodsFor:'code generation - indenting'! |
142 |
140 |
143 dedent |
141 dedent |
144 buffer dedent |
142 source dedent |
145 |
143 |
146 "Created: / 01-06-2015 / 21:32:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
144 "Created: / 01-06-2015 / 21:32:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
147 ! |
145 ! |
148 |
146 |
149 indent |
147 indent |
150 buffer indent |
148 source indent |
151 |
149 |
152 "Created: / 01-06-2015 / 21:32:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
150 "Created: / 01-06-2015 / 21:32:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
153 ! |
151 ! |
154 |
152 |
155 nl |
153 nl |
156 |
154 |
157 buffer nl |
155 source nl |
158 |
156 |
159 "Created: / 01-06-2015 / 21:52:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
157 "Created: / 01-06-2015 / 21:52:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
160 ! ! |
158 ! ! |
161 |
159 |
162 !PPCMethod methodsFor:'code generation - variables'! |
160 !PPCMethod methodsFor:'code generation - variables'! |