Skip to content

Commit

Permalink
Simplify some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ytausky committed Oct 9, 2020
1 parent 91b7976 commit a64fecd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
6 changes: 1 addition & 5 deletions src/assembler/session/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<C, R, I, D> Backend<R::Span> for CompositeSession<C, R, I, D>
where
R: SpanSystem<BufId>,
I: StringSource,
Self: MacroSource + Diagnostics<R::Span>,
Self: Diagnostics<R::Span>,
for<'a> DiagnosticsContext<'a, C, R, D>: Diagnostics<R::Span>,
{
fn define_symbol(&mut self, name: SymbolId, _span: R::Span, expr: Expr<SymbolId, R::Span>) {
Expand Down Expand Up @@ -133,10 +133,6 @@ where
}
}

impl<S: Clone> SymbolSource for ObjectBuilder<S> {
type SymbolId = SymbolId;
}

impl<S: Clone> AllocSymbol<S> for ObjectBuilder<S> {
fn alloc_symbol(&mut self, _span: S) -> SymbolId {
self.object.content.symbols.alloc().into()
Expand Down
12 changes: 1 addition & 11 deletions src/assembler/session/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,7 @@ pub(crate) type VecMacroTable<D, R> = Vec<Rc<MacroDef<D, R>>>;

pub type MacroArgs<T, S> = (Box<[Box<[T]>]>, Box<[Box<[S]>]>);

impl<D, R> MacroSource for VecMacroTable<D, R> {
type MacroId = MacroId;
}

impl<'a, C, R: SpanSystem<BufId>, I: StringSource, D> MacroSource for CompositeSession<C, R, I, D> {
type MacroId = MacroId;
}

impl<C, R, I, D> MacroTable<I::StringRef, <Self as SpanSource>::Span>
for CompositeSession<C, R, I, D>
impl<C, R, I, D> MacroTable<I::StringRef, R::Span> for CompositeSession<C, R, I, D>
where
Self: Lex<R, I, Span = R::Span, StringRef = I::StringRef>,
C: Codebase,
Expand All @@ -47,7 +38,6 @@ where
Self: EmitDiag<R::Span, R::Stripped>,
Self: StartScope + NameTable<I::StringRef>,
Self: Backend<R::Span>,
Self: MacroSource<MacroId = MacroId>,
<Self as StringSource>::StringRef: 'static,
<Self as SpanSource>::Span: 'static,
<Self as Lex<R, I>>::TokenIter: 'static,
Expand Down
13 changes: 0 additions & 13 deletions src/assembler/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,6 @@ pub trait StringSource {
type StringRef: Clone + Debug + Eq + Hash;
}

pub trait SymbolSource {
type SymbolId: Clone;
}

pub(crate) trait MacroSource {
type MacroId: Clone;
}

pub(super) type Session<'a> = CompositeSession<
FileCodebase<'a, dyn FileSystem>,
RcContextFactory<BufId>,
Expand Down Expand Up @@ -224,10 +216,6 @@ impl<C, R: SpanSystem<BufId>, I: StringSource, D> StringSource for CompositeSess
type StringRef = I::StringRef;
}

impl<C, R: SpanSystem<BufId>, I: StringSource, D> SymbolSource for CompositeSession<C, R, I, D> {
type SymbolId = SymbolId;
}

impl<C, R: SpanSystem<BufId>, I: StringSource, D> NextToken for CompositeSession<C, R, I, D> {
fn next_token(&mut self) -> Option<LexItem<Self::StringRef, Self::Span>> {
let token = self
Expand All @@ -246,7 +234,6 @@ impl<C, R: SpanSystem<BufId>, I: StringSource, D> NextToken for CompositeSession
impl<C, R: SpanSystem<BufId>, I: StringSource, D> EmitDiag<R::Span, R::Stripped>
for CompositeSession<C, R, I, D>
where
Self: SymbolSource + MacroSource,
for<'a> DiagnosticsContext<'a, C, R, D>: EmitDiag<R::Span, R::Stripped>,
R::Stripped: Clone,
{
Expand Down

0 comments on commit a64fecd

Please sign in to comment.