mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
s/compile/parse/ -- compile is overgeneral, especially in light of what's next.
This commit is contained in:
parent
c4044d863e
commit
df0ecadb4b
@ -68,7 +68,7 @@ var global = {
|
||||
x2.scope = x.scope;
|
||||
ExecutionContext.current = x2;
|
||||
try {
|
||||
execute(compile(s), x2);
|
||||
execute(parse(s), x2);
|
||||
} catch (e if e == THROW) {
|
||||
x.result = x2.result;
|
||||
throw e;
|
||||
@ -96,7 +96,7 @@ var global = {
|
||||
}
|
||||
b += arguments[m];
|
||||
}
|
||||
var f = compile("function (" + p + ") {" + b + "}");
|
||||
var f = parse("function (" + p + ") {" + b + "}");
|
||||
var s = {object: global, parent: null};
|
||||
return new FunctionObject(f, s);
|
||||
},
|
||||
@ -905,7 +905,7 @@ function evaluate(s, f, l) {
|
||||
var x2 = new ExecutionContext(GLOBAL_CODE);
|
||||
ExecutionContext.current = x2;
|
||||
try {
|
||||
execute(compile(s, f, l), x2);
|
||||
execute(parse(s, f, l), x2);
|
||||
} catch (e if e == THROW) {
|
||||
if (x) {
|
||||
x.result = x2.result;
|
||||
|
@ -213,15 +213,6 @@ var CCp = CompilerContext.prototype;
|
||||
CCp.bracketLevel = CCp.curlyLevel = CCp.parenLevel = CCp.hookLevel = 0;
|
||||
CCp.ecmaStrictMode = CCp.inForLoopInit = false;
|
||||
|
||||
function compile(s, f, l) {
|
||||
var t = new Tokenizer(s, f, l);
|
||||
var x = new CompilerContext(false);
|
||||
var n = Script(t, x);
|
||||
if (!t.done)
|
||||
throw t.newSyntaxError("Syntax error");
|
||||
return n;
|
||||
}
|
||||
|
||||
function Script(t, x) {
|
||||
var n = Statements(t, x);
|
||||
n.type = SCRIPT;
|
||||
@ -969,3 +960,12 @@ loop:
|
||||
reduce();
|
||||
return operands.pop();
|
||||
}
|
||||
|
||||
function parse(s, f, l) {
|
||||
var t = new Tokenizer(s, f, l);
|
||||
var x = new CompilerContext(false);
|
||||
var n = Script(t, x);
|
||||
if (!t.done)
|
||||
throw t.newSyntaxError("Syntax error");
|
||||
return n;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user