ObjectMemory.st
changeset 532 2511c99de912
parent 530 07d0bce293c9
child 615 e9d0e782206d
--- a/ObjectMemory.st	Sat Nov 11 16:30:26 1995 +0100
+++ b/ObjectMemory.st	Mon Nov 13 10:08:17 1995 +0100
@@ -50,7 +50,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.76 1995-11-11 15:24:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.77 1995-11-13 09:08:12 stefan Exp $'
 !
 
 documentation
@@ -797,6 +797,34 @@
     __flushMethodCache();
     __flushAllInlineCaches();
 %}
+!
+
+trapRestrictedMethods:trap
+    "Allow/Deny execution of restricted Methods (see Method>>>restricted:)
+
+     Notice: method restriction is a nonstandard feature, not supported
+     by other smalltalk implementations and not specified in the ANSI spec.
+     This is EXPERIMENTAL - and being evaluated for usability.
+     It may change or even vanish (if it shows to be not useful)."
+
+    |oldTrap|
+
+%{ 
+	if (__setTrapRestrictedMethods(trap == true))
+	    oldTrap = true;
+	else
+	    oldTrap = false;
+%}.
+
+    (trap and:[oldTrap not]) ifTrue:[
+	self flushCaches
+    ].
+    ^ oldTrap
+
+    "
+	ObjectMemory trapRestrictedMethods:true
+	ObjectMemory trapRestrictedMethods:false
+    "
 ! !
 
 !ObjectMemory class methodsFor:'enumerating'!