acorn-class-fields
Advanced tools
Comparing version 0.3.6 to 0.3.7
@@ -0,1 +1,7 @@ | ||
## 0.3.7 (2020-08-13) | ||
* Don't break methods with line break after name | ||
* Mark as compatible with acorn@8 | ||
* Support await in field initializers | ||
## 0.3.6 (2020-06-11) | ||
@@ -2,0 +8,0 @@ |
10
index.js
@@ -15,3 +15,5 @@ "use strict" | ||
this._inFieldValue = true | ||
field.value = this.parseExpression() | ||
if (this.type === tt.name && this.value === "await" && (this.inAsync || this.options.allowAwaitOutsideFunction)) { | ||
field.value = this.parseAwait() | ||
} else field.value = this.parseExpression() | ||
this._inFieldValue = oldInFieldValue | ||
@@ -33,3 +35,7 @@ } else field.value = null | ||
} else branch.next(true) | ||
if (branch.type == tt.eq || branch.canInsertSemicolon() || branch.type == tt.semi) { | ||
let isField = branch.type == tt.eq || branch.type == tt.semi | ||
if (!isField && branch.canInsertSemicolon()) { | ||
isField = branch.type != tt.parenL | ||
} | ||
if (isField) { | ||
const node = this.startNode() | ||
@@ -36,0 +42,0 @@ if (this.type == this.privateNameToken) { |
@@ -22,16 +22,16 @@ { | ||
"peerDependencies": { | ||
"acorn": "^6.0.0 || ^7.0.0" | ||
"acorn": "^6 || ^7 || ^8" | ||
}, | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"devDependencies": { | ||
"acorn": "^6.0.0 || ^7.0.0", | ||
"acorn": "^8", | ||
"eslint": "^7.2", | ||
"eslint-plugin-node": "^11", | ||
"mocha": "^8", | ||
"test262": "git+https://github.com/tc39/test262.git#adf2cf4204a748463cacb68f07d0d006b00c3821", | ||
"test262": "git+https://github.com/tc39/test262.git#e0758bbeacac7776dae2a69f88eb4742f0930d7c", | ||
"test262-parser-runner": "^0.5.0" | ||
}, | ||
"dependencies": { | ||
"acorn-private-class-elements": "^0.2.6" | ||
"acorn-private-class-elements": "^0.2.7" | ||
} | ||
} |
"use strict" | ||
const fs = require("fs") | ||
const path = require("path") | ||
@@ -13,4 +12,3 @@ const run = require("test262-parser-runner") | ||
"class-static-fields-private", | ||
"class-static-methods-private", | ||
"optional-chaining" | ||
"class-static-methods-private" | ||
] | ||
@@ -25,4 +23,3 @@ | ||
skip: test => (!test.attrs.features || !implementedFeatures.some(f => test.attrs.features.includes(f)) || unsupportedFeatures.some(f => test.attrs.features.includes(f))), | ||
whitelist: fs.readFileSync("./test262.whitelist", "utf8").split("\n").filter(v => v && v[0] !== "#") | ||
} | ||
) |
@@ -9,3 +9,3 @@ "use strict" | ||
it(text, function () { | ||
const result = Parser.parse(text, Object.assign({ ecmaVersion: 9 }, additionalOptions)) | ||
const result = Parser.parse(text, Object.assign({ ecmaVersion: 9, allowAwaitOutsideFunction: true }, additionalOptions)) | ||
if (expectedResult) { | ||
@@ -62,2 +62,8 @@ assert.deepStrictEqual(result.body[0], expectedResult) | ||
test(` | ||
class Class { | ||
value = await getValue(); | ||
} | ||
`) | ||
test(`class Counter extends HTMLElement { | ||
@@ -368,3 +374,19 @@ #x = 0; | ||
test("var C = class { bre\\u0061k() { return 42; }}") | ||
test(`class X { | ||
x | ||
() {} | ||
}`) | ||
test(`class X { | ||
static x | ||
() {} | ||
}`) | ||
test(`class X { | ||
get | ||
y() {} | ||
}`) | ||
test(`class X { | ||
static; | ||
async; | ||
y() {} | ||
}`) | ||
}) |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
26816
750
0
9
+ Addedacorn@8.12.0(transitive)
- Removedacorn@7.4.1(transitive)