Parser.st
changeset 4049 3fcfb25c58f5
parent 4036 287d2a808484
child 4052 5a61cae38e30
--- a/Parser.st	Mon Nov 21 11:59:18 2016 +0100
+++ b/Parser.st	Tue Nov 22 00:24:30 2016 +0100
@@ -5112,7 +5112,7 @@
     ].
 
     self source:s.
-    selector := #doIt.  "/ so isDoit returns the correct answer!!
+    selector := self doItSelector.  "/ so isDoit returns the correct answer!!
 
     self parseForCode.
     self foldConstants:nil.
@@ -5247,7 +5247,7 @@
                 "/ actually, its a block, to allow
                 "/ easy return ...
 
-                sReal := 'doIt ^[ ' , s , '\] value' withCRs.
+                sReal := (self doItSelector),' ^[ ' , s , '\] value' withCRs.
 
                 compiler := ByteCodeCompiler new.
                 compiler initializeFlagsFrom:self.
@@ -5275,8 +5275,8 @@
 
                         value := method
                                     valueWithReceiver:anObject
-                                    arguments:nil  "/ (Array with:m)
-                                    selector:(requestor isNil ifTrue:[#'doItX'] ifFalse:[#'doIt']) "/ #doIt:
+                                    arguments:nil 
+                                    selector:(self doItSelector) "/ #__doIt__
                                     search:nil
                                     sender:nil.
                     ] ifFalse:[
@@ -5293,7 +5293,7 @@
 
     "Created: / 08-02-1997 / 19:34:44 / cg"
     "Modified: / 18-03-1999 / 18:25:40 / stefan"
-    "Modified: / 06-07-2011 / 11:46:24 / cg"
+    "Modified: / 22-11-2016 / 00:08:52 / cg"
 !
 
 evaluate:aStringOrStream logged:logged
@@ -8789,6 +8789,25 @@
         ^ v
     ].
 
+    "/ hack: if we are in a doIt of a debugger's context,
+    "/ AND the variable is an inlined block variable,
+    "/ it will not be found in the context.
+"/    self isDoIt ifTrue:[
+"/        contextToEvaluateIn notNil ifTrue:[
+"/            |mthd source parseTree|
+"/
+"/            "/ we need a parse tree to find the temporary var's slot
+"/            mthd := contextToEvaluateIn method.
+"/            (source := mthd source) notNil ifTrue:[
+"/self halt.
+"/                parseTree := Parser parseMethod:source.
+"/                (parseTree notNil and:[parseTree ~~ #Error]) ifTrue:[
+"/self halt.
+"/                ].
+"/            ].
+"/        ].
+"/    ].
+
     pos1 := tokenPosition.
     pos2 := pos1+tokenName size-1.
     self markUnknownIdentifierFrom:pos1 to:pos2.
@@ -8830,7 +8849,7 @@
         startPosition: pos1 endPosition: (pos1 + tokenName size - 1)
 
     "Modified: / 25-08-2011 / 11:57:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 04-09-2011 / 07:34:57 / cg"
+    "Modified: / 22-11-2016 / 00:23:44 / cg"
 !
 
 variableOrError
@@ -10521,6 +10540,16 @@
     ^ didWarnAboutSqueakExtensions ? false
 !
 
+doItSelector
+    "the name of the method used for doit's.
+     The method will not be installed, but called directly,
+     so the name is more or less arbitrary."
+
+    ^ #'doIt'
+
+    "Created: / 21-11-2016 / 23:58:43 / cg"
+!
+
 hasNonOptionalPrimitiveCode
     "return true if there was any ST/X style primitive code (valid after parsing)"
 
@@ -10540,7 +10569,9 @@
 !
 
 isDoIt
-    ^ (false "selector isNil" or:[selector == #'doIt' or:[selector == #'doIt:']])
+    ^ selector == self doItSelector
+
+    "Modified: / 22-11-2016 / 00:00:10 / cg"
 !
 
 isEmptyMethod