Tools_ClassChecker.st
changeset 9486 fb1fc792752e
parent 9485 9c45ce543fd9
child 12037 ca4d1532f6c1
--- a/Tools_ClassChecker.st	Tue May 18 15:15:54 2010 +0200
+++ b/Tools_ClassChecker.st	Tue May 18 15:19:24 2010 +0200
@@ -343,6 +343,25 @@
     "Modified: / 18.8.2000 / 23:10:56 / cg"
 !
 
+parseMethod:method in:aClass withParserDo:aBlock onErrorDo:errorBlock
+    |source parser|
+
+    source := method source.
+    parser := Parser
+                parseMethod:source
+                in:aClass
+                ignoreErrors:true
+                ignoreWarnings:true.
+
+    (parser notNil and:[parser ~~ #Error]) ifTrue:[
+        aBlock value:parser
+    ] ifFalse:[
+        errorBlock value
+    ].
+
+    "Created: / 18-05-2010 / 15:17:19 / cg"
+!
+
 sendsObsoleteMessages
     obsoleteWarners isNil ifTrue:[
         obsoleteWarners := Object selectors select:[:each | each startsWith:'obsoleteMethodWarning'].
@@ -530,18 +549,12 @@
 
     checkedClass theNonMetaclass withAllSubclassesDo:[:eachClassToCheck |
         eachClassToCheck instAndClassMethodsDo:[:method |
-            |source parser|
-
-            source := method source.
-            parser := Parser
-                        parseMethod:source
-                        in:eachClassToCheck
-                        ignoreErrors:true
-                        ignoreWarnings:true.
-
-            (parser notNil and:[parser ~~ #Error]) ifTrue:[
-                remainingVars removeAllFoundIn:(parser usedClassVars)
-            ].
+            self 
+                parseMethod:method in:method mclass 
+                withParserDo:[:parser |
+                    remainingVars removeAllFoundIn:(parser usedClassVars)
+                ]
+                onErrorDo:[]
         ].
     ].
 
@@ -559,18 +572,12 @@
 
     checkedClass theNonMetaclass withAllSubclassesDo:[:eachClassToCheck |
         eachClassToCheck methodDictionary keysAndValuesDo:[:mSelector :method |
-            |source parser|
-
-            source := method source.
-            parser := Parser
-                        parseMethod:source
-                        in:eachClassToCheck
-                        ignoreErrors:true
-                        ignoreWarnings:true.
-
-            (parser notNil and:[parser ~~ #Error]) ifTrue:[
-                remainingVars removeAllFoundIn:(parser usedInstVars)
-            ].
+            self 
+                parseMethod:method in:eachClassToCheck 
+                withParserDo:[:parser |
+                    remainingVars removeAllFoundIn:(parser usedInstVars)
+                ]
+                onErrorDo:[]
         ].
     ].
 
@@ -909,9 +916,9 @@
 !ClassChecker class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_ClassChecker.st,v 1.15 2010-05-18 13:15:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_ClassChecker.st,v 1.16 2010-05-18 13:19:24 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_ClassChecker.st,v 1.15 2010-05-18 13:15:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_ClassChecker.st,v 1.16 2010-05-18 13:19:24 cg Exp $'
 ! !