From 839318a1d25ee541869fdcfd67a94f3ab994b455 Mon Sep 17 00:00:00 2001 From: brian Date: Fri, 30 Jan 2004 07:03:31 +0000 Subject: [PATCH] 2003/07/07 01:51:17 darcs-hash:20040130070331-aa32f-aa3be080d3962fe464119e8da96c25fab6cc61e5.gz --- src/org/xwt/js/ScopeImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/org/xwt/js/ScopeImpl.java b/src/org/xwt/js/ScopeImpl.java index 9185868..f64c952 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_PLACEHOLDER = new Object(); + private static final 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!"); @@ -18,12 +18,13 @@ class ScopeImpl extends JS.Obj { public boolean has(Object key) { return super.get(key) != null; } // 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_PLACEHOLDER ? null : ret; + Object o = super.get(key); + if (o != null) return o == NULL_PLACEHOLDER ? null : o; + else return parentScope == null ? null : parentScope.get(key); } // 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); + if (parentScope != null && !has(key)) parentScope.put(key, val); else super.put(key, val == null ? NULL_PLACEHOLDER : val); } public boolean isTransparent() { return false; } -- 1.7.10.4