Skip to content

Commit 7bf97d9

Browse files
authored
Back-end: emit let instead of var. (#6102)
Fixes #856
1 parent 9bae27c commit 7bf97d9

File tree

832 files changed

+21342
-21342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

832 files changed

+21342
-21342
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
- Remove empty export blocks in generated js code. https://github.com/rescript-lang/rescript-compiler/pull/6744
3232
- Fix indent for returned/thrown/wrapped in parentheses objects in generated js code. https://github.com/rescript-lang/rescript-compiler/pull/6746
3333
- Fix indent in generated js code. https://github.com/rescript-lang/rescript-compiler/pull/6747
34+
- In generated code, use `let` instead of `var`. https://github.com/rescript-lang/rescript-compiler/pull/6102
3435

3536
# 11.1.0
3637

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33

4-
var v = 42;
4+
let v = 42;
55

66
exports.v = v;
77
/* No side effect */

jscomp/build_tests/devonly/src/demo.bs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/build_tests/devonly/src/depdemo.bs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/build_tests/devonly/src2/hello.bs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/build_tests/devonly/src2/hellodep.bs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/build_tests/ns/src/demo.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/build_tests/ns/src/hello.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/build_tests/react_ppx/src/React.bs.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/build_tests/react_ppx/src/gpr_3695_test.bs.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/build_tests/react_ppx/src/gpr_3987_test.bs.js

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/build_tests/react_ppx/src/recursive_component_test.bs.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/core/js_dump.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ let pp_paren_params (inner_cxt : cxt) (f : Ext_pp.t) (lexical : Ident.t list) :
182182
id) *)
183183

184184
let pp_var_assign cxt f id =
185-
P.string f L.var;
185+
P.string f L.let_;
186186
P.space f;
187187
let acxt = Ext_pp_scope.ident cxt f id in
188188
P.space f;
@@ -199,7 +199,7 @@ let pp_var_assign_this cxt f id =
199199
cxt
200200

201201
let pp_var_declare cxt f id =
202-
P.string f L.var;
202+
P.string f L.let_;
203203
P.space f;
204204
let acxt = Ext_pp_scope.ident cxt f id in
205205
semi f;

jscomp/core/js_dump_import_export.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ let requires require_lit cxt f (modules : (Ident.t * string * bool) list) =
111111
in
112112
P.at_least_two_lines f;
113113
Ext_list.rev_iter reversed_list (fun (s, file, default) ->
114-
P.string f L.var;
114+
P.string f L.let_;
115115
P.space f;
116116
P.string f s;
117117
P.space f;

jscomp/core/js_dump_lit.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let function_ = "function"
2929

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

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

3434
let return = "return"
3535

jscomp/gentype_tests/typescript-react-example/src/Wrapper.res.js

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/test/406_primitive_test.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/test/AsInUncurriedExternals.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/test/Coercion.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)