ECMA-357 botch where * or @b or (given valid namespace reference n) n::id
results in undefined, instead of a TypeError.
- Lazily bootstrap AnyName and AttributeName classes, instead of leaving the
former uninitialized, and initializing the latter only if QName is init'ed.
These classes, representing ECMA-357 internal types, must be initialized
in order to string conversion and default value on them to return useful
results. So this change also requires the shared qname_toString to cope
with these classes, which ape QName in having a JSXMLQName as private data.
- Revise Filtering Predicate Expressions bytecode schema to avoid bogo-script
creating in js_FilterXMLObject. With a new JSOP_ENDFILTER bytecode acting
in lieu of JSOP_POPV, but also exiting the nested js_Interpret() call, the
runtime can avoid trying to fake a JSScript for the subsequence of script
bytecode in parens in x.(e), that contains the bytecode for e plus the pop
or endfilter op.
This requires a historic reparameterization of js_Interpret to take the
starting pc! I cleaned up order of declaration, use, and useless init nits
for a few variables while messing with it.
- Based on the above change, fix the decompiler to handle filtered predicate
expressions -- that code was stubbed out till now, and I forgot to go back.
All better now, especially thanks to JSOP_ENDFILTER.
- Also while fixing filtered predicates, eliminate the useless TOK_RP parse
node above the parenthesized expression, to avoid a JSOP_GROUP bytecode.
- Fix js_GetAttributeNameObject so it doesn't take over its QName parameter's
object and rebind it to an object of class AttributeName -- instead, clone
the qn if necessary. This is important to cope with the errata, noticed a
while ago but finally recorded:
9.2.1.2 Step 2(e)(i, ii),
9.2.1.2 Step 7(e)(i),
9.2.1.3 Step 2(b)(ii)(1)(a)
All uses of a.[[Name]] for an attribute a in these sections that pass
that QName object to [[Delete]] must pass an AttributeName cloned from
a.[[Name]]. The [[Name]] internal property is always a QName instance
and never an AttributeName or AnyName instance. But [[Delete]] will
not operate on x.[[Attributes]] when given a QName by these sections,
so a child could be wrongly deleted instead of the attribute of the
same name.
This rework exposed a bug in the XML.prototype.name() impl, where it was
returning an AttributeName, not a QName, for attribute-class XML objects.
Clearly wrong -- the E4X spec makes plain early on that [[Name]] is always
a QName -- but the spec and e4x testsuite seemed to require it due to the
above-noted errata.
until JS_DestroyRuntime is called (68450, r=rginda, sr=jband).
- NUL-terminate tagbuf in tagify, for the HTML helpers such as string.big()
(66648, r=timeless, sr=jband).
- Optimize compile (parse+emit) operation to generate code for each top-level
statement or function in turn, recycling JSParseNodes as we go for greatly
reduced "long linear script" footprint.
- Fix O(n**2) growth problems in bytecode and srcnote generation.
- Add js_ParseTokenStream entry point to compiler, for tree-generation without
code-generation. Move JSOP_EVAL instruction selection from code-generator to
parser, to match other such specializations and enable js_ParseTokenStream.
- Fix js_CompileTokenStream (and get it right in new js_ParseTokenStream) to
respect JSOPTION_VAROBJFIX.
- Clean up bracing, multi-line conditions, and overlong lines.
- Add JS1.5 getter/setter support in all its glory:
* getter function SN() {return ++x} at top-level or as a closure binds an SN
property getter than returns the incremented value of x. Likewise for
setter function SN(y) {return y = x}.
* getters and setters may be defined in an object literal:
o = {p getter:function() {return ++this.x},
p setter:function(y){return this.x = y},
x:42};
* getter= and setter= operators (compound tokens) may be used to bind getter
and setter properties dynamically:
o = new Object;
o.p getter= function() {return ++this.x};
o.p setter= function(y){return this.x = y};
o.x = 42;
Waldemar is concerned that this form will collide semantically with JS2, so
I am not committing to keeping it in JS1.5. I'd like to check my code in
ASAP so shaver can use it, and I'd also like to see this form get used (or
not) during Mozilla betas. Caveat emptor, and if you find this "dynamic"
or "imperative" form necessary and hard to substitute, please let me know.
If this proves important to users, then I think JS1.5 should keep it.
- Cleaned up property flags (in a binary-incompatible fashion -- who cares?) by
eliminating JSPROP_ASSIGNHACK and JSPROP_TINYIDHACK.
- Added JS_DONT_PRETTY_PRINT flag to be ORed with the indent argument to the
several JS_Decompile*() API calls. This avoids any newlines or identation in
the decompiled string.
- Improved and extended (for getter/setter non-reservation) scanner lookahead
by using a circular (power-of-2 sized) token buffer.
- Fix ECMA Edition 3 deviation where function f(){function g(){}} bound f.g by
mistake (it should arrange to make a closure named g in activations of f, but
it should not bind a property of function f).
+ merging of js/src and js/ref
+ elimination of most dependencies on NSPR
+ JS1.4 feature additions and accumulated bug fixes
More details are in last week's mozilla status report.