jass 0.9.1 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jass.rb +5 -0
- data/lib/jass/compiler.rb +5 -0
- data/lib/jass/plugin.rb +2 -1
- data/lib/jass/version.rb +1 -1
- data/vendor/node_modules/@types/estree/index.d.ts +4 -2
- data/vendor/node_modules/@types/estree/package.json +2 -2
- data/vendor/node_modules/acorn/bin/_acorn.js +12 -12
- data/vendor/node_modules/acorn/bin/run_test262.js +2 -3
- data/vendor/node_modules/acorn/bin/test262.whitelist +0 -5
- data/vendor/node_modules/acorn/dist/acorn.es.js +76 -68
- data/vendor/node_modules/acorn/dist/acorn.js +76 -68
- data/vendor/node_modules/acorn/dist/acorn_loose.es.js +42 -30
- data/vendor/node_modules/acorn/dist/acorn_loose.js +42 -30
- data/vendor/node_modules/acorn/dist/walk.es.js +47 -43
- data/vendor/node_modules/acorn/dist/walk.js +47 -43
- data/vendor/node_modules/acorn/package.json +9 -5
- data/vendor/node_modules/chalk/index.js.flow +93 -0
- data/vendor/node_modules/chalk/package.json +8 -3
- data/vendor/node_modules/color-convert/conversions.js +36 -29
- data/vendor/node_modules/color-convert/package.json +4 -4
- data/vendor/node_modules/estree-walker/index.d.ts +17 -0
- data/vendor/node_modules/estree-walker/package.json +2 -1
- data/vendor/node_modules/fill-range/index.js +2 -2
- data/vendor/node_modules/fill-range/package.json +24 -7
- data/vendor/node_modules/is-reference/node_modules/@types/estree/index.d.ts +546 -0
- data/vendor/node_modules/is-reference/node_modules/@types/estree/package.json +22 -0
- data/vendor/node_modules/math-random/browser.js +17 -0
- data/vendor/node_modules/math-random/node.js +13 -0
- data/vendor/node_modules/math-random/package.json +31 -0
- data/vendor/node_modules/math-random/test.js +26 -0
- data/vendor/node_modules/nodent-compiler/compiler.js +115 -11
- data/vendor/node_modules/nodent-compiler/{lib/output.js → output.js} +0 -0
- data/vendor/node_modules/nodent-compiler/package.json +8 -4
- data/vendor/node_modules/{nodent-compiler/lib → nodent-transform}/arboriculture.js +1340 -1107
- data/vendor/node_modules/nodent-transform/package.json +19 -0
- data/vendor/node_modules/path-parse/package.json +1 -1
- data/vendor/node_modules/pretty-ms/index.js +2 -1
- data/vendor/node_modules/pretty-ms/package.json +2 -3
- data/vendor/node_modules/randomatic/index.js +12 -2
- data/vendor/node_modules/randomatic/node_modules/is-number/index.js +6 -7
- data/vendor/node_modules/randomatic/node_modules/is-number/package.json +9 -16
- data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +112 -102
- data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +18 -20
- data/vendor/node_modules/randomatic/package.json +15 -13
- data/vendor/node_modules/repeat-element/index.js +1 -1
- data/vendor/node_modules/repeat-element/package.json +27 -22
- data/vendor/node_modules/resolve/lib/async.js +20 -17
- data/vendor/node_modules/resolve/lib/core.js +2 -2
- data/vendor/node_modules/resolve/lib/core.json +4 -1
- data/vendor/node_modules/resolve/lib/sync.js +52 -13
- data/vendor/node_modules/resolve/package.json +3 -3
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js +50 -12
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js +50 -12
- data/vendor/node_modules/rollup-plugin-commonjs/package.json +2 -2
- data/vendor/node_modules/rollup-plugin-commonjs/src/index.js +49 -11
- data/vendor/node_modules/rollup-plugin-commonjs/src/transform.js +1 -1
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js +82 -85
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.es.js +82 -85
- data/vendor/node_modules/rollup-plugin-node-resolve/package.json +1 -1
- data/vendor/node_modules/rollup-plugin-node-resolve/src/index.js +81 -84
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +81 -2
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +81 -3
- data/vendor/node_modules/rollup-pluginutils/package.json +12 -6
- data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +10 -2
- data/vendor/node_modules/rollup-pluginutils/src/dataToEsm.js +69 -0
- data/vendor/node_modules/rollup-pluginutils/src/index.js +1 -0
- data/vendor/node_modules/supports-color/index.js +1 -5
- data/vendor/node_modules/supports-color/package.json +51 -51
- data/vendor/yarn.lock +65 -70
- metadata +16 -21
- data/vendor/node_modules/irregular-plurals/irregular-plurals.json +0 -146
- data/vendor/node_modules/irregular-plurals/package.json +0 -39
- data/vendor/node_modules/nodent-compiler/lib/parser.js +0 -291
- data/vendor/node_modules/path-parse/index.min.js +0 -1
- data/vendor/node_modules/path-parse/test.min.js +0 -1
- data/vendor/node_modules/plur/index.js +0 -20
- data/vendor/node_modules/plur/package.json +0 -42
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +0 -116
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +0 -90
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +0 -217
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js +0 -55
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js +0 -59
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js +0 -65
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json +0 -33
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js +0 -49
@@ -16,11 +16,11 @@
|
|
16
16
|
// walker, and state can be used to give this walked an initial
|
17
17
|
// state.
|
18
18
|
|
19
|
-
function simple(node, visitors,
|
20
|
-
if (!
|
19
|
+
function simple(node, visitors, baseVisitor, state, override) {
|
20
|
+
if (!baseVisitor) { baseVisitor = base
|
21
21
|
; }(function c(node, st, override) {
|
22
22
|
var type = override || node.type, found = visitors[type];
|
23
|
-
|
23
|
+
baseVisitor[type](node, st, c);
|
24
24
|
if (found) { found(node, st); }
|
25
25
|
})(node, state, override);
|
26
26
|
}
|
@@ -28,13 +28,14 @@ function simple(node, visitors, base, state, override) {
|
|
28
28
|
// An ancestor walk keeps an array of ancestor nodes (including the
|
29
29
|
// current node) and passes them to the callback as third parameter
|
30
30
|
// (and also as state parameter when no other state is present).
|
31
|
-
function ancestor(node, visitors,
|
32
|
-
|
33
|
-
|
31
|
+
function ancestor(node, visitors, baseVisitor, state) {
|
32
|
+
var ancestors = [];
|
33
|
+
if (!baseVisitor) { baseVisitor = base
|
34
|
+
; }(function c(node, st, override) {
|
34
35
|
var type = override || node.type, found = visitors[type];
|
35
|
-
var isNew = node
|
36
|
+
var isNew = node !== ancestors[ancestors.length - 1];
|
36
37
|
if (isNew) { ancestors.push(node); }
|
37
|
-
|
38
|
+
baseVisitor[type](node, st, c);
|
38
39
|
if (found) { found(node, st || ancestors, ancestors); }
|
39
40
|
if (isNew) { ancestors.pop(); }
|
40
41
|
})(node, state);
|
@@ -45,15 +46,15 @@ function ancestor(node, visitors, base, state) {
|
|
45
46
|
// threaded through the walk, and can opt how and whether to walk
|
46
47
|
// their child nodes (by calling their third argument on these
|
47
48
|
// nodes).
|
48
|
-
function recursive(node, state, funcs,
|
49
|
-
var visitor = funcs ?
|
49
|
+
function recursive(node, state, funcs, baseVisitor, override) {
|
50
|
+
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor;(function c(node, st, override) {
|
50
51
|
visitor[override || node.type](node, st, c);
|
51
52
|
})(node, state, override);
|
52
53
|
}
|
53
54
|
|
54
55
|
function makeTest(test) {
|
55
|
-
if (typeof test
|
56
|
-
{ return function (type) { return type
|
56
|
+
if (typeof test === "string")
|
57
|
+
{ return function (type) { return type === test; } }
|
57
58
|
else if (!test)
|
58
59
|
{ return function () { return true; } }
|
59
60
|
else
|
@@ -63,24 +64,24 @@ function makeTest(test) {
|
|
63
64
|
var Found = function Found(node, state) { this.node = node; this.state = state; };
|
64
65
|
|
65
66
|
// A full walk triggers the callback on each node
|
66
|
-
function full(node, callback,
|
67
|
-
if (!
|
67
|
+
function full(node, callback, baseVisitor, state, override) {
|
68
|
+
if (!baseVisitor) { baseVisitor = base
|
68
69
|
; }(function c(node, st, override) {
|
69
70
|
var type = override || node.type;
|
70
|
-
|
71
|
+
baseVisitor[type](node, st, c);
|
71
72
|
if (!override) { callback(node, st, type); }
|
72
73
|
})(node, state, override);
|
73
74
|
}
|
74
75
|
|
75
76
|
// An fullAncestor walk is like an ancestor walk, but triggers
|
76
77
|
// the callback on each node
|
77
|
-
function fullAncestor(node, callback,
|
78
|
-
if (!
|
78
|
+
function fullAncestor(node, callback, baseVisitor, state) {
|
79
|
+
if (!baseVisitor) { baseVisitor = base; }
|
79
80
|
var ancestors = [];(function c(node, st, override) {
|
80
81
|
var type = override || node.type;
|
81
|
-
var isNew = node
|
82
|
+
var isNew = node !== ancestors[ancestors.length - 1];
|
82
83
|
if (isNew) { ancestors.push(node); }
|
83
|
-
|
84
|
+
baseVisitor[type](node, st, c);
|
84
85
|
if (!override) { callback(node, st || ancestors, ancestors, type); }
|
85
86
|
if (isNew) { ancestors.pop(); }
|
86
87
|
})(node, state);
|
@@ -89,17 +90,17 @@ function fullAncestor(node, callback, base, state) {
|
|
89
90
|
// Find a node with a given start, end, and type (all are optional,
|
90
91
|
// null can be used as wildcard). Returns a {node, state} object, or
|
91
92
|
// undefined when it doesn't find a matching node.
|
92
|
-
function findNodeAt(node, start, end, test,
|
93
|
+
function findNodeAt(node, start, end, test, baseVisitor, state) {
|
94
|
+
if (!baseVisitor) { baseVisitor = base; }
|
93
95
|
test = makeTest(test);
|
94
|
-
if (!base) { base = exports.base; }
|
95
96
|
try {
|
96
97
|
(function c(node, st, override) {
|
97
98
|
var type = override || node.type;
|
98
99
|
if ((start == null || node.start <= start) &&
|
99
100
|
(end == null || node.end >= end))
|
100
|
-
{
|
101
|
-
if ((start == null || node.start
|
102
|
-
(end == null || node.end
|
101
|
+
{ baseVisitor[type](node, st, c); }
|
102
|
+
if ((start == null || node.start === start) &&
|
103
|
+
(end == null || node.end === end) &&
|
103
104
|
test(type, node))
|
104
105
|
{ throw new Found(node, st) }
|
105
106
|
})(node, state);
|
@@ -111,14 +112,14 @@ function findNodeAt(node, start, end, test, base, state) {
|
|
111
112
|
|
112
113
|
// Find the innermost node of a given type that contains the given
|
113
114
|
// position. Interface similar to findNodeAt.
|
114
|
-
function findNodeAround(node, pos, test,
|
115
|
+
function findNodeAround(node, pos, test, baseVisitor, state) {
|
115
116
|
test = makeTest(test);
|
116
|
-
if (!
|
117
|
+
if (!baseVisitor) { baseVisitor = base; }
|
117
118
|
try {
|
118
119
|
(function c(node, st, override) {
|
119
120
|
var type = override || node.type;
|
120
121
|
if (node.start > pos || node.end < pos) { return }
|
121
|
-
|
122
|
+
baseVisitor[type](node, st, c);
|
122
123
|
if (test(type, node)) { throw new Found(node, st) }
|
123
124
|
})(node, state);
|
124
125
|
} catch (e) {
|
@@ -128,15 +129,15 @@ function findNodeAround(node, pos, test, base, state) {
|
|
128
129
|
}
|
129
130
|
|
130
131
|
// Find the outermost matching node after a given position.
|
131
|
-
function findNodeAfter(node, pos, test,
|
132
|
+
function findNodeAfter(node, pos, test, baseVisitor, state) {
|
132
133
|
test = makeTest(test);
|
133
|
-
if (!
|
134
|
+
if (!baseVisitor) { baseVisitor = base; }
|
134
135
|
try {
|
135
136
|
(function c(node, st, override) {
|
136
137
|
if (node.end < pos) { return }
|
137
138
|
var type = override || node.type;
|
138
139
|
if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
|
139
|
-
|
140
|
+
baseVisitor[type](node, st, c);
|
140
141
|
})(node, state);
|
141
142
|
} catch (e) {
|
142
143
|
if (e instanceof Found) { return e }
|
@@ -145,15 +146,15 @@ function findNodeAfter(node, pos, test, base, state) {
|
|
145
146
|
}
|
146
147
|
|
147
148
|
// Find the outermost matching node before a given position.
|
148
|
-
function findNodeBefore(node, pos, test,
|
149
|
+
function findNodeBefore(node, pos, test, baseVisitor, state) {
|
149
150
|
test = makeTest(test);
|
150
|
-
if (!
|
151
|
+
if (!baseVisitor) { baseVisitor = base; }
|
151
152
|
var max;(function c(node, st, override) {
|
152
153
|
if (node.start > pos) { return }
|
153
154
|
var type = override || node.type;
|
154
155
|
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
|
155
156
|
{ max = new Found(node, st); }
|
156
|
-
|
157
|
+
baseVisitor[type](node, st, c);
|
157
158
|
})(node, state);
|
158
159
|
return max
|
159
160
|
}
|
@@ -167,9 +168,8 @@ var create = Object.create || function(proto) {
|
|
167
168
|
|
168
169
|
// Used to create a custom walker. Will fill in all missing node
|
169
170
|
// type properties with the defaults.
|
170
|
-
function make(funcs,
|
171
|
-
|
172
|
-
var visitor = create(base);
|
171
|
+
function make(funcs, baseVisitor) {
|
172
|
+
var visitor = create(baseVisitor || base);
|
173
173
|
for (var type in funcs) { visitor[type] = funcs[type]; }
|
174
174
|
return visitor
|
175
175
|
}
|
@@ -238,7 +238,7 @@ base.TryStatement = function (node, st, c) {
|
|
238
238
|
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
239
239
|
};
|
240
240
|
base.CatchClause = function (node, st, c) {
|
241
|
-
c(node.param, st, "Pattern");
|
241
|
+
if (node.param) { c(node.param, st, "Pattern"); }
|
242
242
|
c(node.body, st, "ScopeBody");
|
243
243
|
};
|
244
244
|
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
@@ -257,7 +257,7 @@ base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
|
257
257
|
c(node.body, st, "Statement");
|
258
258
|
};
|
259
259
|
base.ForInit = function (node, st, c) {
|
260
|
-
if (node.type
|
260
|
+
if (node.type === "VariableDeclaration") { c(node, st); }
|
261
261
|
else { c(node, st, "Expression"); }
|
262
262
|
};
|
263
263
|
base.DebuggerStatement = ignore;
|
@@ -292,9 +292,9 @@ base.ScopeBody = function (node, st, c) { return c(node, st, "Statement"); };
|
|
292
292
|
base.ScopeExpression = function (node, st, c) { return c(node, st, "Expression"); };
|
293
293
|
|
294
294
|
base.Pattern = function (node, st, c) {
|
295
|
-
if (node.type
|
295
|
+
if (node.type === "Identifier")
|
296
296
|
{ c(node, st, "VariablePattern"); }
|
297
|
-
else if (node.type
|
297
|
+
else if (node.type === "MemberExpression")
|
298
298
|
{ c(node, st, "MemberPattern"); }
|
299
299
|
else
|
300
300
|
{ c(node, st); }
|
@@ -313,8 +313,12 @@ base.ObjectPattern = function (node, st, c) {
|
|
313
313
|
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
314
314
|
var prop = list[i];
|
315
315
|
|
316
|
-
if (prop.
|
317
|
-
|
316
|
+
if (prop.type === "Property") {
|
317
|
+
if (prop.computed) { c(prop.key, st, "Expression"); }
|
318
|
+
c(prop.value, st, "Pattern");
|
319
|
+
} else if (prop.type === "RestElement") {
|
320
|
+
c(prop.argument, st, "Pattern");
|
321
|
+
}
|
318
322
|
}
|
319
323
|
};
|
320
324
|
|
@@ -376,7 +380,7 @@ base.MemberExpression = function (node, st, c) {
|
|
376
380
|
};
|
377
381
|
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
378
382
|
if (node.declaration)
|
379
|
-
{ c(node.declaration, st, node.type
|
383
|
+
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
380
384
|
if (node.source) { c(node.source, st, "Expression"); }
|
381
385
|
};
|
382
386
|
base.ExportAllDeclaration = function (node, st, c) {
|
@@ -22,11 +22,11 @@
|
|
22
22
|
// walker, and state can be used to give this walked an initial
|
23
23
|
// state.
|
24
24
|
|
25
|
-
function simple(node, visitors,
|
26
|
-
if (!
|
25
|
+
function simple(node, visitors, baseVisitor, state, override) {
|
26
|
+
if (!baseVisitor) { baseVisitor = base
|
27
27
|
; }(function c(node, st, override) {
|
28
28
|
var type = override || node.type, found = visitors[type];
|
29
|
-
|
29
|
+
baseVisitor[type](node, st, c);
|
30
30
|
if (found) { found(node, st); }
|
31
31
|
})(node, state, override);
|
32
32
|
}
|
@@ -34,13 +34,14 @@ function simple(node, visitors, base, state, override) {
|
|
34
34
|
// An ancestor walk keeps an array of ancestor nodes (including the
|
35
35
|
// current node) and passes them to the callback as third parameter
|
36
36
|
// (and also as state parameter when no other state is present).
|
37
|
-
function ancestor(node, visitors,
|
38
|
-
|
39
|
-
|
37
|
+
function ancestor(node, visitors, baseVisitor, state) {
|
38
|
+
var ancestors = [];
|
39
|
+
if (!baseVisitor) { baseVisitor = base
|
40
|
+
; }(function c(node, st, override) {
|
40
41
|
var type = override || node.type, found = visitors[type];
|
41
|
-
var isNew = node
|
42
|
+
var isNew = node !== ancestors[ancestors.length - 1];
|
42
43
|
if (isNew) { ancestors.push(node); }
|
43
|
-
|
44
|
+
baseVisitor[type](node, st, c);
|
44
45
|
if (found) { found(node, st || ancestors, ancestors); }
|
45
46
|
if (isNew) { ancestors.pop(); }
|
46
47
|
})(node, state);
|
@@ -51,15 +52,15 @@ function ancestor(node, visitors, base, state) {
|
|
51
52
|
// threaded through the walk, and can opt how and whether to walk
|
52
53
|
// their child nodes (by calling their third argument on these
|
53
54
|
// nodes).
|
54
|
-
function recursive(node, state, funcs,
|
55
|
-
var visitor = funcs ?
|
55
|
+
function recursive(node, state, funcs, baseVisitor, override) {
|
56
|
+
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor;(function c(node, st, override) {
|
56
57
|
visitor[override || node.type](node, st, c);
|
57
58
|
})(node, state, override);
|
58
59
|
}
|
59
60
|
|
60
61
|
function makeTest(test) {
|
61
|
-
if (typeof test
|
62
|
-
{ return function (type) { return type
|
62
|
+
if (typeof test === "string")
|
63
|
+
{ return function (type) { return type === test; } }
|
63
64
|
else if (!test)
|
64
65
|
{ return function () { return true; } }
|
65
66
|
else
|
@@ -69,24 +70,24 @@ function makeTest(test) {
|
|
69
70
|
var Found = function Found(node, state) { this.node = node; this.state = state; };
|
70
71
|
|
71
72
|
// A full walk triggers the callback on each node
|
72
|
-
function full(node, callback,
|
73
|
-
if (!
|
73
|
+
function full(node, callback, baseVisitor, state, override) {
|
74
|
+
if (!baseVisitor) { baseVisitor = base
|
74
75
|
; }(function c(node, st, override) {
|
75
76
|
var type = override || node.type;
|
76
|
-
|
77
|
+
baseVisitor[type](node, st, c);
|
77
78
|
if (!override) { callback(node, st, type); }
|
78
79
|
})(node, state, override);
|
79
80
|
}
|
80
81
|
|
81
82
|
// An fullAncestor walk is like an ancestor walk, but triggers
|
82
83
|
// the callback on each node
|
83
|
-
function fullAncestor(node, callback,
|
84
|
-
if (!
|
84
|
+
function fullAncestor(node, callback, baseVisitor, state) {
|
85
|
+
if (!baseVisitor) { baseVisitor = base; }
|
85
86
|
var ancestors = [];(function c(node, st, override) {
|
86
87
|
var type = override || node.type;
|
87
|
-
var isNew = node
|
88
|
+
var isNew = node !== ancestors[ancestors.length - 1];
|
88
89
|
if (isNew) { ancestors.push(node); }
|
89
|
-
|
90
|
+
baseVisitor[type](node, st, c);
|
90
91
|
if (!override) { callback(node, st || ancestors, ancestors, type); }
|
91
92
|
if (isNew) { ancestors.pop(); }
|
92
93
|
})(node, state);
|
@@ -95,17 +96,17 @@ function fullAncestor(node, callback, base, state) {
|
|
95
96
|
// Find a node with a given start, end, and type (all are optional,
|
96
97
|
// null can be used as wildcard). Returns a {node, state} object, or
|
97
98
|
// undefined when it doesn't find a matching node.
|
98
|
-
function findNodeAt(node, start, end, test,
|
99
|
+
function findNodeAt(node, start, end, test, baseVisitor, state) {
|
100
|
+
if (!baseVisitor) { baseVisitor = base; }
|
99
101
|
test = makeTest(test);
|
100
|
-
if (!base) { base = exports.base; }
|
101
102
|
try {
|
102
103
|
(function c(node, st, override) {
|
103
104
|
var type = override || node.type;
|
104
105
|
if ((start == null || node.start <= start) &&
|
105
106
|
(end == null || node.end >= end))
|
106
|
-
{
|
107
|
-
if ((start == null || node.start
|
108
|
-
(end == null || node.end
|
107
|
+
{ baseVisitor[type](node, st, c); }
|
108
|
+
if ((start == null || node.start === start) &&
|
109
|
+
(end == null || node.end === end) &&
|
109
110
|
test(type, node))
|
110
111
|
{ throw new Found(node, st) }
|
111
112
|
})(node, state);
|
@@ -117,14 +118,14 @@ function findNodeAt(node, start, end, test, base, state) {
|
|
117
118
|
|
118
119
|
// Find the innermost node of a given type that contains the given
|
119
120
|
// position. Interface similar to findNodeAt.
|
120
|
-
function findNodeAround(node, pos, test,
|
121
|
+
function findNodeAround(node, pos, test, baseVisitor, state) {
|
121
122
|
test = makeTest(test);
|
122
|
-
if (!
|
123
|
+
if (!baseVisitor) { baseVisitor = base; }
|
123
124
|
try {
|
124
125
|
(function c(node, st, override) {
|
125
126
|
var type = override || node.type;
|
126
127
|
if (node.start > pos || node.end < pos) { return }
|
127
|
-
|
128
|
+
baseVisitor[type](node, st, c);
|
128
129
|
if (test(type, node)) { throw new Found(node, st) }
|
129
130
|
})(node, state);
|
130
131
|
} catch (e) {
|
@@ -134,15 +135,15 @@ function findNodeAround(node, pos, test, base, state) {
|
|
134
135
|
}
|
135
136
|
|
136
137
|
// Find the outermost matching node after a given position.
|
137
|
-
function findNodeAfter(node, pos, test,
|
138
|
+
function findNodeAfter(node, pos, test, baseVisitor, state) {
|
138
139
|
test = makeTest(test);
|
139
|
-
if (!
|
140
|
+
if (!baseVisitor) { baseVisitor = base; }
|
140
141
|
try {
|
141
142
|
(function c(node, st, override) {
|
142
143
|
if (node.end < pos) { return }
|
143
144
|
var type = override || node.type;
|
144
145
|
if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
|
145
|
-
|
146
|
+
baseVisitor[type](node, st, c);
|
146
147
|
})(node, state);
|
147
148
|
} catch (e) {
|
148
149
|
if (e instanceof Found) { return e }
|
@@ -151,15 +152,15 @@ function findNodeAfter(node, pos, test, base, state) {
|
|
151
152
|
}
|
152
153
|
|
153
154
|
// Find the outermost matching node before a given position.
|
154
|
-
function findNodeBefore(node, pos, test,
|
155
|
+
function findNodeBefore(node, pos, test, baseVisitor, state) {
|
155
156
|
test = makeTest(test);
|
156
|
-
if (!
|
157
|
+
if (!baseVisitor) { baseVisitor = base; }
|
157
158
|
var max;(function c(node, st, override) {
|
158
159
|
if (node.start > pos) { return }
|
159
160
|
var type = override || node.type;
|
160
161
|
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
|
161
162
|
{ max = new Found(node, st); }
|
162
|
-
|
163
|
+
baseVisitor[type](node, st, c);
|
163
164
|
})(node, state);
|
164
165
|
return max
|
165
166
|
}
|
@@ -173,9 +174,8 @@ var create = Object.create || function(proto) {
|
|
173
174
|
|
174
175
|
// Used to create a custom walker. Will fill in all missing node
|
175
176
|
// type properties with the defaults.
|
176
|
-
function make(funcs,
|
177
|
-
|
178
|
-
var visitor = create(base);
|
177
|
+
function make(funcs, baseVisitor) {
|
178
|
+
var visitor = create(baseVisitor || base);
|
179
179
|
for (var type in funcs) { visitor[type] = funcs[type]; }
|
180
180
|
return visitor
|
181
181
|
}
|
@@ -244,7 +244,7 @@ base.TryStatement = function (node, st, c) {
|
|
244
244
|
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
245
245
|
};
|
246
246
|
base.CatchClause = function (node, st, c) {
|
247
|
-
c(node.param, st, "Pattern");
|
247
|
+
if (node.param) { c(node.param, st, "Pattern"); }
|
248
248
|
c(node.body, st, "ScopeBody");
|
249
249
|
};
|
250
250
|
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
@@ -263,7 +263,7 @@ base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
|
263
263
|
c(node.body, st, "Statement");
|
264
264
|
};
|
265
265
|
base.ForInit = function (node, st, c) {
|
266
|
-
if (node.type
|
266
|
+
if (node.type === "VariableDeclaration") { c(node, st); }
|
267
267
|
else { c(node, st, "Expression"); }
|
268
268
|
};
|
269
269
|
base.DebuggerStatement = ignore;
|
@@ -298,9 +298,9 @@ base.ScopeBody = function (node, st, c) { return c(node, st, "Statement"); };
|
|
298
298
|
base.ScopeExpression = function (node, st, c) { return c(node, st, "Expression"); };
|
299
299
|
|
300
300
|
base.Pattern = function (node, st, c) {
|
301
|
-
if (node.type
|
301
|
+
if (node.type === "Identifier")
|
302
302
|
{ c(node, st, "VariablePattern"); }
|
303
|
-
else if (node.type
|
303
|
+
else if (node.type === "MemberExpression")
|
304
304
|
{ c(node, st, "MemberPattern"); }
|
305
305
|
else
|
306
306
|
{ c(node, st); }
|
@@ -319,8 +319,12 @@ base.ObjectPattern = function (node, st, c) {
|
|
319
319
|
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
320
320
|
var prop = list[i];
|
321
321
|
|
322
|
-
if (prop.
|
323
|
-
|
322
|
+
if (prop.type === "Property") {
|
323
|
+
if (prop.computed) { c(prop.key, st, "Expression"); }
|
324
|
+
c(prop.value, st, "Pattern");
|
325
|
+
} else if (prop.type === "RestElement") {
|
326
|
+
c(prop.argument, st, "Pattern");
|
327
|
+
}
|
324
328
|
}
|
325
329
|
};
|
326
330
|
|
@@ -382,7 +386,7 @@ base.MemberExpression = function (node, st, c) {
|
|
382
386
|
};
|
383
387
|
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
384
388
|
if (node.declaration)
|
385
|
-
{ c(node.declaration, st, node.type
|
389
|
+
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
386
390
|
if (node.source) { c(node.source, st, "Expression"); }
|
387
391
|
};
|
388
392
|
base.ExportAllDeclaration = function (node, st, c) {
|
@@ -4,7 +4,7 @@
|
|
4
4
|
"homepage": "https://github.com/acornjs/acorn",
|
5
5
|
"main": "dist/acorn.js",
|
6
6
|
"module": "dist/acorn.es.js",
|
7
|
-
"version": "5.
|
7
|
+
"version": "5.7.2",
|
8
8
|
"engines": {
|
9
9
|
"node": ">=0.4.0"
|
10
10
|
},
|
@@ -18,6 +18,10 @@
|
|
18
18
|
"name": "Ingvar Stepanyan",
|
19
19
|
"email": "me@rreverser.com",
|
20
20
|
"web": "http://rreverser.com/"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"name": "Adrian Heine",
|
24
|
+
"email": "http://adrianheine.de"
|
21
25
|
}
|
22
26
|
],
|
23
27
|
"repository": {
|
@@ -26,7 +30,7 @@
|
|
26
30
|
},
|
27
31
|
"license": "MIT",
|
28
32
|
"scripts": {
|
29
|
-
"prepare": "npm test",
|
33
|
+
"prepare": "npm run build && node test/run.js && node test/lint.js",
|
30
34
|
"test": "node test/run.js && node test/lint.js",
|
31
35
|
"pretest": "npm run build:main && npm run build:loose",
|
32
36
|
"test:test262": "node bin/run_test262.js",
|
@@ -49,8 +53,8 @@
|
|
49
53
|
"eslint-plugin-standard": "^3.0.1",
|
50
54
|
"rollup": "^0.45.0",
|
51
55
|
"rollup-plugin-buble": "^0.16.0",
|
52
|
-
"test262": "git+https://github.com/tc39/test262.git#
|
53
|
-
"test262-parser-runner": "^0.
|
54
|
-
"unicode-
|
56
|
+
"test262": "git+https://github.com/tc39/test262.git#3bfad28cc302fd4455badcfcbca7c5bb7ce41a72",
|
57
|
+
"test262-parser-runner": "^0.4.0",
|
58
|
+
"unicode-11.0.0": "^0.7.7"
|
55
59
|
}
|
56
60
|
}
|