reports/Builder__LintReport.st
changeset 119 318a202597cc
parent 118 7e93ef8c5417
child 141 9265bed28ff5
equal deleted inserted replaced
118:7e93ef8c5417 119:318a202597cc
   304     "
   304     "
   305         SourceInfo for: Builder::ReportRunner
   305         SourceInfo for: Builder::ReportRunner
   306     "
   306     "
   307 
   307 
   308     "Created: / 01-03-2013 / 17:30:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   308     "Created: / 01-03-2013 / 17:30:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   309     "Modified: / 03-03-2013 / 11:09:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   310 ! !
       
   311 
       
   312 !LintReport::SourceInfo methodsFor:'queries'!
       
   313 
       
   314 lineAndColumnOfOffset: offset
       
   315     | low high middle element line col |
       
   316 
       
   317     low := 1.
       
   318     high := lineEnds size.
       
   319     [low > high] whileFalse:[
       
   320         middle := (low + high) // 2.
       
   321         element := lineEnds at:middle.
       
   322         element < offset ifTrue:[
       
   323             "middleelement is smaller than object"
       
   324             low := middle + 1
       
   325         ] ifFalse:[
       
   326             high := middle - 1
       
   327         ]
       
   328     ].
       
   329 
       
   330     line := low.
       
   331     col := offset - (line > 1 ifTrue:[lineEnds at: line - 1] ifFalse:[0]).
       
   332     ^line @ col.
       
   333 
       
   334     "Created: / 03-03-2013 / 10:50:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   335 !
       
   336 
       
   337 offsetOfMethod: aMethod
       
   338     ^offsets at: aMethod
       
   339 
       
   340     "Created: / 03-03-2013 / 10:49:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   309 ! !
   341 ! !
   310 
   342 
   311 !LintReport::SourceInfo methodsFor:'utilities'!
   343 !LintReport::SourceInfo methodsFor:'utilities'!
   312 
   344 
   313 fileOutOn:aStream
   345 fileOutOn:aStream