diff --git a/src/protocol/ast.rs b/src/protocol/ast.rs index e137985fa110c6e2cea9a0f83be7cedf79aef88d..6ad5f1ca98cfa39f02cad26fa0314df2c6f14413 100644 --- a/src/protocol/ast.rs +++ b/src/protocol/ast.rs @@ -1071,6 +1071,36 @@ impl ExpressionInfoVariant { } } +#[derive(Debug)] +pub enum ProcedureSource { + FuncUserDefined, + CompUserDefined, + // Builtin functions, available to user + FuncGet, + FuncPut, + FuncFires, + FuncCreate, + FuncLength, + FuncAssert, + FuncPrint, + // Buitlin functions, not available to user + FuncSelectStart, + FuncSelectRegisterCasePort, + FuncSelectWait, + // Builtin components, available to user + CompRandomU32, // TODO: Remove, temporary thing +} + +impl ProcedureSource { + pub(crate) fn is_builtin(&self) -> bool { + match self { + ProcedureSource::FuncUserDefined | ProcedureSource::CompUserDefined => false, + _ => true, + } + } +} + + /// Generic storage for functions, primitive components and composite /// components. // Note that we will have function definitions for builtin functions as well. In @@ -1080,12 +1110,12 @@ pub struct ProcedureDefinition { pub this: ProcedureDefinitionId, pub defined_in: RootId, // Symbol scanning - pub builtin: bool, pub kind: ProcedureKind, pub span: InputSpan, pub identifier: Identifier, pub poly_vars: Vec, // Parser + pub source: ProcedureSource, pub return_type: Option, // present on functions, not components pub parameters: Vec, pub scope: ScopeId, @@ -1101,9 +1131,9 @@ impl ProcedureDefinition { ) -> Self { Self { this, defined_in, - builtin: false, span, kind, identifier, poly_vars, + source: ProcedureSource::FuncUserDefined, return_type: None, parameters: Vec::new(), scope: ScopeId::new_invalid(),