SharedPool.st
branchjv
changeset 17862 8a8ae3107950
parent 17846 24edc476ac18
child 17865 598963c6ff8e
--- a/SharedPool.st	Thu Sep 15 12:05:35 2011 +0100
+++ b/SharedPool.st	Tue Sep 20 11:11:19 2011 +0100
@@ -45,6 +45,40 @@
 "
 ! !
 
+!SharedPool class methodsFor:'Compatibility-Squeak'!
+
+bindingOf: varName
+    "Answer the binding of some variable resolved in the scope of the receiver"
+
+    | aSymbol binding |
+
+    "/ self shouldImplement.       "not yet finished"
+    aSymbol := varName asSymbol.
+
+    "First look in classVar dictionary."
+    binding := self classPool bindingOf: aSymbol.
+    binding notNil ifTrue:[^binding].
+
+    "Next look in shared pools."
+    self sharedPools do:[:pool |
+        binding := pool bindingOf: aSymbol.
+        binding notNil ifTrue:[^binding].
+    ].
+
+    "subclassing and environment are not preserved"
+    ^nil
+
+    "Modified: / 12-09-2011 / 09:40:36 / cg"
+!
+
+bindingsDo: aBlock
+    self classVarNames do:[:eachKey |
+        aBlock value:(eachKey -> (self classVarAt:eachKey))
+    ].
+
+    "Modified: / 12-09-2011 / 09:42:00 / cg"
+! !
+
 !SharedPool class methodsFor:'Compatibility-V''Age'!
 
 declareConstant:constantName value:value
@@ -86,7 +120,6 @@
     "Modified: / 15-01-2011 / 14:20:58 / cg"
 ! !
 
-
 !SharedPool class methodsFor:'misc ui support'!
 
 iconInBrowserSymbol
@@ -113,33 +146,12 @@
     ^ self classVarAt:name
 !
 
-bindingOf: varName
-    "Answer the binding of some variable resolved in the scope of the receiver"
-
-    | aSymbol binding |
-
-    self shouldImplement.       "not yet finished"
-    aSymbol := varName asSymbol.
-
-    "First look in classVar dictionary."
-    binding := self classPool bindingOf: aSymbol.
-    binding notNil ifTrue:[^binding].
+at:name put:aValue
+    "set a pool variable by name"
 
-    "Next look in shared pools."
-    self sharedPools do:[:pool |
-        binding := pool bindingOf: aSymbol.
-        binding notNil ifTrue:[^binding].
-    ].
+    ^ self classVarAt:name put:aValue
 
-    "subclassing and environment are not preserved"
-    ^nil
-
-    "Modified: / 08-08-2010 / 14:46:09 / cg"
-!
-
-bindingsDo: aBlock
-self halt:'unfinished implementation'.
-    ^ self classPool bindingsDo: aBlock
+    "Created: / 08-09-2011 / 05:48:16 / cg"
 !
 
 classBindingOf: varName
@@ -157,6 +169,15 @@
     "
 !
 
+keyAtValue:value ifAbsent:exceptionValue
+    self keysDo:[:k |
+        (self at:k) == value ifTrue:[ ^ k ].
+    ].
+    ^ exceptionValue value
+
+    "Created: / 08-09-2011 / 05:51:10 / cg"
+!
+
 keys
     ^ self classVarNames
 
@@ -190,9 +211,10 @@
 !SharedPool class methodsFor:'documentation'!
 
 version
-    ^ '$Id: SharedPool.st 10660 2011-07-18 15:22:09Z vranyj1 $'
+    ^ '$Id: SharedPool.st 10690 2011-09-20 10:11:19Z vranyj1 $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libbasic/SharedPool.st,v 1.15 2011/01/15 13:21:03 cg Exp §'
+    ^ 'Header: /cvs/stx/stx/libbasic/SharedPool.st,v 1.18 2011/09/12 08:22:19 cg Exp '
 ! !
+