Skip to content

Commit

Permalink
boxing
Browse files Browse the repository at this point in the history
  • Loading branch information
nanne007 committed Jul 5, 2021
1 parent b2d4d62 commit 015294b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion vm/resource-viewer/src/abi_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl<'a> ABIResolver<'a> {
.map(|t| self.resolve_type(t))
.collect::<Result<Vec<_>>>()?;
let inst_struct_abi = struct_abi.subst(&type_args)?;
TypeABI::Struct(inst_struct_abi)
TypeABI::new_struct(inst_struct_abi)
}
Type::Vector(sub_ty) => TypeABI::new_vector(self.resolve_type(&sub_ty)?),
Type::TypeParameter(i) => TypeABI::TypeParameter(*i as usize),
Expand Down
10 changes: 5 additions & 5 deletions vm/types/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ pub enum TypeABI {
Address,
Signer,
Vector(Box<TypeABI>),
Struct(StructABI),
Struct(Box<StructABI>),
TypeParameter(usize),
}
impl TypeABI {
pub fn new_vector(subtype: TypeABI) -> Self {
TypeABI::Vector(Box::new(subtype))
}
pub fn new_struct(s: StructABI) -> Self {
TypeABI::Struct(s)
TypeABI::Struct(Box::new(s))
}

pub fn subst(&self, ty_args: &[TypeABI]) -> Result<TypeABI> {
Expand All @@ -250,7 +250,7 @@ impl TypeABI {
Address => Address,
Signer => Signer,
Vector(ty) => Vector(Box::new(ty.subst(ty_args)?)),
Struct(struct_ty) => Struct(struct_ty.subst(ty_args)?),
Struct(struct_ty) => Struct(Box::new(struct_ty.subst(ty_args)?)),
})
}
}
Expand Down Expand Up @@ -332,14 +332,14 @@ pub struct FieldABI {
/// doc of the field
doc: String,
/// type of the field
type_abi: Box<TypeABI>,
type_abi: TypeABI,
}
impl FieldABI {
pub fn new(name: String, doc: String, type_abi: TypeABI) -> Self {
Self {
name,
doc,
type_abi: Box::new(type_abi),
type_abi,
}
}
pub fn name(&self) -> &str {
Expand Down

0 comments on commit 015294b

Please sign in to comment.