Skip to content

Commit df9a8ef

Browse files
committed
fixup! Document source maps
1 parent 4872613 commit df9a8ef

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

compiler/lib/js_output.ml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
(*
4444
Source maps
4545
===========
46+
Most of this information was obtained by running the Firefox and
47+
Chrome debuggers on some test programs.
4648
4749
The location of a declaration is determined by the first character of
4850
the expression.
@@ -74,8 +76,8 @@ Chrome stops on the character right after.
7476
(x)=>x+1
7577
^^
7678
77-
In Chrome the location of a function call is determined by the name of the
78-
function when it is explicit.
79+
In Chrome the location of a function call is at the start of the name
80+
of the function when it is explicit.
7981
8082
f(e) Math.cos(1.)
8183
^ ^
@@ -86,29 +88,35 @@ always uses this location.
8688
(0,f)(e)(e')
8789
^ ^
8890
89-
Except for variable declarations, Chrome stops at the begining of
90-
statements.
91+
Usually, Chrome stops at the begining of statements.
9192
9293
if (e) { ... }
9394
^
9495
95-
Firefox will rather stop on the expression.
96-
96+
Firefox will rather stop on the expression when there is one.
9797
9898
if (e) { ... }
9999
^
100100
101+
The debugger don't stop at some statements, such as function
102+
declarations, labelled statements, and block statements.
103+
101104
Chrome uses the name associated to the location of each bound variable
102-
to determine its name.
105+
to determine its name [1].
103106
104107
function f(x) { var y = ... }
105108
^ ^ ^
106109
107110
Chrome uses the location of the opening parenthesis of a function
108-
declaration to determine the function name in the stack.
111+
declaration to determine the function name in the stack [2].
112+
109113
110114
function f() { ... }
111115
^
116+
117+
[1] https://github.com/ChromeDevTools/devtools-frontend/blob/11db398f811784395a6706cf3f800014d98171d9/front_end/models/source_map_scopes/NamesResolver.ts#L238-L243
118+
119+
[2] https://github.com/ChromeDevTools/devtools-frontend/blob/11db398f811784395a6706cf3f800014d98171d9/front_end/models/source_map_scopes/NamesResolver.ts#L765-L768
112120
*)
113121

114122
open! Stdlib

0 commit comments

Comments
 (0)