Revert "Support for AccountLoaderDynamic"
This reverts commit 1153380487
.
This commit is contained in:
parent
309c2c2f4c
commit
b3707b1faa
|
@ -216,7 +216,6 @@ pub fn generate_constraint_has_one(f: &Field, c: &ConstraintHasOne) -> proc_macr
|
|||
let field = match &f.ty {
|
||||
Ty::Loader(_) => quote! {#ident.load()?},
|
||||
Ty::AccountLoader(_) => quote! {#ident.load()?},
|
||||
Ty::AccountLoaderDynamic(_) => quote! {#ident.load_fixed()?},
|
||||
_ => quote! {#ident},
|
||||
};
|
||||
let error = generate_custom_error(
|
||||
|
|
|
@ -358,21 +358,6 @@ impl Field {
|
|||
}
|
||||
}
|
||||
}
|
||||
Ty::AccountLoaderDynamic(_) => {
|
||||
if checked {
|
||||
quote! {
|
||||
#container_ty::try_from(
|
||||
&#field,
|
||||
).map_err(|e| e.with_account_name(#field_str))?
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
#container_ty::try_from_unchecked(
|
||||
&#field,
|
||||
).map_err(|e| e.with_account_name(#field_str))?
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
if checked {
|
||||
quote! {
|
||||
|
@ -404,9 +389,6 @@ impl Field {
|
|||
Ty::AccountLoader(_) => quote! {
|
||||
anchor_lang::accounts::account_loader::AccountLoader
|
||||
},
|
||||
Ty::AccountLoaderDynamic(_) => quote! {
|
||||
crate::state::AccountLoaderDynamic
|
||||
},
|
||||
Ty::Loader(_) => quote! {
|
||||
anchor_lang::accounts::loader::Loader
|
||||
},
|
||||
|
@ -461,12 +443,6 @@ impl Field {
|
|||
#ident
|
||||
}
|
||||
}
|
||||
Ty::AccountLoaderDynamic(ty) => {
|
||||
let ident = &ty.account_type_path;
|
||||
quote! {
|
||||
#ident
|
||||
}
|
||||
}
|
||||
Ty::Loader(ty) => {
|
||||
let ident = &ty.account_type_path;
|
||||
quote! {
|
||||
|
@ -533,7 +509,6 @@ pub enum Ty {
|
|||
ProgramAccount(ProgramAccountTy),
|
||||
Loader(LoaderTy),
|
||||
AccountLoader(AccountLoaderTy),
|
||||
AccountLoaderDynamic(AccountLoaderDynamicTy),
|
||||
CpiAccount(CpiAccountTy),
|
||||
Sysvar(SysvarTy),
|
||||
Account(AccountTy),
|
||||
|
@ -585,12 +560,6 @@ pub struct AccountLoaderTy {
|
|||
pub account_type_path: TypePath,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct AccountLoaderDynamicTy {
|
||||
// The struct type of the account.
|
||||
pub account_type_path: TypePath,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct LoaderTy {
|
||||
// The struct type of the account.
|
||||
|
|
|
@ -886,9 +886,7 @@ impl<'ty> ConstraintGroupBuilder<'ty> {
|
|||
&& !matches!(self.f_ty, Some(Ty::Account(_)))
|
||||
&& !matches!(self.f_ty, Some(Ty::Loader(_)))
|
||||
&& !matches!(self.f_ty, Some(Ty::AccountLoader(_)))
|
||||
&& !matches!(self.f_ty, Some(Ty::AccountLoaderDynamic(_)))
|
||||
{
|
||||
println!("{:?}", self.f_ty);
|
||||
return Err(ParseError::new(
|
||||
c.span(),
|
||||
"close must be on an Account, ProgramAccount, or Loader",
|
||||
|
|
|
@ -239,7 +239,6 @@ fn is_field_primitive(f: &syn::Field) -> ParseResult<bool> {
|
|||
| "CpiState"
|
||||
| "Loader"
|
||||
| "AccountLoader"
|
||||
| "AccountLoaderDynamic"
|
||||
| "Account"
|
||||
| "Program"
|
||||
| "Signer"
|
||||
|
@ -264,9 +263,6 @@ fn parse_ty(f: &syn::Field) -> ParseResult<Ty> {
|
|||
"UncheckedAccount" => Ty::UncheckedAccount,
|
||||
"Loader" => Ty::Loader(parse_program_account_zero_copy(&path)?),
|
||||
"AccountLoader" => Ty::AccountLoader(parse_program_account_loader(&path)?),
|
||||
"AccountLoaderDynamic" => {
|
||||
Ty::AccountLoaderDynamic(parse_program_mango_account_loader(&path)?)
|
||||
}
|
||||
"Account" => Ty::Account(parse_account_ty(&path)?),
|
||||
"Program" => Ty::Program(parse_program_ty(&path)?),
|
||||
"Signer" => Ty::Signer,
|
||||
|
@ -341,12 +337,6 @@ fn parse_program_account_loader(path: &syn::Path) -> ParseResult<AccountLoaderTy
|
|||
account_type_path: account_ident,
|
||||
})
|
||||
}
|
||||
fn parse_program_mango_account_loader(path: &syn::Path) -> ParseResult<AccountLoaderDynamicTy> {
|
||||
let account_ident = parse_account(path)?;
|
||||
Ok(AccountLoaderDynamicTy {
|
||||
account_type_path: account_ident,
|
||||
})
|
||||
}
|
||||
|
||||
fn parse_account_ty(path: &syn::Path) -> ParseResult<AccountTy> {
|
||||
let account_type_path = parse_account(path)?;
|
||||
|
|
Loading…
Reference in New Issue