diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-04-24 22:49:32 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-04-30 16:22:56 +0200 |
commit | 72c6ea26830025c9b7cecb2b1dfd1002481d93ad (patch) | |
tree | 51d789d32ffaa3834862722521e1f02ad02a8eae /deps/acorn-plugins/acorn-private-methods | |
parent | 98e9de7db930e505884ca8d0ca6588afbe43f127 (diff) | |
download | android-node-v8-72c6ea26830025c9b7cecb2b1dfd1002481d93ad.tar.gz android-node-v8-72c6ea26830025c9b7cecb2b1dfd1002481d93ad.tar.bz2 android-node-v8-72c6ea26830025c9b7cecb2b1dfd1002481d93ad.zip |
deps: add acorn stage-3 plugins
This adds bigint, class-fields, numeric-separators, static-class
features, private class methods and fields as dependency. That way
it's possible to use these in combination with acorn to parse these
language features.
This also removes a couple of files that were not necessary for
Node.js to reduce the code base.
PR-URL: https://github.com/nodejs/node/pull/27400
Refs: https://github.com/nodejs/node/issues/27391
Refs: https://github.com/nodejs/node/issues/25835
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/acorn-plugins/acorn-private-methods')
-rw-r--r-- | deps/acorn-plugins/acorn-private-methods/CHANGELOG.md | 29 | ||||
-rw-r--r-- | deps/acorn-plugins/acorn-private-methods/LICENSE | 19 | ||||
-rw-r--r-- | deps/acorn-plugins/acorn-private-methods/README.md | 21 | ||||
-rw-r--r-- | deps/acorn-plugins/acorn-private-methods/index.js | 25 | ||||
-rw-r--r-- | deps/acorn-plugins/acorn-private-methods/package.json | 68 |
5 files changed, 162 insertions, 0 deletions
diff --git a/deps/acorn-plugins/acorn-private-methods/CHANGELOG.md b/deps/acorn-plugins/acorn-private-methods/CHANGELOG.md new file mode 100644 index 0000000000..5de4b97b81 --- /dev/null +++ b/deps/acorn-plugins/acorn-private-methods/CHANGELOG.md @@ -0,0 +1,29 @@ +## 0.3.0 (2019-02-09) + +* Require acorn >= 6.1.0 + +## 0.2.3 (2019-02-09) + +* Forbid binding await in async arrow function's parameter list + +## 0.2.2 (2019-01-30) + +* Fix parsing of chained subscripts + +## 0.2.1 (2018-11-06) + +* Adapt to changes in acorn 6.0.3 + +## 0.2.0 (2018-09-14) + +* Update to new acorn 6 interface +* Change license to MIT +* Don't allow direct super() calls in private methods + +## 0.1.1 (2018-02-09) + +* Don't accept whitespace between hash and private name + +## 0.1.0 (2018-01-13) + +Initial release diff --git a/deps/acorn-plugins/acorn-private-methods/LICENSE b/deps/acorn-plugins/acorn-private-methods/LICENSE new file mode 100644 index 0000000000..7c2b27a19c --- /dev/null +++ b/deps/acorn-plugins/acorn-private-methods/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2017-2018 by Adrian Heine + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/deps/acorn-plugins/acorn-private-methods/README.md b/deps/acorn-plugins/acorn-private-methods/README.md new file mode 100644 index 0000000000..6929e84ba6 --- /dev/null +++ b/deps/acorn-plugins/acorn-private-methods/README.md @@ -0,0 +1,21 @@ +# Private methods and getter/setters support for Acorn + +[![NPM version](https://img.shields.io/npm/v/acorn-private-methods.svg)](https://www.npmjs.org/package/acorn-private-methods) + +This is a plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript. + +It implements support for private methods, getters and setters as defined in the stage 3 proposal [Private methods and getter/setters for JavaScript classes](https://github.com/tc39/proposal-private-methods). The emitted AST follows [an ESTree proposal](https://github.com/estree/estree/pull/180). + +## Usage + +This module provides a plugin that can be used to extend the Acorn `Parser` class: + +```javascript +const {Parser} = require('acorn'); +const privateMethods = require('acorn-private-methods'); +Parser.extend(privateMethods).parse('class X { #a() {} }'); +``` + +## License + +This plugin is released under an [MIT License](./LICENSE). diff --git a/deps/acorn-plugins/acorn-private-methods/index.js b/deps/acorn-plugins/acorn-private-methods/index.js new file mode 100644 index 0000000000..a296425168 --- /dev/null +++ b/deps/acorn-plugins/acorn-private-methods/index.js @@ -0,0 +1,25 @@ +"use strict" + +const privateClassElements = require('internal/deps/acorn-plugins/acorn-private-class-elements/index') + +module.exports = function(Parser) { + const ExtendedParser = privateClassElements(Parser) + + return class extends ExtendedParser { + // Parse private methods + parseClassElement(_constructorAllowsSuper) { + const oldInClassMemberName = this._inClassMemberName + this._inClassMemberName = true + const result = super.parseClassElement.apply(this, arguments) + this._inClassMemberName = oldInClassMemberName + return result + } + + parsePropertyName(prop) { + const isPrivate = this.options.ecmaVersion >= 8 && this._inClassMemberName && this.type == this.privateNameToken + this._inClassMemberName = false + if (!isPrivate) return super.parsePropertyName(prop) + return this.parsePrivateClassElementName(prop) + } + } +} diff --git a/deps/acorn-plugins/acorn-private-methods/package.json b/deps/acorn-plugins/acorn-private-methods/package.json new file mode 100644 index 0000000000..d25c611316 --- /dev/null +++ b/deps/acorn-plugins/acorn-private-methods/package.json @@ -0,0 +1,68 @@ +{ + "_from": "acorn-private-methods", + "_id": "acorn-private-methods@0.3.0", + "_inBundle": false, + "_integrity": "sha512-+gWTjSA+13lsv1mwCPosSrLzEyghYtWgrr/1Ck7i7Pu5iK7Ke0hOgw3IW1RUxhc4qS2QTQBQx2+qHYqsa4Qlqw==", + "_location": "/acorn-private-methods", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "acorn-private-methods", + "name": "acorn-private-methods", + "escapedName": "acorn-private-methods", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/acorn-private-methods/-/acorn-private-methods-0.3.0.tgz", + "_shasum": "a5a9f8cd83d175bc138fa22592fababd0afda35d", + "_spec": "acorn-private-methods", + "_where": "/home/ruben/repos/node/node", + "bugs": { + "url": "https://github.com/acornjs/acorn-private-methods/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Adrian Heine", + "email": "mail@adrianheine.de" + } + ], + "dependencies": { + "acorn-private-class-elements": "^0.1.0" + }, + "deprecated": false, + "description": "Support for private methods in acorn", + "devDependencies": { + "acorn": "^6.1.0", + "eslint": "^5.13.0", + "eslint-plugin-node": "^8.0.1", + "mocha": "^5.2.0", + "test262": "git+https://github.com/tc39/test262.git#33a306d1026b72227eb50a918db19ada16f12b3d", + "test262-parser-runner": "^0.5.0" + }, + "engines": { + "node": ">=4.8.2" + }, + "homepage": "https://github.com/acornjs/acorn-private-methods", + "license": "MIT", + "name": "acorn-private-methods", + "peerDependencies": { + "acorn": "^6.1.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/acornjs/acorn-private-methods.git" + }, + "scripts": { + "lint": "eslint -c .eslintrc.json .", + "test": "mocha", + "test:test262": "node run_test262.js" + }, + "version": "0.3.0" +} |