@@ -11,7 +11,7 @@ use simplicity::jet::Elements;
1111use crate :: debug:: { CallTracker , DebugSymbols , TrackedCallName } ;
1212use crate :: error:: { Error , RichError , Span , WithSpan } ;
1313use crate :: num:: { NonZeroPow2Usize , Pow2Usize } ;
14- use crate :: parse:: { MatchPattern , UseDecl } ;
14+ use crate :: parse:: { MatchPattern , UseDecl , Visibility } ;
1515use crate :: pattern:: Pattern ;
1616use crate :: str:: { AliasName , FunctionName , Identifier , ModuleName , WitnessName } ;
1717use crate :: types:: {
@@ -307,6 +307,7 @@ pub enum CallName {
307307/// Definition of a custom function.
308308#[ derive( Clone , Debug , Eq , PartialEq , Hash ) ]
309309pub struct CustomFunction {
310+ visibility : Visibility ,
310311 params : Arc < [ FunctionParam ] > ,
311312 body : Arc < Expression > ,
312313}
@@ -780,6 +781,7 @@ impl AbstractSyntaxTree for Function {
780781 assert ! ( scope. is_topmost( ) , "Items live in the topmost scope only" ) ;
781782
782783 if from. name ( ) . as_inner ( ) != "main" {
784+ let visibility = from. visibility ( ) . clone ( ) ;
783785 let params = from
784786 . params ( )
785787 . iter ( )
@@ -803,7 +805,11 @@ impl AbstractSyntaxTree for Function {
803805 let body = Expression :: analyze ( from. body ( ) , & ret, scope) . map ( Arc :: new) ?;
804806 scope. pop_scope ( ) ;
805807 debug_assert ! ( scope. is_topmost( ) ) ;
806- let function = CustomFunction { params, body } ;
808+ let function = CustomFunction {
809+ visibility,
810+ params,
811+ body,
812+ } ;
807813 scope
808814 . insert_function ( from. name ( ) . clone ( ) , function)
809815 . with_span ( from) ?;
0 commit comments