From fe50da78b21a572f3c897136d614e7a3c085fac6 Mon Sep 17 00:00:00 2001 From: zapashcanon Date: Sat, 15 Jun 2024 23:40:28 +0200 Subject: [PATCH] support binary files in `owi validate` --- src/cmd/cmd_validate.ml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/cmd/cmd_validate.ml b/src/cmd/cmd_validate.ml index 25576ab96..4f0999d7a 100644 --- a/src/cmd/cmd_validate.ml +++ b/src/cmd/cmd_validate.ml @@ -5,9 +5,16 @@ open Syntax let validate filename = - let* modul = Parse.Text.Module.from_file filename in - let+ _modul = Compile.Text.until_typecheck ~unsafe:false modul in - () + let* modul = Parse.guess_from_file filename in + match modul with + | Either.Left (Either.Left text_module) -> + let+ _modul = Compile.Text.until_typecheck ~unsafe:false text_module in + () + | Either.Left (Either.Right _text_script) -> + Error (`Msg "can not run validation on a script (.wast) file") + | Either.Right binary_module -> + let+ _module = Compile.Binary.until_typecheck ~unsafe:false binary_module in + () let cmd debug files = if debug then Log.debug_on := true;