reports/Builder__LintReport.st
changeset 119 318a202597cc
parent 118 7e93ef8c5417
child 141 9265bed28ff5
--- a/reports/Builder__LintReport.st	Fri Mar 01 19:12:32 2013 +0100
+++ b/reports/Builder__LintReport.st	Sun Mar 03 12:50:54 2013 +0100
@@ -306,6 +306,38 @@
     "
 
     "Created: / 01-03-2013 / 17:30:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-03-2013 / 11:09:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!LintReport::SourceInfo methodsFor:'queries'!
+
+lineAndColumnOfOffset: offset
+    | low high middle element line col |
+
+    low := 1.
+    high := lineEnds size.
+    [low > high] whileFalse:[
+        middle := (low + high) // 2.
+        element := lineEnds at:middle.
+        element < offset ifTrue:[
+            "middleelement is smaller than object"
+            low := middle + 1
+        ] ifFalse:[
+            high := middle - 1
+        ]
+    ].
+
+    line := low.
+    col := offset - (line > 1 ifTrue:[lineEnds at: line - 1] ifFalse:[0]).
+    ^line @ col.
+
+    "Created: / 03-03-2013 / 10:50:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+offsetOfMethod: aMethod
+    ^offsets at: aMethod
+
+    "Created: / 03-03-2013 / 10:49:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !LintReport::SourceInfo methodsFor:'utilities'!