MCPcopy Index your code
hub / github.com/endbasic/endbasic / debug_assert_function_seps

Method debug_assert_function_seps

core/src/callable.rs:643–667  ·  view source on GitHub ↗

Checks that the syntax of a callable that returns a value only uses separators that can appear in a function call (i.e. the comma separator). The parser only produces `ArgSep::Long` for function arguments, so any other separator in the metadata would be dead/untestable.

(&self, syntax: &CallableSyntax)

Source from the content-addressed store, hash-verified

641 /// in a function call (i.e. the comma separator). The parser only produces `ArgSep::Long` for
642 /// function arguments, so any other separator in the metadata would be dead/untestable.
643 fn debug_assert_function_seps(&self, syntax: &CallableSyntax) {
644 if self.return_type().is_none() {
645 return;
646 }
647 for syn in syntax.singular.iter() {
648 let sep = match syn {
649 SingularArgSyntax::RequiredValue(_, sep) => sep,
650 SingularArgSyntax::RequiredRef(_, sep) => sep,
651 SingularArgSyntax::OptionalValue(_, sep) => sep,
652 SingularArgSyntax::AnyValue(_, sep) => sep,
653 };
654 debug_assert!(
655 Self::is_function_sep(sep),
656 "Function {} has a non-comma separator in its singular args syntax",
657 self.name()
658 );
659 }
660 if let Some(repeated) = syntax.repeated.as_ref() {
661 debug_assert!(
662 Self::is_function_sep(&repeated.sep),
663 "Function {} has a non-comma separator in its repeated args syntax",
664 self.name()
665 );
666 }
667 }
668
669 /// Finds the syntax definition that matches the given argument count.
670 ///

Callers 1

find_syntaxMethod · 0.80

Calls 2

return_typeMethod · 0.80
iterMethod · 0.80

Tested by

no test coverage detected