Skip to content

Commit b39bd2b

Browse files
committed
Merge remote-tracking branch 'origin/master' into osa1/rts_rust_port
2 parents e025135 + 80401f5 commit b39bd2b

File tree

7 files changed

+27
-8
lines changed

7 files changed

+27
-8
lines changed

Changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
= Motoko compiler changelog
22

3+
* new `moc` command-line arguments `--args <file>` and `--args0 <file>` for reading newline/NUL terminated arguments from `<file>`.
4+
35
== 0.5.4 (2021-01-07)
46

57
* _Option blocks_ `do ? <block>` and _option checks_ `<exp> !`.

doc/modules/language-guide/pages/compiler-ref.adoc

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ You can use the following options with the `+moc+` command.
3232

3333
|`+--actor-alias+` |Specifies an actor import alias.
3434

35+
|`+--args <file>+` |Read additional newline separated command line arguments from <file>
36+
37+
|`+--args0 <file>+` |Read additional NUL separated command line arguments from <file>
38+
3539
|`+-c+` |Compiles programs to WebAssembly.
3640

3741
|`+--check+` |Performs type checking only.

nix/sources.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"motoko-base": {
4848
"branch": "next-moc",
4949
"repo": "ssh://git@github.com/dfinity-lab/motoko-base",
50-
"rev": "5e010560a3f12c85980f61f6fe766eff8c997d57",
50+
"rev": "65855b989792abb8c5e68adb47edfd566a8dd73a",
5151
"type": "git"
5252
},
5353
"motoko-matchers": {
@@ -83,10 +83,10 @@
8383
"homepage": "https://github.com/nmattia/niv",
8484
"owner": "nmattia",
8585
"repo": "niv",
86-
"rev": "94dadba1a3a6a2f0b8ca2963e49daeec5d4e3098",
87-
"sha256": "1y2h9wl7w60maa2m4xw9231xdr325xynzpph8xr4j5vsznygv986",
86+
"rev": "18b7314c13a6d0e82113a15c14e7a5f54286327d",
87+
"sha256": "0b2xb99nn7ddysvgzncwa4vglv0j6c0l4bgxz9hl4i3gmrlq3r59",
8888
"type": "tarball",
89-
"url": "https://github.com/nmattia/niv/archive/94dadba1a3a6a2f0b8ca2963e49daeec5d4e3098.tar.gz",
89+
"url": "https://github.com/nmattia/niv/archive/18b7314c13a6d0e82113a15c14e7a5f54286327d.tar.gz",
9090
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
9191
},
9292
"nixpkgs": {

src/codegen/compile.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3018,7 +3018,7 @@ module Tuple = struct
30183018

30193019
(* We represent the boxed empty tuple as the unboxed scalar 0, i.e. simply as
30203020
number (but really anything is fine, we never look at this) *)
3021-
let unit_vanilla_lit = 1l
3021+
let unit_vanilla_lit = 0l
30223022
let compile_unit = compile_unboxed_const unit_vanilla_lit
30233023

30243024
(* Expects on the stack the pointer to the array. *)

src/exes/moc.ml

+5-3
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ let argspec = Arg.align [
9595
"--sanity-checks",
9696
Arg.Unit
9797
(fun () -> Flags.sanity := true),
98-
" enable sanity checking in the RTS and generated code";
99-
]
98+
" enable sanity checking in the RTS and generated code";
99+
]
100+
@ Args.inclusion_args
101+
100102

101103

102104
let set_out_file files ext =
@@ -176,7 +178,7 @@ let () =
176178
(useful for debugging infinite loops)
177179
*)
178180
Printexc.record_backtrace true;
179-
Arg.parse argspec add_arg usage;
181+
Arg.parse_expand argspec add_arg usage;
180182
if !mode = Default then mode := (if !args = [] then Interact else Compile);
181183
Flags.compiled := (!mode = Compile || !mode = Idl);
182184
process_profiler_flags ();

src/mo_config/args.ml

+10
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,13 @@ let error_args = [
2626
"--error-detail", Arg.Set_int Flags.error_detail, " set error message detail for syntax errors"
2727
(* TODO move --hide-warnings here? *)
2828
]
29+
30+
let inclusion_args = [
31+
(* generic arg inclusion from file *)
32+
"--args", Arg.Expand Arg.read_arg,
33+
"<file> Read additional newline separated command line arguments \n\
34+
\ from <file>";
35+
"--args0", Arg.Expand Arg.read_arg0,
36+
"<file> Read additional NUL separated command line arguments from \n\
37+
\ <file>"
38+
]

src/mo_config/args.mli

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
val error_args : (Arg.key * Arg.spec * Arg.doc) list
22
val package_args : (Arg.key * Arg.spec * Arg.doc) list
3+
val inclusion_args : (Arg.key * Arg.spec * Arg.doc) list

0 commit comments

Comments
 (0)