equal
deleted
inserted
replaced
103 sourceLineToOffset: lineNr |
103 sourceLineToOffset: lineNr |
104 lineNr == 1 ifTrue:[ ^ 1 ]. |
104 lineNr == 1 ifTrue:[ ^ 1 ]. |
105 ^ (sourceLineEnds at: lineNr - 1) + 1. |
105 ^ (sourceLineEnds at: lineNr - 1) + 1. |
106 |
106 |
107 "Created: / 08-09-2013 / 10:52:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
107 "Created: / 08-09-2013 / 10:52:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
108 ! |
|
109 |
|
110 sourceOffsetToLine: offset |
|
111 |
|
112 |low "{ Class: SmallInteger}" |
|
113 high "{ Class: SmallInteger}" |
|
114 middle "{ Class: SmallInteger}" |
|
115 element| |
|
116 |
|
117 " |
|
118 we can of course use a binary search - since the elements are sorted |
|
119 " |
|
120 low := 1. |
|
121 high := sourceLineEnds size. |
|
122 [low > high] whileFalse:[ |
|
123 middle := (low + high) // 2. |
|
124 element := sourceLineEnds at:middle. |
|
125 element < offset ifTrue:[ |
|
126 "middleelement is smaller than object" |
|
127 low := middle + 1 |
|
128 ] ifFalse:[ |
|
129 high := middle - 1 |
|
130 ] |
|
131 ]. |
|
132 ^ low |
|
133 |
|
134 "Created: / 10-09-2013 / 03:40:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
108 ! |
135 ! |
109 |
136 |
110 sourceText |
137 sourceText |
111 ^ sourceText |
138 ^ sourceText |
112 ! |
139 ! |
243 ]. |
270 ]. |
244 methodNode := methodNodes anElement. |
271 methodNode := methodNodes anElement. |
245 ]. |
272 ]. |
246 ]. |
273 ]. |
247 methodNode notNil ifTrue: [ |
274 methodNode notNil ifTrue: [ |
|
275 | line | |
|
276 |
|
277 line := (self sourceOffsetToLine: methodNode sourceStart) - |
|
278 (self sourceOffsetToLine: methodNode declarationSourceStart) + 1. |
|
279 |
248 source := JavaSourceRef new. |
280 source := JavaSourceRef new. |
249 source offset: methodNode declarationSourceStart. |
281 source offset: methodNode declarationSourceStart. |
250 source |
282 source length: methodNode declarationSourceEnd - methodNode declarationSourceStart + 1. |
251 length: methodNode declarationSourceEnd - methodNode declarationSourceStart |
283 source line: line. |
252 + 1. |
|
253 method setSource: source. |
284 method setSource: source. |
254 ] ifFalse: [ |
285 ] ifFalse: [ |
255 self error: 'Cannot determine method!!'. |
286 self error: 'Cannot determine method!!'. |
256 ] |
287 ] |
257 ]. |
288 ]. |
258 ]. |
289 ]. |
259 ] |
290 ] |
260 |
291 |
261 "Created: / 07-09-2013 / 01:43:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
292 "Created: / 07-09-2013 / 01:43:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
262 "Modified: / 09-09-2013 / 10:28:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
293 "Modified: / 10-09-2013 / 03:56:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
263 ! |
294 ! |
264 |
295 |
265 initializeSourceTree |
296 initializeSourceTree |
266 sourceTreeLock := Semaphore new. |
297 sourceTreeLock := Semaphore new. |
267 Job |
298 Job |