Parser.st
changeset 3767 f679eb82cb2b
parent 3757 7f9746a7b24c
child 3780 e288d4cb4cda
child 3790 7fcb69f3d0c5
--- a/Parser.st	Mon Apr 25 16:22:55 2016 +0200
+++ b/Parser.st	Tue Apr 26 11:39:18 2016 +0200
@@ -40,7 +40,8 @@
 		annotationStartPosition annotationEndPosition'
 	classVariableNames:'PrevClass PrevInstVarNames PrevClassVarNames
 		PrevClassInstVarNames LazyCompilation FoldConstants
-		LineNumberInfo SuppressDoItCompilation ParseErrorSignal'
+		LineNumberInfo SuppressDoItCompilation ParseErrorSignal
+		AlreadyWarnedUnimplementedSelectorsPerReceiverClass'
 	poolDictionaries:''
 	category:'System-Compiler'
 !
@@ -2581,7 +2582,7 @@
 
 checkForProperUseOfArticleInVariableName:aVariableName
     "heuristic - and wrong !!
-     The probelm is that a simple rule like anyVowel is not sufficient.
+     The problem is that a simple rule like anyVowel is not sufficient.
      I'd be happy to get some help on that."
 
     |soundsLikeVowel firstCharacterAfterArticle rest whatShouldItBeNamed msg|
@@ -2880,17 +2881,23 @@
                     ].
                 ].
                 allowed ifTrue:[
-                    "/ not from cg to stefan: thats wrong - if not implemented in all subclasses,
-                    "/ its a bug of the subclass not a bug here - that message send here
-                    "/ is perfectly correct. (it is very annoying for a framework developped to get
-                    "/ error messages for bugs which are not his...
+                    "/ note from cg to stefan: this is something that lint must report - not the compiler.
+                    "/ if not implemented in all subclasses, it's a bug of the subclass;
+                    "/ not a bug here - that message sent here is perfectly correct. 
+                    "/ (it is very annoying for a framework developper to get
+                    "/  error messages for bugs which are not his)
 "/                    (self checkIfAllSubclassesOf:cls implement:selector) ifFalse:[
 "/                        "if not all subclasses implement the selector - this is a possible bug"
 "/                        allowed := false
 "/                    ].
                 ].
                 allowed ifFalse:[
-                    err := 'is subclassResponsibility'
+                    mthd messagesSent size == 1 ifTrue:[
+                        err := 'is subclassResponsibility'
+                    ] ifFalse:[
+                        "/ the subclassResponsibility is probably conditional;
+                        "/ we need more advanced analysis, if it is sent at all.
+                    ].    
                 ].
             ] ifFalse:[mthd isObsolete ifTrue:[
                 err := 'is deprecated'.
@@ -3072,6 +3079,13 @@
     ^ alreadyWarnedUnimplementedSelectors
 !
 
+alreadyWarnedUnimplementedSelectorsPerReceiverClass
+    AlreadyWarnedUnimplementedSelectorsPerReceiverClass isNil ifTrue:[
+        AlreadyWarnedUnimplementedSelectorsPerReceiverClass := Dictionary new
+    ].
+    ^ AlreadyWarnedUnimplementedSelectorsPerReceiverClass
+!
+
 askForCorrection:aString fromList:aList
     "launch a selection box, which allows user to enter correction.
      return newString or nil (for abort)"
@@ -3201,11 +3215,19 @@
      or a ParseNode as returned by variable"
 
     |correctIt suggestedNames newSelector pos1 pos2 fixes
-     positionOfPeriod|
+     positionOfPeriod alreadyPerClass|
 
     (self alreadyWarnedUnimplementedSelectors includes:aSelectorString) ifTrue:[
         ^ aSelectorString
     ].
+    aClassOrNil notNil ifTrue:[
+        alreadyPerClass := self alreadyWarnedUnimplementedSelectorsPerReceiverClass at:aClassOrNil ifAbsent:nil.
+        alreadyPerClass notNil ifTrue:[
+            (alreadyPerClass includes:aSelectorString) ifTrue:[
+                ^ aSelectorString
+            ].
+        ].
+    ].
 
     pos1 := posVector first start.
     pos2 := posVector last stop.
@@ -4680,6 +4702,9 @@
     boldName := aName allBold.
 
     (requestor isNil or:[requestor isStream]) ifTrue:[
+        requestor := CompilationErrorHandlerQuery query.
+    ].    
+    (requestor isNil or:[requestor isStream]) ifTrue:[
         errMsg := 'Error: "%1" is undefined' bindWith:boldName.
         aName isUppercaseFirst ifFalse:[
             self showErrorMessage:errMsg position:pos1.