fn fold_attribute(&mut self, attr: Attribute) -> Attribute {
        if attr.path.is_ident("external_call") {
            let func_name: Result<Ident> = attr.parse_args();
            match func_name {
                Ok(name) => self.external_calls.push(name),
                Err(_) => return attr,
            };
        }

        if attr.path.is_ident("external_method") {
            let method_name: Result<Ident> = attr.parse_args();
            match method_name {
                Ok(name) => self.external_methods.push(name),
                Err(_) => return attr,
            };
        }

        if attr.path.is_ident("external_calls") {
            let func_names: Result<Meta> = attr.parse_meta();
            if let Ok(Meta::List(l)) = func_names {
                // iterate over punctuated list of elements
                for meta in l.nested.iter() {
                    if let NestedMeta::Meta(m2) = meta {
                        let name = path_to_last_ident(m2.path().clone()).unwrap();
                        self.external_calls.push(name.clone());
                    }
                }
            }
        }

        if attr.path.is_ident("external_methods") {
            let func_names: Result<Meta> = attr.parse_meta();
            if let Ok(Meta::List(l)) = func_names {
                // iterate over punctuated list of elements
                for meta in l.nested.iter() {
                    if let NestedMeta::Meta(m2) = meta {
                        let name = path_to_last_ident(m2.path().clone()).unwrap();
                        self.external_methods.push(name.clone());
                    }
                }
            }
        }
        // match func_names {
        //     Ok(names) => {
        //         for name in names.iter(){
        //             self.external_calls.push(name.clone())
        //         }
        //     },
        //     Err(_) => return attr,
        // };
        //}

        attr
    }
/// Record external_call and external_method attributes
/// self.external_calls (and self.external_methods) currently just store
/// the name of the target function/method
Record external_call and external_method attributes
self.external_calls (and self.external_methods) currently just store
the name of the target function/method
Record external_call and external_method attributes self . external_calls ( and self . external_methods ) currently just store the name of the target function / method
fn fold_attribute(&mut self, attr: Attribute) -> Attribute {
        if attr.path.is_ident("external_call") {
            let func_name: Result<Ident> = attr.parse_args();
            match func_name {
                Ok(name) => self.external_calls.push(name),
                Err(_) => return attr,
            };
        }
        if attr.path.is_ident("external_method") {
            let method_name: Result<Ident> = attr.parse_args();
            match method_name {
                Ok(name) => self.external_methods.push(name),
                Err(_) => return attr,
            };
        }
        if attr.path.is_ident("external_calls") {
            let func_names: Result<Meta> = attr.parse_meta();
            if let Ok(Meta::List(l)) = func_names {
                // iterate over punctuated list of elements
                for meta in l.nested.iter() {
                    if let NestedMeta::Meta(m2) = meta {
                        let name = path_to_last_ident(m2.path().clone()).unwrap();
                        self.external_calls.push(name.clone());
                    }
                }
            }
        }
        if attr.path.is_ident("external_methods") {
            let func_names: Result<Meta> = attr.parse_meta();
            if let Ok(Meta::List(l)) = func_names {
                // iterate over punctuated list of elements
                for meta in l.nested.iter() {
                    if let NestedMeta::Meta(m2) = meta {
                        let name = path_to_last_ident(m2.path().clone()).unwrap();
                        self.external_methods.push(name.clone());
                    }
                }
            }
        }
        // match func_names {
        //     Ok(names) => {
        //         for name in names.iter(){
        //             self.external_calls.push(name.clone())
        //         }
        //     },
        //     Err(_) => return attr,
        // };
        //}
        attr
    }
fn fold_attribute ( & mut self , attr : Attribute ) -> Attribute { if attr . path . is_ident ( " " ) { let func_name : Result < Ident > = attr . parse_args ( ) ; match func_name { Ok ( name ) => self . external_calls . push ( name ) , Err ( _ ) => return attr , } ; } if attr . path . is_ident ( " " ) { let method_name : Result < Ident > = attr . parse_args ( ) ; match method_name { Ok ( name ) => self . external_methods . push ( name ) , Err ( _ ) => return attr , } ; } if attr . path . is_ident ( " " ) { let func_names : Result < Meta > = attr . parse_meta ( ) ; if let Ok ( Meta :: List ( l ) ) = func_names { // iterate over punctuated list of elements for meta in l . nested . iter ( ) { if let NestedMeta :: Meta ( m2 ) = meta { let name = path_to_last_ident ( m2 . path ( ) . clone ( ) ) . unwrap ( ) ; self . external_calls . push ( name . clone ( ) ) ; } } } } if attr . path . is_ident ( " " ) { let func_names : Result < Meta > = attr . parse_meta ( ) ; if let Ok ( Meta :: List ( l ) ) = func_names { // iterate over punctuated list of elements for meta in l . nested . iter ( ) { if let NestedMeta :: Meta ( m2 ) = meta { let name = path_to_last_ident ( m2 . path ( ) . clone ( ) ) . unwrap ( ) ; self . external_methods . push ( name . clone ( ) ) ; } } } } // match func_names { //     Ok(names) => { //         for name in names.iter(){ //             self.external_calls.push(name.clone()) //         } //     }, //     Err(_) => return attr, // }; //} attr }
Record external_call and external_method attributes
self.external_calls (and self.external_methods) currently just store
the name of the target function/method
Record external_call and external_method attributes self . external_calls ( and self . external_methods ) currently just store the name of the target function / method
&mut self
attr
Attribute
&mut self
attr
Attribute