X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fjs%2FScopeImpl.java;h=9185868585ae38821de580adf103405498600797;hb=650cc315549ff0d546472f8fc3b9426119e8d9fa;hp=bf5acc9f11d365bce7ee167f2f252efa7cfb6a73;hpb=10d0296318104e8b9ac8afbea71ef118aa77387c;p=org.ibex.core.git diff --git a/src/org/xwt/js/ScopeImpl.java b/src/org/xwt/js/ScopeImpl.java index bf5acc9..9185868 100644 --- a/src/org/xwt/js/ScopeImpl.java +++ b/src/org/xwt/js/ScopeImpl.java @@ -8,7 +8,7 @@ import java.util.*; /** Implementation of a JavaScript Scope */ class ScopeImpl extends JS.Obj { private JS.Scope parentScope; - private static Object NULL = new Object(); + private static Object NULL_PLACEHOLDER = new Object(); public ScopeImpl(JS.Scope parentScope, boolean sealed) { super(sealed); if (parentScope == this) throw new Error("can't make a scope its own parent!"); @@ -19,16 +19,17 @@ class ScopeImpl extends JS.Obj { // we use _get instead of get solely to work around a GCJ bug public Object _get(Object key) { if (!has(key)) return parentScope == null ? null : parentScope.get(key); - Object ret = super.get(key); return ret == NULL ? null : ret; + Object ret = super.get(key); return ret == NULL_PLACEHOLDER ? null : ret; } // we use _put instead of put solely to work around a GCJ bug public void _put(Object key, Object val) { if (!has(key) && parentScope != null) parentScope.put(key, val); - else super.put(key, val == null ? NULL : val); + else super.put(key, val == null ? NULL_PLACEHOLDER : val); } public boolean isTransparent() { return false; } public void declare(String s) { if (isTransparent()) parentScope.declare(s); - else super.put(s, NULL); + else super.put(s, NULL_PLACEHOLDER); } + public Scope getParentScope() { return parentScope; } }