diff --git a/src/protocol/ast.rs b/src/protocol/ast.rs index 56a0149fed527e40c7493e409b86c5dc78feadbc..71ea38e2e1768e374b9d1fb2b5726386ca1482ab 100644 --- a/src/protocol/ast.rs +++ b/src/protocol/ast.rs @@ -357,6 +357,12 @@ impl Display for Identifier { #[derive(Debug, Clone, PartialEq, Eq)] pub enum ParserTypeVariant { + // Special builtin, only usable by the compiler and not constructable by the + // programmer + Void, + InputOrOutput, + ArrayLike, + IntegerLike, // Basic builtin Message, Bool, @@ -381,13 +387,14 @@ impl ParserTypeVariant { use ParserTypeVariant::*; match self { + Void | IntegerLike | Message | Bool | UInt8 | UInt16 | UInt32 | UInt64 | SInt8 | SInt16 | SInt32 | SInt64 | Character | String | IntegerLiteral | Inferred | PolymorphicArgument(_, _) => 0, - Array | Input | Output => + ArrayLike | InputOrOutput | Array | Input | Output => 1, Definition(_, num) => *num, } @@ -1209,31 +1216,6 @@ pub struct BlockStatement { pub labels: Vec, } -impl BlockStatement { - pub fn parent_block(&self, h: &Heap) -> Option { - let parent = self.parent_scope.unwrap(); - match parent { - Scope::Definition(_) => { - // If the parent scope is a definition, then there is no - // parent block. - None - } - Scope::Synchronous((parent, _)) => { - // It is always the case that when this function is called, - // the parent of a synchronous statement is a block statement: - // nested synchronous statements are flagged illegal, - // and that happens before resolving variables that - // creates the parent_scope references in the first place. - Some(h[parent].parent_scope.unwrap().to_block()) - } - Scope::Regular(parent) => { - // A variable scope is either a definition, sync, or block. - Some(parent) - } - } - } -} - #[derive(Debug, Clone)] pub struct EndBlockStatement { pub this: EndBlockStatementId,