File tree Expand file tree Collapse file tree
lang/attribute/access-control Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,9 +11,12 @@ incremented for features.
1111
1212## [ Unreleased]
1313
14+ ### Features
15+
1416* cli: Embed workspace programs into local validator genesis when testing.
1517* cli: Stream program logs to ` .anchor/program-logs ` directory when testing.
1618* spl: Add shared memory api.
19+ * lang/attribute/access-control: Allow specifying multiple modifier functions.
1720
1821## [ 0.2.0] - 2021-02-08
1922
Original file line number Diff line number Diff line change @@ -15,4 +15,5 @@ proc-macro2 = "1.0"
1515quote = " 1.0"
1616syn = { version = " =1.0.57" , features = [" full" ] }
1717anyhow = " 1.0.32"
18- anchor-syn = { path = " ../../syn" , version = " 0.2.0" }
18+ anchor-syn = { path = " ../../syn" , version = " 0.2.0" }
19+ regex = " 1.0"
Original file line number Diff line number Diff line change @@ -50,7 +50,18 @@ pub fn access_control(
5050 args : proc_macro:: TokenStream ,
5151 input : proc_macro:: TokenStream ,
5252) -> proc_macro:: TokenStream {
53- let access_control: proc_macro2:: TokenStream = args. to_string ( ) . parse ( ) . unwrap ( ) ;
53+ let mut args = args. to_string ( ) ;
54+ args. retain ( |c| !c. is_whitespace ( ) ) ;
55+ let access_control: Vec < proc_macro2:: TokenStream > = args
56+ . split ( ')' )
57+ . filter_map ( |ac| match ac {
58+ "" => None ,
59+ _ => Some ( ac) ,
60+ } )
61+ . map ( |ac| format ! ( "{})" , ac) ) // Put back on the split char.
62+ . map ( |ac| format ! ( "{}?;" , ac) ) // Add `?;` syntax.
63+ . map ( |ac| ac. parse ( ) . unwrap ( ) )
64+ . collect ( ) ;
5465
5566 let item_fn = parse_macro_input ! ( input as syn:: ItemFn ) ;
5667
@@ -63,7 +74,7 @@ pub fn access_control(
6374 proc_macro:: TokenStream :: from ( quote ! {
6475 #fn_vis #fn_sig {
6576
66- #access_control? ;
77+ #( # access_control) *
6778
6879 #( #fn_stmts) *
6980 }
You can’t perform that action at this time.
0 commit comments