Skip to content

Commit b0b1030

Browse files
committed
Rename noIn parameter to forInit
1 parent d7fc125 commit b0b1030

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

acorn/src/expression.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ pp.checkPropClash = function(prop, propHash, refDestructuringErrors) {
9090
// and object pattern might appear (so it's possible to raise
9191
// delayed syntax error at correct position).
9292

93-
pp.parseExpression = function(noIn, refDestructuringErrors) {
93+
pp.parseExpression = function(forInit, refDestructuringErrors) {
9494
let startPos = this.start, startLoc = this.startLoc
95-
let expr = this.parseMaybeAssign(noIn, refDestructuringErrors)
95+
let expr = this.parseMaybeAssign(forInit, refDestructuringErrors)
9696
if (this.type === tt.comma) {
9797
let node = this.startNodeAt(startPos, startLoc)
9898
node.expressions = [expr]
99-
while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors))
99+
while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors))
100100
return this.finishNode(node, "SequenceExpression")
101101
}
102102
return expr
@@ -105,9 +105,9 @@ pp.parseExpression = function(noIn, refDestructuringErrors) {
105105
// Parse an assignment expression. This includes applications of
106106
// operators like `+=`.
107107

108-
pp.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
108+
pp.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
109109
if (this.isContextual("yield")) {
110-
if (this.inGenerator) return this.parseYield(noIn)
110+
if (this.inGenerator) return this.parseYield(forInit)
111111
// The tokenizer will assume an expression is allowed after
112112
// `yield`, but this isn't that kind of yield
113113
else this.exprAllowed = false
@@ -126,7 +126,7 @@ pp.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
126126
let startPos = this.start, startLoc = this.startLoc
127127
if (this.type === tt.parenL || this.type === tt.name)
128128
this.potentialArrowAt = this.start
129-
let left = this.parseMaybeConditional(noIn, refDestructuringErrors)
129+
let left = this.parseMaybeConditional(forInit, refDestructuringErrors)
130130
if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc)
131131
if (this.type.isAssign) {
132132
let node = this.startNodeAt(startPos, startLoc)
@@ -144,7 +144,7 @@ pp.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
144144
this.checkLValSimple(left)
145145
node.left = left
146146
this.next()
147-
node.right = this.parseMaybeAssign(noIn)
147+
node.right = this.parseMaybeAssign(forInit)
148148
return this.finishNode(node, "AssignmentExpression")
149149
} else {
150150
if (ownDestructuringErrors) this.checkExpressionErrors(refDestructuringErrors, true)
@@ -156,28 +156,28 @@ pp.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
156156

157157
// Parse a ternary conditional (`?:`) operator.
158158

159-
pp.parseMaybeConditional = function(noIn, refDestructuringErrors) {
159+
pp.parseMaybeConditional = function(forInit, refDestructuringErrors) {
160160
let startPos = this.start, startLoc = this.startLoc
161-
let expr = this.parseExprOps(noIn, refDestructuringErrors)
161+
let expr = this.parseExprOps(forInit, refDestructuringErrors)
162162
if (this.checkExpressionErrors(refDestructuringErrors)) return expr
163163
if (this.eat(tt.question)) {
164164
let node = this.startNodeAt(startPos, startLoc)
165165
node.test = expr
166166
node.consequent = this.parseMaybeAssign()
167167
this.expect(tt.colon)
168-
node.alternate = this.parseMaybeAssign(noIn)
168+
node.alternate = this.parseMaybeAssign(forInit)
169169
return this.finishNode(node, "ConditionalExpression")
170170
}
171171
return expr
172172
}
173173

174174
// Start the precedence parser.
175175

176-
pp.parseExprOps = function(noIn, refDestructuringErrors) {
176+
pp.parseExprOps = function(forInit, refDestructuringErrors) {
177177
let startPos = this.start, startLoc = this.startLoc
178178
let expr = this.parseMaybeUnary(refDestructuringErrors, false)
179179
if (this.checkExpressionErrors(refDestructuringErrors)) return expr
180-
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn)
180+
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit)
181181
}
182182

183183
// Parse binary operators with the operator precedence parsing
@@ -186,9 +186,9 @@ pp.parseExprOps = function(noIn, refDestructuringErrors) {
186186
// defer further parser to one of its callers when it encounters an
187187
// operator that has a lower precedence than the set it is parsing.
188188

189-
pp.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
189+
pp.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
190190
let prec = this.type.binop
191-
if (prec != null && (!noIn || this.type !== tt._in)) {
191+
if (prec != null && (!forInit || this.type !== tt._in)) {
192192
if (prec > minPrec) {
193193
let logical = this.type === tt.logicalOR || this.type === tt.logicalAND
194194
let coalesce = this.type === tt.coalesce
@@ -200,12 +200,12 @@ pp.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
200200
let op = this.value
201201
this.next()
202202
let startPos = this.start, startLoc = this.startLoc
203-
let right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn)
203+
let right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, forInit)
204204
let node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce)
205205
if ((logical && this.type === tt.coalesce) || (coalesce && (this.type === tt.logicalOR || this.type === tt.logicalAND))) {
206206
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses")
207207
}
208-
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)
208+
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
209209
}
210210
}
211211
return left
@@ -1051,7 +1051,7 @@ pp.parsePrivateIdent = function() {
10511051

10521052
// Parses yield expression inside generator.
10531053

1054-
pp.parseYield = function(noIn) {
1054+
pp.parseYield = function(forInit) {
10551055
if (!this.yieldPos) this.yieldPos = this.start
10561056

10571057
let node = this.startNode()
@@ -1061,7 +1061,7 @@ pp.parseYield = function(noIn) {
10611061
node.argument = null
10621062
} else {
10631063
node.delegate = this.eat(tt.star)
1064-
node.argument = this.parseMaybeAssign(noIn)
1064+
node.argument = this.parseMaybeAssign(forInit)
10651065
}
10661066
return this.finishNode(node, "YieldExpression")
10671067
}

acorn/src/statement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ pp.parseForStatement = function(node) {
233233
return this.parseFor(node, init)
234234
}
235235
let refDestructuringErrors = new DestructuringErrors
236-
let init = this.parseExpression(true, refDestructuringErrors)
236+
let init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors)
237237
if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
238238
if (this.options.ecmaVersion >= 9) {
239239
if (this.type === tt._in) {

0 commit comments

Comments
 (0)