tamer: asg::object: Remove IdentObjectState, IdentObjectData

These traits are no longer necessary now that I'm using concrete types; they
just add unnecessary noise and confusion as I attempt to further refactor.

Don't abstract prematurely.

DEV-11864
main
Mike Gerwitz 2022-05-12 16:28:43 -04:00
parent 3748762d31
commit d87006391e
5 changed files with 888 additions and 1023 deletions

View File

@ -312,7 +312,7 @@ mod object {
mod ident {
use super::*;
use tamer::asg::{IdentKind, IdentObject, IdentObjectState, Source};
use tamer::asg::{IdentKind, IdentObject, Source};
use tamer::sym::GlobalSymbolIntern;
type Sut = IdentObject;

View File

@ -20,7 +20,7 @@
//! Abstract graph as the basis for concrete ASGs.
use super::ident::IdentKind;
use super::object::{FragmentText, IdentObjectState, Source, TransitionResult};
use super::object::{FragmentText, Source, TransitionResult};
use super::{AsgError, IdentObject};
use crate::global;
use crate::sym::SymbolId;
@ -156,7 +156,7 @@ impl Asg {
/// Lookup `ident` or add a missing identifier to the graph and return a
/// reference to it.
///
/// See [`IdentObjectState::declare`] for more information.
/// See [`IdentObject::declare`] for more information.
fn lookup_or_missing(&mut self, ident: SymbolId) -> ObjectRef {
self.lookup(ident).unwrap_or_else(|| {
let index = self.graph.add_node(Some(IdentObject::declare(ident)));
@ -242,7 +242,7 @@ impl Asg {
///
/// For more information on state transitions that can occur when
/// redeclaring an identifier that already exists,
/// see [`IdentObjectState::resolve`].
/// see [`IdentObject::resolve`].
///
/// A successful declaration will add an identifier to the graph
/// and return an [`ObjectRef`] reference.
@ -272,8 +272,8 @@ impl Asg {
/// on the graph will not be altered.
/// Resolution will otherwise fail in error.
///
/// See [`IdentObjectState::extern_`] and
/// [`IdentObjectState::resolve`] for more information on
/// See [`IdentObject::extern_`] and
/// [`IdentObject::resolve`] for more information on
/// compatibility related to extern resolution.
pub fn declare_extern(
&mut self,
@ -288,7 +288,7 @@ impl Asg {
///
/// Fragments are intended for use by the [linker][crate::ld].
/// For more information,
/// see [`IdentObjectState::set_fragment`].
/// see [`IdentObject::set_fragment`].
pub fn set_fragment(
&mut self,
identi: ObjectRef,
@ -358,7 +358,7 @@ impl Asg {
/// a missing identifier will be added as a placeholder,
/// allowing the ASG to be built with partial information as
/// identifiers continue to be discovered.
/// See [`IdentObjectState::declare`] for more information.
/// See [`IdentObject::declare`] for more information.
///
/// References to both identifiers are returned in argument order.
pub fn add_dep_lookup(

View File

@ -199,8 +199,8 @@ pub use error::AsgError;
pub use graph::{Asg, AsgResult, IndexType, ObjectRef};
pub use ident::{DataType, Dim, IdentKind, IdentKindError};
pub use object::{
FragmentText, IdentObject, IdentObjectData, IdentObjectState, Source,
TransitionError, TransitionResult, UnresolvedError,
FragmentText, IdentObject, Source, TransitionError, TransitionResult,
UnresolvedError,
};
/// Default concrete ASG implementation.

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@
//! which places the relocatable object code fragments in the order
//! necessary for execution.
use crate::asg::{IdentKind, IdentObject, IdentObjectState, UnresolvedError};
use crate::asg::{IdentKind, IdentObject, UnresolvedError};
use crate::sym::SymbolId;
use fxhash::FxHashSet;
use std::mem::take;