diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-04-04 14:03:39 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-04-04 14:03:39 -0400 |
commit | dfe722a61e5c81cdfa6ed844933a14783cd9bd9c (patch) | |
tree | f845ffce49085952ab6313d30ed7d977dc2ab8d6 /lib/js | |
parent | abb3bffd224cb7bdbbbc1461643a8e58fb03ed8f (diff) |
_Really_ implement embedded closure GC; extend Scriptcheck to figure out when client IDs must be assigned
Diffstat (limited to 'lib/js')
-rw-r--r-- | lib/js/urweb.js | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index fe996833..de956d3f 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -22,11 +22,19 @@ function union(ls1, ls2) { // Embedding closures in XML strings +function cs(f) { + return {closure: f}; +} + +function isWeird(v) { + return v.closure != null || v.cat1 != null; +} + function cat(s1, s2) { - if (s1.length && s2.length) - return s1 + s2; + if (isWeird(s1) || isWeird(s2)) + return {cat1: s1, cat2: s2}; else - return {_1: s1, _2: s2}; + return s1 + s2; } var closures = []; @@ -42,12 +50,12 @@ function cr(n) { } function flatten(tr) { - if (tr.length) - return tr; - else if (tr._1) - return cs(tr._1) + cs(tr._2); + if (tr.cat1 != null) + return flatten(tr.cat1) + flatten(tr.cat2); + else if (tr.closure != null) + return "cr(" + newClosure(tr.closure) + ")"; else - return "cr(" + newClosure(tr) + ")"; + return tr; } function clearClosures() { @@ -157,7 +165,7 @@ function dyn(s) { ls.data.dyns = remove(span, ls.data.dyns); } - x.innerHTML = v; + x.innerHTML = flatten(v); runScripts(x); if (--dynDepth == 0) @@ -412,3 +420,7 @@ function rv(chn, parse, k) { k(parse(msg))(null); } } + + +// App-specific code + |