From 46e9313e555e74566144c9c33531cf09fd87f777 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Wed, 2 Aug 2023 19:49:30 -0400 Subject: [PATCH] Introduce Type::Signature to the AST --- compiler/ast/src/types/type_.rs | 4 ++++ compiler/passes/src/code_generation/visit_type.rs | 1 + compiler/span/src/symbol.rs | 1 + 3 files changed, 6 insertions(+) diff --git a/compiler/ast/src/types/type_.rs b/compiler/ast/src/types/type_.rs index f938e8fe7b..aa2f0f7093 100644 --- a/compiler/ast/src/types/type_.rs +++ b/compiler/ast/src/types/type_.rs @@ -40,6 +40,8 @@ pub enum Type { Mapping(MappingType), /// The `scalar` type. Scalar, + /// The `signature` type. + Signature, /// The `string` type. String, /// A static tuple of at least one type. @@ -64,6 +66,7 @@ impl Type { | (Type::Field, Type::Field) | (Type::Group, Type::Group) | (Type::Scalar, Type::Scalar) + | (Type::Signature, Type::Signature) | (Type::String, Type::String) | (Type::Unit, Type::Unit) => true, (Type::Integer(left), Type::Integer(right)) => left.eq(right), @@ -90,6 +93,7 @@ impl fmt::Display for Type { Type::Integer(ref integer_type) => write!(f, "{integer_type}"), Type::Mapping(ref mapping_type) => write!(f, "{mapping_type}"), Type::Scalar => write!(f, "scalar"), + Type::Signature => write!(f, "signature"), Type::String => write!(f, "string"), Type::Tuple(ref tuple) => write!(f, "{tuple}"), Type::Unit => write!(f, "()"), diff --git a/compiler/passes/src/code_generation/visit_type.rs b/compiler/passes/src/code_generation/visit_type.rs index f93746df93..43df14dc70 100644 --- a/compiler/passes/src/code_generation/visit_type.rs +++ b/compiler/passes/src/code_generation/visit_type.rs @@ -26,6 +26,7 @@ impl<'a> CodeGenerator<'a> { | Type::Field | Type::Group | Type::Scalar + | Type::Signature | Type::String | Type::Integer(..) => format!("{input}"), Type::Identifier(ident) => format!("{ident}"), diff --git a/compiler/span/src/symbol.rs b/compiler/span/src/symbol.rs index b6a0ac0035..f8c58b10a8 100644 --- a/compiler/span/src/symbol.rs +++ b/compiler/span/src/symbol.rs @@ -208,6 +208,7 @@ symbols! { i128, record, scalar, + signature, string, Struct: "struct", u8,