зеркало из https://github.com/mozilla/gecko-dev.git
Bug 888469 - rm PND_BLOCKCHILD (r=bhackett)
This commit is contained in:
Родитель
a542988b37
Коммит
bc88f36c2f
|
@ -86,17 +86,13 @@ class FullParseHandler
|
|||
void prepareNodeForMutation(ParseNode *pn) { return allocator.prepareNodeForMutation(pn); }
|
||||
const Token ¤tToken() { return tokenStream.currentToken(); }
|
||||
|
||||
ParseNode *newName(PropertyName *name, InBlockBool inBlock, uint32_t blockid,
|
||||
const TokenPos &pos)
|
||||
{
|
||||
return new_<NameNode>(PNK_NAME, JSOP_NAME, name, inBlock, blockid, pos);
|
||||
ParseNode *newName(PropertyName *name, uint32_t blockid, const TokenPos &pos) {
|
||||
return new_<NameNode>(PNK_NAME, JSOP_NAME, name, blockid, pos);
|
||||
}
|
||||
|
||||
Definition *newPlaceholder(JSAtom *atom, InBlockBool inBlock, uint32_t blockid,
|
||||
const TokenPos &pos)
|
||||
{
|
||||
Definition *newPlaceholder(JSAtom *atom, uint32_t blockid, const TokenPos &pos) {
|
||||
Definition *dn =
|
||||
(Definition *) new_<NameNode>(PNK_NAME, JSOP_NOP, atom, inBlock, blockid, pos);
|
||||
(Definition *) new_<NameNode>(PNK_NAME, JSOP_NOP, atom, blockid, pos);
|
||||
if (!dn)
|
||||
return NULL;
|
||||
dn->setDefn(true);
|
||||
|
|
|
@ -630,7 +630,6 @@ class ParseNode
|
|||
#define PND_LET 0x01 /* let (block-scoped) binding */
|
||||
#define PND_CONST 0x02 /* const binding (orthogonal to let) */
|
||||
#define PND_ASSIGNED 0x04 /* set if ever LHS of assignment */
|
||||
#define PND_BLOCKCHILD 0x08 /* use or def is direct block child */
|
||||
#define PND_PLACEHOLDER 0x10 /* placeholder definition for lexdep */
|
||||
#define PND_BOUND 0x20 /* bound to a stack or global slot */
|
||||
#define PND_DEOPTIMIZED 0x40 /* former pn_used name node, pn_lexdef
|
||||
|
@ -713,7 +712,6 @@ class ParseNode
|
|||
|
||||
bool isLet() const { return test(PND_LET); }
|
||||
bool isConst() const { return test(PND_CONST); }
|
||||
bool isBlockChild() const { return test(PND_BLOCKCHILD); }
|
||||
bool isPlaceholder() const { return test(PND_PLACEHOLDER); }
|
||||
bool isDeoptimized() const { return test(PND_DEOPTIMIZED); }
|
||||
bool isAssigned() const { return test(PND_ASSIGNED); }
|
||||
|
@ -976,21 +974,16 @@ struct CodeNode : public ParseNode
|
|||
#endif
|
||||
};
|
||||
|
||||
enum InBlockBool {
|
||||
NotInBlock = false,
|
||||
InBlock = true
|
||||
};
|
||||
|
||||
struct NameNode : public ParseNode
|
||||
{
|
||||
NameNode(ParseNodeKind kind, JSOp op, JSAtom *atom, InBlockBool inBlock, uint32_t blockid,
|
||||
NameNode(ParseNodeKind kind, JSOp op, JSAtom *atom, uint32_t blockid,
|
||||
const TokenPos &pos)
|
||||
: ParseNode(kind, op, PN_NAME, pos)
|
||||
{
|
||||
pn_atom = atom;
|
||||
pn_expr = NULL;
|
||||
pn_cookie.makeFree();
|
||||
pn_dflags = inBlock ? PND_BLOCKCHILD : 0;
|
||||
pn_dflags = 0;
|
||||
pn_blockid = blockid;
|
||||
JS_ASSERT(pn_blockid == blockid); // check for bitfield overflow
|
||||
}
|
||||
|
|
|
@ -1262,7 +1262,7 @@ Parser<ParseHandler>::getOrCreateLexicalDependency(ParseContext<ParseHandler> *p
|
|||
if (p)
|
||||
return p.value().get<ParseHandler>();
|
||||
|
||||
DefinitionNode dn = handler.newPlaceholder(atom, pc->inBlock(), pc->blockid(), pos());
|
||||
DefinitionNode dn = handler.newPlaceholder(atom, pc->blockid(), pos());
|
||||
if (!dn)
|
||||
return ParseHandler::nullDefinition();
|
||||
DefinitionSingle def = DefinitionSingle::new_<ParseHandler>(dn);
|
||||
|
@ -1314,9 +1314,6 @@ Parser<FullParseHandler>::leaveFunction(ParseNode *fn, HandlePropertyName funNam
|
|||
FunctionBox *funbox = fn->pn_funbox;
|
||||
JS_ASSERT(funbox == pc->sc->asFunctionBox());
|
||||
|
||||
if (!outerpc->topStmt || outerpc->topStmt->type == STMT_BLOCK)
|
||||
fn->pn_dflags |= PND_BLOCKCHILD;
|
||||
|
||||
/* Propagate unresolved lexical names up to outerpc->lexdeps. */
|
||||
if (pc->lexdeps->count()) {
|
||||
for (AtomDefnRange r = pc->lexdeps->all(); !r.empty(); r.popFront()) {
|
||||
|
@ -5598,8 +5595,8 @@ CompExprTransplanter::transplant(ParseNode *pn)
|
|||
* generator) a use of a new placeholder in the generator's
|
||||
* lexdeps.
|
||||
*/
|
||||
Definition *dn2 = parser->handler.newPlaceholder(
|
||||
atom, parser->pc->inBlock(), parser->pc->blockid(), parser->pos());
|
||||
Definition *dn2 = parser->handler.newPlaceholder(atom, parser->pc->blockid(),
|
||||
parser->pos());
|
||||
if (!dn2)
|
||||
return false;
|
||||
dn2->pn_pos = root->pn_pos;
|
||||
|
@ -6227,7 +6224,7 @@ template <typename ParseHandler>
|
|||
typename ParseHandler::Node
|
||||
Parser<ParseHandler>::newName(PropertyName *name)
|
||||
{
|
||||
return handler.newName(name, pc->inBlock(), pc->blockid(), pos());
|
||||
return handler.newName(name, pc->blockid(), pos());
|
||||
}
|
||||
|
||||
template <typename ParseHandler>
|
||||
|
|
|
@ -272,7 +272,6 @@ struct ParseContext : public GenericParseContext
|
|||
return decls_.init() && lexdeps.ensureMap(sc->context);
|
||||
}
|
||||
|
||||
InBlockBool inBlock() const { return InBlockBool(!topStmt || topStmt->type == STMT_BLOCK); }
|
||||
unsigned blockid() { return topStmt ? topStmt->blockid : bodyid; }
|
||||
|
||||
// True if we are at the topmost level of a entire script or function body.
|
||||
|
|
|
@ -53,14 +53,12 @@ class SyntaxParseHandler
|
|||
|
||||
void trace(JSTracer *trc) {}
|
||||
|
||||
Node newName(PropertyName *name, InBlockBool inBlock, uint32_t blockid, const TokenPos &pos) {
|
||||
Node newName(PropertyName *name, uint32_t blockid, const TokenPos &pos) {
|
||||
lastAtom = name;
|
||||
return NodeName;
|
||||
}
|
||||
|
||||
DefinitionNode newPlaceholder(JSAtom *atom, InBlockBool inBlock, uint32_t blockid,
|
||||
const TokenPos &pos)
|
||||
{
|
||||
DefinitionNode newPlaceholder(JSAtom *atom, uint32_t blockid, const TokenPos &pos) {
|
||||
return Definition::PLACEHOLDER;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче