DoWhatIMeanSupport.st
changeset 5980 0ae8756ef72f
parent 5973 0608413dbe36
child 6013 36f85fdcc2eb
--- a/DoWhatIMeanSupport.st	Mon Dec 24 14:11:18 2018 +0100
+++ b/DoWhatIMeanSupport.st	Thu Dec 27 12:28:09 2018 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2002 by eXept Software AG
 	      All Rights Reserved
@@ -16,7 +18,7 @@
 Object subclass:#DoWhatIMeanSupport
 	instanceVariableNames:'tree tokens languageOrNil classOrNil methodOrNil contextOrNil
 		instanceOrNil codeView rememberedScopeNodes rememberedNodes
-		codeAspect partialString partialStringInterval'
+		codeAspect partialString partialStringInterval classResolverHook'
 	classVariableNames:'LastSource LastParseTree LastScanTokens LastChoices
 		LastCompletedSelectors Verbose'
 	poolDictionaries:''
@@ -2527,7 +2529,7 @@
 "/
 "/    info := best storeString.
 "/    implClass notNil ifTrue:[
-"/        info := implClass name , ' » ' , info.
+"/        info := implClass name , ' » ' , info.
 "/    ].
 "/    self information:info.
 "/].
@@ -5258,7 +5260,7 @@
 "/
 "/    info := best storeString.
 "/    implClass notNil ifTrue:[
-"/        info := implClass name , ' » ' , info.
+"/        info := implClass name , ' » ' , info.
 "/    ].
 "/    self information:info.
 
@@ -5829,6 +5831,10 @@
 addClassesOfExpression:expr inClass:classOrNil to:setOfPossibleClasses
     |cls exprVal varName constraints|
 
+    classResolverHook notNil ifTrue:[
+        setOfPossibleClasses addAll:((classResolverHook value:expr) ? #())
+    ].
+
     (expr isVariable "and:[expr name = 'secondsOrNil']") ifTrue:[
         "/ see if contained inside an isXXX ifTrue;
         "/ then, we know a lot more...
@@ -5898,7 +5904,7 @@
 
     "Modified: / 24-02-2017 / 14:41:00 / stefan"
     "Modified: / 15-09-2017 / 10:52:40 / cg"
-    "Modified: / 13-06-2018 / 10:20:48 / Claus Gittinger"
+    "Modified: / 27-12-2018 / 12:16:28 / Claus Gittinger"
 !
 
 addClassesOfInstVarNamed:varName inClass:aClass to:setOfTypes
@@ -6607,6 +6613,30 @@
     "Modified: / 26-08-2016 / 14:16:16 / cg"
 ! !
 
+!DoWhatIMeanSupport methodsFor:'setup'!
+
+classResolverHook:aBlock
+    "additional hook to allow for special class resolving.
+     If non-nil, this hook is called for expression nodes,
+     and may return a class or nil.
+     Used eg. with expecco to resolve pin types"
+
+    classResolverHook := aBlock
+
+    "
+     self new classResolverHook:[:expr |
+         (expr isVariable and:[expr name = 'foo']) ifTrue:[
+             { String }
+         ] ifFalse:[
+             nil
+         ]
+     ].
+     
+    "
+
+    "Created: / 27-12-2018 / 12:11:31 / Claus Gittinger"
+! !
+
 !DoWhatIMeanSupport::InputCompletionResult class methodsFor:'instance creation'!
 
 bestName:bestNameArg matchingNames:matchingNamesArg