// only could be private fields in 'in', such as #x in obj
if (this.type !== tt._in) this.unexpected()
} else {
- expr = this.parseExprSubscripts(refDestructuringErrors, forInit)
+ expr = this.parseExprSubscripts(refDestructuringErrors, forInit, true) // Nick allowHTML = true
if (this.checkExpressionErrors(refDestructuringErrors)) return expr
while (this.type.postfix && !this.canInsertSemicolon()) {
let node = this.startNodeAt(startPos, startLoc)
// Parse call, dot, and `[]`-subscript expressions.
-pp.parseExprSubscripts = function(refDestructuringErrors, forInit) {
+pp.parseExprSubscripts = function(refDestructuringErrors, forInit, allowHTML) { // Nick allowHTML
let startPos = this.start, startLoc = this.startLoc
let expr = this.parseExprAtom(refDestructuringErrors, forInit)
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
return expr
- let result = this.parseSubscripts(expr, startPos, startLoc, false, forInit)
+ let result = this.parseSubscripts(expr, startPos, startLoc, false, forInit, allowHTML) // Nick allowHTML
if (refDestructuringErrors && result.type === "MemberExpression") {
if (refDestructuringErrors.parenthesizedAssign >= result.start) refDestructuringErrors.parenthesizedAssign = -1
if (refDestructuringErrors.parenthesizedBind >= result.start) refDestructuringErrors.parenthesizedBind = -1
return result
}
-pp.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
+pp.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit, allowHTML) { // Nick allowHTML
let maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
this.potentialArrowAt === base.start
let optionalChained = false
while (true) {
- let element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit)
+ let element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit, allowHTML) // Nick allowHTML
if (element.optional) optionalChained = true
if (element === base || element.type === "ArrowFunctionExpression") {
}
}
-pp.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
+pp.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit, allowHTML) { // Nick allowHTML
let optionalSupported = this.options.ecmaVersion >= 11
let optional = optionalSupported && this.eat(tt.questionDot)
if (noCalls && optional) this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions")
node.tag = base
node.quasi = this.parseTemplate({isTagged: true})
base = this.finishNode(node, "TaggedTemplateExpression")
- } else if (this.type === tt.braceL) { // Nick
+ } else if (allowHTML && this.type === tt.braceL) { // Nick
let node = this.startNodeAt(startPos, startLoc)
node.tag = base
if (
return this.finishNode(node, "MetaProperty")
}
let startPos = this.start, startLoc = this.startLoc, isImport = this.type === tt._import
- node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false)
+ node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false, false) // Nick allowHTML = false
if (isImport && node.callee.type === "ImportExpression") {
this.raise(startPos, "Cannot use new with import()")
}