Skip to content

Commit

Permalink
Allocate type fields on an arena
Browse files Browse the repository at this point in the history
  • Loading branch information
Marwes committed Mar 20, 2020
1 parent 3c4fde1 commit a37d8e6
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 74 deletions.
4 changes: 3 additions & 1 deletion base/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ impl<'ast, Id> TypePtr for AstType<'ast, Id> {
type Types = &'ast mut [AstType<'ast, Id>];
type Generics = &'ast mut [Generic<Id>];
type Fields = &'ast mut [Field<Id, Self>];
type TypeFields = &'ast mut [Field<Id, Alias<Id, Self>>];
}

pub trait HasMetadata {
Expand Down Expand Up @@ -906,7 +907,7 @@ pub fn walk_ast_type<'a, 'ast, V: ?Sized + $trait_name<'a, 'ast>>(
ref $($mut)* types,
ref $($mut)* rest,
} => {
for field in types {
for field in & $($mut)* **types {
if let Some(alias) = field.typ.$try_get_alias() {
v.visit_ast_type(&$($mut)* alias.$unresolved_type()._typ.typ);
}
Expand Down Expand Up @@ -1210,6 +1211,7 @@ impl_ast_arena! {
AstType<'ast, Id> => type_ptrs,
Generic<Id> => generics,
Field<Id, AstType<'ast, Id>> => type_fields,
Field<Id, Alias<Id, AstType<'ast, Id>>> => type_type_fields,
}

pub struct RootSpannedExpr<Id: 'static> {
Expand Down
Loading

0 comments on commit a37d8e6

Please sign in to comment.