// Generate a statement that modifies signature to add a new argument in.
Generate a statement that modifies signature to add a new argument in.
Generate a statement that modifies signature to add a new argument in .
fn render_signature_arg(arg: &StarArg) -> TokenStream {
    let mut name_str_full = (if arg.by_ref { "$" } else { "" }).to_owned();
    name_str_full += &ident_string(&arg.name);
    let name_str = name_str_full.trim_matches('_');
    if arg.is_args() {
        assert!(arg.default.is_none(), "Can't have *args with a default");
        quote! {__signature.args();}
    } else if arg.is_kwargs() {
        assert!(arg.default.is_none(), "Can't have **kwargs with a default");
        quote! {__signature.kwargs();}
    } else if arg.is_this() {
        quote! {}
    } else if arg.is_option() {
        quote! {__signature.optional(#name_str);}
    } else if let Some(default) = &arg.default {
        // For things that are type Value, we put them on the frozen heap.
        // For things that aren't type value, use optional and then next_opt/unwrap
        // to avoid the to/from value conversion.
        if arg.is_value() {
            quote! {__signature.defaulted(#name_str, globals_builder.alloc(#default));}
        } else {
            quote! {__signature.optional(#name_str);}
        }
    } else {
        quote! {__signature.required(#name_str);}
    }
}
fn render_signature_arg ( arg : & StarArg ) -> TokenStream { let mut name_str_full = ( if arg . by_ref { " " } else { " " } ) . to_owned ( ) ; name_str_full += & ident_string ( & arg . name ) ; let name_str = name_str_full . trim_matches ( '_' ) ; if arg . is_args ( ) { assert ! ( arg default is_none ( ) " " ) ; quote ! { __signature args ( ) } } else if arg . is_kwargs ( ) { assert ! ( arg default is_none ( ) " " ) ; quote ! { __signature kwargs ( ) } } else if arg . is_this ( ) { quote ! { } } else if arg . is_option ( ) { quote ! { __signature optional ( name_str ) } } else if let Some ( default ) = & arg . default { // For things that are type Value, we put them on the frozen heap. // For things that aren't type value, use optional and then next_opt/unwrap // to avoid the to/from value conversion. if arg . is_value ( ) { quote ! { __signature defaulted ( name_str globals_builder alloc ( default ) ) } } else { quote ! { __signature optional ( name_str ) } } } else { quote ! { __signature required ( name_str ) } } }
Generate a statement that modifies signature to add a new argument in.
Generate a statement that modifies signature to add a new argument in .
arg
&StarArg