Skip to content

Commit 698fbf5

Browse files
committed
Test emitting let instead of var.
Fixes #856
1 parent 17804a4 commit 698fbf5

File tree

832 files changed

+21319
-21319
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

+21319
-21319
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- Remove redundant space for empty return in generated js code. https://github.com/rescript-lang/rescript-compiler/pull/6745
3030
- Remove redundant space for export in generated js code. https://github.com/rescript-lang/rescript-compiler/pull/6560
3131
- Remove empty export blocks in generated js code. https://github.com/rescript-lang/rescript-compiler/pull/6744
32+
- In generated code, use `let` instead of `var`.
3233

3334
# 11.1.0
3435

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: 4 additions & 4 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: 7 additions & 7 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: 3 additions & 3 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
@@ -185,7 +185,7 @@ let pp_paren_params (inner_cxt : cxt) (f : Ext_pp.t) (lexical : Ident.t list) :
185185
id) *)
186186

187187
let pp_var_assign cxt f id =
188-
P.string f L.var;
188+
P.string f L.let_;
189189
P.space f;
190190
let acxt = Ext_pp_scope.ident cxt f id in
191191
P.space f;
@@ -202,7 +202,7 @@ let pp_var_assign_this cxt f id =
202202
cxt
203203

204204
let pp_var_declare cxt f id =
205-
P.string f L.var;
205+
P.string f L.let_;
206206
P.space f;
207207
let acxt = Ext_pp_scope.ident cxt f id in
208208
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.

jscomp/test/DerivingAccessorsCurried.js

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

jscomp/test/DerivingAccessorsUncurried.js

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

0 commit comments

Comments
 (0)