diff --git a/src/datatype/mod.rs b/src/datatype/mod.rs index 65c6fa1..895529f 100644 --- a/src/datatype/mod.rs +++ b/src/datatype/mod.rs @@ -5,14 +5,14 @@ use std::{ mod r#enum; mod literal; -mod object; mod primitive; +mod r#struct; mod tuple; pub use literal::*; -pub use object::*; pub use primitive::*; pub use r#enum::*; +pub use r#struct::*; pub use tuple::*; use crate::{ImplLocation, TypeSid}; @@ -48,7 +48,7 @@ pub enum DataType { // Named reference types Named(NamedDataType), // Anonymous Reference types - Object(ObjectType), + Struct(ObjectType), Enum(EnumType), Tuple(TupleType), // Result diff --git a/src/datatype/object.rs b/src/datatype/struct.rs similarity index 97% rename from src/datatype/object.rs rename to src/datatype/struct.rs index 3719738..3a380c8 100644 --- a/src/datatype/object.rs +++ b/src/datatype/struct.rs @@ -24,7 +24,7 @@ pub struct ObjectType { impl ObjectType { /// Convert a [`ObjectType`] to an anonymous [`DataType`]. pub fn to_anonymous(self) -> DataType { - DataType::Object(self) + DataType::Struct(self) } /// Convert a [`ObjectType`] to a named [`NamedDataType`]. diff --git a/src/lang/ts/mod.rs b/src/lang/ts/mod.rs index 0d9dd06..da8f244 100644 --- a/src/lang/ts/mod.rs +++ b/src/lang/ts/mod.rs @@ -219,7 +219,7 @@ fn datatype_inner(ctx: ExportContext, typ: &DataType, type_map: &TypeMap) -> Out format!("{dt}[]") } } - DataType::Object(item) => object_datatype(ctx, None, item, type_map)?, + DataType::Struct(item) => object_datatype(ctx, None, item, type_map)?, DataType::Enum(item) => enum_datatype(ctx, None, item, type_map)?, DataType::Tuple(tuple) => tuple_datatype(ctx, tuple, type_map)?, DataType::Named(typ) => { diff --git a/src/type/impls.rs b/src/type/impls.rs index 74d24e4..2c05678 100644 --- a/src/type/impls.rs +++ b/src/type/impls.rs @@ -187,7 +187,7 @@ pub enum Infallible {} impl Type for std::ops::Range { fn inline(opts: DefOpts, _generics: &[DataType]) -> Result { let ty = T::definition(opts)?; - Ok(DataType::Object(ObjectType { + Ok(DataType::Struct(ObjectType { generics: vec![], fields: vec![ ObjectField {