Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
## Bug fixes
* Compiler: put custom header at the top of the output file (fix #1441)
* Compiler (js parser): fix parsing of js labels (fix #1440)
* Compiler: fix simplification of js with let and const
* Compiler: reduce memory consumption when parsing js
* Compiler: parsing js can return a list of token, the list was sometime incorrect

# 5.1.1 (2023-03-15) - Lille
## Bug fixes
Expand Down
5 changes: 2 additions & 3 deletions compiler/lib/js_parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ T_BACKQUOTE
(* Rules type decl *)
(*************************************************************************)

%start <[ `Annot of Js_token.Annot.t * Parse_info.t | `Item of Javascript.statement * Javascript.location] list > program
%start <(Lexing.position * (Javascript.statement * Javascript.location)) list > program
%start <Javascript.expression> standalone_expression

%%
Expand Down Expand Up @@ -248,8 +248,7 @@ annot:
| a=TAnnot { a, pi $symbolstartpos }

module_item:
| item { `Item $1 }
| annot { `Annot $1 }
| item { $symbolstartpos, $1 }

(*************************************************************************)
(* statement *)
Expand Down
2 changes: 1 addition & 1 deletion compiler/lib/js_traverse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ class simpl =
, Some (Expression_statement (EBin (Eq, v2, e2)), _) )
when Poly.(v1 = v2) ->
(Expression_statement (EBin (Eq, v1, ECond (cond, e1, e2))), loc) :: rem
| Variable_statement ((Var as k), l1) ->
| Variable_statement (((Var | Let | Const) as k), l1) ->
let x =
List.map l1 ~f:(function
| DeclPattern _ as d -> Variable_statement (k, [ d ]), loc
Expand Down
4 changes: 2 additions & 2 deletions compiler/lib/linker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module Named_value : sig
end = struct
class traverse_and_find_named_values all =
object
inherit Js_traverse.map as self
inherit Js_traverse.iter as self

method expression x =
let open Javascript in
Expand All @@ -83,7 +83,7 @@ end = struct
let find_all code =
let all = ref StringSet.empty in
let p = new traverse_and_find_named_values all in
ignore (p#program code);
p#program code;
!all
end

Expand Down
Loading