Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

acorn-static-class-features

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acorn-static-class-features - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

5

CHANGELOG.md

@@ -0,1 +1,6 @@

## 0.2.2 (2020-05-21)
* Allow `arguments` usage in nested static methods
* Allow numeric class element names
## 0.2.1 (2020-04-25)

@@ -2,0 +7,0 @@

12

index.js

@@ -14,6 +14,6 @@ "use strict"

if (this.eat(tt.eq)) {
const oldInFieldValue = this._inStaticFieldValue
this._inStaticFieldValue = true
const oldInFieldValue = this._inStaticFieldScope
this._inStaticFieldScope = this.currentThisScope()
field.value = this.parseExpression()
this._inStaticFieldValue = oldInFieldValue
this._inStaticFieldScope = oldInFieldValue
} else field.value = null

@@ -30,3 +30,3 @@ }

branch.next()
if ([tt.name, tt.bracketL, tt.string, this.privateNameToken].indexOf(branch.type) == -1) {
if ([tt.name, tt.bracketL, tt.string, tt.num, this.privateNameToken].indexOf(branch.type) == -1) {
return super.parseClassElement.apply(this, arguments)

@@ -79,3 +79,5 @@ }

const ident = super.parseIdent(liberal, isBinding)
if (this._inStaticFieldValue && ident.name == "arguments") this.raise(ident.start, "A static class field initializer may not contain arguments")
if (this._inStaticFieldScope && this.currentThisScope() === this._inStaticFieldScope && ident.name == "arguments") {
this.raise(ident.start, "A static class field initializer may not contain arguments")
}
return ident

@@ -82,0 +84,0 @@ }

@@ -24,3 +24,3 @@ {

},
"version": "0.2.1",
"version": "0.2.2",
"devDependencies": {

@@ -31,3 +31,3 @@ "acorn": "^7.0.0",

"mocha": "^7",
"test262": "git+https://github.com/tc39/test262.git#c0ffc8f6da0f2a7ec87afb87ec5f2664b1ba57ec",
"test262": "git+https://github.com/tc39/test262.git#2f1d28ddcaa82004236619876c31359d8ca81414",
"test262-parser-runner": "^0.5.0"

@@ -34,0 +34,0 @@ },

@@ -11,2 +11,3 @@ "use strict"

"class-fields-public",
"class-fields-private",
"class-methods-private"

@@ -13,0 +14,0 @@ ]

@@ -46,2 +46,9 @@ "use strict"

}`)
test(`class C {
static a = () => {
function p () {
console.log(arguments);
}
}
}`)

@@ -410,2 +417,8 @@ const classes = [

test("class A extends B { constructor() { super() } }")
test(`class C {
static f = 'test262';
static 'g';
static 0 = 'bar';
static [computed];
}`)
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc