diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index 11a19bd3ffbdc35734f7290fdbe9bad6d3276054..9a41b28c25581af0f1467043b1f9c21082f5e794 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -94,20 +94,20 @@ impl ProtocolDescription { let definition_id = definition_id.unwrap(); let ast_definition = &self.heap[definition_id]; - if !ast_definition.is_component() { + if !ast_definition.is_procedure() { return Err(ComponentCreationError::DefinitionNotComponent); } // Make sure that the types of the provided value group matches that of // the expected types. - let ast_definition = ast_definition.as_component(); - if !ast_definition.poly_vars.is_empty() { + let ast_definition = ast_definition.as_procedure(); + if !ast_definition.poly_vars.is_empty() || ast_definition.kind == ProcedureKind::Function { return Err(ComponentCreationError::DefinitionNotComponent); } // - check number of arguments by retrieving the one instantiated // monomorph - let concrete_type = ConcreteType{ parts: vec![ConcreteTypePart::Component(definition_id, 0)] }; + let concrete_type = ConcreteType{ parts: vec![ConcreteTypePart::Component(ast_definition.this, 0)] }; let mono_index = self.types.get_procedure_monomorph_type_id(&definition_id, &concrete_type.parts).unwrap(); let mono_type = self.types.get_procedure_monomorph(mono_index); if mono_type.arg_types.len() != arguments.values.len() { @@ -125,7 +125,7 @@ impl ProtocolDescription { // By now we're sure that all of the arguments are correct. So create // the connector. - return Ok(Prompt::new(&self.types, &self.heap, definition_id, mono_index, arguments)); + return Ok(Prompt::new(&self.types, &self.heap, ast_definition.this, mono_index, arguments)); } fn lookup_module_root(&self, module_name: &[u8]) -> Option {