Commit cc65ad3
CLJS-1515: Self-host: Allow :file key in cljs.js/*load-fn*
Bootstrapped ClojureScript is abstracted away from direct I/O by use of a *load-fn* callback. A
result is that when a namespace is loaded, the :file attribute associated with def s in
[:cljs.analyzer/namespaces 'foo.ns :defs] in the AST is nil, because cljs.analyzer/*cljs-file*
cannot be set to a meaningful value.
This ticket asks for an extension to *load-fn*, allowing a :file key to be optionally included by
cljs.js clients, and for cljs.analyzer/*cljs-file* to be bound to that value in appropriate places
in cljs.js so that the :file info appears in the AST.
One rationale for this :file attribute is that it makes it easier for clients of cljs.js to look up
the file for a def, say, for use when implementing a source REPL special, for example.1 parent 60d5349 commit cc65ad3
2 files changed
+33
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
246 | 248 | | |
247 | 249 | | |
248 | 250 | | |
249 | | - | |
| 251 | + | |
250 | 252 | | |
251 | | - | |
| 253 | + | |
252 | 254 | | |
253 | 255 | | |
254 | 256 | | |
| |||
379 | 381 | | |
380 | 382 | | |
381 | 383 | | |
382 | | - | |
| 384 | + | |
383 | 385 | | |
384 | | - | |
| 386 | + | |
385 | 387 | | |
386 | 388 | | |
387 | 389 | | |
| |||
517 | 519 | | |
518 | 520 | | |
519 | 521 | | |
520 | | - | |
| 522 | + | |
| 523 | + | |
521 | 524 | | |
522 | 525 | | |
523 | 526 | | |
| |||
780 | 783 | | |
781 | 784 | | |
782 | 785 | | |
783 | | - | |
| 786 | + | |
| 787 | + | |
784 | 788 | | |
785 | 789 | | |
786 | 790 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
50 | 72 | | |
51 | 73 | | |
52 | 74 | | |
| |||
750 | 772 | | |
751 | 773 | | |
752 | 774 | | |
753 | | - | |
| 775 | + | |
754 | 776 | | |
755 | 777 | | |
756 | 778 | | |
| |||
0 commit comments