projects
/
org.ibex.core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2003/10/07 20:37:25
[org.ibex.core.git]
/
src
/
org
/
xwt
/
js
/
ScopeImpl.java
diff --git
a/src/org/xwt/js/ScopeImpl.java
b/src/org/xwt/js/ScopeImpl.java
index
bf5acc9
..
a01b3bb
100644
(file)
--- 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;
/** Implementation of a JavaScript Scope */
class ScopeImpl extends JS.Obj {
private JS.Scope parentScope;
- private static Object NULL = 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!");
public ScopeImpl(JS.Scope parentScope, boolean sealed) {
super(sealed);
if (parentScope == this) throw new Error("can't make a scope its own parent!");
@@
-18,17
+18,17
@@
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) {
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 ? 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) {
}
// 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);
+ if (parentScope != null && !has(key)) parentScope.put(key, val);
+ else super.put(key, val == null ? NULL_PLACEHOLDER : val);
}
public boolean isTransparent() { return false; }
}
public boolean isTransparent() { return false; }
- public void declare(String s) {
- if (isTransparent()) parentScope.declare(s);
- else super.put(s, NULL);
- }
-}
+ public void declare(String s) { super.put(s, NULL_PLACEHOLDER); }
+ public Scope getParentScope() { return parentScope; }
+}
+