Revision: 1917
          http://svn.sourceforge.net/vexi/?rev=1917&view=rev
Author:   mkpg2
Date:     2007-07-03 22:54:12 -0700 (Tue, 03 Jul 2007)

Log Message:
-----------
Fix. (partial) Clear cache when adding a read trap.

Modified Paths:
--------------
    core/trunk/org.vexi.core/src/org/vexi/core/Blessing.java

Modified: core/trunk/org.vexi.core/src/org/vexi/core/Blessing.java
===================================================================
--- core/trunk/org.vexi.core/src/org/vexi/core/Blessing.java    2007-07-04 
05:12:35 UTC (rev 1916)
+++ core/trunk/org.vexi.core/src/org/vexi/core/Blessing.java    2007-07-04 
05:54:12 UTC (rev 1917)
@@ -48,6 +48,17 @@
         return (js instanceof Blessing)? (Blessing)js:null;
     }
     
+    public void addTrap(JS key, JS f) throws JSExn {
+               // FIXME - this is not sufficient. However it will work for the 
common
+       // case where the trap always returns the same value (i.e. an override)
+       // Actually if the JS added is a function read trap then the correct
+       // behaviour would be to disable the cache for that value.
+               // 
+       // Adding a read trap -> Cache is dirty -> Remove item from cache.
+               if(f.getFormalArgs() != null && f.getFormalArgs().length == 0)
+               cache.remove(key);
+       super.addTrap(key, f);
+    }
     
     private InputStream getForExtensions(String[] exts) throws JSExn{
         try {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to