deps: update acorn to 6.2.0
Includes support for bigint syntax so we can remove the acorn-bigint plugin. PR-URL: https://github.com/nodejs/node/pull/28649 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
parent
00464b5282
commit
60a207f5f2
21
deps/acorn-plugins/acorn-bigint/CHANGELOG.md
vendored
21
deps/acorn-plugins/acorn-bigint/CHANGELOG.md
vendored
@ -1,21 +0,0 @@
|
|||||||
## 0.4.0 (2019-04-04)
|
|
||||||
|
|
||||||
* Make compatible with acorn-numeric-separator
|
|
||||||
|
|
||||||
## 0.3.1 (2018-10-06)
|
|
||||||
|
|
||||||
* Fix creation of BigInt values everywhere (Thanks, Gus Caplan!)
|
|
||||||
|
|
||||||
## 0.3.0 (2018-09-14)
|
|
||||||
|
|
||||||
* Update to new acorn 6 interface
|
|
||||||
* Actually support creating BigInt values in AST in Chrome
|
|
||||||
* Change license to MIT
|
|
||||||
|
|
||||||
## 0.2.0 (2017-12-20)
|
|
||||||
|
|
||||||
* Emit BigInt values in AST if supported by runtime engine
|
|
||||||
|
|
||||||
## 0.1.0 (2017-12-19)
|
|
||||||
|
|
||||||
Initial release
|
|
19
deps/acorn-plugins/acorn-bigint/LICENSE
vendored
19
deps/acorn-plugins/acorn-bigint/LICENSE
vendored
@ -1,19 +0,0 @@
|
|||||||
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.
|
|
21
deps/acorn-plugins/acorn-bigint/README.md
vendored
21
deps/acorn-plugins/acorn-bigint/README.md
vendored
@ -1,21 +0,0 @@
|
|||||||
# BigInt support for Acorn
|
|
||||||
|
|
||||||
[](https://www.npmjs.org/package/acorn-bigint)
|
|
||||||
|
|
||||||
This is a plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
|
|
||||||
|
|
||||||
It implements support for arbitrary precision integers as defined in the stage 3 proposal [BigInt: Arbitrary precision integers in JavaScript](https://github.com/tc39/proposal-bigint). The emitted AST follows [an ESTree proposal](https://github.com/estree/estree/blob/132be9b9ec376adbc082dd5f6ba78aefd7a1a864/experimental/bigint.md).
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
This module provides a plugin that can be used to extend the Acorn `Parser` class:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
const {Parser} = require('acorn');
|
|
||||||
const bigInt = require('acorn-bigint');
|
|
||||||
Parser.extend(bigInt).parse('100n');
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This plugin is released under an [MIT License](./LICENSE).
|
|
59
deps/acorn-plugins/acorn-bigint/index.js
vendored
59
deps/acorn-plugins/acorn-bigint/index.js
vendored
@ -1,59 +0,0 @@
|
|||||||
"use strict"
|
|
||||||
|
|
||||||
const acorn = require('internal/deps/acorn/acorn/dist/acorn')
|
|
||||||
const tt = acorn.tokTypes
|
|
||||||
const isIdentifierStart = acorn.isIdentifierStart
|
|
||||||
|
|
||||||
module.exports = function(Parser) {
|
|
||||||
return class extends Parser {
|
|
||||||
parseLiteral(value) {
|
|
||||||
const node = super.parseLiteral(value)
|
|
||||||
if (node.raw.charCodeAt(node.raw.length - 1) == 110) node.bigint = this.getNumberInput(node.start, node.end)
|
|
||||||
return node
|
|
||||||
}
|
|
||||||
|
|
||||||
readRadixNumber(radix) {
|
|
||||||
let start = this.pos
|
|
||||||
this.pos += 2 // 0x
|
|
||||||
let val = this.readInt(radix)
|
|
||||||
if (val === null) this.raise(this.start + 2, `Expected number in radix ${radix}`)
|
|
||||||
if (this.input.charCodeAt(this.pos) == 110) {
|
|
||||||
let str = this.getNumberInput(start, this.pos)
|
|
||||||
val = typeof BigInt !== "undefined" ? BigInt(str) : null
|
|
||||||
++this.pos
|
|
||||||
} else if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number")
|
|
||||||
return this.finishToken(tt.num, val)
|
|
||||||
}
|
|
||||||
|
|
||||||
readNumber(startsWithDot) {
|
|
||||||
let start = this.pos
|
|
||||||
|
|
||||||
// Not an int
|
|
||||||
if (startsWithDot) return super.readNumber(startsWithDot)
|
|
||||||
|
|
||||||
// Legacy octal
|
|
||||||
if (this.input.charCodeAt(start) === 48 && this.input.charCodeAt(start + 1) !== 110) {
|
|
||||||
return super.readNumber(startsWithDot)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.readInt(10) === null) this.raise(start, "Invalid number")
|
|
||||||
|
|
||||||
// Not a BigInt, reset and parse again
|
|
||||||
if (this.input.charCodeAt(this.pos) != 110) {
|
|
||||||
this.pos = start
|
|
||||||
return super.readNumber(startsWithDot)
|
|
||||||
}
|
|
||||||
|
|
||||||
let str = this.getNumberInput(start, this.pos)
|
|
||||||
let val = typeof BigInt !== "undefined" ? BigInt(str) : null
|
|
||||||
++this.pos
|
|
||||||
return this.finishToken(tt.num, val)
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is basically a hook for acorn-numeric-separator
|
|
||||||
getNumberInput(start, end) {
|
|
||||||
if (super.getNumberInput) return super.getNumberInput(start, end)
|
|
||||||
return this.input.slice(start, end)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
65
deps/acorn-plugins/acorn-bigint/package.json
vendored
65
deps/acorn-plugins/acorn-bigint/package.json
vendored
@ -1,65 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "acorn-bigint",
|
|
||||||
"_id": "acorn-bigint@0.4.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-W9iaqWzqFo7ZBLmI9dMjHYGrN0Nm/ZgToqhvd3RELJux7RsX6k1/80h+bD9TtTpeKky/kYNbr3+vHWqI3hdyfA==",
|
|
||||||
"_location": "/acorn-bigint",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "tag",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "acorn-bigint",
|
|
||||||
"name": "acorn-bigint",
|
|
||||||
"escapedName": "acorn-bigint",
|
|
||||||
"rawSpec": "",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "latest"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"#USER",
|
|
||||||
"/"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/acorn-bigint/-/acorn-bigint-0.4.0.tgz",
|
|
||||||
"_shasum": "af3245ed8a7c3747387fca4680ae1960f617c4cd",
|
|
||||||
"_spec": "acorn-bigint",
|
|
||||||
"_where": "/home/ruben/repos/node/node",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/acornjs/acorn-bigint/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Adrian Heine",
|
|
||||||
"email": "mail@adrianheine.de"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Support for BigInt in acorn",
|
|
||||||
"devDependencies": {
|
|
||||||
"acorn": "^6.1.1",
|
|
||||||
"eslint": "^5.16.0",
|
|
||||||
"eslint-plugin-node": "^8.0.1",
|
|
||||||
"mocha": "^6.0.2",
|
|
||||||
"test262": "git+https://github.com/tc39/test262.git#611919174ffe060503691a0c7e3eb2a65b646124",
|
|
||||||
"test262-parser-runner": "^0.5.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=4.8.2"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/acornjs/acorn-bigint",
|
|
||||||
"license": "MIT",
|
|
||||||
"name": "acorn-bigint",
|
|
||||||
"peerDependencies": {
|
|
||||||
"acorn": "^6.0.0"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/acornjs/acorn-bigint.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"lint": "eslint -c .eslintrc.json .",
|
|
||||||
"test": "mocha",
|
|
||||||
"test:test262": "node run_test262.js"
|
|
||||||
},
|
|
||||||
"version": "0.4.0"
|
|
||||||
}
|
|
6
deps/acorn/acorn-walk/CHANGELOG.md
vendored
6
deps/acorn/acorn-walk/CHANGELOG.md
vendored
@ -1,3 +1,9 @@
|
|||||||
|
## 6.2.0 (2017-07-04)
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Add support for `Import` nodes.
|
||||||
|
|
||||||
## 6.1.0 (2018-09-28)
|
## 6.1.0 (2018-09-28)
|
||||||
|
|
||||||
### New features
|
### New features
|
||||||
|
2
deps/acorn/acorn-walk/README.md
vendored
2
deps/acorn/acorn-walk/README.md
vendored
@ -6,7 +6,7 @@ An abstract syntax tree walker for the
|
|||||||
## Community
|
## Community
|
||||||
|
|
||||||
Acorn is open source software released under an
|
Acorn is open source software released under an
|
||||||
[MIT license](https://github.com/acornjs/acorn/blob/master/LICENSE).
|
[MIT license](https://github.com/acornjs/acorn/blob/master/acorn-walk/LICENSE).
|
||||||
|
|
||||||
You are welcome to
|
You are welcome to
|
||||||
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
|
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
|
||||||
|
858
deps/acorn/acorn-walk/dist/walk.js
vendored
858
deps/acorn/acorn-walk/dist/walk.js
vendored
@ -1,456 +1,458 @@
|
|||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||||
(factory((global.acorn = global.acorn || {}, global.acorn.walk = {})));
|
(global = global || self, factory((global.acorn = global.acorn || {}, global.acorn.walk = {})));
|
||||||
}(this, (function (exports) { 'use strict';
|
}(this, function (exports) { 'use strict';
|
||||||
|
|
||||||
// AST walker module for Mozilla Parser API compatible trees
|
// AST walker module for Mozilla Parser API compatible trees
|
||||||
|
|
||||||
// A simple walk is one where you simply specify callbacks to be
|
// A simple walk is one where you simply specify callbacks to be
|
||||||
// called on specific nodes. The last two arguments are optional. A
|
// called on specific nodes. The last two arguments are optional. A
|
||||||
// simple use would be
|
// simple use would be
|
||||||
//
|
//
|
||||||
// walk.simple(myTree, {
|
// walk.simple(myTree, {
|
||||||
// Expression: function(node) { ... }
|
// Expression: function(node) { ... }
|
||||||
// });
|
// });
|
||||||
//
|
//
|
||||||
// to do something with all expressions. All Parser API node types
|
// to do something with all expressions. All Parser API node types
|
||||||
// can be used to identify node types, as well as Expression and
|
// can be used to identify node types, as well as Expression and
|
||||||
// Statement, which denote categories of nodes.
|
// Statement, which denote categories of nodes.
|
||||||
//
|
//
|
||||||
// The base argument can be used to pass a custom (recursive)
|
// The base argument can be used to pass a custom (recursive)
|
||||||
// walker, and state can be used to give this walked an initial
|
// walker, and state can be used to give this walked an initial
|
||||||
// state.
|
// state.
|
||||||
|
|
||||||
function simple(node, visitors, baseVisitor, state, override) {
|
function simple(node, visitors, baseVisitor, state, override) {
|
||||||
if (!baseVisitor) { baseVisitor = base
|
if (!baseVisitor) { baseVisitor = base
|
||||||
; }(function c(node, st, override) {
|
; }(function c(node, st, override) {
|
||||||
var type = override || node.type, found = visitors[type];
|
var type = override || node.type, found = visitors[type];
|
||||||
baseVisitor[type](node, st, c);
|
|
||||||
if (found) { found(node, st); }
|
|
||||||
})(node, state, override);
|
|
||||||
}
|
|
||||||
|
|
||||||
// An ancestor walk keeps an array of ancestor nodes (including the
|
|
||||||
// current node) and passes them to the callback as third parameter
|
|
||||||
// (and also as state parameter when no other state is present).
|
|
||||||
function ancestor(node, visitors, baseVisitor, state) {
|
|
||||||
var ancestors = [];
|
|
||||||
if (!baseVisitor) { baseVisitor = base
|
|
||||||
; }(function c(node, st, override) {
|
|
||||||
var type = override || node.type, found = visitors[type];
|
|
||||||
var isNew = node !== ancestors[ancestors.length - 1];
|
|
||||||
if (isNew) { ancestors.push(node); }
|
|
||||||
baseVisitor[type](node, st, c);
|
|
||||||
if (found) { found(node, st || ancestors, ancestors); }
|
|
||||||
if (isNew) { ancestors.pop(); }
|
|
||||||
})(node, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
// A recursive walk is one where your functions override the default
|
|
||||||
// walkers. They can modify and replace the state parameter that's
|
|
||||||
// threaded through the walk, and can opt how and whether to walk
|
|
||||||
// their child nodes (by calling their third argument on these
|
|
||||||
// nodes).
|
|
||||||
function recursive(node, state, funcs, baseVisitor, override) {
|
|
||||||
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor;(function c(node, st, override) {
|
|
||||||
visitor[override || node.type](node, st, c);
|
|
||||||
})(node, state, override);
|
|
||||||
}
|
|
||||||
|
|
||||||
function makeTest(test) {
|
|
||||||
if (typeof test === "string")
|
|
||||||
{ return function (type) { return type === test; } }
|
|
||||||
else if (!test)
|
|
||||||
{ return function () { return true; } }
|
|
||||||
else
|
|
||||||
{ return test }
|
|
||||||
}
|
|
||||||
|
|
||||||
var Found = function Found(node, state) { this.node = node; this.state = state; };
|
|
||||||
|
|
||||||
// A full walk triggers the callback on each node
|
|
||||||
function full(node, callback, baseVisitor, state, override) {
|
|
||||||
if (!baseVisitor) { baseVisitor = base
|
|
||||||
; }(function c(node, st, override) {
|
|
||||||
var type = override || node.type;
|
|
||||||
baseVisitor[type](node, st, c);
|
|
||||||
if (!override) { callback(node, st, type); }
|
|
||||||
})(node, state, override);
|
|
||||||
}
|
|
||||||
|
|
||||||
// An fullAncestor walk is like an ancestor walk, but triggers
|
|
||||||
// the callback on each node
|
|
||||||
function fullAncestor(node, callback, baseVisitor, state) {
|
|
||||||
if (!baseVisitor) { baseVisitor = base; }
|
|
||||||
var ancestors = [];(function c(node, st, override) {
|
|
||||||
var type = override || node.type;
|
|
||||||
var isNew = node !== ancestors[ancestors.length - 1];
|
|
||||||
if (isNew) { ancestors.push(node); }
|
|
||||||
baseVisitor[type](node, st, c);
|
|
||||||
if (!override) { callback(node, st || ancestors, ancestors, type); }
|
|
||||||
if (isNew) { ancestors.pop(); }
|
|
||||||
})(node, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find a node with a given start, end, and type (all are optional,
|
|
||||||
// null can be used as wildcard). Returns a {node, state} object, or
|
|
||||||
// undefined when it doesn't find a matching node.
|
|
||||||
function findNodeAt(node, start, end, test, baseVisitor, state) {
|
|
||||||
if (!baseVisitor) { baseVisitor = base; }
|
|
||||||
test = makeTest(test);
|
|
||||||
try {
|
|
||||||
(function c(node, st, override) {
|
|
||||||
var type = override || node.type;
|
|
||||||
if ((start == null || node.start <= start) &&
|
|
||||||
(end == null || node.end >= end))
|
|
||||||
{ baseVisitor[type](node, st, c); }
|
|
||||||
if ((start == null || node.start === start) &&
|
|
||||||
(end == null || node.end === end) &&
|
|
||||||
test(type, node))
|
|
||||||
{ throw new Found(node, st) }
|
|
||||||
})(node, state);
|
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof Found) { return e }
|
|
||||||
throw e
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the innermost node of a given type that contains the given
|
|
||||||
// position. Interface similar to findNodeAt.
|
|
||||||
function findNodeAround(node, pos, test, baseVisitor, state) {
|
|
||||||
test = makeTest(test);
|
|
||||||
if (!baseVisitor) { baseVisitor = base; }
|
|
||||||
try {
|
|
||||||
(function c(node, st, override) {
|
|
||||||
var type = override || node.type;
|
|
||||||
if (node.start > pos || node.end < pos) { return }
|
|
||||||
baseVisitor[type](node, st, c);
|
baseVisitor[type](node, st, c);
|
||||||
if (test(type, node)) { throw new Found(node, st) }
|
if (found) { found(node, st); }
|
||||||
})(node, state);
|
})(node, state, override);
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof Found) { return e }
|
|
||||||
throw e
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Find the outermost matching node after a given position.
|
// An ancestor walk keeps an array of ancestor nodes (including the
|
||||||
function findNodeAfter(node, pos, test, baseVisitor, state) {
|
// current node) and passes them to the callback as third parameter
|
||||||
test = makeTest(test);
|
// (and also as state parameter when no other state is present).
|
||||||
if (!baseVisitor) { baseVisitor = base; }
|
function ancestor(node, visitors, baseVisitor, state) {
|
||||||
try {
|
var ancestors = [];
|
||||||
(function c(node, st, override) {
|
if (!baseVisitor) { baseVisitor = base
|
||||||
if (node.end < pos) { return }
|
; }(function c(node, st, override) {
|
||||||
|
var type = override || node.type, found = visitors[type];
|
||||||
|
var isNew = node !== ancestors[ancestors.length - 1];
|
||||||
|
if (isNew) { ancestors.push(node); }
|
||||||
|
baseVisitor[type](node, st, c);
|
||||||
|
if (found) { found(node, st || ancestors, ancestors); }
|
||||||
|
if (isNew) { ancestors.pop(); }
|
||||||
|
})(node, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
// A recursive walk is one where your functions override the default
|
||||||
|
// walkers. They can modify and replace the state parameter that's
|
||||||
|
// threaded through the walk, and can opt how and whether to walk
|
||||||
|
// their child nodes (by calling their third argument on these
|
||||||
|
// nodes).
|
||||||
|
function recursive(node, state, funcs, baseVisitor, override) {
|
||||||
|
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor
|
||||||
|
;(function c(node, st, override) {
|
||||||
|
visitor[override || node.type](node, st, c);
|
||||||
|
})(node, state, override);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeTest(test) {
|
||||||
|
if (typeof test === "string")
|
||||||
|
{ return function (type) { return type === test; } }
|
||||||
|
else if (!test)
|
||||||
|
{ return function () { return true; } }
|
||||||
|
else
|
||||||
|
{ return test }
|
||||||
|
}
|
||||||
|
|
||||||
|
var Found = function Found(node, state) { this.node = node; this.state = state; };
|
||||||
|
|
||||||
|
// A full walk triggers the callback on each node
|
||||||
|
function full(node, callback, baseVisitor, state, override) {
|
||||||
|
if (!baseVisitor) { baseVisitor = base
|
||||||
|
; }(function c(node, st, override) {
|
||||||
var type = override || node.type;
|
var type = override || node.type;
|
||||||
if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
|
baseVisitor[type](node, st, c);
|
||||||
|
if (!override) { callback(node, st, type); }
|
||||||
|
})(node, state, override);
|
||||||
|
}
|
||||||
|
|
||||||
|
// An fullAncestor walk is like an ancestor walk, but triggers
|
||||||
|
// the callback on each node
|
||||||
|
function fullAncestor(node, callback, baseVisitor, state) {
|
||||||
|
if (!baseVisitor) { baseVisitor = base; }
|
||||||
|
var ancestors = []
|
||||||
|
;(function c(node, st, override) {
|
||||||
|
var type = override || node.type;
|
||||||
|
var isNew = node !== ancestors[ancestors.length - 1];
|
||||||
|
if (isNew) { ancestors.push(node); }
|
||||||
|
baseVisitor[type](node, st, c);
|
||||||
|
if (!override) { callback(node, st || ancestors, ancestors, type); }
|
||||||
|
if (isNew) { ancestors.pop(); }
|
||||||
|
})(node, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find a node with a given start, end, and type (all are optional,
|
||||||
|
// null can be used as wildcard). Returns a {node, state} object, or
|
||||||
|
// undefined when it doesn't find a matching node.
|
||||||
|
function findNodeAt(node, start, end, test, baseVisitor, state) {
|
||||||
|
if (!baseVisitor) { baseVisitor = base; }
|
||||||
|
test = makeTest(test);
|
||||||
|
try {
|
||||||
|
(function c(node, st, override) {
|
||||||
|
var type = override || node.type;
|
||||||
|
if ((start == null || node.start <= start) &&
|
||||||
|
(end == null || node.end >= end))
|
||||||
|
{ baseVisitor[type](node, st, c); }
|
||||||
|
if ((start == null || node.start === start) &&
|
||||||
|
(end == null || node.end === end) &&
|
||||||
|
test(type, node))
|
||||||
|
{ throw new Found(node, st) }
|
||||||
|
})(node, state);
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof Found) { return e }
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the innermost node of a given type that contains the given
|
||||||
|
// position. Interface similar to findNodeAt.
|
||||||
|
function findNodeAround(node, pos, test, baseVisitor, state) {
|
||||||
|
test = makeTest(test);
|
||||||
|
if (!baseVisitor) { baseVisitor = base; }
|
||||||
|
try {
|
||||||
|
(function c(node, st, override) {
|
||||||
|
var type = override || node.type;
|
||||||
|
if (node.start > pos || node.end < pos) { return }
|
||||||
|
baseVisitor[type](node, st, c);
|
||||||
|
if (test(type, node)) { throw new Found(node, st) }
|
||||||
|
})(node, state);
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof Found) { return e }
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the outermost matching node after a given position.
|
||||||
|
function findNodeAfter(node, pos, test, baseVisitor, state) {
|
||||||
|
test = makeTest(test);
|
||||||
|
if (!baseVisitor) { baseVisitor = base; }
|
||||||
|
try {
|
||||||
|
(function c(node, st, override) {
|
||||||
|
if (node.end < pos) { return }
|
||||||
|
var type = override || node.type;
|
||||||
|
if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
|
||||||
|
baseVisitor[type](node, st, c);
|
||||||
|
})(node, state);
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof Found) { return e }
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the outermost matching node before a given position.
|
||||||
|
function findNodeBefore(node, pos, test, baseVisitor, state) {
|
||||||
|
test = makeTest(test);
|
||||||
|
if (!baseVisitor) { baseVisitor = base; }
|
||||||
|
var max
|
||||||
|
;(function c(node, st, override) {
|
||||||
|
if (node.start > pos) { return }
|
||||||
|
var type = override || node.type;
|
||||||
|
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
|
||||||
|
{ max = new Found(node, st); }
|
||||||
baseVisitor[type](node, st, c);
|
baseVisitor[type](node, st, c);
|
||||||
})(node, state);
|
})(node, state);
|
||||||
} catch (e) {
|
return max
|
||||||
if (e instanceof Found) { return e }
|
|
||||||
throw e
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Find the outermost matching node before a given position.
|
// Fallback to an Object.create polyfill for older environments.
|
||||||
function findNodeBefore(node, pos, test, baseVisitor, state) {
|
var create = Object.create || function(proto) {
|
||||||
test = makeTest(test);
|
function Ctor() {}
|
||||||
if (!baseVisitor) { baseVisitor = base; }
|
Ctor.prototype = proto;
|
||||||
var max;(function c(node, st, override) {
|
return new Ctor
|
||||||
if (node.start > pos) { return }
|
};
|
||||||
var type = override || node.type;
|
|
||||||
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
|
|
||||||
{ max = new Found(node, st); }
|
|
||||||
baseVisitor[type](node, st, c);
|
|
||||||
})(node, state);
|
|
||||||
return max
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback to an Object.create polyfill for older environments.
|
// Used to create a custom walker. Will fill in all missing node
|
||||||
var create = Object.create || function(proto) {
|
// type properties with the defaults.
|
||||||
function Ctor() {}
|
function make(funcs, baseVisitor) {
|
||||||
Ctor.prototype = proto;
|
var visitor = create(baseVisitor || base);
|
||||||
return new Ctor
|
for (var type in funcs) { visitor[type] = funcs[type]; }
|
||||||
};
|
return visitor
|
||||||
|
|
||||||
// Used to create a custom walker. Will fill in all missing node
|
|
||||||
// type properties with the defaults.
|
|
||||||
function make(funcs, baseVisitor) {
|
|
||||||
var visitor = create(baseVisitor || base);
|
|
||||||
for (var type in funcs) { visitor[type] = funcs[type]; }
|
|
||||||
return visitor
|
|
||||||
}
|
|
||||||
|
|
||||||
function skipThrough(node, st, c) { c(node, st); }
|
|
||||||
function ignore(_node, _st, _c) {}
|
|
||||||
|
|
||||||
// Node walkers.
|
|
||||||
|
|
||||||
var base = {};
|
|
||||||
|
|
||||||
base.Program = base.BlockStatement = function (node, st, c) {
|
|
||||||
for (var i = 0, list = node.body; i < list.length; i += 1)
|
|
||||||
{
|
|
||||||
var stmt = list[i];
|
|
||||||
|
|
||||||
c(stmt, st, "Statement");
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
base.Statement = skipThrough;
|
|
||||||
base.EmptyStatement = ignore;
|
|
||||||
base.ExpressionStatement = base.ParenthesizedExpression =
|
|
||||||
function (node, st, c) { return c(node.expression, st, "Expression"); };
|
|
||||||
base.IfStatement = function (node, st, c) {
|
|
||||||
c(node.test, st, "Expression");
|
|
||||||
c(node.consequent, st, "Statement");
|
|
||||||
if (node.alternate) { c(node.alternate, st, "Statement"); }
|
|
||||||
};
|
|
||||||
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
|
|
||||||
base.BreakStatement = base.ContinueStatement = ignore;
|
|
||||||
base.WithStatement = function (node, st, c) {
|
|
||||||
c(node.object, st, "Expression");
|
|
||||||
c(node.body, st, "Statement");
|
|
||||||
};
|
|
||||||
base.SwitchStatement = function (node, st, c) {
|
|
||||||
c(node.discriminant, st, "Expression");
|
|
||||||
for (var i = 0, list = node.cases; i < list.length; i += 1) {
|
|
||||||
var cs = list[i];
|
|
||||||
|
|
||||||
if (cs.test) { c(cs.test, st, "Expression"); }
|
function skipThrough(node, st, c) { c(node, st); }
|
||||||
for (var i$1 = 0, list$1 = cs.consequent; i$1 < list$1.length; i$1 += 1)
|
function ignore(_node, _st, _c) {}
|
||||||
|
|
||||||
|
// Node walkers.
|
||||||
|
|
||||||
|
var base = {};
|
||||||
|
|
||||||
|
base.Program = base.BlockStatement = function (node, st, c) {
|
||||||
|
for (var i = 0, list = node.body; i < list.length; i += 1)
|
||||||
{
|
{
|
||||||
var cons = list$1[i$1];
|
var stmt = list[i];
|
||||||
|
|
||||||
|
c(stmt, st, "Statement");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
base.Statement = skipThrough;
|
||||||
|
base.EmptyStatement = ignore;
|
||||||
|
base.ExpressionStatement = base.ParenthesizedExpression =
|
||||||
|
function (node, st, c) { return c(node.expression, st, "Expression"); };
|
||||||
|
base.IfStatement = function (node, st, c) {
|
||||||
|
c(node.test, st, "Expression");
|
||||||
|
c(node.consequent, st, "Statement");
|
||||||
|
if (node.alternate) { c(node.alternate, st, "Statement"); }
|
||||||
|
};
|
||||||
|
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
|
||||||
|
base.BreakStatement = base.ContinueStatement = ignore;
|
||||||
|
base.WithStatement = function (node, st, c) {
|
||||||
|
c(node.object, st, "Expression");
|
||||||
|
c(node.body, st, "Statement");
|
||||||
|
};
|
||||||
|
base.SwitchStatement = function (node, st, c) {
|
||||||
|
c(node.discriminant, st, "Expression");
|
||||||
|
for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
|
||||||
|
var cs = list$1[i$1];
|
||||||
|
|
||||||
|
if (cs.test) { c(cs.test, st, "Expression"); }
|
||||||
|
for (var i = 0, list = cs.consequent; i < list.length; i += 1)
|
||||||
|
{
|
||||||
|
var cons = list[i];
|
||||||
|
|
||||||
|
c(cons, st, "Statement");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
base.SwitchCase = function (node, st, c) {
|
||||||
|
if (node.test) { c(node.test, st, "Expression"); }
|
||||||
|
for (var i = 0, list = node.consequent; i < list.length; i += 1)
|
||||||
|
{
|
||||||
|
var cons = list[i];
|
||||||
|
|
||||||
c(cons, st, "Statement");
|
c(cons, st, "Statement");
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
|
||||||
base.SwitchCase = function (node, st, c) {
|
if (node.argument) { c(node.argument, st, "Expression"); }
|
||||||
if (node.test) { c(node.test, st, "Expression"); }
|
};
|
||||||
for (var i = 0, list = node.consequent; i < list.length; i += 1)
|
base.ThrowStatement = base.SpreadElement =
|
||||||
{
|
function (node, st, c) { return c(node.argument, st, "Expression"); };
|
||||||
var cons = list[i];
|
base.TryStatement = function (node, st, c) {
|
||||||
|
c(node.block, st, "Statement");
|
||||||
|
if (node.handler) { c(node.handler, st); }
|
||||||
|
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
||||||
|
};
|
||||||
|
base.CatchClause = function (node, st, c) {
|
||||||
|
if (node.param) { c(node.param, st, "Pattern"); }
|
||||||
|
c(node.body, st, "Statement");
|
||||||
|
};
|
||||||
|
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
||||||
|
c(node.test, st, "Expression");
|
||||||
|
c(node.body, st, "Statement");
|
||||||
|
};
|
||||||
|
base.ForStatement = function (node, st, c) {
|
||||||
|
if (node.init) { c(node.init, st, "ForInit"); }
|
||||||
|
if (node.test) { c(node.test, st, "Expression"); }
|
||||||
|
if (node.update) { c(node.update, st, "Expression"); }
|
||||||
|
c(node.body, st, "Statement");
|
||||||
|
};
|
||||||
|
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
||||||
|
c(node.left, st, "ForInit");
|
||||||
|
c(node.right, st, "Expression");
|
||||||
|
c(node.body, st, "Statement");
|
||||||
|
};
|
||||||
|
base.ForInit = function (node, st, c) {
|
||||||
|
if (node.type === "VariableDeclaration") { c(node, st); }
|
||||||
|
else { c(node, st, "Expression"); }
|
||||||
|
};
|
||||||
|
base.DebuggerStatement = ignore;
|
||||||
|
|
||||||
c(cons, st, "Statement");
|
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
|
||||||
}
|
base.VariableDeclaration = function (node, st, c) {
|
||||||
};
|
for (var i = 0, list = node.declarations; i < list.length; i += 1)
|
||||||
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
|
|
||||||
if (node.argument) { c(node.argument, st, "Expression"); }
|
|
||||||
};
|
|
||||||
base.ThrowStatement = base.SpreadElement =
|
|
||||||
function (node, st, c) { return c(node.argument, st, "Expression"); };
|
|
||||||
base.TryStatement = function (node, st, c) {
|
|
||||||
c(node.block, st, "Statement");
|
|
||||||
if (node.handler) { c(node.handler, st); }
|
|
||||||
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
|
||||||
};
|
|
||||||
base.CatchClause = function (node, st, c) {
|
|
||||||
if (node.param) { c(node.param, st, "Pattern"); }
|
|
||||||
c(node.body, st, "Statement");
|
|
||||||
};
|
|
||||||
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
|
||||||
c(node.test, st, "Expression");
|
|
||||||
c(node.body, st, "Statement");
|
|
||||||
};
|
|
||||||
base.ForStatement = function (node, st, c) {
|
|
||||||
if (node.init) { c(node.init, st, "ForInit"); }
|
|
||||||
if (node.test) { c(node.test, st, "Expression"); }
|
|
||||||
if (node.update) { c(node.update, st, "Expression"); }
|
|
||||||
c(node.body, st, "Statement");
|
|
||||||
};
|
|
||||||
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
|
||||||
c(node.left, st, "ForInit");
|
|
||||||
c(node.right, st, "Expression");
|
|
||||||
c(node.body, st, "Statement");
|
|
||||||
};
|
|
||||||
base.ForInit = function (node, st, c) {
|
|
||||||
if (node.type === "VariableDeclaration") { c(node, st); }
|
|
||||||
else { c(node, st, "Expression"); }
|
|
||||||
};
|
|
||||||
base.DebuggerStatement = ignore;
|
|
||||||
|
|
||||||
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
|
|
||||||
base.VariableDeclaration = function (node, st, c) {
|
|
||||||
for (var i = 0, list = node.declarations; i < list.length; i += 1)
|
|
||||||
{
|
|
||||||
var decl = list[i];
|
|
||||||
|
|
||||||
c(decl, st);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
base.VariableDeclarator = function (node, st, c) {
|
|
||||||
c(node.id, st, "Pattern");
|
|
||||||
if (node.init) { c(node.init, st, "Expression"); }
|
|
||||||
};
|
|
||||||
|
|
||||||
base.Function = function (node, st, c) {
|
|
||||||
if (node.id) { c(node.id, st, "Pattern"); }
|
|
||||||
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
||||||
{
|
|
||||||
var param = list[i];
|
|
||||||
|
|
||||||
c(param, st, "Pattern");
|
|
||||||
}
|
|
||||||
c(node.body, st, node.expression ? "Expression" : "Statement");
|
|
||||||
};
|
|
||||||
|
|
||||||
base.Pattern = function (node, st, c) {
|
|
||||||
if (node.type === "Identifier")
|
|
||||||
{ c(node, st, "VariablePattern"); }
|
|
||||||
else if (node.type === "MemberExpression")
|
|
||||||
{ c(node, st, "MemberPattern"); }
|
|
||||||
else
|
|
||||||
{ c(node, st); }
|
|
||||||
};
|
|
||||||
base.VariablePattern = ignore;
|
|
||||||
base.MemberPattern = skipThrough;
|
|
||||||
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
|
|
||||||
base.ArrayPattern = function (node, st, c) {
|
|
||||||
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
|
||||||
var elt = list[i];
|
|
||||||
|
|
||||||
if (elt) { c(elt, st, "Pattern"); }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
base.ObjectPattern = function (node, st, c) {
|
|
||||||
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
|
||||||
var prop = list[i];
|
|
||||||
|
|
||||||
if (prop.type === "Property") {
|
|
||||||
if (prop.computed) { c(prop.key, st, "Expression"); }
|
|
||||||
c(prop.value, st, "Pattern");
|
|
||||||
} else if (prop.type === "RestElement") {
|
|
||||||
c(prop.argument, st, "Pattern");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
base.Expression = skipThrough;
|
|
||||||
base.ThisExpression = base.Super = base.MetaProperty = ignore;
|
|
||||||
base.ArrayExpression = function (node, st, c) {
|
|
||||||
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
|
||||||
var elt = list[i];
|
|
||||||
|
|
||||||
if (elt) { c(elt, st, "Expression"); }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
base.ObjectExpression = function (node, st, c) {
|
|
||||||
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
|
||||||
{
|
|
||||||
var prop = list[i];
|
|
||||||
|
|
||||||
c(prop, st);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
|
|
||||||
base.SequenceExpression = function (node, st, c) {
|
|
||||||
for (var i = 0, list = node.expressions; i < list.length; i += 1)
|
|
||||||
{
|
|
||||||
var expr = list[i];
|
|
||||||
|
|
||||||
c(expr, st, "Expression");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
base.TemplateLiteral = function (node, st, c) {
|
|
||||||
for (var i = 0, list = node.quasis; i < list.length; i += 1)
|
|
||||||
{
|
|
||||||
var quasi = list[i];
|
|
||||||
|
|
||||||
c(quasi, st);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
|
|
||||||
{
|
|
||||||
var expr = list$1[i$1];
|
|
||||||
|
|
||||||
c(expr, st, "Expression");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
base.TemplateElement = ignore;
|
|
||||||
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
|
|
||||||
c(node.argument, st, "Expression");
|
|
||||||
};
|
|
||||||
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
|
|
||||||
c(node.left, st, "Expression");
|
|
||||||
c(node.right, st, "Expression");
|
|
||||||
};
|
|
||||||
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
|
|
||||||
c(node.left, st, "Pattern");
|
|
||||||
c(node.right, st, "Expression");
|
|
||||||
};
|
|
||||||
base.ConditionalExpression = function (node, st, c) {
|
|
||||||
c(node.test, st, "Expression");
|
|
||||||
c(node.consequent, st, "Expression");
|
|
||||||
c(node.alternate, st, "Expression");
|
|
||||||
};
|
|
||||||
base.NewExpression = base.CallExpression = function (node, st, c) {
|
|
||||||
c(node.callee, st, "Expression");
|
|
||||||
if (node.arguments)
|
|
||||||
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
|
|
||||||
{
|
{
|
||||||
var arg = list[i];
|
var decl = list[i];
|
||||||
|
|
||||||
c(arg, st, "Expression");
|
c(decl, st);
|
||||||
} }
|
}
|
||||||
};
|
};
|
||||||
base.MemberExpression = function (node, st, c) {
|
base.VariableDeclarator = function (node, st, c) {
|
||||||
c(node.object, st, "Expression");
|
c(node.id, st, "Pattern");
|
||||||
if (node.computed) { c(node.property, st, "Expression"); }
|
if (node.init) { c(node.init, st, "Expression"); }
|
||||||
};
|
};
|
||||||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
|
||||||
if (node.declaration)
|
|
||||||
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
|
||||||
if (node.source) { c(node.source, st, "Expression"); }
|
|
||||||
};
|
|
||||||
base.ExportAllDeclaration = function (node, st, c) {
|
|
||||||
c(node.source, st, "Expression");
|
|
||||||
};
|
|
||||||
base.ImportDeclaration = function (node, st, c) {
|
|
||||||
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
|
|
||||||
{
|
|
||||||
var spec = list[i];
|
|
||||||
|
|
||||||
c(spec, st);
|
base.Function = function (node, st, c) {
|
||||||
}
|
if (node.id) { c(node.id, st, "Pattern"); }
|
||||||
c(node.source, st, "Expression");
|
for (var i = 0, list = node.params; i < list.length; i += 1)
|
||||||
};
|
{
|
||||||
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
|
var param = list[i];
|
||||||
|
|
||||||
base.TaggedTemplateExpression = function (node, st, c) {
|
c(param, st, "Pattern");
|
||||||
c(node.tag, st, "Expression");
|
}
|
||||||
c(node.quasi, st, "Expression");
|
c(node.body, st, node.expression ? "Expression" : "Statement");
|
||||||
};
|
};
|
||||||
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
|
|
||||||
base.Class = function (node, st, c) {
|
|
||||||
if (node.id) { c(node.id, st, "Pattern"); }
|
|
||||||
if (node.superClass) { c(node.superClass, st, "Expression"); }
|
|
||||||
c(node.body, st);
|
|
||||||
};
|
|
||||||
base.ClassBody = function (node, st, c) {
|
|
||||||
for (var i = 0, list = node.body; i < list.length; i += 1)
|
|
||||||
{
|
|
||||||
var elt = list[i];
|
|
||||||
|
|
||||||
c(elt, st);
|
base.Pattern = function (node, st, c) {
|
||||||
}
|
if (node.type === "Identifier")
|
||||||
};
|
{ c(node, st, "VariablePattern"); }
|
||||||
base.MethodDefinition = base.Property = function (node, st, c) {
|
else if (node.type === "MemberExpression")
|
||||||
if (node.computed) { c(node.key, st, "Expression"); }
|
{ c(node, st, "MemberPattern"); }
|
||||||
c(node.value, st, "Expression");
|
else
|
||||||
};
|
{ c(node, st); }
|
||||||
|
};
|
||||||
|
base.VariablePattern = ignore;
|
||||||
|
base.MemberPattern = skipThrough;
|
||||||
|
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
|
||||||
|
base.ArrayPattern = function (node, st, c) {
|
||||||
|
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
||||||
|
var elt = list[i];
|
||||||
|
|
||||||
exports.simple = simple;
|
if (elt) { c(elt, st, "Pattern"); }
|
||||||
exports.ancestor = ancestor;
|
}
|
||||||
exports.recursive = recursive;
|
};
|
||||||
exports.full = full;
|
base.ObjectPattern = function (node, st, c) {
|
||||||
exports.fullAncestor = fullAncestor;
|
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
||||||
exports.findNodeAt = findNodeAt;
|
var prop = list[i];
|
||||||
exports.findNodeAround = findNodeAround;
|
|
||||||
exports.findNodeAfter = findNodeAfter;
|
|
||||||
exports.findNodeBefore = findNodeBefore;
|
|
||||||
exports.make = make;
|
|
||||||
exports.base = base;
|
|
||||||
|
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
if (prop.type === "Property") {
|
||||||
|
if (prop.computed) { c(prop.key, st, "Expression"); }
|
||||||
|
c(prop.value, st, "Pattern");
|
||||||
|
} else if (prop.type === "RestElement") {
|
||||||
|
c(prop.argument, st, "Pattern");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
})));
|
base.Expression = skipThrough;
|
||||||
//# sourceMappingURL=walk.js.map
|
base.ThisExpression = base.Super = base.MetaProperty = ignore;
|
||||||
|
base.ArrayExpression = function (node, st, c) {
|
||||||
|
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
||||||
|
var elt = list[i];
|
||||||
|
|
||||||
|
if (elt) { c(elt, st, "Expression"); }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
base.ObjectExpression = function (node, st, c) {
|
||||||
|
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
||||||
|
{
|
||||||
|
var prop = list[i];
|
||||||
|
|
||||||
|
c(prop, st);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
|
||||||
|
base.SequenceExpression = function (node, st, c) {
|
||||||
|
for (var i = 0, list = node.expressions; i < list.length; i += 1)
|
||||||
|
{
|
||||||
|
var expr = list[i];
|
||||||
|
|
||||||
|
c(expr, st, "Expression");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
base.TemplateLiteral = function (node, st, c) {
|
||||||
|
for (var i = 0, list = node.quasis; i < list.length; i += 1)
|
||||||
|
{
|
||||||
|
var quasi = list[i];
|
||||||
|
|
||||||
|
c(quasi, st);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
|
||||||
|
{
|
||||||
|
var expr = list$1[i$1];
|
||||||
|
|
||||||
|
c(expr, st, "Expression");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
base.TemplateElement = ignore;
|
||||||
|
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
|
||||||
|
c(node.argument, st, "Expression");
|
||||||
|
};
|
||||||
|
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
|
||||||
|
c(node.left, st, "Expression");
|
||||||
|
c(node.right, st, "Expression");
|
||||||
|
};
|
||||||
|
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
|
||||||
|
c(node.left, st, "Pattern");
|
||||||
|
c(node.right, st, "Expression");
|
||||||
|
};
|
||||||
|
base.ConditionalExpression = function (node, st, c) {
|
||||||
|
c(node.test, st, "Expression");
|
||||||
|
c(node.consequent, st, "Expression");
|
||||||
|
c(node.alternate, st, "Expression");
|
||||||
|
};
|
||||||
|
base.NewExpression = base.CallExpression = function (node, st, c) {
|
||||||
|
c(node.callee, st, "Expression");
|
||||||
|
if (node.arguments)
|
||||||
|
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
|
||||||
|
{
|
||||||
|
var arg = list[i];
|
||||||
|
|
||||||
|
c(arg, st, "Expression");
|
||||||
|
} }
|
||||||
|
};
|
||||||
|
base.MemberExpression = function (node, st, c) {
|
||||||
|
c(node.object, st, "Expression");
|
||||||
|
if (node.computed) { c(node.property, st, "Expression"); }
|
||||||
|
};
|
||||||
|
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
||||||
|
if (node.declaration)
|
||||||
|
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
||||||
|
if (node.source) { c(node.source, st, "Expression"); }
|
||||||
|
};
|
||||||
|
base.ExportAllDeclaration = function (node, st, c) {
|
||||||
|
c(node.source, st, "Expression");
|
||||||
|
};
|
||||||
|
base.ImportDeclaration = function (node, st, c) {
|
||||||
|
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
|
||||||
|
{
|
||||||
|
var spec = list[i];
|
||||||
|
|
||||||
|
c(spec, st);
|
||||||
|
}
|
||||||
|
c(node.source, st, "Expression");
|
||||||
|
};
|
||||||
|
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = base.Import = ignore;
|
||||||
|
|
||||||
|
base.TaggedTemplateExpression = function (node, st, c) {
|
||||||
|
c(node.tag, st, "Expression");
|
||||||
|
c(node.quasi, st, "Expression");
|
||||||
|
};
|
||||||
|
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
|
||||||
|
base.Class = function (node, st, c) {
|
||||||
|
if (node.id) { c(node.id, st, "Pattern"); }
|
||||||
|
if (node.superClass) { c(node.superClass, st, "Expression"); }
|
||||||
|
c(node.body, st);
|
||||||
|
};
|
||||||
|
base.ClassBody = function (node, st, c) {
|
||||||
|
for (var i = 0, list = node.body; i < list.length; i += 1)
|
||||||
|
{
|
||||||
|
var elt = list[i];
|
||||||
|
|
||||||
|
c(elt, st);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
base.MethodDefinition = base.Property = function (node, st, c) {
|
||||||
|
if (node.computed) { c(node.key, st, "Expression"); }
|
||||||
|
c(node.value, st, "Expression");
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.ancestor = ancestor;
|
||||||
|
exports.base = base;
|
||||||
|
exports.findNodeAfter = findNodeAfter;
|
||||||
|
exports.findNodeAround = findNodeAround;
|
||||||
|
exports.findNodeAt = findNodeAt;
|
||||||
|
exports.findNodeBefore = findNodeBefore;
|
||||||
|
exports.full = full;
|
||||||
|
exports.fullAncestor = fullAncestor;
|
||||||
|
exports.make = make;
|
||||||
|
exports.recursive = recursive;
|
||||||
|
exports.simple = simple;
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
}));
|
||||||
|
2
deps/acorn/acorn-walk/package.json
vendored
2
deps/acorn/acorn-walk/package.json
vendored
@ -4,7 +4,7 @@
|
|||||||
"homepage": "https://github.com/acornjs/acorn",
|
"homepage": "https://github.com/acornjs/acorn",
|
||||||
"main": "dist/walk.js",
|
"main": "dist/walk.js",
|
||||||
"module": "dist/walk.mjs",
|
"module": "dist/walk.mjs",
|
||||||
"version": "6.1.1",
|
"version": "6.2.0",
|
||||||
"engines": {"node": ">=0.4.0"},
|
"engines": {"node": ">=0.4.0"},
|
||||||
"maintainers": [
|
"maintainers": [
|
||||||
{
|
{
|
||||||
|
22
deps/acorn/acorn/CHANGELOG.md
vendored
22
deps/acorn/acorn/CHANGELOG.md
vendored
@ -1,3 +1,25 @@
|
|||||||
|
## 6.2.0 (2019-07-04)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Improve valid assignment checking in `for`/`in` and `for`/`of` loops.
|
||||||
|
|
||||||
|
Disallow binding `let` in patterns.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Support bigint syntax with `ecmaVersion` >= 10.
|
||||||
|
|
||||||
|
Support dynamic `import` syntax with `ecmaVersion` >= 10.
|
||||||
|
|
||||||
|
Upgrade to Unicode version 12.
|
||||||
|
|
||||||
|
## 6.1.1 (2019-02-27)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix bug that caused parsing default exports of with names to fail.
|
||||||
|
|
||||||
## 6.1.0 (2019-02-08)
|
## 6.1.0 (2019-02-08)
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
11
deps/acorn/acorn/README.md
vendored
11
deps/acorn/acorn/README.md
vendored
@ -54,7 +54,7 @@ an object containing any of these fields:
|
|||||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||||
either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018) or 10 (2019, partial
|
either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018) or 10 (2019, partial
|
||||||
support). This influences support for strict mode, the set of
|
support). This influences support for strict mode, the set of
|
||||||
reserved words, and support for new syntax features. Default is 7.
|
reserved words, and support for new syntax features. Default is 9.
|
||||||
|
|
||||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||||
implemented by Acorn. Other proposed new features can be implemented
|
implemented by Acorn. Other proposed new features can be implemented
|
||||||
@ -86,7 +86,7 @@ an object containing any of these fields:
|
|||||||
- **allowImportExportEverywhere**: By default, `import` and `export`
|
- **allowImportExportEverywhere**: By default, `import` and `export`
|
||||||
declarations can only appear at a program's top level. Setting this
|
declarations can only appear at a program's top level. Setting this
|
||||||
option to `true` allows them anywhere where a statement is allowed.
|
option to `true` allows them anywhere where a statement is allowed.
|
||||||
|
|
||||||
- **allowAwaitOutsideFunction**: By default, `await` expressions can
|
- **allowAwaitOutsideFunction**: By default, `await` expressions can
|
||||||
only appear inside `async` functions. Setting this option to
|
only appear inside `async` functions. Setting this option to
|
||||||
`true` allows to have top-level `await` expressions. They are
|
`true` allows to have top-level `await` expressions. They are
|
||||||
@ -256,14 +256,11 @@ The utility spits out the syntax tree as JSON data.
|
|||||||
## Existing plugins
|
## Existing plugins
|
||||||
|
|
||||||
- [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
|
- [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
|
||||||
|
|
||||||
Plugins for ECMAScript proposals:
|
Plugins for ECMAScript proposals:
|
||||||
|
|
||||||
- [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling:
|
- [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling:
|
||||||
- [`acorn-async-iteration`](https://github.com/acornjs/acorn-async-iteration): Parse [async iteration proposal](https://github.com/tc39/proposal-async-iteration)
|
|
||||||
- [`acorn-bigint`](https://github.com/acornjs/acorn-bigint): Parse [BigInt proposal](https://github.com/tc39/proposal-bigint)
|
|
||||||
- [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields)
|
- [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields)
|
||||||
- [`acorn-dynamic-import`](https://github.com/kesne/acorn-dynamic-import): Parse [import() proposal](https://github.com/tc39/proposal-dynamic-import)
|
|
||||||
- [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta)
|
- [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta)
|
||||||
- [`acorn-numeric-separator`](https://github.com/acornjs/acorn-numeric-separator): Parse [numeric separator proposal](https://github.com/tc39/proposal-numeric-separator)
|
- [`acorn-numeric-separator`](https://github.com/acornjs/acorn-numeric-separator): Parse [numeric separator proposal](https://github.com/tc39/proposal-numeric-separator)
|
||||||
- [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n
|
- [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n
|
||||||
|
9380
deps/acorn/acorn/dist/acorn.js
vendored
9380
deps/acorn/acorn/dist/acorn.js
vendored
File diff suppressed because it is too large
Load Diff
2
deps/acorn/acorn/package.json
vendored
2
deps/acorn/acorn/package.json
vendored
@ -4,7 +4,7 @@
|
|||||||
"homepage": "https://github.com/acornjs/acorn",
|
"homepage": "https://github.com/acornjs/acorn",
|
||||||
"main": "dist/acorn.js",
|
"main": "dist/acorn.js",
|
||||||
"module": "dist/acorn.mjs",
|
"module": "dist/acorn.mjs",
|
||||||
"version": "6.1.0",
|
"version": "6.2.0",
|
||||||
"engines": {"node": ">=0.4.0"},
|
"engines": {"node": ">=0.4.0"},
|
||||||
"maintainers": [
|
"maintainers": [
|
||||||
{
|
{
|
||||||
|
@ -204,7 +204,6 @@ function parseCode(code, offset) {
|
|||||||
const acorn = require('internal/deps/acorn/acorn/dist/acorn');
|
const acorn = require('internal/deps/acorn/acorn/dist/acorn');
|
||||||
const privateMethods =
|
const privateMethods =
|
||||||
require('internal/deps/acorn-plugins/acorn-private-methods/index');
|
require('internal/deps/acorn-plugins/acorn-private-methods/index');
|
||||||
const bigInt = require('internal/deps/acorn-plugins/acorn-bigint/index');
|
|
||||||
const classFields =
|
const classFields =
|
||||||
require('internal/deps/acorn-plugins/acorn-class-fields/index');
|
require('internal/deps/acorn-plugins/acorn-class-fields/index');
|
||||||
const numericSeparator =
|
const numericSeparator =
|
||||||
@ -216,7 +215,6 @@ function parseCode(code, offset) {
|
|||||||
|
|
||||||
const Parser = acorn.Parser.extend(
|
const Parser = acorn.Parser.extend(
|
||||||
privateMethods,
|
privateMethods,
|
||||||
bigInt,
|
|
||||||
classFields,
|
classFields,
|
||||||
numericSeparator,
|
numericSeparator,
|
||||||
staticClassFeatures
|
staticClassFeatures
|
||||||
@ -228,7 +226,7 @@ function parseCode(code, offset) {
|
|||||||
// Parse the read code until the correct expression is found.
|
// Parse the read code until the correct expression is found.
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
node = parseExpressionAt(code, start);
|
node = parseExpressionAt(code, start, { ecmaVersion: 11 });
|
||||||
start = node.end + 1 || start;
|
start = node.end + 1 || start;
|
||||||
// Find the CallExpression in the tree.
|
// Find the CallExpression in the tree.
|
||||||
node = findNodeAround(node, offset, 'CallExpression');
|
node = findNodeAround(node, offset, 'CallExpression');
|
||||||
|
@ -6,7 +6,6 @@ const acorn = require('internal/deps/acorn/acorn/dist/acorn');
|
|||||||
const walk = require('internal/deps/acorn/acorn-walk/dist/walk');
|
const walk = require('internal/deps/acorn/acorn-walk/dist/walk');
|
||||||
const privateMethods =
|
const privateMethods =
|
||||||
require('internal/deps/acorn-plugins/acorn-private-methods/index');
|
require('internal/deps/acorn-plugins/acorn-private-methods/index');
|
||||||
const bigInt = require('internal/deps/acorn-plugins/acorn-bigint/index');
|
|
||||||
const classFields =
|
const classFields =
|
||||||
require('internal/deps/acorn-plugins/acorn-class-fields/index');
|
require('internal/deps/acorn-plugins/acorn-class-fields/index');
|
||||||
const numericSeparator =
|
const numericSeparator =
|
||||||
@ -16,7 +15,6 @@ const staticClassFeatures =
|
|||||||
|
|
||||||
const parser = acorn.Parser.extend(
|
const parser = acorn.Parser.extend(
|
||||||
privateMethods,
|
privateMethods,
|
||||||
bigInt,
|
|
||||||
classFields,
|
classFields,
|
||||||
numericSeparator,
|
numericSeparator,
|
||||||
staticClassFeatures
|
staticClassFeatures
|
||||||
@ -93,7 +91,7 @@ function processTopLevelAwait(src) {
|
|||||||
const wrappedArray = wrapped.split('');
|
const wrappedArray = wrapped.split('');
|
||||||
let root;
|
let root;
|
||||||
try {
|
try {
|
||||||
root = parser.parse(wrapped, { ecmaVersion: 10 });
|
root = parser.parse(wrapped, { ecmaVersion: 11 });
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
const acorn = require('internal/deps/acorn/acorn/dist/acorn');
|
const acorn = require('internal/deps/acorn/acorn/dist/acorn');
|
||||||
const privateMethods =
|
const privateMethods =
|
||||||
require('internal/deps/acorn-plugins/acorn-private-methods/index');
|
require('internal/deps/acorn-plugins/acorn-private-methods/index');
|
||||||
const bigInt = require('internal/deps/acorn-plugins/acorn-bigint/index');
|
|
||||||
const classFields =
|
const classFields =
|
||||||
require('internal/deps/acorn-plugins/acorn-class-fields/index');
|
require('internal/deps/acorn-plugins/acorn-class-fields/index');
|
||||||
const numericSeparator =
|
const numericSeparator =
|
||||||
@ -44,7 +43,6 @@ function isRecoverableError(e, code) {
|
|||||||
const RecoverableParser = AcornParser
|
const RecoverableParser = AcornParser
|
||||||
.extend(
|
.extend(
|
||||||
privateMethods,
|
privateMethods,
|
||||||
bigInt,
|
|
||||||
classFields,
|
classFields,
|
||||||
numericSeparator,
|
numericSeparator,
|
||||||
staticClassFeatures,
|
staticClassFeatures,
|
||||||
@ -78,7 +76,7 @@ function isRecoverableError(e, code) {
|
|||||||
// Try to parse the code with acorn. If the parse fails, ignore the acorn
|
// Try to parse the code with acorn. If the parse fails, ignore the acorn
|
||||||
// error and return the recoverable status.
|
// error and return the recoverable status.
|
||||||
try {
|
try {
|
||||||
RecoverableParser.parse(code, { ecmaVersion: 10 });
|
RecoverableParser.parse(code, { ecmaVersion: 11 });
|
||||||
|
|
||||||
// Odd case: the underlying JS engine (V8, Chakra) rejected this input
|
// Odd case: the underlying JS engine (V8, Chakra) rejected this input
|
||||||
// but Acorn detected no issue. Presume that additional text won't
|
// but Acorn detected no issue. Presume that additional text won't
|
||||||
|
1
node.gyp
1
node.gyp
@ -223,7 +223,6 @@
|
|||||||
'deps/node-inspect/lib/internal/inspect_repl.js',
|
'deps/node-inspect/lib/internal/inspect_repl.js',
|
||||||
'deps/acorn/acorn/dist/acorn.js',
|
'deps/acorn/acorn/dist/acorn.js',
|
||||||
'deps/acorn/acorn-walk/dist/walk.js',
|
'deps/acorn/acorn-walk/dist/walk.js',
|
||||||
'deps/acorn-plugins/acorn-bigint/index.js',
|
|
||||||
'deps/acorn-plugins/acorn-class-fields/index.js',
|
'deps/acorn-plugins/acorn-class-fields/index.js',
|
||||||
'deps/acorn-plugins/acorn-numeric-separator/index.js',
|
'deps/acorn-plugins/acorn-numeric-separator/index.js',
|
||||||
'deps/acorn-plugins/acorn-private-class-elements/index.js',
|
'deps/acorn-plugins/acorn-private-class-elements/index.js',
|
||||||
|
@ -30,7 +30,7 @@ fi
|
|||||||
|
|
||||||
# Dependencies bundled in distributions
|
# Dependencies bundled in distributions
|
||||||
addlicense "Acorn" "deps/acorn" "$(cat ${rootdir}/deps/acorn/acorn/LICENSE)"
|
addlicense "Acorn" "deps/acorn" "$(cat ${rootdir}/deps/acorn/acorn/LICENSE)"
|
||||||
addlicense "Acorn plugins" "deps/acorn-plugins" "$(cat ${rootdir}/deps/acorn-plugins/acorn-bigint/LICENSE)"
|
addlicense "Acorn plugins" "deps/acorn-plugins" "$(cat ${rootdir}/deps/acorn-plugins/acorn-class-fields/LICENSE)"
|
||||||
addlicense "c-ares" "deps/cares" "$(tail -n +3 ${rootdir}/deps/cares/LICENSE.md)"
|
addlicense "c-ares" "deps/cares" "$(tail -n +3 ${rootdir}/deps/cares/LICENSE.md)"
|
||||||
addlicense "HTTP Parser" "deps/http_parser" "$(cat deps/http_parser/LICENSE-MIT)"
|
addlicense "HTTP Parser" "deps/http_parser" "$(cat deps/http_parser/LICENSE-MIT)"
|
||||||
if [ -f "${rootdir}/deps/icu/LICENSE" ]; then
|
if [ -f "${rootdir}/deps/icu/LICENSE" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user