Parser.st
changeset 3724 e432b166a2ab
parent 3704 b1412a04e935
child 3727 5ce5e4d7a752
child 3739 fe0b0d99714b
--- a/Parser.st	Fri Mar 11 01:02:50 2016 +0100
+++ b/Parser.st	Sun Mar 20 15:14:06 2016 +0100
@@ -8633,23 +8633,6 @@
      tokenSymbol space classVarIndex holder node
      checkSharedPoolAction|
 
-    checkSharedPoolAction :=
-        [:eachPoolName |
-            |sharedPool|
-
-            sharedPool := Smalltalk classNamed:eachPoolName.
-            sharedPool isNil ifTrue:[
-                Transcript showCR:'Parser: No such pool: ' , eachPoolName.
-                "/ self warning:('No such pool: ' , eachPoolName).
-            ] ifFalse:[
-                (sharedPool includesKey:varName) ifTrue:[
-                    parseForCode ifFalse:[self rememberGlobalUsed:(sharedPool name , ':' , varName)].
-                    ^ (VariableNode type:#PoolVariable class:sharedPool name:varName)
-                        startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
-                ].
-            ].
-        ].
-
     "is it a block-arg or block-var ?"
     searchBlock := currentBlock.
     [searchBlock notNil] whileTrue:[
@@ -8720,6 +8703,23 @@
         ].
     ].
 
+    checkSharedPoolAction :=
+        [:eachPoolName |
+            |sharedPool|
+
+            sharedPool := Smalltalk classNamed:eachPoolName.
+            sharedPool isNil ifTrue:[
+                Transcript showCR:'Parser: No such pool: ' , eachPoolName.
+                "/ self warning:('No such pool: ' , eachPoolName).
+            ] ifFalse:[
+                (sharedPool includesKey:varName) ifTrue:[
+                    parseForCode ifFalse:[self rememberGlobalUsed:(sharedPool name , ':' , varName)].
+                    ^ (VariableNode type:#PoolVariable class:sharedPool name:varName)
+                        startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
+                ].
+            ].
+        ].
+
     classToCompileFor notNil ifTrue:[
         "is it an instance-variable ?"
 
@@ -8833,6 +8833,11 @@
         moreSharedPools notNil ifTrue:[
             moreSharedPools do:checkSharedPoolAction.
         ].
+        "is it a thread local variable ?"
+        (Processor activeProcess environmentIncludesKey:varName asSymbol) ifTrue:[
+            ^ (VariableNode type:#ThreadLocal name:varName)
+                startPosition: tokenPosition endPosition: tokenPosition + varName size -1
+        ].    
     ].
 
     "is it in a namespace ?"
@@ -8860,38 +8865,39 @@
         ]
     ].
 
-    "is it a workspace variable ?"
-    (requestor notNil and:[requestor isStream not]) ifTrue:[
-        "/ when parsing doits, this is done twice;
-        "/ first, for the parse, then as a block-code
-        "/ for the code.
-        "/ We only care for WorkspaceVars in doIts
-        (self isDoIt) ifTrue:[
-            (Workspace notNil
-            and:[(holder := Workspace workspaceVariableHolderAt:varName) notNil])
-            ifTrue:[
-                ^ (VariableNode type:#WorkspaceVariable holder:holder name:varName)
-                    startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
+    (self isDoIt) ifTrue:[
+        "is it a workspace variable ?"
+        (requestor notNil and:[requestor isStream not]) ifTrue:[
+            "/ when parsing doits, this is done twice;
+            "/ first, for the parse, then as a block-code
+            "/ for the code.
+            "/ We only care for WorkspaceVars in doIts
+            (self isDoIt) ifTrue:[
+                (Workspace notNil
+                and:[(holder := Workspace workspaceVariableHolderAt:varName) notNil])
+                ifTrue:[
+                    ^ (VariableNode type:#WorkspaceVariable holder:holder name:varName)
+                        startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
+                ]
             ]
-        ]
-    ].
-    "is it a doIt variable ?"
-
-"/    (requestor notNil and:[requestor isStream not]) ifTrue:[
-        "/ when parsing doits, this is done twice;
-        "/ first, for the parse, then as a block-code
-        "/ for the code.
-        "/ We only care for WorkspaceVars in doIts
-
-        (self isDoIt) ifTrue:[
+        ].
+        "is it a doIt variable ?"
+
+        "/ (requestor notNil and:[requestor isStream not]) ifTrue:[
+            "/ when parsing doits, this is done twice;
+            "/ first, for the parse, then as a block-code
+            "/ for the code.
+            "/ We only care for WorkspaceVars in doIts
+
             (doItTemporaries notNil
             and:[(holder := doItTemporaries at:varName asSymbol ifAbsent:nil) notNil])
             ifTrue:[
                 ^ (VariableNode type:#DoItTemporary holder:holder name:varName)
                     startPosition: tokenPosition endPosition: tokenPosition + varName size - 1
-            ]
-        ].
-"/    ].
+            ].
+        "/ ].
+    ].
+    
     "/ do not raise parseError here, but instead report it a the old stupid #Error token.
     "/ this is required here so that the caller can check for an assignment,
     "/ and autodefine workspace- and doIt variables.