Skip to content

Commit eacc273

Browse files
committed
Runtime_ast_extensions
1 parent 8ff1a7c commit eacc273

7 files changed

+48
-3
lines changed

jscomp/ext/js_runtime_modules.ml

+2
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,5 @@ let caml_splice_call = "Caml_splice_call"
7474
let deriving = "Runtime_deriving"
7575

7676
let promise = "Runtime_promise"
77+
78+
let astExtensions = "Runtime_ast_extensions"

jscomp/frontend/ast_exp_extension.ml

+9-2
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,21 @@ let handle_extension e (self : Bs_ast_mapper.mapper)
8585
Exp.sequence ~loc
8686
(Ast_compatible.app1 ~loc
8787
(Exp.ident ~loc
88-
{loc; txt = Ldot (Ldot (Lident "Js", "Console"), "timeStart")})
88+
{
89+
loc;
90+
txt = Ldot (Lident Js_runtime_modules.astExtensions, "timeStart");
91+
})
8992
(Ast_compatible.const_exp_string ~loc loc_string))
9093
(Exp.let_ ~loc Nonrecursive
9194
[Vb.mk ~loc (Pat.var ~loc {loc; txt = "timed"}) e]
9295
(Exp.sequence ~loc
9396
(Ast_compatible.app1 ~loc
9497
(Exp.ident ~loc
95-
{loc; txt = Ldot (Ldot (Lident "Js", "Console"), "timeEnd")})
98+
{
99+
loc;
100+
txt =
101+
Ldot (Lident Js_runtime_modules.astExtensions, "timeEnd");
102+
})
96103
(Ast_compatible.const_exp_string ~loc loc_string))
97104
(Exp.ident ~loc {loc; txt = Lident "timed"})))
98105
| _ ->

jscomp/others/release.ninja

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ o others/belt_internalSetString.cmi others/belt_internalSetString.cmj : cc other
156156
o others/dom.cmi others/dom.cmj : cc others/dom.res | others/belt_internals.cmi others/dom_storage.cmj others/dom_storage2.cmj others/js.cmi $bsc js_pkg
157157
o others/dom_storage.cmi others/dom_storage.cmj : cc others/dom_storage.res | others/belt_internals.cmi others/dom_storage2.cmj others/js.cmi $bsc js_pkg
158158
o others/dom_storage2.cmi others/dom_storage2.cmj : cc others/dom_storage2.res | others/belt_internals.cmi others/js.cmi $bsc
159+
o others/runtime_ast_extensions.cmi others/runtime_ast_extensions.cmj : cc others/runtime_ast_extensions.res | others/belt_internals.cmi others/js.cmi $bsc
159160
o others/runtime_deriving.cmj : cc_cmi others/runtime_deriving.res | others/belt_internals.cmi others/js.cmi others/runtime_deriving.cmi $bsc js_pkg
160161
o others/runtime_deriving.cmi : cc others/runtime_deriving.resi | others/belt_internals.cmi others/js.cmi $bsc
161162
o others/runtime_promise.cmi others/runtime_promise.cmj : cc others/runtime_promise.res | others/belt_internals.cmi others/js.cmi $bsc
162-
o others : phony others/belt_Array.cmi others/belt_Array.cmj others/belt_Float.cmi others/belt_Float.cmj others/belt_HashMap.cmi others/belt_HashMap.cmj others/belt_HashMapInt.cmi others/belt_HashMapInt.cmj others/belt_HashMapString.cmi others/belt_HashMapString.cmj others/belt_HashSet.cmi others/belt_HashSet.cmj others/belt_HashSetInt.cmi others/belt_HashSetInt.cmj others/belt_HashSetString.cmi others/belt_HashSetString.cmj others/belt_Id.cmi others/belt_Id.cmj others/belt_Int.cmi others/belt_Int.cmj others/belt_List.cmi others/belt_List.cmj others/belt_Map.cmi others/belt_Map.cmj others/belt_MapDict.cmi others/belt_MapDict.cmj others/belt_MapInt.cmi others/belt_MapInt.cmj others/belt_MapString.cmi others/belt_MapString.cmj others/belt_MutableMap.cmi others/belt_MutableMap.cmj others/belt_MutableMapInt.cmi others/belt_MutableMapInt.cmj others/belt_MutableMapString.cmi others/belt_MutableMapString.cmj others/belt_MutableQueue.cmi others/belt_MutableQueue.cmj others/belt_MutableSet.cmi others/belt_MutableSet.cmj others/belt_MutableSetInt.cmi others/belt_MutableSetInt.cmj others/belt_MutableSetString.cmi others/belt_MutableSetString.cmj others/belt_MutableStack.cmi others/belt_MutableStack.cmj others/belt_Option.cmi others/belt_Option.cmj others/belt_Range.cmi others/belt_Range.cmj others/belt_Result.cmi others/belt_Result.cmj others/belt_Set.cmi others/belt_Set.cmj others/belt_SetDict.cmi others/belt_SetDict.cmj others/belt_SetInt.cmi others/belt_SetInt.cmj others/belt_SetString.cmi others/belt_SetString.cmj others/belt_SortArray.cmi others/belt_SortArray.cmj others/belt_SortArrayInt.cmi others/belt_SortArrayInt.cmj others/belt_SortArrayString.cmi others/belt_SortArrayString.cmj others/belt_internalAVLset.cmi others/belt_internalAVLset.cmj others/belt_internalAVLtree.cmi others/belt_internalAVLtree.cmj others/belt_internalBuckets.cmi others/belt_internalBuckets.cmj others/belt_internalBucketsType.cmi others/belt_internalBucketsType.cmj others/belt_internalMapInt.cmi others/belt_internalMapInt.cmj others/belt_internalMapString.cmi others/belt_internalMapString.cmj others/belt_internalSetBuckets.cmi others/belt_internalSetBuckets.cmj others/belt_internalSetInt.cmi others/belt_internalSetInt.cmj others/belt_internalSetString.cmi others/belt_internalSetString.cmj others/dom.cmi others/dom.cmj others/dom_storage.cmi others/dom_storage.cmj others/dom_storage2.cmi others/dom_storage2.cmj others/runtime_deriving.cmi others/runtime_deriving.cmj others/runtime_promise.cmi others/runtime_promise.cmj
163+
o others : phony others/belt_Array.cmi others/belt_Array.cmj others/belt_Float.cmi others/belt_Float.cmj others/belt_HashMap.cmi others/belt_HashMap.cmj others/belt_HashMapInt.cmi others/belt_HashMapInt.cmj others/belt_HashMapString.cmi others/belt_HashMapString.cmj others/belt_HashSet.cmi others/belt_HashSet.cmj others/belt_HashSetInt.cmi others/belt_HashSetInt.cmj others/belt_HashSetString.cmi others/belt_HashSetString.cmj others/belt_Id.cmi others/belt_Id.cmj others/belt_Int.cmi others/belt_Int.cmj others/belt_List.cmi others/belt_List.cmj others/belt_Map.cmi others/belt_Map.cmj others/belt_MapDict.cmi others/belt_MapDict.cmj others/belt_MapInt.cmi others/belt_MapInt.cmj others/belt_MapString.cmi others/belt_MapString.cmj others/belt_MutableMap.cmi others/belt_MutableMap.cmj others/belt_MutableMapInt.cmi others/belt_MutableMapInt.cmj others/belt_MutableMapString.cmi others/belt_MutableMapString.cmj others/belt_MutableQueue.cmi others/belt_MutableQueue.cmj others/belt_MutableSet.cmi others/belt_MutableSet.cmj others/belt_MutableSetInt.cmi others/belt_MutableSetInt.cmj others/belt_MutableSetString.cmi others/belt_MutableSetString.cmj others/belt_MutableStack.cmi others/belt_MutableStack.cmj others/belt_Option.cmi others/belt_Option.cmj others/belt_Range.cmi others/belt_Range.cmj others/belt_Result.cmi others/belt_Result.cmj others/belt_Set.cmi others/belt_Set.cmj others/belt_SetDict.cmi others/belt_SetDict.cmj others/belt_SetInt.cmi others/belt_SetInt.cmj others/belt_SetString.cmi others/belt_SetString.cmj others/belt_SortArray.cmi others/belt_SortArray.cmj others/belt_SortArrayInt.cmi others/belt_SortArrayInt.cmj others/belt_SortArrayString.cmi others/belt_SortArrayString.cmj others/belt_internalAVLset.cmi others/belt_internalAVLset.cmj others/belt_internalAVLtree.cmi others/belt_internalAVLtree.cmj others/belt_internalBuckets.cmi others/belt_internalBuckets.cmj others/belt_internalBucketsType.cmi others/belt_internalBucketsType.cmj others/belt_internalMapInt.cmi others/belt_internalMapInt.cmj others/belt_internalMapString.cmi others/belt_internalMapString.cmj others/belt_internalSetBuckets.cmi others/belt_internalSetBuckets.cmj others/belt_internalSetInt.cmi others/belt_internalSetInt.cmj others/belt_internalSetString.cmi others/belt_internalSetString.cmj others/dom.cmi others/dom.cmj others/dom_storage.cmi others/dom_storage.cmj others/dom_storage2.cmi others/dom_storage2.cmj others/runtime_ast_extensions.cmi others/runtime_ast_extensions.cmj others/runtime_deriving.cmi others/runtime_deriving.cmj others/runtime_promise.cmi others/runtime_promise.cmj
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Copyright (C) 2024 Authors of ReScript
2+
*
3+
* This program is free software: you can redistribute it and/or modify
4+
* it under the terms of the GNU Lesser General Public License as published by
5+
* the Free Software Foundation, either version 3 of the License, or
6+
* (at your option) any later version.
7+
*
8+
* In addition to the permissions granted to you by the LGPL, you may combine
9+
* or link a "work that uses the Library" with a publicly distributed version
10+
* of this file to produce a combined library or application, then distribute
11+
* that combined work under the terms of your choosing, with no requirement
12+
* to comply with the obligations normally placed on you by section 4 of the
13+
* LGPL version 3 (or the corresponding section of a later version of the LGPL
14+
* should you choose to use a later version).
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU Lesser General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU Lesser General Public License
22+
* along with this program; if not, write to the Free Software
23+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24+
25+
@val @scope("console") external timeStart: string => unit = "time"
26+
27+
@val @scope("console") external timeEnd: string => unit = "timeEnd"

lib/es6/runtime_ast_extensions.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */

lib/js/runtime_ast_extensions.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */

packages/artifacts.txt

+6
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ lib/es6/pervasives.js
178178
lib/es6/pervasivesU.js
179179
lib/es6/queue.js
180180
lib/es6/random.js
181+
lib/es6/runtime_ast_extensions.js
181182
lib/es6/runtime_deriving.js
182183
lib/es6/runtime_promise.js
183184
lib/es6/set.js
@@ -343,6 +344,7 @@ lib/js/pervasives.js
343344
lib/js/pervasivesU.js
344345
lib/js/queue.js
345346
lib/js/random.js
347+
lib/js/runtime_ast_extensions.js
346348
lib/js/runtime_deriving.js
347349
lib/js/runtime_promise.js
348350
lib/js/set.js
@@ -999,6 +1001,10 @@ lib/ocaml/random.cmt
9991001
lib/ocaml/random.cmti
10001002
lib/ocaml/random.res
10011003
lib/ocaml/random.resi
1004+
lib/ocaml/runtime_ast_extensions.cmi
1005+
lib/ocaml/runtime_ast_extensions.cmj
1006+
lib/ocaml/runtime_ast_extensions.cmt
1007+
lib/ocaml/runtime_ast_extensions.res
10021008
lib/ocaml/runtime_deriving.cmi
10031009
lib/ocaml/runtime_deriving.cmj
10041010
lib/ocaml/runtime_deriving.cmt

0 commit comments

Comments
 (0)