Repository navigation
Commit 58dbca2
committed
Defer emitting JS library aliases when target is in a dependency cycle
When a JS library alias target (e.g. `foo`) is visited first and
transitively depends on its own alias (e.g. `foo_alias: 'foo'`),
`addedLibraryItems['foo']` is marked as visited before `var _foo = ...`
is emitted. Without deferral, `addFromLibrary('foo_alias')` emits
`var _foo_alias = _foo;` before `var _foo = ...`, leaving `_foo_alias`
initialized to `undefined` for arrow functions and non-hoisted values.
Track emitted library symbols in `emittedLibraryItems` and defer alias
assignments in `deferredAliases` until immediately after their target
symbol is emitted.1 parent 119421b commit 58dbca2
2 files changed
Lines changed: 30 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
728 | 730 | | |
729 | 731 | | |
730 | 732 | | |
| 733 | + | |
731 | 734 | | |
732 | 735 | | |
733 | 736 | | |
734 | 737 | | |
735 | | - | |
| 738 | + | |
736 | 739 | | |
737 | 740 | | |
738 | 741 | | |
| |||
884 | 887 | | |
885 | 888 | | |
886 | 889 | | |
887 | | - | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
888 | 907 | | |
889 | 908 | | |
890 | 909 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
608 | 616 | | |
609 | 617 | | |
610 | 618 | | |
| |||
0 commit comments