Add exec-time ecmaStrictMode flag and use it to allow 'for (i in null)' and the like.

git-svn-id: svn://10.0.0.236/trunk@194450 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
brendan%mozilla.org
2006-04-15 05:02:08 +00:00
parent d7cd1bb343
commit f23330b0fd

View File

@@ -173,6 +173,7 @@ XCp.scope = {object: global, parent: null};
XCp.thisObject = global;
XCp.result = undefined;
XCp.target = null;
XCp.ecmaStrictMode = false;
function Reference(base, propertyName, node) {
this.base = base;
@@ -353,8 +354,8 @@ function execute(n, x) {
s = execute(n.object, x);
v = getValue(s);
// ECMA erratum: allow for (i in null)
t = (v === null) ? v : toObject(v, s, n.object);
// ECMA deviation to track extant browser JS implementation behavior.
t = (v == null && !x.ecmaStrictMode) ? v : toObject(v, s, n.object);
a = [];
for (i in t)
a.push(i);