--- a/DoWhatIMeanSupport.st Mon Sep 21 22:43:38 2009 +0200
+++ b/DoWhatIMeanSupport.st Tue Sep 22 13:28:28 2009 +0200
@@ -838,7 +838,7 @@
!
findNodeForInterval:interval in:source allowErrors:allowErrors
- |tree "errCount"|
+ |tree "errCount" firstIntersectingNode|
interval isEmpty ifTrue: [^ nil].
RBParser isNil ifTrue: [^ nil].
@@ -852,6 +852,7 @@
|nodes|
allowErrors ifTrue:[
+ firstIntersectingNode notNil ifTrue:[^ firstIntersectingNode].
nodes := nodesSoFar asOrderedCollection
collect:[:nd | nd whichNodeIntersects:interval]
thenSelect:[:nd | nd notNil ].
@@ -861,14 +862,26 @@
].
^ nil]
rememberNodes:true
- nodeGenerationCallback:[:node |
- (node intersectsInterval:interval) ifTrue:[^ node].
+ nodeGenerationCallback:[:node |
+ "/ we would like to return here as soon as the node has been created by the parser;
+ "/ however, at that time, its parent(chain) is not yet created and so we might not know
+ "/ what the semantic intepretation (especially: scope of variable) will be.
+ "/ therefore, we parse all, and return the found node at the end.
+ "//// ^ node.
+ firstIntersectingNode isNil ifTrue:[
+ (node intersectsInterval:interval) ifTrue:[
+ firstIntersectingNode := node
+ ].
+ ].
].
"/ onError: [:str :err | errCount := (errCount?0) + 1. self halt.]
"/ proceedAfterError:true.
- tree isNil ifTrue:[^ nil].
- LastSource := source.
- LastParseTree := tree.
+
+ tree notNil ifTrue:[
+ LastSource := source.
+ LastParseTree := tree.
+ ].
+ ^ firstIntersectingNode
].
^ self findNodeForInterval:interval inParseTree:tree.
@@ -1344,27 +1357,23 @@
matches := IdentitySet new.
"/ search for exact match
- anEnvironment allClassesDo:[:aClass |
- aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod |
- |protocol|
+ anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
+ |protocol|
- protocol := aMethod category.
- (protocol notNil and:[protocol startsWith:aPartialProtocolName]) ifTrue:[
- matches add:protocol
- ]
+ protocol := eachMethod category.
+ (protocol notNil and:[protocol startsWith:aPartialProtocolName]) ifTrue:[
+ matches add:protocol
].
].
matches isEmpty ifTrue:[
"/ search for case-ignoring match
lcName := aPartialProtocolName asLowercase.
- anEnvironment allClassesDo:[:aClass |
- aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod |
- |protocol|
+ anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
+ |protocol|
- protocol := aMethod category.
- (protocol asLowercase startsWith:lcName) ifTrue:[
- matches add:protocol
- ]
+ protocol := eachMethod category.
+ (protocol asLowercase startsWith:lcName) ifTrue:[
+ matches add:protocol
].
].
].
@@ -1472,21 +1481,17 @@
matches := IdentitySet new.
"/ search for exact match
- anEnvironment allClassesDo:[:aClass |
- aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod |
- (aSelector startsWith:aPartialSymbolName) ifTrue:[
- matches add:aSelector
- ]
+ anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
+ (eachSelector startsWith:aPartialSymbolName) ifTrue:[
+ matches add:eachSelector
].
].
matches isEmpty ifTrue:[
"/ search for case-ignoring match
lcSym := aPartialSymbolName asLowercase.
- anEnvironment allClassesDo:[:aClass |
- aClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod |
- (aSelector asLowercase startsWith:lcSym) ifTrue:[
- matches add:aSelector
- ]
+ anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
+ (eachSelector asLowercase startsWith:lcSym) ifTrue:[
+ matches add:eachSelector
].
].
].
@@ -1805,5 +1810,5 @@
!DoWhatIMeanSupport class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.58 2009-09-08 15:56:35 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.59 2009-09-22 11:28:28 cg Exp $'
! !