reports/Builder__LintReport.st
changeset 162 1dbab63ebbd5
parent 141 9265bed28ff5
child 203 297a4be47446
--- a/reports/Builder__LintReport.st	Tue Jun 25 20:25:22 2013 +0200
+++ b/reports/Builder__LintReport.st	Tue Jun 25 20:25:30 2013 +0200
@@ -9,20 +9,6 @@
 	category:'Builder-Reports'
 !
 
-Object subclass:#SourceInfo
-	instanceVariableNames:'klass filename offsets lineEnds'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:LintReport
-!
-
-Stream subclass:#LineCountingStream
-	instanceVariableNames:'position lineEnds'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:LintReport::SourceInfo
-!
-
 
 !LintReport methodsFor:'accessing - defaults'!
 
@@ -70,7 +56,7 @@
 
 generateClass: aClass
         | sourceInfo sourceName |
-        sourceInfo := SourceInfo for: aClass.
+        sourceInfo := ReportSourceInfo for: aClass.
         sourceName := self encodeFilename: (self sourceFilenameFor: aClass).
 
         format writeFile: sourceName with: [
@@ -256,202 +242,6 @@
 	^ #(SelectorEnvironment ParseTreeEnvironment VariableEnvironment) includes: anEnvironment class name
 ! !
 
-!LintReport::SourceInfo class methodsFor:'instance creation'!
-
-for: aClass
-    ^self new setClass: aClass
-
-    "Created: / 01-03-2013 / 17:50:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!LintReport::SourceInfo methodsFor:'initialization'!
-
-setClass: aClass
-    klass := aClass theNonMetaclass.
-    self setup.
-
-    "Created: / 01-03-2013 / 17:49:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-setup
-    "To be called after class is set"
-
-    | stream |
-
-    stream := LineCountingStream new.
-    offsets := Dictionary new.
-
-    [
-        self fileOutOn: stream.
-    ] on: AbstractSourceFileWriter methodSourceRewriteQuery do:[:rewriteQuery |
-        | m |
-
-        m := rewriteQuery method.
-        offsets at: m put: stream position + 1.
-        rewriteQuery proceed.
-    ].
-    lineEnds := stream lineEnds
-
-    "
-        SourceInfo for: Builder::ReportRunner
-    "
-
-    "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'!
-
-fileOutOn:aStream
-    klass fileOutOn: aStream withTimeStamp:false
-
-    "Created: / 01-03-2013 / 17:51:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!LintReport::SourceInfo::LineCountingStream class methodsFor:'instance creation'!
-
-new
-    "return an initialized instance"
-
-    ^ self basicNew initialize.
-! !
-
-!LintReport::SourceInfo::LineCountingStream methodsFor:'accessing'!
-
-contents
-    "return the entire contents of the stream.
-     For a readStream, that is the rest (i.e. upToEnd),
-     for a writeStream, that is the collected data. As we do not know here,
-     what we are, this is the responsibility of a subclass..."
-
-    ^ self shouldNotImplement
-
-    "Modified: / 01-03-2013 / 17:36:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-lineEnds
-    ^ lineEnds
-!
-
-position
-    ^ position
-! !
-
-!LintReport::SourceInfo::LineCountingStream methodsFor:'initialization'!
-
-initialize
-    "Invoked when a new instance is created."
-
-    "/ please change as required (and remove this comment)
-    position := 0.
-    lineEnds := OrderedCollection new.
-
-    "/ super initialize.   -- commented since inherited method does nothing
-
-    "Modified: / 01-03-2013 / 17:39:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!LintReport::SourceInfo::LineCountingStream methodsFor:'queries'!
-
-isReadable
-    "return true, if reading is supported by the recevier.
-     This has to be redefined in concrete subclasses."
-
-    ^ false
-
-    "Modified: / 01-03-2013 / 17:36:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-isWritable
-    "return true, if writing is supported by the recevier.
-     This has to be redefined in concrete subclasses."
-
-    ^ true
-
-    "Modified: / 01-03-2013 / 17:37:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-size
-    "return the number of elements in the streamed collection."
-
-    ^ self shouldImplement
-! !
-
-!LintReport::SourceInfo::LineCountingStream methodsFor:'reading'!
-
-next
-    "return the next element of the stream
-     - we do not know here how to do it, it must be redefined in subclass"
-
-    ^ self shouldNotImplement
-
-    "Modified: / 01-03-2013 / 17:37:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!LintReport::SourceInfo::LineCountingStream methodsFor:'testing'!
-
-atEnd
-    "return true if the end of the stream has been reached;
-     - we do not know here how to do it, it must be redefined in subclass"
-
-    ^ false
-
-    "Modified: / 01-03-2013 / 17:37:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-isEmpty
-    "return true, if the contents of the stream is empty"
-
-    ^ self shouldNotImplement
-
-    "Modified: / 01-03-2013 / 17:37:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!LintReport::SourceInfo::LineCountingStream methodsFor:'writing'!
-
-nextPut:aCharacter
-    "put the argument, anObject onto the receiver
-     - we do not know here how to do it, it must be redefined in subclass"
-
-     position := position + 1.
-    aCharacter == Character cr ifTrue:[
-        lineEnds add: position
-    ].
-
-    "Modified: / 01-03-2013 / 17:39:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
 !LintReport class methodsFor:'documentation'!
 
 version
@@ -463,6 +253,6 @@
 !
 
 version_SVN
-    ^ '§Id: Builder__LintReport.st 293 2011-11-25 21:42:31Z vranyj1 §'
+    ^ '$Id$'
 ! !