summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/ParseNode.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/frontend/ParseNode.h')
-rw-r--r--js/src/frontend/ParseNode.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h
index d37aaaae0..c58dab431 100644
--- a/js/src/frontend/ParseNode.h
+++ b/js/src/frontend/ParseNode.h
@@ -450,6 +450,9 @@ class ParseNode
uint8_t pn_op; /* see JSOp enum and jsopcode.tbl */
uint8_t pn_arity:4; /* see ParseNodeArity enum */
bool pn_parens:1; /* this expr was enclosed in parens */
+ bool pn_rhs_anon_fun:1; /* this expr is anonymous function or class that
+ * is a direct RHS of PNK_ASSIGN or PNK_COLON of
+ * property, that needs SetFunctionName. */
ParseNode(const ParseNode& other) = delete;
void operator=(const ParseNode& other) = delete;
@@ -460,6 +463,7 @@ class ParseNode
pn_op(op),
pn_arity(arity),
pn_parens(false),
+ pn_rhs_anon_fun(false),
pn_pos(0, 0),
pn_next(nullptr)
{
@@ -472,6 +476,7 @@ class ParseNode
pn_op(op),
pn_arity(arity),
pn_parens(false),
+ pn_rhs_anon_fun(false),
pn_pos(pos),
pn_next(nullptr)
{
@@ -512,6 +517,13 @@ class ParseNode
bool isLikelyIIFE() const { return isInParens(); }
void setInParens(bool enabled) { pn_parens = enabled; }
+ bool isDirectRHSAnonFunction() const {
+ return pn_rhs_anon_fun;
+ }
+ void setDirectRHSAnonFunction(bool enabled) {
+ pn_rhs_anon_fun = enabled;
+ }
+
TokenPos pn_pos; /* two 16-bit pairs here, for 64 bits */
ParseNode* pn_next; /* intrinsic link in parent PN_LIST */
@@ -637,14 +649,12 @@ class ParseNode
MOZ_ASSERT(pn_arity == PN_CODE && getKind() == PNK_FUNCTION);
MOZ_ASSERT(isOp(JSOP_LAMBDA) || // lambda, genexpr
isOp(JSOP_LAMBDA_ARROW) || // arrow function
- isOp(JSOP_FUNWITHPROTO) || // already emitted lambda with needsProto
isOp(JSOP_DEFFUN) || // non-body-level function statement
isOp(JSOP_NOP) || // body-level function stmt in global code
isOp(JSOP_GETLOCAL) || // body-level function stmt in function code
isOp(JSOP_GETARG) || // body-level function redeclaring formal
isOp(JSOP_INITLEXICAL)); // block-level function stmt
- return !isOp(JSOP_LAMBDA) && !isOp(JSOP_LAMBDA_ARROW) &&
- !isOp(JSOP_FUNWITHPROTO) && !isOp(JSOP_DEFFUN);
+ return !isOp(JSOP_LAMBDA) && !isOp(JSOP_LAMBDA_ARROW) && !isOp(JSOP_DEFFUN);
}
/*
@@ -1444,6 +1454,9 @@ FunctionFormalParametersList(ParseNode* fn, unsigned* numFormals)
return argsBody->pn_head;
}
+bool
+IsAnonymousFunctionDefinition(ParseNode* pn);
+
} /* namespace frontend */
} /* namespace js */