Commit 5a7e578
authored
Improve parsing error messages (#405)
- output more informative error messages in `js_parse_expect`.
The previous code was bogus:
```
return js_parse_error(s, "expecting '%c'", tok);
```
this was causing a bug on `eval("do;")` where `tok` is `TOK_WHILE` (-70, 0xBA)
creating an invalid UTF-8 encoding (lone trailing byte).
This would ultimately have caused a failure in `JS_ThrowError2` if `JS_NewString`
failed when converting the error message to a string if the conversion detected the invalid
UTF-8 encoding and throwed an error (it currently does not, but should).
- test for `JS_NewString` failure in `JS_ThrowError2`
- test for `JS_FreeCString` failure in run-test262.c
- add more test cases1 parent 99c6719 commit 5a7e578
3 files changed
+72
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6635 | 6635 | | |
6636 | 6636 | | |
6637 | 6637 | | |
6638 | | - | |
| 6638 | + | |
6639 | 6639 | | |
6640 | 6640 | | |
6641 | 6641 | | |
| |||
6644 | 6644 | | |
6645 | 6645 | | |
6646 | 6646 | | |
6647 | | - | |
6648 | | - | |
6649 | | - | |
| 6647 | + | |
| 6648 | + | |
| 6649 | + | |
| 6650 | + | |
| 6651 | + | |
| 6652 | + | |
| 6653 | + | |
6650 | 6654 | | |
6651 | 6655 | | |
6652 | 6656 | | |
| |||
18633 | 18637 | | |
18634 | 18638 | | |
18635 | 18639 | | |
18636 | | - | |
18637 | | - | |
18638 | | - | |
| 18640 | + | |
| 18641 | + | |
| 18642 | + | |
| 18643 | + | |
| 18644 | + | |
| 18645 | + | |
| 18646 | + | |
| 18647 | + | |
| 18648 | + | |
| 18649 | + | |
| 18650 | + | |
| 18651 | + | |
| 18652 | + | |
| 18653 | + | |
| 18654 | + | |
| 18655 | + | |
| 18656 | + | |
| 18657 | + | |
| 18658 | + | |
| 18659 | + | |
| 18660 | + | |
| 18661 | + | |
| 18662 | + | |
| 18663 | + | |
| 18664 | + | |
| 18665 | + | |
18639 | 18666 | | |
18640 | | - | |
18641 | 18667 | | |
18642 | 18668 | | |
18643 | 18669 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1299 | 1299 | | |
1300 | 1300 | | |
1301 | 1301 | | |
1302 | | - | |
1303 | | - | |
| 1302 | + | |
1304 | 1303 | | |
1305 | | - | |
1306 | | - | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
1307 | 1311 | | |
1308 | 1312 | | |
1309 | 1313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
24 | 31 | | |
25 | 32 | | |
26 | 33 | | |
| |||
546 | 553 | | |
547 | 554 | | |
548 | 555 | | |
549 | | - | |
| 556 | + | |
550 | 557 | | |
551 | 558 | | |
552 | 559 | | |
| |||
608 | 615 | | |
609 | 616 | | |
610 | 617 | | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
611 | 638 | | |
612 | 639 | | |
613 | 640 | | |
| |||
629 | 656 | | |
630 | 657 | | |
631 | 658 | | |
| 659 | + | |
0 commit comments