tamer: asg::graph::object::prelude: New module to reduce imports

These are used by virtually every `ObjectKind`; I've been meaning to do this
for a while, but now that I'm about to introduce a new one (`Doc`), let's
just get it out of the way.

DEV-13708
main
Mike Gerwitz 2023-04-07 09:56:50 -04:00
parent f4653790da
commit 0163391498
7 changed files with 17 additions and 30 deletions

View File

@ -151,6 +151,16 @@ pub use rel::{
pub use root::Root;
pub use tpl::Tpl;
/// Often-needed exports for [`ObjectKind`]s.
pub mod prelude {
pub use super::{
super::{super::error::AsgError, Asg},
Object, ObjectIndex, ObjectIndexRelTo, ObjectKind, ObjectRel,
ObjectRelFrom, ObjectRelTo, ObjectRelTy, ObjectRelatable,
ObjectTreeRelTo,
};
}
/// Given a list of [`ObjectKind`]s,
/// generate [`Object`],
/// associated types,
@ -313,8 +323,6 @@ object_gen! {
Ident,
/// Expression.
///
/// An expression may optionally be named by one or more [`Ident`]s.
Expr,
/// A template definition.

View File

@ -21,10 +21,7 @@
use std::fmt::Display;
use super::{
Asg, Ident, Object, ObjectIndex, ObjectIndexRelTo, ObjectRel,
ObjectRelFrom, ObjectRelTy, ObjectRelatable, ObjectTreeRelTo, Tpl,
};
use super::{prelude::*, Ident, Tpl};
use crate::{
f::Functor,
num::Dim,

View File

@ -19,11 +19,7 @@
//! Identifiers (a type of [object](super)).
use super::{
super::{Asg, AsgError, ObjectIndex, ObjectKind},
Expr, Meta, Object, ObjectIndexRelTo, ObjectRel, ObjectRelFrom,
ObjectRelTo, ObjectRelTy, ObjectRelatable, ObjectTreeRelTo, Pkg, Tpl,
};
use super::{prelude::*, Expr, Meta, Pkg, Tpl};
use crate::{
diagnose::{Annotate, Diagnostic},
diagnostic_todo,

View File

@ -24,12 +24,8 @@
//! have historically been a feature of the template system.
//! The canonical metavariable is the template parameter.
use super::{
Ident, Object, ObjectIndex, ObjectIndexRelTo, ObjectRel, ObjectRelFrom,
ObjectRelTy, ObjectRelatable, ObjectTreeRelTo, Tpl,
};
use super::{prelude::*, Ident, Tpl};
use crate::{
asg::Asg,
diagnose::Annotate,
diagnostic_todo,
f::Functor,

View File

@ -19,12 +19,8 @@
//! Package object on the ASG.
use super::{
Ident, Object, ObjectIndex, ObjectIndexRelTo, ObjectRel, ObjectRelFrom,
ObjectRelTy, ObjectRelatable, ObjectTreeRelTo, Tpl,
};
use super::{prelude::*, Ident, Tpl};
use crate::{
asg::Asg,
f::Functor,
parse::{util::SPair, Token},
span::Span,

View File

@ -21,10 +21,7 @@
use std::fmt::Display;
use super::{
Ident, Object, ObjectIndex, ObjectRel, ObjectRelFrom, ObjectRelTy,
ObjectRelatable, ObjectTreeRelTo, Pkg,
};
use super::{prelude::*, Ident, Pkg};
#[cfg(doc)]
use super::ObjectKind;

View File

@ -21,11 +21,8 @@
use std::fmt::Display;
use super::{
Expr, Ident, Object, ObjectIndex, ObjectIndexRelTo, ObjectRel,
ObjectRelFrom, ObjectRelTy, ObjectRelatable, ObjectTreeRelTo,
};
use crate::{asg::Asg, f::Functor, span::Span};
use super::{prelude::*, Expr, Ident};
use crate::{f::Functor, span::Span};
/// Template with associated name.
#[derive(Debug, PartialEq, Eq)]