Skip to content

Commit

Permalink
Back-end: emit let instead of var. (#6102)
Browse files Browse the repository at this point in the history
Fixes #856
  • Loading branch information
cristianoc committed Apr 30, 2024
1 parent 9bae27c commit 7bf97d9
Show file tree
Hide file tree
Showing 832 changed files with 21,342 additions and 21,342 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -31,6 +31,7 @@
- Remove empty export blocks in generated js code. https://github.com/rescript-lang/rescript-compiler/pull/6744
- Fix indent for returned/thrown/wrapped in parentheses objects in generated js code. https://github.com/rescript-lang/rescript-compiler/pull/6746
- Fix indent in generated js code. https://github.com/rescript-lang/rescript-compiler/pull/6747
- In generated code, use `let` instead of `var`. https://github.com/rescript-lang/rescript-compiler/pull/6102

# 11.1.0

Expand Down
2 changes: 1 addition & 1 deletion jscomp/build_tests/custom_namespace/src/demo.bs.js
@@ -1,7 +1,7 @@
'use strict';


var v = 42;
let v = 42;

exports.v = v;
/* No side effect */
2 changes: 1 addition & 1 deletion jscomp/build_tests/devonly/src/demo.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jscomp/build_tests/devonly/src/depdemo.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jscomp/build_tests/devonly/src2/hello.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jscomp/build_tests/devonly/src2/hellodep.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jscomp/build_tests/ns/src/demo.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions jscomp/build_tests/ns/src/hello.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions jscomp/build_tests/react_ppx/src/React.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions jscomp/build_tests/react_ppx/src/gpr_3695_test.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 22 additions & 22 deletions jscomp/build_tests/react_ppx/src/gpr_3987_test.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions jscomp/build_tests/react_ppx/src/recursive_component_test.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions jscomp/core/js_dump.ml
Expand Up @@ -182,7 +182,7 @@ let pp_paren_params (inner_cxt : cxt) (f : Ext_pp.t) (lexical : Ident.t list) :
id) *)

let pp_var_assign cxt f id =
P.string f L.var;
P.string f L.let_;
P.space f;
let acxt = Ext_pp_scope.ident cxt f id in
P.space f;
Expand All @@ -199,7 +199,7 @@ let pp_var_assign_this cxt f id =
cxt

let pp_var_declare cxt f id =
P.string f L.var;
P.string f L.let_;
P.space f;
let acxt = Ext_pp_scope.ident cxt f id in
semi f;
Expand Down
2 changes: 1 addition & 1 deletion jscomp/core/js_dump_import_export.ml
Expand Up @@ -111,7 +111,7 @@ let requires require_lit cxt f (modules : (Ident.t * string * bool) list) =
in
P.at_least_two_lines f;
Ext_list.rev_iter reversed_list (fun (s, file, default) ->
P.string f L.var;
P.string f L.let_;
P.space f;
P.string f s;
P.space f;
Expand Down
2 changes: 1 addition & 1 deletion jscomp/core/js_dump_lit.ml
Expand Up @@ -29,7 +29,7 @@ let function_ = "function"

let function_async ~async = if async then "async function" else "function"

let var = "var" (* should be able to switch to [let] easily*)
let let_ = "let"

let return = "return"

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions jscomp/test/406_primitive_test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jscomp/test/AsInUncurriedExternals.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions jscomp/test/Coercion.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7bf97d9

Please sign in to comment.