acorn-private-class-elements
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -0,1 +1,5 @@ | ||
## 0.2.6 (2020-06-11) | ||
* Don't break acorn's optional chaining support | ||
## 0.2.5 (2020-04-23) | ||
@@ -2,0 +6,0 @@ |
17
index.js
@@ -115,5 +115,15 @@ "use strict" | ||
// Parse private element access | ||
parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow) { | ||
parseSubscript(base, startPos, startLoc, _noCalls, _maybeAsyncArrow, _optionalChained) { | ||
const optionalSupported = this.options.ecmaVersion >= 11 && acorn.tokTypes.questionDot | ||
const branch = this._branch() | ||
if (!( | ||
(branch.eat(acorn.tokTypes.dot) || (optionalSupported && branch.eat(acorn.tokTypes.questionDot))) && | ||
branch.type == this.privateNameToken | ||
)) { | ||
return super.parseSubscript.apply(this, arguments) | ||
} | ||
let optional = false | ||
if (!this.eat(acorn.tokTypes.dot)) { | ||
return super.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow) | ||
this.expect(acorn.tokTypes.questionDot) | ||
optional = true | ||
} | ||
@@ -123,2 +133,5 @@ let node = this.startNodeAt(startPos, startLoc) | ||
node.computed = false | ||
if (optionalSupported) { | ||
node.optional = optional | ||
} | ||
if (this.type == this.privateNameToken) { | ||
@@ -125,0 +138,0 @@ if (base.type == "Super") { |
@@ -23,9 +23,9 @@ { | ||
}, | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"devDependencies": { | ||
"acorn": "^7.0.0", | ||
"eslint": "^6.8.0", | ||
"eslint": "^7", | ||
"eslint-plugin-node": "^11.0.0", | ||
"mocha": "^7.1.0" | ||
"mocha": "^8" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19134
462