X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FStatic.java;h=4117892fdb2837edef594e31bc164c1099088299;hb=fea7f27cc252c8feaafb8a5c0d4b9f391f03975d;hp=59450a7fa144f06ab190f6bdeaaf8c5e1c43c58a;hpb=3cef8349390961b96c434ec063638d3c18057ea5;p=org.ibex.core.git diff --git a/src/org/xwt/Static.java b/src/org/xwt/Static.java index 59450a7..4117892 100644 --- a/src/org/xwt/Static.java +++ b/src/org/xwt/Static.java @@ -11,7 +11,10 @@ public class Static extends JSObject { Static ret = (Static)cache.get(resourcename); if (ret == null) { Template t = Template.getTemplate(resourcename, null); - if (t == null) return null; + + // FIXME: ugly + if (t == null) return new Static(resourcename, true); + ret = new Static(resourcename, false); t.link(); return ret; @@ -36,9 +39,7 @@ public class Static extends JSObject { } /** creates a new static representing a package */ - public Static(String resourcename) { - this(resourcename, true); - } + public Static(String resourcename) { this(resourcename, true); } public Object get(String name, Scriptable start) { if (name == null) return null; @@ -49,7 +50,12 @@ public class Static extends JSObject { if (name.equals("Function")) return JSObject.defaultObjects.get("Function", null); if (name.equals("TypeError")) return JSObject.defaultObjects.get("TypeError", null); - if ("xwt".equals(name)) return XWT.singleton; + if ("xwt".equals(name)) + for(Scriptable cur = Context.enter().currentFunction; cur != null; cur = cur.getParentScope()) + if (cur == this) return XWT.singleton; + + System.out.println("casc up " + (resourcename + (resourcename.length() == 0 ? "" : ".") + name)); + if (!ispackage) return super.get(name, start); return getStatic(resourcename + (resourcename.length() == 0 ? "" : ".") + name); }