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;