Bug 784608 (part 6) - Rename some parsing and emitting variables. r=luke.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 22 Aug 2012 23:16:05 -0700
changeset 105542 878eb7f978b676c9e2887355e2ee41057358953f
parent 105541 45ac09b4bcb4a279eda0828cc50d84eff0bc5402
child 105543 660d18ddffcd0c150fe58200e5c041df1e73f3e4
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersluke
bugs784608
milestone17.0a1
Bug 784608 (part 6) - Rename some parsing and emitting variables. r=luke.
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/BytecodeEmitter.h
js/src/frontend/Parser-inl.h
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -116,17 +116,17 @@ BytecodeEmitter::BytecodeEmitter(Bytecod
     stackDepth(0), maxStackDepth(0),
     ntrynotes(0), lastTryNode(NULL),
     arrayCompDepth(0),
     emitLevel(0),
     constMap(sc->context),
     constList(sc->context),
     typesetCount(0),
     hasSingletons(false),
-    inForInit(false),
+    emittingForInit(false),
     hasGlobalScope(hasGlobalScope),
     selfHostingMode(selfHostingMode)
 {
     memset(&prolog, 0, sizeof prolog);
     memset(&main, 0, sizeof main);
     current = &main;
     firstLine = prolog.currentLine = main.currentLine = lineno;
 }
@@ -1297,17 +1297,17 @@ BindNameToSlot(JSContext *cx, BytecodeEm
         StackFrame *caller = bce->callerFrame;
         if (caller) {
             JS_ASSERT(bce->script->compileAndGo);
 
             /*
              * Don't generate upvars on the left side of a for loop. See
              * bug 470758.
              */
-            if (bce->inForInit)
+            if (bce->emittingForInit)
                 return true;
 
             /*
              * If this is an eval in the global scope, then unbound variables
              * must be globals, so try to use GNAME ops.
              */
             if (caller->isGlobalFrame() && TryConvertToGname(bce, pn, &op)) {
                 pn->setOp(op);
@@ -1814,21 +1814,21 @@ static bool
 EmitXMLName(JSContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce)
 {
     JS_ASSERT(!bce->sc->inStrictMode());
     JS_ASSERT(pn->isKind(PNK_XMLUNARY));
     JS_ASSERT(pn->isOp(JSOP_XMLNAME));
     JS_ASSERT(op == JSOP_XMLNAME || op == JSOP_CALLXMLNAME);
 
     ParseNode *pn2 = pn->pn_kid;
-    bool oldInForInit = bce->inForInit;
-    bce->inForInit = false;
+    bool oldEmittingForInit = bce->emittingForInit;
+    bce->emittingForInit = false;
     if (!EmitTree(cx, bce, pn2))
         return false;
-    bce->inForInit = oldInForInit;
+    bce->emittingForInit = oldEmittingForInit;
     if (NewSrcNote2(cx, bce, SRC_PCBASE, bce->offset() - pn2->pn_offset) < 0)
         return false;
 
     if (Emit1(cx, bce, op) < 0)
         return false;
 
     return true;
 }
@@ -3404,21 +3404,21 @@ EmitVariables(JSContext *cx, BytecodeEmi
                     return false;
             }
             if (pn->isOp(JSOP_DEFCONST) &&
                 !DefineCompileTimeConstant(cx, bce, pn2->pn_atom, pn3))
             {
                 return false;
             }
 
-            bool oldInForInit = bce->inForInit;
-            bce->inForInit = false;
+            bool oldEmittingForInit = bce->emittingForInit;
+            bce->emittingForInit = false;
             if (!EmitTree(cx, bce, pn3))
                 return false;
-            bce->inForInit = oldInForInit;
+            bce->emittingForInit = oldEmittingForInit;
         } else if (letNotes) {
             /* JSOP_ENTERLETx expects at least 1 slot to have been pushed. */
             if (Emit1(cx, bce, JSOP_UNDEFINED) < 0)
                 return false;
         }
 
         /* If we are not initializing, nothing to pop. */
         if (emitOption != InitializeVars) {
@@ -4558,20 +4558,20 @@ EmitForIn(JSContext *cx, BytecodeEmitter
      * If the left part is 'var x', emit code to define x if necessary
      * using a prolog opcode, but do not emit a pop. If the left part was
      * originally 'var x = i', the parser will have rewritten it; see
      * Parser::forStatement. 'for (let x = i in o)' is mercifully banned.
      */
     if (pn1) {
         ParseNode *decl = letDecl ? pn1->pn_expr : pn1;
         JS_ASSERT(decl->isKind(PNK_VAR) || decl->isKind(PNK_LET));
-        bce->inForInit = true;
+        bce->emittingForInit = true;
         if (!EmitVariables(cx, bce, decl, DefineVars))
             return false;
-        bce->inForInit = false;
+        bce->emittingForInit = false;
     }
 
     /* Compile the object expression to the right of 'in'. */
     if (!EmitTree(cx, bce, forHead->pn_kid3))
         return false;
 
     /*
      * Emit a bytecode to convert top of stack value to the iterator
@@ -4703,17 +4703,17 @@ EmitNormalFor(JSContext *cx, BytecodeEmi
 
     /* C-style for (init; cond; update) ... loop. */
     JSOp op = JSOP_POP;
     ParseNode *pn3 = forHead->pn_kid1;
     if (!pn3) {
         /* No initializer: emit an annotated nop for the decompiler. */
         op = JSOP_NOP;
     } else {
-        bce->inForInit = true;
+        bce->emittingForInit = true;
 #if JS_HAS_DESTRUCTURING
         if (pn3->isKind(PNK_ASSIGN)) {
             JS_ASSERT(pn3->isOp(JSOP_NOP));
             if (!MaybeEmitGroupAssignment(cx, bce, op, pn3, GroupIsNotDecl, &op))
                 return false;
         }
 #endif
         if (op == JSOP_POP) {
@@ -4728,17 +4728,17 @@ EmitNormalFor(JSContext *cx, BytecodeEmi
                  * not need to emit a pop below, so switch to a nop,
                  * just for the decompiler.
                  */
                 JS_ASSERT(pn3->isArity(PN_LIST) || pn3->isArity(PN_BINARY));
                 if (pn3->pn_xflags & PNX_GROUPINIT)
                     op = JSOP_NOP;
             }
         }
-        bce->inForInit = false;
+        bce->emittingForInit = false;
     }
 
     /*
      * NB: the SRC_FOR note has offsetBias 1 (JSOP_{NOP,POP}_LENGTH).
      * Use tmp to hold the biased srcnote "top" offset, which differs
      * from the top local variable by the length of the JSOP_GOTO
      * emitted in between tmp and top if this loop has a condition.
      */
@@ -5395,23 +5395,23 @@ EmitCallOrNew(JSContext *cx, BytecodeEmi
             ParseNode *funNode = pn2->pn_next;
             while (funNode->pn_next)
                 funNode = funNode->pn_next;
             if (!EmitTree(cx, bce, funNode))
                 return false;
             ParseNode *receiver = pn2->pn_next;
             if (!EmitTree(cx, bce, receiver))
                 return false;
-            bool oldInForInit = bce->inForInit;
-            bce->inForInit = false;
+            bool oldEmittingForInit = bce->emittingForInit;
+            bce->emittingForInit = false;
             for (ParseNode *argpn = receiver->pn_next; argpn != funNode; argpn = argpn->pn_next) {
                 if (!EmitTree(cx, bce, argpn))
                     return false;
             }
-            bce->inForInit = oldInForInit;
+            bce->emittingForInit = oldEmittingForInit;
             argc -= 2;
             emitArgs = false;
             break;
         }
         if (!EmitNameOp(cx, bce, pn2, callop))
             return false;
         break;
       case PNK_DOT:
@@ -5441,23 +5441,23 @@ EmitCallOrNew(JSContext *cx, BytecodeEmi
         return false;
 
     if (emitArgs) {
         /*
          * Emit code for each argument in order, then emit the JSOP_*CALL or
          * JSOP_NEW bytecode with a two-byte immediate telling how many args
          * were pushed on the operand stack.
          */
-        bool oldInForInit = bce->inForInit;
-        bce->inForInit = false;
+        bool oldEmittingForInit = bce->emittingForInit;
+        bce->emittingForInit = false;
         for (ParseNode *pn3 = pn2->pn_next; pn3; pn3 = pn3->pn_next) {
             if (!EmitTree(cx, bce, pn3))
                 return false;
         }
-        bce->inForInit = oldInForInit;
+        bce->emittingForInit = oldEmittingForInit;
     }
     if (NewSrcNote2(cx, bce, SRC_PCBASE, bce->offset() - top) < 0)
         return false;
 
     if (Emit3(cx, bce, pn->getOp(), ARGC_HI(argc), ARGC_LO(argc)) < 0)
         return false;
     CheckTypeSet(cx, bce, pn->getOp());
     if (pn->isOp(JSOP_EVAL))
@@ -5962,22 +5962,22 @@ EmitUnary(JSContext *cx, BytecodeEmitter
     /* Unary op, including unary +/-. */
     JSOp op = pn->getOp();
     ParseNode *pn2 = pn->pn_kid;
 
     JS_ASSERT(op != JSOP_XMLNAME);
     if (op == JSOP_TYPEOF && !pn2->isKind(PNK_NAME))
         op = JSOP_TYPEOFEXPR;
 
-    bool oldInForInit = bce->inForInit;
-    bce->inForInit = false;
+    bool oldEmittingForInit = bce->emittingForInit;
+    bce->emittingForInit = false;
     if (!EmitTree(cx, bce, pn2))
         return false;
 
-    bce->inForInit = oldInForInit;
+    bce->emittingForInit = oldEmittingForInit;
     return Emit1(cx, bce, op) >= 0;
 }
 
 static bool
 EmitDefaults(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
 {
     JS_ASSERT(pn->isKind(PNK_ARGSBODY));
     uint16_t ndefaults = bce->sc->funbox()->ndefaults;
@@ -6361,48 +6361,48 @@ frontend::EmitTree(JSContext *cx, Byteco
                 if (!EmitAtomOp(cx, pn, pn->getOp(), bce))
                     return false;
                 break;
             }
 
             /*
              * Binary :: has a right operand that brackets arbitrary code,
              * possibly including a let (a = b) ... expression.  We must clear
-             * inForInit to avoid mis-compiling such beasts.
+             * emittingForInit to avoid mis-compiling such beasts.
              */
-            bool oldInForInit = bce->inForInit;
-            bce->inForInit = false;
+            bool oldEmittingForInit = bce->emittingForInit;
+            bce->emittingForInit = false;
 #endif
 
             /* Binary operators that evaluate both operands unconditionally. */
             if (!EmitTree(cx, bce, pn->pn_left))
                 return false;
             if (!EmitTree(cx, bce, pn->pn_right))
                 return false;
 #if JS_HAS_XML_SUPPORT
-            bce->inForInit = oldInForInit;
+            bce->emittingForInit = oldEmittingForInit;
 #endif
             if (Emit1(cx, bce, pn->getOp()) < 0)
                 return false;
         }
         break;
 
 #if JS_HAS_XML_SUPPORT
       case PNK_XMLUNARY:
         if (pn->getOp() == JSOP_XMLNAME) {
             if (!EmitXMLName(cx, pn, JSOP_XMLNAME, bce))
                 return false;
         } else {
             JSOp op = pn->getOp();
             JS_ASSERT(op == JSOP_BINDXMLNAME || op == JSOP_SETXMLNAME);
-            bool oldInForInit = bce->inForInit;
-            bce->inForInit = false;
+            bool oldEmittingForInit = bce->emittingForInit;
+            bce->emittingForInit = false;
             if (!EmitTree(cx, bce, pn->pn_kid))
                 return false;
-            bce->inForInit = oldInForInit;
+            bce->emittingForInit = oldEmittingForInit;
             if (Emit1(cx, bce, op) < 0)
                 return false;
         }
         break;
 #endif
 
       case PNK_THROW:
 #if JS_HAS_XML_SUPPORT
--- a/js/src/frontend/BytecodeEmitter.h
+++ b/js/src/frontend/BytecodeEmitter.h
@@ -107,17 +107,17 @@ struct BytecodeEmitter
     CGObjectList    objectList;     /* list of emitted objects */
     CGObjectList    regexpList;     /* list of emitted regexp that will be
                                        cloned during execution */
 
     uint16_t        typesetCount;   /* Number of JOF_TYPESET opcodes generated */
 
     bool            hasSingletons:1;    /* script contains singleton initializer JSOP_OBJECT */
 
-    bool            inForInit:1;        /* emitting init expr of for; exclude 'in' */
+    bool            emittingForInit:1;  /* true while emitting init expr of for; exclude 'in' */
 
     const bool      hasGlobalScope:1;   /* frontend::CompileScript's scope chain is the
                                            global object */
 
     const bool      selfHostingMode:1;  /* Emit JSOP_CALLINTRINSIC instead of JSOP_NAME
                                            and assert that JSOP_NAME and JSOP_*GNAME
                                            don't ever get emitted. See the comment for
                                            the field |selfHostingMode| in Parser.h for details. */
--- a/js/src/frontend/Parser-inl.h
+++ b/js/src/frontend/Parser-inl.h
@@ -43,19 +43,19 @@ ParseContext::ParseContext(Parser *prs, 
     yieldNode(NULL),
     functionList(NULL),
     queuedStrictModeError(NULL),
     parserPC(&prs->pc),
     lexdeps(prs->context),
     parent(prs->pc),
     innermostWith(NULL),
     funcStmts(NULL),
-    hasReturnExpr(false),
-    hasReturnVoid(false),
-    inForInit(false),
+    funHasReturnExpr(false),
+    funHasReturnVoid(false),
+    parsingForInit(false),
     inDeclDestructuring(false)
 {
     prs->pc = this;
 }
 
 inline bool
 ParseContext::init()
 {
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -695,17 +695,17 @@ ParseNode *
 Parser::functionBody(FunctionBodyType type)
 {
     JS_ASSERT(pc->sc->inFunction());
 
     StmtInfoPC stmtInfo(context);
     PushStatementPC(pc, &stmtInfo, STMT_BLOCK);
     stmtInfo.isFunctionBodyBlock = true;
 
-    JS_ASSERT(!pc->hasReturnExpr && !pc->hasReturnVoid);
+    JS_ASSERT(!pc->funHasReturnExpr && !pc->funHasReturnVoid);
 
     ParseNode *pn;
     if (type == StatementListBody) {
         pn = statements();
     } else {
         JS_ASSERT(type == ExpressionBody);
         JS_ASSERT(JS_HAS_EXPR_CLOSURES);
 
@@ -734,17 +734,17 @@ Parser::functionBody(FunctionBodyType ty
 
     if (!pn)
         return NULL;
 
     JS_ASSERT(!pc->topStmt->isBlockScope);
     FinishPopStatement(pc);
 
     /* Check for falling off the end of a function that returns a value. */
-    if (context->hasStrictOption() && pc->hasReturnExpr &&
+    if (context->hasStrictOption() && pc->funHasReturnExpr &&
         !CheckFinalReturn(context, this, pn))
     {
         pn = NULL;
     }
 
     /* Time to implement the odd semantics of 'arguments'. */
     Rooted<PropertyName*> arguments(context, context->runtime->atomState.argumentsAtom);
 
@@ -2554,34 +2554,34 @@ Parser::returnOrYield(bool useAssignExpr
         )
     {
         ParseNode *pn2 = useAssignExpr ? assignExpr() : expr();
         if (!pn2)
             return NULL;
 #if JS_HAS_GENERATORS
         if (tt == TOK_RETURN)
 #endif
-            pc->hasReturnExpr = true;
+            pc->funHasReturnExpr = true;
         pn->pn_pos.end = pn2->pn_pos.end;
         pn->pn_kid = pn2;
     } else {
 #if JS_HAS_GENERATORS
         if (tt == TOK_RETURN)
 #endif
-            pc->hasReturnVoid = true;
+            pc->funHasReturnVoid = true;
     }
 
-    if (pc->hasReturnExpr && pc->sc->funIsGenerator()) {
+    if (pc->funHasReturnExpr && pc->sc->funIsGenerator()) {
         /* As in Python (see PEP-255), disallow return v; in generators. */
         ReportBadReturn(context, this, pn, &Parser::reportError, JSMSG_BAD_GENERATOR_RETURN,
                         JSMSG_BAD_ANON_GENERATOR_RETURN);
         return NULL;
     }
 
-    if (context->hasStrictOption() && pc->hasReturnExpr && pc->hasReturnVoid &&
+    if (context->hasStrictOption() && pc->funHasReturnExpr && pc->funHasReturnVoid &&
         !ReportBadReturn(context, this, pn, &Parser::reportStrictWarning,
                          JSMSG_NO_RETURN_VALUE, JSMSG_ANON_NO_RETURN_VALUE))
     {
         return NULL;
     }
 
     return pn;
 }
@@ -2959,27 +2959,27 @@ Parser::forStatement()
                 return NULL;
             }
 
             pn1 = NULL;
         } else {
             /*
              * Set pn1 to a var list or an initializing expression.
              *
-             * Set the inForInit flag during parsing of the first clause
+             * Set the parsingForInit flag during parsing of the first clause
              * of the for statement.  This flag will be used by the RelExpr
              * production; if it is set, then the 'in' keyword will not be
              * recognized as an operator, leaving it available to be parsed as
              * part of a for/in loop.
              *
              * A side effect of this restriction is that (unparenthesized)
              * expressions involving an 'in' operator are illegal in the init
              * clause of an ordinary for loop.
              */
-            pc->inForInit = true;
+            pc->parsingForInit = true;
             if (tt == TOK_VAR || tt == TOK_CONST) {
                 forDecl = true;
                 tokenStream.consumeKnownToken(tt);
                 pn1 = variables(tt == TOK_VAR ? PNK_VAR : PNK_CONST);
             }
 #if JS_HAS_BLOCK_SCOPE
             else if (tt == TOK_LET) {
                 (void) tokenStream.getToken();
@@ -2992,17 +2992,17 @@ Parser::forStatement()
                         return NULL;
                     pn1 = variables(PNK_LET, blockObj, DontHoistVars);
                 }
             }
 #endif
             else {
                 pn1 = expr();
             }
-            pc->inForInit = false;
+            pc->parsingForInit = false;
             if (!pn1)
                 return NULL;
         }
     }
 
     JS_ASSERT_IF(forDecl, pn1->isArity(PN_LIST));
     JS_ASSERT(!!blockObj == (forDecl && pn1->isOp(JSOP_NOP)));
 
@@ -3010,17 +3010,17 @@ Parser::forStatement()
 
     /* If non-null, the parent that should be returned instead of forHead. */
     ParseNode *forParent = NULL;
 
     /*
      * We can be sure that it's a for/in loop if there's still an 'in'
      * keyword here, even if JavaScript recognizes 'in' as an operator,
      * as we've excluded 'in' from being parsed in RelExpr by setting
-     * pc->inForInit.
+     * pc->parsingForInit.
      */
     ParseNode *forHead;        /* initialized by both branches. */
     StmtInfoPC letStmt(context); /* used if blockObj != NULL. */
     ParseNode *pn2, *pn3;      /* forHead->pn_kid1 and pn_kid2. */
     bool forOf;
     if (pn1 && matchInOrOf(&forOf)) {
         /*
          * Parse the rest of the for/in or for/of head.
@@ -4070,17 +4070,17 @@ Parser::variables(ParseNodeKind kind, St
             pn2 = primaryExpr(tt, false);
             pc->inDeclDestructuring = false;
             if (!pn2)
                 return NULL;
 
             if (!CheckDestructuring(context, &data, pn2, this))
                 return NULL;
             bool ignored;
-            if (pc->inForInit && matchInOrOf(&ignored)) {
+            if (pc->parsingForInit && matchInOrOf(&ignored)) {
                 tokenStream.ungetToken();
                 pn->append(pn2);
                 continue;
             }
 
             MUST_MATCH_TOKEN(TOK_ASSIGN, JSMSG_BAD_DESTRUCT_DECL);
             JS_ASSERT(tokenStream.currentToken().t_op == JSOP_NOP);
 
@@ -4276,34 +4276,34 @@ RelationalTokenToParseNodeKind(const Tok
 }
 
 BEGIN_EXPR_PARSER(relExpr1)
 {
     /*
      * Uses of the in operator in shiftExprs are always unambiguous,
      * so unset the flag that prohibits recognizing it.
      */
-    bool oldInForInit = pc->inForInit;
-    pc->inForInit = false;
+    bool oldParsingForInit = pc->parsingForInit;
+    pc->parsingForInit = false;
 
     ParseNode *pn = shiftExpr1i();
     while (pn &&
            (tokenStream.isCurrentTokenRelational() ||
             /*
              * Recognize the 'in' token as an operator only if we're not
              * currently in the init expr of a for loop.
              */
-            (oldInForInit == 0 && tokenStream.isCurrentTokenType(TOK_IN)) ||
+            (oldParsingForInit == 0 && tokenStream.isCurrentTokenType(TOK_IN)) ||
             tokenStream.isCurrentTokenType(TOK_INSTANCEOF))) {
         ParseNodeKind kind = RelationalTokenToParseNodeKind(tokenStream.currentToken());
         JSOp op = tokenStream.currentToken().t_op;
         pn = ParseNode::newBinaryOrAppend(kind, op, pn, shiftExpr1n(), this);
     }
-    /* Restore previous state of inForInit flag. */
-    pc->inForInit |= oldInForInit;
+    /* Restore previous state of parsingForInit flag. */
+    pc->parsingForInit |= oldParsingForInit;
 
     return pn;
 }
 END_EXPR_PARSER(relExpr1)
 
 inline ParseNodeKind
 EqualityTokenToParseNodeKind(const Token &token)
 {
@@ -4387,20 +4387,20 @@ Parser::condExpr1()
     if (!condition || !tokenStream.isCurrentTokenType(TOK_HOOK))
         return condition;
 
     /*
      * Always accept the 'in' operator in the middle clause of a ternary,
      * where it's unambiguous, even if we might be parsing the init of a
      * for statement.
      */
-    bool oldInForInit = pc->inForInit;
-    pc->inForInit = false;
+    bool oldParsingForInit = pc->parsingForInit;
+    pc->parsingForInit = false;
     ParseNode *thenExpr = assignExpr();
-    pc->inForInit = oldInForInit;
+    pc->parsingForInit = oldParsingForInit;
     if (!thenExpr)
         return NULL;
 
     MUST_MATCH_TOKEN(TOK_COLON, JSMSG_COLON_IN_COND);
 
     ParseNode *elseExpr = assignExpr();
     if (!elseExpr)
         return NULL;
@@ -4805,17 +4805,17 @@ GenexpGuard::maybeNoteGenerator(ParseNod
 {
     ParseContext *pc = parser->pc;
     if (pc->yieldCount > 0) {
         pc->sc->setFunIsGenerator();
         if (!pc->sc->inFunction()) {
             parser->reportError(NULL, JSMSG_BAD_RETURN_OR_YIELD, js_yield_str);
             return false;
         }
-        if (pc->hasReturnExpr) {
+        if (pc->funHasReturnExpr) {
             /* At the time we saw the yield, we might not have set funIsGenerator yet. */
             ReportBadReturn(pc->sc->context, parser, pn, &Parser::reportError,
                             JSMSG_BAD_GENERATOR_RETURN, JSMSG_BAD_ANON_GENERATOR_RETURN);
             return false;
         }
     }
     return true;
 }
@@ -5691,20 +5691,20 @@ Parser::memberExpr(bool allowCallSyntax)
 ParseNode *
 Parser::bracketedExpr()
 {
     /*
      * Always accept the 'in' operator in a parenthesized expression,
      * where it's unambiguous, even if we might be parsing the init of a
      * for statement.
      */
-    bool oldInForInit = pc->inForInit;
-    pc->inForInit = false;
+    bool oldParsingForInit = pc->parsingForInit;
+    pc->parsingForInit = false;
     ParseNode *pn = expr();
-    pc->inForInit = oldInForInit;
+    pc->parsingForInit = oldParsingForInit;
     return pn;
 }
 
 #if JS_HAS_XML_SUPPORT
 
 ParseNode *
 Parser::endBracketedExpr()
 {
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -175,24 +175,25 @@ struct ParseContext                 /* t
     ParseContext     *parent;       /* Enclosing function or global context.  */
 
     ParseNode       *innermostWith; /* innermost WITH parse node */
 
     FuncStmtSet     *funcStmts;     /* Set of (non-top-level) function statements
                                        that will alias any top-level bindings with
                                        the same name. */
 
-    /*
-     * Flags that are set for a short time during parsing to indicate context
-     * or the presence of a code feature.
-     */
-    bool            hasReturnExpr:1; /* function has 'return <expr>;' */
-    bool            hasReturnVoid:1; /* function has 'return;' */
+    // The following flags are set when a particular code feature is detected
+    // in a function.
+    bool            funHasReturnExpr:1; /* function has 'return <expr>;' */
+    bool            funHasReturnVoid:1; /* function has 'return;' */
 
-    bool            inForInit:1;    /* parsing init expr of for; exclude 'in' */
+    // The following flags are set when parsing enters a particular region of
+    // source code, and cleared when that region is exited.
+    bool            parsingForInit:1;   /* true while parsing init expr of for;
+                                           exclude 'in' */
 
     // Set when parsing a declaration-like destructuring pattern.  This flag
     // causes PrimaryExpr to create PN_NAME parse nodes for variable references
     // which are not hooked into any definition's use chain, added to any tree
     // context's AtomList, etc. etc.  CheckDestructuring will do that work
     // later.
     //
     // The comments atop CheckDestructuring explain the distinction between