summaryrefslogtreecommitdiff
path: root/src/main.mlton.sml
diff options
context:
space:
mode:
authorGravatar FrigoEU <simon.van.casteren@gmail.com>2019-07-31 15:13:18 +0200
committerGravatar FrigoEU <simon.van.casteren@gmail.com>2019-07-31 15:13:18 +0200
commit80e7bb6165a5ad6517b35f301228f56b58eef39c (patch)
treed9f3b42b6cb74ebacc43d4081e5d91aebbe7a20f /src/main.mlton.sml
parent83bab4581d9570e151b23db3b4de016600afa76d (diff)
first iteration of "typeOf" command
Diffstat (limited to 'src/main.mlton.sml')
-rw-r--r--src/main.mlton.sml6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.mlton.sml b/src/main.mlton.sml
index cb7c8a77..8e70e398 100644
--- a/src/main.mlton.sml
+++ b/src/main.mlton.sml
@@ -139,6 +139,10 @@ fun oneRun args =
fun printModuleOf fname =
print_and_exit (Compiler.moduleOf fname) ()
+ fun typeOf loc =
+ (Print.print (Compiler.typeOf loc);
+ raise Code OS.Process.success)
+
fun add_class (class, num) =
case Int.fromString num of
NONE => raise Fail ("Invalid limit number '" ^ num ^ "'")
@@ -245,6 +249,8 @@ fun oneRun args =
NONE),
("moduleOf", ONE ("<file>", printModuleOf),
SOME "print module name of <file> and exit"),
+ ("typeOf", ONE ("<file:row:col>", typeOf),
+ SOME "print type of expression at <file:row:col> and exit"),
("noEmacs", set_true Demo.noEmacs,
NONE),
("limit", TWO ("<class>", "<num>", add_class),