From f341527aa6fbac233b1f340c68da80616183daa9 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 31 Oct 2019 16:46:07 +0100 Subject: [PATCH] add signature type --- src/passes/6-transpiler/transpiler.ml | 1 + src/passes/8-compiler/compiler_type.ml | 3 +++ src/stages/mini_c/PP.ml | 1 + src/stages/mini_c/types.ml | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/passes/6-transpiler/transpiler.ml b/src/passes/6-transpiler/transpiler.ml index eb2fe4b54..1beb15ef2 100644 --- a/src/passes/6-transpiler/transpiler.ml +++ b/src/passes/6-transpiler/transpiler.ml @@ -116,6 +116,7 @@ let rec transpile_type (t:AST.type_value) : type_value result = | T_constant ("timestamp", []) -> ok (T_base Base_timestamp) | T_constant ("unit", []) -> ok (T_base Base_unit) | T_constant ("operation", []) -> ok (T_base Base_operation) + | T_constant ("signature", []) -> ok (T_base Base_signature) | T_constant ("contract", [x]) -> let%bind x' = transpile_type x in ok (T_contract x') diff --git a/src/passes/8-compiler/compiler_type.ml b/src/passes/8-compiler/compiler_type.ml index f7e04adb3..df0ff7bc6 100644 --- a/src/passes/8-compiler/compiler_type.ml +++ b/src/passes/8-compiler/compiler_type.ml @@ -68,6 +68,7 @@ module Ty = struct | Base_timestamp -> return timestamp_k | Base_bytes -> return bytes_k | Base_operation -> fail (not_comparable "operation") + | Base_signature -> fail (not_comparable "signature") let comparable_type : type_value -> ex_comparable_ty result = fun tv -> match tv with @@ -97,6 +98,7 @@ module Ty = struct | Base_timestamp -> return timestamp | Base_bytes -> return bytes | Base_operation -> return operation + | Base_signature -> return signature let rec type_ : type_value -> ex_ty result = function @@ -182,6 +184,7 @@ let base_type : type_base -> O.michelson result = | Base_timestamp -> ok @@ O.prim T_timestamp | Base_bytes -> ok @@ O.prim T_bytes | Base_operation -> ok @@ O.prim T_operation + | Base_signature -> ok @@ O.prim T_signature let rec type_ : type_value -> O.michelson result = function diff --git a/src/stages/mini_c/PP.ml b/src/stages/mini_c/PP.ml index 977c7b931..e904ad01f 100644 --- a/src/stages/mini_c/PP.ml +++ b/src/stages/mini_c/PP.ml @@ -20,6 +20,7 @@ let type_base ppf : type_base -> _ = function | Base_timestamp -> fprintf ppf "timestamp" | Base_bytes -> fprintf ppf "bytes" | Base_operation -> fprintf ppf "operation" + | Base_signature -> fprintf ppf "signature" let rec type_ ppf : type_value -> _ = function | T_or(a, b) -> fprintf ppf "(%a) | (%a)" annotated a annotated b diff --git a/src/stages/mini_c/types.ml b/src/stages/mini_c/types.ml index 5901b7dc6..2646d3dc9 100644 --- a/src/stages/mini_c/types.ml +++ b/src/stages/mini_c/types.ml @@ -6,7 +6,7 @@ type type_base = | Base_int | Base_nat | Base_tez | Base_timestamp | Base_string | Base_bytes | Base_address - | Base_operation + | Base_operation | Base_signature type 'a annotated = string option * 'a