mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 753249 (part 6) - Remove TCF_GENEXP_LAMBDA from TreeContextFlags. r=luke.
--HG-- extra : rebase_source : 30b9e049999e66dae1409022adc8973efd7d2254
This commit is contained in:
parent
99c5195886
commit
3588797929
@ -4863,11 +4863,8 @@ EmitFunc(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
|
||||
/* Emit a bytecode pointing to the closure object in its immediate. */
|
||||
if (pn->getOp() != JSOP_NOP) {
|
||||
if ((pn->pn_funbox->tcflags & TCF_GENEXP_LAMBDA) &&
|
||||
NewSrcNote(cx, bce, SRC_GENEXP) < 0)
|
||||
{
|
||||
if ((pn->pn_funbox->inGenexpLambda) && NewSrcNote(cx, bce, SRC_GENEXP) < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return EmitFunctionOp(cx, pn->getOp(), index, bce);
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ Boolish(ParseNode *pn)
|
||||
ParseNode *pn2 = pn->pn_head;
|
||||
if (!pn2->isKind(PNK_FUNCTION))
|
||||
return Unknown;
|
||||
if (!(pn2->pn_funbox->tcflags & TCF_GENEXP_LAMBDA))
|
||||
if (!(pn2->pn_funbox->inGenexpLambda))
|
||||
return Unknown;
|
||||
return Truthy;
|
||||
}
|
||||
@ -442,7 +442,7 @@ js::FoldConstants(JSContext *cx, ParseNode *pn, Parser *parser, bool inGenexpLam
|
||||
|
||||
switch (pn->getArity()) {
|
||||
case PN_FUNC:
|
||||
if (!FoldConstants(cx, pn->pn_body, parser, pn->pn_funbox->tcflags & TCF_GENEXP_LAMBDA))
|
||||
if (!FoldConstants(cx, pn->pn_body, parser, pn->pn_funbox->inGenexpLambda))
|
||||
return false;
|
||||
break;
|
||||
|
||||
|
@ -1545,6 +1545,7 @@ struct FunctionBox : public ObjectBox
|
||||
uint32_t tcflags;
|
||||
bool inWith:1; /* some enclosing scope is a with-statement
|
||||
or E4X filter-expression */
|
||||
bool inGenexpLambda:1; /* lambda from generator expression */
|
||||
|
||||
JSFunction *function() const { return (JSFunction *) object; }
|
||||
|
||||
|
@ -246,6 +246,7 @@ Parser::newFunctionBox(JSObject *obj, ParseNode *fn, TreeContext *tc)
|
||||
scope = scope->enclosingScope();
|
||||
}
|
||||
}
|
||||
funbox->inGenexpLambda = false;
|
||||
return funbox;
|
||||
}
|
||||
|
||||
@ -2266,7 +2267,7 @@ MakeSetCall(JSContext *cx, ParseNode *pn, Parser *parser, unsigned msg)
|
||||
return false;
|
||||
|
||||
ParseNode *pn2 = pn->pn_head;
|
||||
if (pn2->isKind(PNK_FUNCTION) && (pn2->pn_funbox->tcflags & TCF_GENEXP_LAMBDA)) {
|
||||
if (pn2->isKind(PNK_FUNCTION) && (pn2->pn_funbox->inGenexpLambda)) {
|
||||
ReportCompileErrorNumber(cx, TS(parser), pn, JSREPORT_ERROR, msg);
|
||||
return false;
|
||||
}
|
||||
@ -5468,9 +5469,9 @@ Parser::generatorExpr(ParseNode *kid)
|
||||
* simplicity we also do not detect if the flags were only set in the
|
||||
* kid and could be removed from tc->sc->flags.
|
||||
*/
|
||||
gensc.flags |= TCF_FUN_IS_GENERATOR | TCF_GENEXP_LAMBDA |
|
||||
(outertc->sc->flags & TCF_FUN_FLAGS);
|
||||
gensc.flags |= TCF_FUN_IS_GENERATOR | (outertc->sc->flags & TCF_FUN_FLAGS);
|
||||
funbox->tcflags |= gensc.flags;
|
||||
funbox->inGenexpLambda = true;
|
||||
genfn->pn_funbox = funbox;
|
||||
genfn->pn_blockid = gensc.bodyid;
|
||||
|
||||
|
@ -64,15 +64,12 @@ JS_ENUM_HEADER(TreeContextFlags, uint32_t)
|
||||
// parsed yield statement in function
|
||||
TCF_FUN_IS_GENERATOR = 0x2,
|
||||
|
||||
// flag lambda from generator expression
|
||||
TCF_GENEXP_LAMBDA = 0x4,
|
||||
|
||||
// This function/global/eval code body contained a Use Strict Directive.
|
||||
// Treat certain strict warnings as errors, and forbid the use of 'with'.
|
||||
// See also TSF_STRICT_MODE_CODE, JSScript::strictModeCode, and
|
||||
// JSREPORT_STRICT_ERROR.
|
||||
//
|
||||
TCF_STRICT_MODE_CODE = 0x8,
|
||||
TCF_STRICT_MODE_CODE = 0x4,
|
||||
|
||||
// The (static) bindings of this script need to support dynamic name
|
||||
// read/write access. Here, 'dynamic' means dynamic dictionary lookup on
|
||||
@ -94,11 +91,11 @@ JS_ENUM_HEADER(TreeContextFlags, uint32_t)
|
||||
// taken not to turn off the whole 'arguments' optimization). To answer the
|
||||
// more general "is this argument aliased" question, script->needsArgsObj
|
||||
// should be tested (see JSScript::argIsAlised).
|
||||
TCF_BINDINGS_ACCESSED_DYNAMICALLY = 0x10,
|
||||
TCF_BINDINGS_ACCESSED_DYNAMICALLY = 0x8,
|
||||
|
||||
// The function or a function that encloses it may define new local names
|
||||
// at runtime through means other than calling eval.
|
||||
TCF_FUN_MIGHT_ALIAS_LOCALS = 0x20,
|
||||
TCF_FUN_MIGHT_ALIAS_LOCALS = 0x10,
|
||||
|
||||
// This function does something that can extend the set of bindings in its
|
||||
// call objects --- it does a direct eval in non-strict code, or includes a
|
||||
@ -107,7 +104,7 @@ JS_ENUM_HEADER(TreeContextFlags, uint32_t)
|
||||
// This flag is *not* inherited by enclosed or enclosing functions; it
|
||||
// applies only to the function in whose flags it appears.
|
||||
//
|
||||
TCF_FUN_EXTENSIBLE_SCOPE = 0x40,
|
||||
TCF_FUN_EXTENSIBLE_SCOPE = 0x20,
|
||||
|
||||
// Technically, every function has a binding named 'arguments'. Internally,
|
||||
// this binding is only added when 'arguments' is mentioned by the function
|
||||
@ -130,7 +127,7 @@ JS_ENUM_HEADER(TreeContextFlags, uint32_t)
|
||||
// have no special semantics: the initial value is unconditionally the
|
||||
// actual argument (or undefined if nactual < nformal).
|
||||
//
|
||||
TCF_ARGUMENTS_HAS_LOCAL_BINDING = 0x80,
|
||||
TCF_ARGUMENTS_HAS_LOCAL_BINDING = 0x40,
|
||||
|
||||
// In many cases where 'arguments' has a local binding (as described above)
|
||||
// we do not need to actually create an arguments object in the function
|
||||
@ -141,7 +138,7 @@ JS_ENUM_HEADER(TreeContextFlags, uint32_t)
|
||||
// be unsound in several cases. The frontend filters out such cases by
|
||||
// setting this flag which eagerly sets script->needsArgsObj to true.
|
||||
//
|
||||
TCF_DEFINITELY_NEEDS_ARGS_OBJ = 0x100
|
||||
TCF_DEFINITELY_NEEDS_ARGS_OBJ = 0x80
|
||||
|
||||
} JS_ENUM_FOOTER(TreeContextFlags);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user