Parser.st
changeset 4052 5a61cae38e30
parent 4049 3fcfb25c58f5
child 4053 60b82c3d5ad1
--- a/Parser.st	Wed Nov 23 15:34:35 2016 +0100
+++ b/Parser.st	Wed Nov 23 15:48:02 2016 +0100
@@ -37,7 +37,7 @@
 		interactiveMode variableCorrectActionForAll annotations
 		variableTypeOfLastCorrectAction usedPoolVars readPoolVars
 		modifiedPoolVars warnings didWarnAboutSTXExtensions
-		annotationStartPosition annotationEndPosition'
+		annotationStartPosition annotationEndPosition autoDefineVariables'
 	classVariableNames:'PrevClass PrevInstVarNames PrevClassVarNames
 		PrevClassInstVarNames LazyCompilation FoldConstants
 		LineNumberInfo SuppressDoItCompilation ParseErrorSignal
@@ -7880,20 +7880,27 @@
 
     varName := tokenName.
 
-    (self isDoIt
-    and:[ currentBlock isNil
-    and:[ requestor notNil
-    and:[ (autoHow := requestor perform:#autoDefineVariables ifNotUnderstood:nil) notNil]]]) ifTrue:[
+    autoDefineVariables isNil ifTrue:[
+        (requestor notNil
+          and:[ (autoDefineVariables := requestor perform:#autoDefineVariables ifNotUnderstood:nil) notNil]
+        ) ifFalse:[
+            autoDefineVariables := false
+        ].
+    ].    
+    (currentBlock isNil and:[ autoDefineVariables ~~ false ]) ifTrue:[
         var := self variableOrError:varName.
         self nextToken.
+        
         (var == #Error) ifTrue:[
             ((tokenType == $_) or:[tokenType == #':=']) ifTrue:[
-                autoHow == #workspace ifTrue:[
+                autoHow == #doIt ifTrue:[
+                    "/ as doIt var (only within this expression)   
+                    holder := self addDoItTemporary:varName.
+                    var := VariableNode type:#DoItTemporary holder:holder name:varName.
+                ] ifFalse:[
+                    "/ as workspace var (only within doIts)    
                     holder := Workspace addWorkspaceVariable:varName.
                     var := VariableNode type:#WorkspaceVariable holder:holder name:varName.
-                ] ifFalse:[
-                    holder := self addDoItTemporary:varName.
-                    var := VariableNode type:#DoItTemporary holder:holder name:varName.
                 ].
             ] ifFalse:[
                 var := self correctVariable:varName atPosition:pos1 to:pos2.