You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While modifying parse_bytecode.ml for rehp, I might have stumbled upon some evidence that parse_bytecode.ml is responsible for source maps being
difficult to use in practice (they jump all over the place in very unintuitive ways).
Problem: For the following Reason code:
letgreeting="hello world";
print_endline(greeting);letgreeting="hello world with unicode: Ɋ";
print_endline(greeting);/* THIS IS LINE 4 */letunicodeLength=String.length(String.make(Random.int(30),'i'));
print_endline(
"String.length(\"Ɋ\") should be two:"++ string_of_int(unicodeLength),
);
print_endline(String.make(1,"Ɋ".[0]) ++String.make(1,"Ɋ".[1]));
We get the following debug data: (Notice the many things claiming to be on line 4 that aren't!
For example _g_ (the number 30))
But if you add the following print statements right after this line in parse_bytecode.ml You will see that there are only two debug events for line 4, (likely the correct line print_endline(greeting))
let _ = print_string ((if after then"<after>"else"") ^ (if before then"<before>"else"") ^" DEBUG EVENT FOUND AT: "^ (pos.Lexing.pos_fname) ^":"^ string_of_int(pos.Lexing.pos_lnum) ^":"^ string_of_int (pos.Lexing.pos_cnum - pos.Lexing.pos_bol)) inlet _ = print_string (""^ (if after then"<after>"else"") ^ (if before then"<before>"else"") ^" DEBUG END FOUND AT: "^ (loc.Location.loc_end.Lexing.pos_fname) ^":"^ string_of_int(loc.Location.loc_end.Lexing.pos_lnum) ^":"^ string_of_int (loc.Location.loc_end.Lexing.pos_cnum - loc.Location.loc_end.Lexing.pos_bol)) inlet _ = print_newline ()in
The text was updated successfully, but these errors were encountered:
While modifying
parse_bytecode.ml
for rehp, I might have stumbled upon some evidence thatparse_bytecode.ml
is responsible for source maps beingdifficult to use in practice (they jump all over the place in very unintuitive ways).
Problem: For the following Reason code:
We get the following debug data: (Notice the many things claiming to be on line
4
that aren't!For example
_g_
(the number30
))But if you add the following print statements right after this line in
parse_bytecode.ml
You will see that there are only two debug events for line
4
, (likely the correct lineprint_endline(greeting)
)The text was updated successfully, but these errors were encountered: