sqlmath 0.0.4 → 2022.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npmignore +10 -0
- package/CHANGELOG.md +7 -0
- package/README.md +3 -3
- package/_binary_sqlmath_napi8_darwin_x64.node +0 -0
- package/_binary_sqlmath_napi8_linux_x64.node +0 -0
- package/_binary_sqlmath_napi8_win32_x64.node +0 -0
- package/jslint.mjs +217 -149
- package/package.json +1 -1
- package/sqlmath.mjs +191 -44
- package/.gitconfig +0 -25
- package/.github/workflows/ci.yml +0 -119
- package/.github/workflows/publish.yml +0 -67
- package/.gitignore +0 -20
- package/asset_image_folder_open_solid.svg +0 -1
- package/jslint_ci.sh +0 -2795
- package/sqlite3.c +0 -248548
- package/sqlite3_ext.c +0 -8372
- package/sqlite3_shell.c +0 -22436
- package/sqlmath_base.c +0 -1832
- package/sqlmath_custom.c +0 -78
- package/sqlmath_custom.cpp +0 -0
- package/sqlmath_custom.mjs +0 -4
- package/sqlmath_old.js +0 -31038
package/jslint.mjs
CHANGED
|
@@ -94,6 +94,8 @@
|
|
|
94
94
|
/*jslint beta, node*/
|
|
95
95
|
|
|
96
96
|
/*property
|
|
97
|
+
fud_stmt,
|
|
98
|
+
is_fart,
|
|
97
99
|
mode_conditional,
|
|
98
100
|
JSLINT_BETA, NODE_V8_COVERAGE, a, all, argv, arity, artifact,
|
|
99
101
|
assertErrorThrownAsync, assertJsonEqual, assertOrThrow, assign, async, b,
|
|
@@ -107,7 +109,7 @@
|
|
|
107
109
|
example_list, exec, execArgv, exit, export_dict, exports, expression, extra,
|
|
108
110
|
file, fileList, fileURLToPath, filter, finally, flag, floor, for, forEach,
|
|
109
111
|
formatted_message, free, freeze, from, froms,
|
|
110
|
-
fsWriteFileWithParents,
|
|
112
|
+
fsWriteFileWithParents, functionName, function_list, function_stack,
|
|
111
113
|
functions, get, getset, github_repo, global, global_dict, global_list,
|
|
112
114
|
holeList, htmlEscape, id, identifier, import, import_list, inc, indent2,
|
|
113
115
|
index, indexOf, init, initial, isArray, isBlockCoverage, isHole, isNaN,
|
|
@@ -115,13 +117,13 @@
|
|
|
115
117
|
jslint_charset_ascii, jslint_cli, jslint_edition, jslint_phase1_split,
|
|
116
118
|
jslint_phase2_lex, jslint_phase3_parse, jslint_phase4_walk,
|
|
117
119
|
jslint_phase5_whitage, jslint_report, json, jstestDescribe, jstestIt,
|
|
118
|
-
jstestOnExit, keys, label, lbp,
|
|
120
|
+
jstestOnExit, keys, label, lbp, led_infix, length, level, line, lineList,
|
|
119
121
|
line_list, line_offset, line_source, lines, linesCovered, linesTotal, live,
|
|
120
122
|
log, long, loop, m, main, map, margin, match, max, message, meta, min,
|
|
121
123
|
mkdir, modeCoverageIgnoreFile, modeIndex, mode_cli, mode_json, mode_module,
|
|
122
124
|
mode_noop, mode_property, mode_shebang, mode_stop, module, moduleFsInit,
|
|
123
125
|
moduleName, module_list, name, names, node, noop, now,
|
|
124
|
-
nr,
|
|
126
|
+
nr, nud_prefix, objectDeepCopyWithKeysSorted, ok, on, open, opening, option,
|
|
125
127
|
option_dict, order, package_name, padEnd, padStart, parameters, parent,
|
|
126
128
|
parentIi, parse, pathname, platform, pop, processArgv, process_argv,
|
|
127
129
|
process_env, process_exit, process_version, promises, property,
|
|
@@ -165,7 +167,7 @@ let jslint_charset_ascii = (
|
|
|
165
167
|
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
|
166
168
|
+ "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
|
|
167
169
|
);
|
|
168
|
-
let jslint_edition = "
|
|
170
|
+
let jslint_edition = "v2022.2.20";
|
|
169
171
|
let jslint_export; // The jslint object to be exported.
|
|
170
172
|
let jslint_fudge = 1; // Fudge starting line and starting
|
|
171
173
|
// ... column to 1.
|
|
@@ -202,11 +204,12 @@ function assertJsonEqual(aa, bb, message) {
|
|
|
202
204
|
|
|
203
205
|
// This function will assert JSON.stringify(<aa>) === JSON.stringify(<bb>).
|
|
204
206
|
|
|
205
|
-
aa = JSON.stringify(objectDeepCopyWithKeysSorted(aa));
|
|
206
|
-
bb = JSON.stringify(objectDeepCopyWithKeysSorted(bb));
|
|
207
|
+
aa = JSON.stringify(objectDeepCopyWithKeysSorted(aa), undefined, 1);
|
|
208
|
+
bb = JSON.stringify(objectDeepCopyWithKeysSorted(bb), undefined, 1);
|
|
207
209
|
if (aa !== bb) {
|
|
208
210
|
throw new Error(
|
|
209
|
-
|
|
211
|
+
"\n" + aa + "\n!==\n" + bb
|
|
212
|
+
+ (
|
|
210
213
|
typeof message === "string"
|
|
211
214
|
? " - " + message
|
|
212
215
|
: message
|
|
@@ -678,9 +681,12 @@ function jslint(
|
|
|
678
681
|
`Expected 'Object.freeze('. All export values should be frozen.`
|
|
679
682
|
);
|
|
680
683
|
break;
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
+
|
|
685
|
+
// PR-378 - Relax warning "function_in_loop".
|
|
686
|
+
//
|
|
687
|
+
// case "function_in_loop":
|
|
688
|
+
// mm = `Don't create functions within a loop.`;
|
|
689
|
+
// break;
|
|
684
690
|
case "infix_in":
|
|
685
691
|
mm = (
|
|
686
692
|
`Unexpected 'in'. Compare with undefined,`
|
|
@@ -833,6 +839,15 @@ function jslint(
|
|
|
833
839
|
case "use_double":
|
|
834
840
|
mm = `Use double quotes, not single quotes.`;
|
|
835
841
|
break;
|
|
842
|
+
|
|
843
|
+
// PR-386 - Fix issue #382 - Make fart-related warnings more readable.
|
|
844
|
+
|
|
845
|
+
case "use_function_not_fart":
|
|
846
|
+
mm = (
|
|
847
|
+
`Use 'function (...)', not '(...) =>' when arrow functions`
|
|
848
|
+
+ ` become too complex.`
|
|
849
|
+
);
|
|
850
|
+
break;
|
|
836
851
|
case "use_open":
|
|
837
852
|
mm = (
|
|
838
853
|
`Wrap a ternary expression in parens,`
|
|
@@ -866,6 +881,12 @@ function jslint(
|
|
|
866
881
|
case "wrap_condition":
|
|
867
882
|
mm = `Wrap the condition in parens.`;
|
|
868
883
|
break;
|
|
884
|
+
|
|
885
|
+
// PR-386 - Fix issue #382 - Make fart-related warnings more readable.
|
|
886
|
+
|
|
887
|
+
case "wrap_fart_parameter":
|
|
888
|
+
mm = `Wrap the parameter before '=>' in parens.`;
|
|
889
|
+
break;
|
|
869
890
|
case "wrap_immediate":
|
|
870
891
|
mm = (
|
|
871
892
|
`Wrap an immediate function invocation in parentheses to assist`
|
|
@@ -873,9 +894,6 @@ function jslint(
|
|
|
873
894
|
+ ` result of a function, and not the function itself.`
|
|
874
895
|
);
|
|
875
896
|
break;
|
|
876
|
-
case "wrap_parameter":
|
|
877
|
-
mm = `Wrap the parameter in parens.`;
|
|
878
|
-
break;
|
|
879
897
|
case "wrap_regexp":
|
|
880
898
|
mm = `Wrap this regexp in parens to avoid confusion.`;
|
|
881
899
|
break;
|
|
@@ -1451,8 +1469,8 @@ async function jslint_cli({
|
|
|
1451
1469
|
let command;
|
|
1452
1470
|
let data;
|
|
1453
1471
|
let exit_code = 0;
|
|
1454
|
-
let mode_plugin_vim;
|
|
1455
1472
|
let mode_report;
|
|
1473
|
+
let mode_wrapper_vim;
|
|
1456
1474
|
let result;
|
|
1457
1475
|
|
|
1458
1476
|
function jslint_from_file({
|
|
@@ -1525,7 +1543,7 @@ async function jslint_cli({
|
|
|
1525
1543
|
if (result_from_file.warnings.length > 0) {
|
|
1526
1544
|
exit_code = 1;
|
|
1527
1545
|
console_error(
|
|
1528
|
-
|
|
1546
|
+
mode_wrapper_vim
|
|
1529
1547
|
|
|
1530
1548
|
// PR-349 - Print warnings in format readable by vim.
|
|
1531
1549
|
|
|
@@ -1658,17 +1676,17 @@ async function jslint_cli({
|
|
|
1658
1676
|
}));
|
|
1659
1677
|
return;
|
|
1660
1678
|
|
|
1661
|
-
//
|
|
1679
|
+
// PR-363 - Add command jslint_report.
|
|
1662
1680
|
|
|
1663
|
-
case "
|
|
1664
|
-
|
|
1681
|
+
case "jslint_report":
|
|
1682
|
+
mode_report = command[1];
|
|
1665
1683
|
process_argv = process_argv.slice(1);
|
|
1666
1684
|
break;
|
|
1667
1685
|
|
|
1668
|
-
//
|
|
1686
|
+
// COMMIT-b26d6df2 - Add command jslint_wrapper_vim.
|
|
1669
1687
|
|
|
1670
|
-
case "
|
|
1671
|
-
|
|
1688
|
+
case "jslint_wrapper_vim":
|
|
1689
|
+
mode_wrapper_vim = true;
|
|
1672
1690
|
process_argv = process_argv.slice(1);
|
|
1673
1691
|
break;
|
|
1674
1692
|
|
|
@@ -1676,6 +1694,7 @@ async function jslint_cli({
|
|
|
1676
1694
|
|
|
1677
1695
|
case "v8_coverage_report":
|
|
1678
1696
|
await v8CoverageReportCreate({
|
|
1697
|
+
consoleError: console_error,
|
|
1679
1698
|
coverageDir: command[1],
|
|
1680
1699
|
processArgv: process_argv.slice(3)
|
|
1681
1700
|
});
|
|
@@ -1684,9 +1703,9 @@ async function jslint_cli({
|
|
|
1684
1703
|
|
|
1685
1704
|
// PR-349 - Detect cli-option --mode-vim-plugin.
|
|
1686
1705
|
|
|
1687
|
-
|
|
1706
|
+
mode_wrapper_vim = (
|
|
1688
1707
|
process_argv.slice(2).indexOf("--mode-vim-plugin") >= 0
|
|
1689
|
-
||
|
|
1708
|
+
|| mode_wrapper_vim
|
|
1690
1709
|
);
|
|
1691
1710
|
|
|
1692
1711
|
// Normalize file relative to process.cwd().
|
|
@@ -1827,6 +1846,9 @@ function jslint_phase2_lex(state) {
|
|
|
1827
1846
|
// ... literal.
|
|
1828
1847
|
let mode_regexp; // true if regular expression literal seen on
|
|
1829
1848
|
// ... this line.
|
|
1849
|
+
let paren_backtrack_list = []; // List of most recent "(" tokens at any
|
|
1850
|
+
// ... paren-depth.
|
|
1851
|
+
let paren_depth = 0; // Keeps track of current paren-depth.
|
|
1830
1852
|
let rx_token = new RegExp(
|
|
1831
1853
|
"^("
|
|
1832
1854
|
+ "(\\s+)"
|
|
@@ -3189,7 +3211,7 @@ node --input-type=module --eval '
|
|
|
3189
3211
|
// /\*jslint beta, node*\/
|
|
3190
3212
|
import moduleHttps from "https";
|
|
3191
3213
|
(async function () {
|
|
3192
|
-
let dict =
|
|
3214
|
+
let dict = Object.create(null);
|
|
3193
3215
|
let result = "";
|
|
3194
3216
|
await new Promise(function (resolve) {
|
|
3195
3217
|
moduleHttps.get((
|
|
@@ -3388,9 +3410,11 @@ import moduleHttps from "https";
|
|
|
3388
3410
|
from,
|
|
3389
3411
|
id,
|
|
3390
3412
|
identifier: Boolean(identifier),
|
|
3413
|
+
is_fart: false,
|
|
3391
3414
|
line,
|
|
3392
3415
|
nr: token_list.length,
|
|
3393
|
-
thru: column
|
|
3416
|
+
thru: column,
|
|
3417
|
+
value
|
|
3394
3418
|
};
|
|
3395
3419
|
token_list.push(the_token);
|
|
3396
3420
|
|
|
@@ -3400,12 +3424,6 @@ import moduleHttps from "https";
|
|
|
3400
3424
|
mode_directive = false;
|
|
3401
3425
|
}
|
|
3402
3426
|
|
|
3403
|
-
// If the token is to have a value, give it one.
|
|
3404
|
-
|
|
3405
|
-
if (value !== undefined) {
|
|
3406
|
-
the_token.value = value;
|
|
3407
|
-
}
|
|
3408
|
-
|
|
3409
3427
|
// If this token is an identifier that touches a preceding number, or
|
|
3410
3428
|
// a "/", comment, or regular expression literal that touches a preceding
|
|
3411
3429
|
// comment or regular expression literal, then give a missing space warning.
|
|
@@ -3439,6 +3457,29 @@ import moduleHttps from "https";
|
|
|
3439
3457
|
the_token.dot = true;
|
|
3440
3458
|
}
|
|
3441
3459
|
|
|
3460
|
+
// PR-385 - Bugfix - Fixes issue #382 - failure to detect destructured fart.
|
|
3461
|
+
// Farts are now detected by keeping a list of most recent "(" tokens at any
|
|
3462
|
+
// given depth. When a "=>" token is encountered, the most recent "(" token at
|
|
3463
|
+
// current depth is marked as a fart.
|
|
3464
|
+
|
|
3465
|
+
switch (id) {
|
|
3466
|
+
case "(":
|
|
3467
|
+
paren_backtrack_list[paren_depth] = the_token;
|
|
3468
|
+
paren_depth += 1;
|
|
3469
|
+
break;
|
|
3470
|
+
case ")":
|
|
3471
|
+
paren_depth -= 1;
|
|
3472
|
+
break;
|
|
3473
|
+
case "=>":
|
|
3474
|
+
if (
|
|
3475
|
+
token_prv_expr.id === ")"
|
|
3476
|
+
&& paren_backtrack_list[paren_depth]
|
|
3477
|
+
) {
|
|
3478
|
+
paren_backtrack_list[paren_depth].is_fart = true;
|
|
3479
|
+
}
|
|
3480
|
+
break;
|
|
3481
|
+
}
|
|
3482
|
+
|
|
3442
3483
|
// The previous token is used to detect adjacency problems.
|
|
3443
3484
|
|
|
3444
3485
|
token_prv = the_token;
|
|
@@ -3554,7 +3595,7 @@ function jslint_phase3_parse(state) {
|
|
|
3554
3595
|
match === undefined
|
|
3555
3596
|
|
|
3556
3597
|
// test_cause:
|
|
3557
|
-
// ["
|
|
3598
|
+
// ["{0:0}", "advance", "expected_a_b", "0", 2]
|
|
3558
3599
|
|
|
3559
3600
|
? stop("expected_a_b", token_nxt, id, artifact())
|
|
3560
3601
|
|
|
@@ -3603,7 +3644,7 @@ function jslint_phase3_parse(state) {
|
|
|
3603
3644
|
// other assignment operators can modify, but they cannot initialize.
|
|
3604
3645
|
|
|
3605
3646
|
const the_symbol = symbol(id, 20);
|
|
3606
|
-
the_symbol.
|
|
3647
|
+
the_symbol.led_infix = function (left) {
|
|
3607
3648
|
const the_token = token_now;
|
|
3608
3649
|
let right;
|
|
3609
3650
|
the_token.arity = "assignment";
|
|
@@ -3915,7 +3956,7 @@ function jslint_phase3_parse(state) {
|
|
|
3915
3956
|
|
|
3916
3957
|
const the_symbol = symbol(id);
|
|
3917
3958
|
the_symbol.constant = true;
|
|
3918
|
-
the_symbol.
|
|
3959
|
+
the_symbol.nud_prefix = (
|
|
3919
3960
|
typeof value === "function"
|
|
3920
3961
|
? value
|
|
3921
3962
|
: function () {
|
|
@@ -4109,7 +4150,7 @@ function jslint_phase3_parse(state) {
|
|
|
4109
4150
|
// Create an infix operator.
|
|
4110
4151
|
|
|
4111
4152
|
const the_symbol = symbol(id, bp);
|
|
4112
|
-
the_symbol.
|
|
4153
|
+
the_symbol.led_infix = function (left) {
|
|
4113
4154
|
const the_token = token_now;
|
|
4114
4155
|
the_token.arity = "binary";
|
|
4115
4156
|
if (f !== undefined) {
|
|
@@ -4167,12 +4208,12 @@ function jslint_phase3_parse(state) {
|
|
|
4167
4208
|
return the_token;
|
|
4168
4209
|
}
|
|
4169
4210
|
|
|
4170
|
-
function infix_fart_unwrapped(
|
|
4211
|
+
function infix_fart_unwrapped() {
|
|
4171
4212
|
|
|
4172
4213
|
// test_cause:
|
|
4173
|
-
// ["aa=>0", "infix_fart_unwrapped", "
|
|
4214
|
+
// ["aa=>0", "infix_fart_unwrapped", "wrap_fart_parameter", "=>", 3]
|
|
4174
4215
|
|
|
4175
|
-
return stop("
|
|
4216
|
+
return stop("wrap_fart_parameter", token_now);
|
|
4176
4217
|
}
|
|
4177
4218
|
|
|
4178
4219
|
function infix_grave(left) {
|
|
@@ -4335,13 +4376,13 @@ function jslint_phase3_parse(state) {
|
|
|
4335
4376
|
// Create a right associative infix operator.
|
|
4336
4377
|
|
|
4337
4378
|
const the_symbol = symbol(id, bp);
|
|
4338
|
-
the_symbol.
|
|
4379
|
+
the_symbol.led_infix = function parse_infixr_led(left) {
|
|
4339
4380
|
const the_token = token_now;
|
|
4340
4381
|
|
|
4341
4382
|
// test_cause:
|
|
4342
|
-
// ["0**0", "parse_infixr_led", "
|
|
4383
|
+
// ["0**0", "parse_infixr_led", "led_infix", "", 0]
|
|
4343
4384
|
|
|
4344
|
-
test_cause("
|
|
4385
|
+
test_cause("led_infix");
|
|
4345
4386
|
the_token.arity = "binary";
|
|
4346
4387
|
the_token.expression = [left, parse_expression(bp - 1)];
|
|
4347
4388
|
return the_token;
|
|
@@ -4349,39 +4390,70 @@ function jslint_phase3_parse(state) {
|
|
|
4349
4390
|
return the_symbol;
|
|
4350
4391
|
}
|
|
4351
4392
|
|
|
4352
|
-
function lookahead() {
|
|
4353
|
-
|
|
4354
|
-
// Look ahead one token without advancing, skipping comments.
|
|
4355
|
-
|
|
4356
|
-
let cadet;
|
|
4357
|
-
let ii = token_ii;
|
|
4358
|
-
while (true) {
|
|
4359
|
-
cadet = token_list[ii];
|
|
4360
|
-
if (cadet.id !== "(comment)") {
|
|
4361
|
-
return cadet;
|
|
4362
|
-
}
|
|
4363
|
-
ii += 1;
|
|
4364
|
-
}
|
|
4365
|
-
}
|
|
4366
|
-
|
|
4367
4393
|
function parse_expression(rbp, initial) {
|
|
4368
4394
|
|
|
4369
4395
|
// This is the heart of JSLINT, the Pratt parser. In addition to parsing, it
|
|
4370
|
-
// is looking for ad hoc lint patterns. We add .
|
|
4371
|
-
// like .
|
|
4372
|
-
// Having .
|
|
4373
|
-
// JavaScript. I retained Pratt's nomenclature.
|
|
4396
|
+
// is looking for ad hoc lint patterns. We add .fud_stmt to Pratt's model, which
|
|
4397
|
+
// is like .nud_prefix except that it is only used on the first token of a
|
|
4398
|
+
// statement. Having .fud_stmt makes it much easier to define statement-oriented
|
|
4399
|
+
// languages like JavaScript. I retained Pratt's nomenclature.
|
|
4374
4400
|
// They are elements of the parsing method called Top Down Operator Precedence.
|
|
4375
4401
|
|
|
4376
|
-
// .
|
|
4377
|
-
// .
|
|
4378
|
-
// .
|
|
4379
|
-
// lbp
|
|
4380
|
-
//
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
//
|
|
4384
|
-
//
|
|
4402
|
+
// .nud_prefix Null denotation. The prefix handler.
|
|
4403
|
+
// .fud_stmt First null denotation. The statement handler.
|
|
4404
|
+
// .led_infix Left denotation. The infix/postfix handler.
|
|
4405
|
+
// lbp Left binding power of infix operator. It tells us how strongly
|
|
4406
|
+
// the operator binds to the argument at its left.
|
|
4407
|
+
// rbp Right binding power.
|
|
4408
|
+
|
|
4409
|
+
// It processes a nud_prefix (variable, constant, prefix operator). It will then
|
|
4410
|
+
// process leds (infix operators) until the bind powers cause it to stop (it
|
|
4411
|
+
// consumes tokens until it meets a token whose lbp <= rbp). Specifically, it
|
|
4412
|
+
// means that it collects all tokens that bind together before returning to the
|
|
4413
|
+
// operator that called it. It returns the expression's parse tree.
|
|
4414
|
+
|
|
4415
|
+
// For example, "3 + 1 * 2 * 4 + 5"
|
|
4416
|
+
// parses into
|
|
4417
|
+
// {
|
|
4418
|
+
// "id": "+",
|
|
4419
|
+
// "expression": [
|
|
4420
|
+
// {
|
|
4421
|
+
// "id": "+",
|
|
4422
|
+
// "expression": [
|
|
4423
|
+
// {
|
|
4424
|
+
// "id": "(number)",
|
|
4425
|
+
// "value": "3"
|
|
4426
|
+
// },
|
|
4427
|
+
// {
|
|
4428
|
+
// "id": "*",
|
|
4429
|
+
// "expression": [
|
|
4430
|
+
// {
|
|
4431
|
+
// "id": "*",
|
|
4432
|
+
// "expression": [
|
|
4433
|
+
// {
|
|
4434
|
+
// "id": "(number)",
|
|
4435
|
+
// "value": "1"
|
|
4436
|
+
// },
|
|
4437
|
+
// {
|
|
4438
|
+
// "id": "(number)",
|
|
4439
|
+
// "value": "2"
|
|
4440
|
+
// }
|
|
4441
|
+
// ]
|
|
4442
|
+
// },
|
|
4443
|
+
// {
|
|
4444
|
+
// "id": "(number)",
|
|
4445
|
+
// "value": "4"
|
|
4446
|
+
// }
|
|
4447
|
+
// ]
|
|
4448
|
+
// }
|
|
4449
|
+
// ]
|
|
4450
|
+
// },
|
|
4451
|
+
// {
|
|
4452
|
+
// "id": "(number)",
|
|
4453
|
+
// "value": "5"
|
|
4454
|
+
// }
|
|
4455
|
+
// ]
|
|
4456
|
+
// }
|
|
4385
4457
|
|
|
4386
4458
|
let left;
|
|
4387
4459
|
let the_symbol;
|
|
@@ -4393,13 +4465,13 @@ function jslint_phase3_parse(state) {
|
|
|
4393
4465
|
advance();
|
|
4394
4466
|
}
|
|
4395
4467
|
the_symbol = syntax_dict[token_now.id];
|
|
4396
|
-
if (the_symbol !== undefined && the_symbol.
|
|
4468
|
+
if (the_symbol !== undefined && the_symbol.nud_prefix !== undefined) {
|
|
4397
4469
|
|
|
4398
4470
|
// test_cause:
|
|
4399
4471
|
// ["0", "parse_expression", "symbol", "", 0]
|
|
4400
4472
|
|
|
4401
4473
|
test_cause("symbol");
|
|
4402
|
-
left = the_symbol.
|
|
4474
|
+
left = the_symbol.nud_prefix();
|
|
4403
4475
|
} else if (token_now.identifier) {
|
|
4404
4476
|
|
|
4405
4477
|
// test_cause:
|
|
@@ -4424,32 +4496,38 @@ function jslint_phase3_parse(state) {
|
|
|
4424
4496
|
the_symbol = syntax_dict[token_nxt.id];
|
|
4425
4497
|
if (
|
|
4426
4498
|
the_symbol === undefined
|
|
4427
|
-
|| the_symbol.
|
|
4499
|
+
|| the_symbol.led_infix === undefined
|
|
4428
4500
|
|| the_symbol.lbp <= rbp
|
|
4429
4501
|
) {
|
|
4430
4502
|
break;
|
|
4431
4503
|
}
|
|
4432
4504
|
advance();
|
|
4433
|
-
left = the_symbol.
|
|
4505
|
+
left = the_symbol.led_infix(left);
|
|
4434
4506
|
}
|
|
4435
4507
|
return left;
|
|
4436
4508
|
}
|
|
4437
4509
|
|
|
4438
|
-
function parse_fart(
|
|
4510
|
+
function parse_fart() {
|
|
4511
|
+
let parameters;
|
|
4512
|
+
let signature;
|
|
4439
4513
|
let the_fart;
|
|
4514
|
+
[parameters, signature] = prefix_function_arg();
|
|
4440
4515
|
advance("=>");
|
|
4441
4516
|
the_fart = token_now;
|
|
4442
4517
|
the_fart.arity = "binary";
|
|
4443
4518
|
the_fart.name = "=>";
|
|
4444
4519
|
the_fart.level = functionage.level + 1;
|
|
4445
4520
|
function_list.push(the_fart);
|
|
4446
|
-
if (functionage.loop > 0) {
|
|
4447
4521
|
|
|
4448
|
-
//
|
|
4449
|
-
//
|
|
4522
|
+
// PR-384 - Relax warning "function_in_loop".
|
|
4523
|
+
//
|
|
4524
|
+
// if (functionage.loop > 0) {
|
|
4450
4525
|
|
|
4451
|
-
|
|
4452
|
-
|
|
4526
|
+
// // test_cause:
|
|
4527
|
+
// // ["while(0){aa.map(()=>0);}", "parse_fart", "function_in_loop", "=>", 19]
|
|
4528
|
+
//
|
|
4529
|
+
// warn("function_in_loop", the_fart);
|
|
4530
|
+
// }
|
|
4453
4531
|
|
|
4454
4532
|
// Give the function properties storing its names and for observing the depth
|
|
4455
4533
|
// of loops and switches.
|
|
@@ -4457,6 +4535,8 @@ function jslint_phase3_parse(state) {
|
|
|
4457
4535
|
the_fart.context = empty();
|
|
4458
4536
|
the_fart.finally = 0;
|
|
4459
4537
|
the_fart.loop = 0;
|
|
4538
|
+
the_fart.parameters = parameters;
|
|
4539
|
+
the_fart.signature = signature;
|
|
4460
4540
|
the_fart.switch = 0;
|
|
4461
4541
|
the_fart.try = 0;
|
|
4462
4542
|
|
|
@@ -4464,23 +4544,42 @@ function jslint_phase3_parse(state) {
|
|
|
4464
4544
|
|
|
4465
4545
|
function_stack.push(functionage);
|
|
4466
4546
|
functionage = the_fart;
|
|
4467
|
-
the_fart.parameters
|
|
4468
|
-
|
|
4469
|
-
|
|
4547
|
+
the_fart.parameters.forEach(function enroll_parameter(name) {
|
|
4548
|
+
if (name.identifier) {
|
|
4549
|
+
enroll(name, "parameter", true);
|
|
4550
|
+
} else {
|
|
4551
|
+
|
|
4552
|
+
// PR-385 - Bugfix - Fixes issue #382 - fix warnings against destructured fart.
|
|
4470
4553
|
|
|
4471
4554
|
// test_cause:
|
|
4472
|
-
// ["(aa)=>
|
|
4555
|
+
// ["([aa])=>0", "enroll_parameter", "use_function_not_fart", "=>", 7]
|
|
4556
|
+
// ["({aa})=>0", "enroll_parameter", "use_function_not_fart", "=>", 7]
|
|
4557
|
+
|
|
4558
|
+
warn("use_function_not_fart", the_fart);
|
|
4473
4559
|
|
|
4474
|
-
|
|
4475
|
-
|
|
4560
|
+
// Recurse enroll_parameter().
|
|
4561
|
+
|
|
4562
|
+
name.names.forEach(enroll_parameter);
|
|
4563
|
+
}
|
|
4476
4564
|
});
|
|
4477
4565
|
if (token_nxt.id === "{") {
|
|
4478
4566
|
|
|
4479
4567
|
// test_cause:
|
|
4480
|
-
// ["()=>{}", "parse_fart", "
|
|
4568
|
+
// ["()=>{}", "parse_fart", "use_function_not_fart", "=>", 3]
|
|
4481
4569
|
|
|
4482
|
-
warn("
|
|
4570
|
+
warn("use_function_not_fart", the_fart);
|
|
4483
4571
|
the_fart.block = block("body");
|
|
4572
|
+
} else if (
|
|
4573
|
+
syntax_dict[token_nxt.id] !== undefined
|
|
4574
|
+
&& syntax_dict[token_nxt.id].fud_stmt !== undefined
|
|
4575
|
+
) {
|
|
4576
|
+
|
|
4577
|
+
// PR-384 - Bugfix - Fixes issue #379 - warn against naked-statement in fart.
|
|
4578
|
+
|
|
4579
|
+
// test_cause:
|
|
4580
|
+
// ["()=>delete aa", "parse_fart", "unexpected_a_after_b", "=>", 5]
|
|
4581
|
+
|
|
4582
|
+
stop("unexpected_a_after_b", token_nxt, token_nxt.id, "=>");
|
|
4484
4583
|
} else {
|
|
4485
4584
|
the_fart.expression = parse_expression(0);
|
|
4486
4585
|
}
|
|
@@ -4703,7 +4802,7 @@ function jslint_phase3_parse(state) {
|
|
|
4703
4802
|
the_symbol = syntax_dict[first.id];
|
|
4704
4803
|
if (
|
|
4705
4804
|
the_symbol !== undefined
|
|
4706
|
-
&& the_symbol.
|
|
4805
|
+
&& the_symbol.fud_stmt !== undefined
|
|
4707
4806
|
|
|
4708
4807
|
// PR-318 - Bugfix - Fixes issues #316, #317 - dynamic-import().
|
|
4709
4808
|
|
|
@@ -4712,7 +4811,7 @@ function jslint_phase3_parse(state) {
|
|
|
4712
4811
|
the_symbol.disrupt = false;
|
|
4713
4812
|
the_symbol.statement = true;
|
|
4714
4813
|
token_now.arity = "statement";
|
|
4715
|
-
the_statement = the_symbol.
|
|
4814
|
+
the_statement = the_symbol.fud_stmt();
|
|
4716
4815
|
functionage.statement_prv = the_statement;
|
|
4717
4816
|
} else {
|
|
4718
4817
|
|
|
@@ -4782,7 +4881,7 @@ function jslint_phase3_parse(state) {
|
|
|
4782
4881
|
// Create one of the postassign operators.
|
|
4783
4882
|
|
|
4784
4883
|
const the_symbol = symbol(id, 150);
|
|
4785
|
-
the_symbol.
|
|
4884
|
+
the_symbol.led_infix = function (left) {
|
|
4786
4885
|
token_now.expression = left;
|
|
4787
4886
|
token_now.arity = "postassign";
|
|
4788
4887
|
check_mutation(token_now.expression);
|
|
@@ -4796,7 +4895,7 @@ function jslint_phase3_parse(state) {
|
|
|
4796
4895
|
// Create one of the preassign operators.
|
|
4797
4896
|
|
|
4798
4897
|
const the_symbol = symbol(id);
|
|
4799
|
-
the_symbol.
|
|
4898
|
+
the_symbol.nud_prefix = function () {
|
|
4800
4899
|
const the_token = token_now;
|
|
4801
4900
|
the_token.arity = "preassign";
|
|
4802
4901
|
the_token.expression = parse_expression(150);
|
|
@@ -4811,7 +4910,7 @@ function jslint_phase3_parse(state) {
|
|
|
4811
4910
|
// Create a prefix operator.
|
|
4812
4911
|
|
|
4813
4912
|
const the_symbol = symbol(id);
|
|
4814
|
-
the_symbol.
|
|
4913
|
+
the_symbol.nud_prefix = function () {
|
|
4815
4914
|
const the_token = token_now;
|
|
4816
4915
|
the_token.arity = "unary";
|
|
4817
4916
|
if (typeof f === "function") {
|
|
@@ -4932,18 +5031,20 @@ function jslint_phase3_parse(state) {
|
|
|
4932
5031
|
// }
|
|
4933
5032
|
// jslint_assert(!mode_mega, `Expected !mode_mega.`);
|
|
4934
5033
|
|
|
4935
|
-
//
|
|
4936
|
-
//
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
//
|
|
4941
|
-
//
|
|
4942
|
-
//
|
|
4943
|
-
//
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
5034
|
+
// PR-378 - Relax warning "function_in_loop".
|
|
5035
|
+
//
|
|
5036
|
+
// // Don't create functions in loops. It is inefficient, and it can lead to
|
|
5037
|
+
// // scoping errors.
|
|
5038
|
+
//
|
|
5039
|
+
// if (functionage.loop > 0) {
|
|
5040
|
+
//
|
|
5041
|
+
// // test_cause:
|
|
5042
|
+
// // ["
|
|
5043
|
+
// // while(0){aa.map(function(){});}
|
|
5044
|
+
// // ", "prefix_function", "function_in_loop", "function", 17]
|
|
5045
|
+
//
|
|
5046
|
+
// warn("function_in_loop", the_function);
|
|
5047
|
+
// }
|
|
4947
5048
|
|
|
4948
5049
|
// Give the function properties for storing its names and for observing the
|
|
4949
5050
|
// depth of loops and switches.
|
|
@@ -4991,6 +5092,9 @@ function jslint_phase3_parse(state) {
|
|
|
4991
5092
|
if (name.identifier) {
|
|
4992
5093
|
enroll(name, "parameter", false);
|
|
4993
5094
|
} else {
|
|
5095
|
+
|
|
5096
|
+
// Recurse enroll_parameter().
|
|
5097
|
+
|
|
4994
5098
|
name.names.forEach(enroll_parameter);
|
|
4995
5099
|
}
|
|
4996
5100
|
});
|
|
@@ -5451,25 +5555,14 @@ function jslint_phase3_parse(state) {
|
|
|
5451
5555
|
}
|
|
5452
5556
|
|
|
5453
5557
|
function prefix_lparen() {
|
|
5454
|
-
|
|
5455
|
-
const the_paren = token_now;
|
|
5558
|
+
let the_paren = token_now;
|
|
5456
5559
|
let the_value;
|
|
5457
5560
|
|
|
5458
|
-
//
|
|
5459
|
-
// with one token of lookahead.
|
|
5460
|
-
|
|
5461
|
-
if (
|
|
5462
|
-
token_nxt.id === ")"
|
|
5463
|
-
|| token_nxt.id === "..."
|
|
5464
|
-
|| (token_nxt.identifier && (cadet === "," || cadet === "="))
|
|
5465
|
-
) {
|
|
5466
|
-
|
|
5467
|
-
// test_cause:
|
|
5468
|
-
// ["()=>0", "prefix_lparen", "fart", "", 0]
|
|
5561
|
+
// PR-385 - Bugfix - Fixes issue #382 - failure to detect destructured fart.
|
|
5469
5562
|
|
|
5470
|
-
|
|
5563
|
+
if (token_now.is_fart) {
|
|
5471
5564
|
the_paren.free = false;
|
|
5472
|
-
return parse_fart(
|
|
5565
|
+
return parse_fart();
|
|
5473
5566
|
}
|
|
5474
5567
|
|
|
5475
5568
|
// test_cause:
|
|
@@ -5487,31 +5580,6 @@ function jslint_phase3_parse(state) {
|
|
|
5487
5580
|
}
|
|
5488
5581
|
the_value.wrapped = true;
|
|
5489
5582
|
advance(")", the_paren);
|
|
5490
|
-
if (token_nxt.id === "=>") {
|
|
5491
|
-
if (the_value.arity !== "variable") {
|
|
5492
|
-
if (the_value.id === "{" || the_value.id === "[") {
|
|
5493
|
-
|
|
5494
|
-
// test_cause:
|
|
5495
|
-
// ["([])=>0", "prefix_lparen", "expected_a_before_b", "(", 1]
|
|
5496
|
-
// ["({})=>0", "prefix_lparen", "expected_a_before_b", "(", 1]
|
|
5497
|
-
|
|
5498
|
-
warn("expected_a_before_b", the_paren, "function", "(");
|
|
5499
|
-
|
|
5500
|
-
// test_cause:
|
|
5501
|
-
// ["([])=>0", "prefix_lparen", "expected_a_b", "=>", 5]
|
|
5502
|
-
// ["({})=>0", "prefix_lparen", "expected_a_b", "=>", 5]
|
|
5503
|
-
|
|
5504
|
-
return stop("expected_a_b", token_nxt, "{", "=>");
|
|
5505
|
-
}
|
|
5506
|
-
|
|
5507
|
-
// test_cause:
|
|
5508
|
-
// ["(0)=>0", "prefix_lparen", "expected_identifier_a", "0", 2]
|
|
5509
|
-
|
|
5510
|
-
return stop("expected_identifier_a", the_value);
|
|
5511
|
-
}
|
|
5512
|
-
the_paren.expression = [the_value];
|
|
5513
|
-
return parse_fart([the_paren.expression, "(" + the_value.id + ")"]);
|
|
5514
|
-
}
|
|
5515
5583
|
return the_value;
|
|
5516
5584
|
}
|
|
5517
5585
|
|
|
@@ -5592,12 +5660,12 @@ function jslint_phase3_parse(state) {
|
|
|
5592
5660
|
anon = "anonymous";
|
|
5593
5661
|
}
|
|
5594
5662
|
|
|
5595
|
-
function stmt(id,
|
|
5663
|
+
function stmt(id, fud_stmt) {
|
|
5596
5664
|
|
|
5597
5665
|
// Create a statement.
|
|
5598
5666
|
|
|
5599
5667
|
const the_symbol = symbol(id);
|
|
5600
|
-
the_symbol.
|
|
5668
|
+
the_symbol.fud_stmt = fud_stmt;
|
|
5601
5669
|
return the_symbol;
|
|
5602
5670
|
}
|
|
5603
5671
|
|
|
@@ -6726,7 +6794,7 @@ function jslint_phase3_parse(state) {
|
|
|
6726
6794
|
// Create a ternary operator.
|
|
6727
6795
|
|
|
6728
6796
|
const the_symbol = symbol(id1, 30);
|
|
6729
|
-
the_symbol.
|
|
6797
|
+
the_symbol.led_infix = function parse_ternary_led(left) {
|
|
6730
6798
|
const the_token = token_now;
|
|
6731
6799
|
let second;
|
|
6732
6800
|
second = parse_expression(20);
|
|
@@ -9563,7 +9631,7 @@ function objectDeepCopyWithKeysSorted(obj) {
|
|
|
9563
9631
|
|
|
9564
9632
|
// Recursively deep-copy obj with keys sorted.
|
|
9565
9633
|
|
|
9566
|
-
sorted =
|
|
9634
|
+
sorted = Object.create(null);
|
|
9567
9635
|
Object.keys(obj).sort().forEach(function (key) {
|
|
9568
9636
|
sorted[key] = objectDeepCopyWithKeysSorted(obj[key]);
|
|
9569
9637
|
});
|
|
@@ -10837,7 +10905,7 @@ function sentinel() {}
|
|
|
10837
10905
|
|
|
10838
10906
|
// 3. Create html-coverage-reports in <coverageDir>.
|
|
10839
10907
|
|
|
10840
|
-
fileDict =
|
|
10908
|
+
fileDict = Object.create(null);
|
|
10841
10909
|
await Promise.all(v8CoverageObj.result.map(async function ({
|
|
10842
10910
|
functions,
|
|
10843
10911
|
url: pathname
|