acorn-loose
Advanced tools
Comparing version 8.1.0 to 8.2.0
@@ -0,1 +1,7 @@ | ||
## 8.2.0 (2021-09-06) | ||
### New features | ||
Add support for ES2022 class static blocks. | ||
## 8.1.0 (2021-04-24) | ||
@@ -2,0 +8,0 @@ |
@@ -600,8 +600,12 @@ (function (global, factory) { | ||
var kind = "method"; | ||
var isStatic = false; | ||
// Parse modifiers | ||
node.static = false; | ||
if (this.eatContextual("static")) { | ||
// Parse static init block | ||
if (ecmaVersion >= 13 && this.eat(acorn.tokTypes.braceL)) { | ||
this.parseClassStaticBlock(node); | ||
return node | ||
} | ||
if (this.isClassElementNameStart() || this.toks.type === acorn.tokTypes.star) { | ||
node.static = true; | ||
isStatic = true; | ||
} else { | ||
@@ -611,2 +615,3 @@ keyName = "static"; | ||
} | ||
node.static = isStatic; | ||
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) { | ||
@@ -691,2 +696,14 @@ if ((this.isClassElementNameStart() || this.toks.type === acorn.tokTypes.star) && !this.canInsertSemicolon()) { | ||
lp$1.parseClassStaticBlock = function(node) { | ||
var blockIndent = this.curIndent, line = this.curLineStart; | ||
node.body = []; | ||
this.pushCx(); | ||
while (!this.closes(acorn.tokTypes.braceR, blockIndent, line, true)) | ||
{ node.body.push(this.parseStatement()); } | ||
this.popCx(); | ||
this.eat(acorn.tokTypes.braceR); | ||
return this.finishNode(node, "StaticBlock") | ||
}; | ||
lp$1.isClassElementNameStart = function() { | ||
@@ -958,4 +975,4 @@ return this.toks.isClassElementNameStart() | ||
if (this.options.ecmaVersion >= 8 && this.toks.isContextual("await") && | ||
(this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction)) | ||
) { | ||
(this.inAsync || (this.toks.inModule && this.options.ecmaVersion >= 13) || | ||
(!this.inFunction && this.options.allowAwaitOutsideFunction))) { | ||
expr = this.parseAwait(); | ||
@@ -1091,4 +1108,6 @@ sawUnary = true; | ||
if (id.name === "async" && !this.canInsertSemicolon()) { | ||
if (this.eat(acorn.tokTypes._function)) | ||
{ return this.parseFunction(this.startNodeAt(start), false, true) } | ||
if (this.eat(acorn.tokTypes._function)) { | ||
this.toks.overrideContext(acorn.tokContexts.f_expr); | ||
return this.parseFunction(this.startNodeAt(start), false, true) | ||
} | ||
if (this.tok.type === acorn.tokTypes.name) { | ||
@@ -1150,2 +1169,3 @@ id = this.parseIdent(); | ||
case acorn.tokTypes.braceL: | ||
this.toks.overrideContext(acorn.tokContexts.b_expr); | ||
return this.parseObj() | ||
@@ -1152,0 +1172,0 @@ |
@@ -18,3 +18,3 @@ { | ||
}, | ||
"version": "8.1.0", | ||
"version": "8.2.0", | ||
"engines": {"node": ">=0.4.0"}, | ||
@@ -21,0 +21,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
112846
2772