Skip to content

Commit

Permalink
rollback
Browse files Browse the repository at this point in the history
  • Loading branch information
gzanitti committed Jan 15, 2025
1 parent 5a7fb49 commit 3984590
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
6 changes: 2 additions & 4 deletions ast/src/analyzed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ pub enum FunctionValueDefinition {
Expression(TypedExpression),
TypeDeclaration(TypeDeclaration),
TypeConstructor(Arc<EnumDeclaration>, EnumVariant),
TraitDeclaration(Arc<TraitDeclaration>),
TraitDeclaration(TraitDeclaration),
TraitFunction(Arc<TraitDeclaration>, NamedType),
}

Expand Down Expand Up @@ -791,9 +791,7 @@ impl Children<Expression> for FunctionValueDefinition {
type_declaration.children_mut()
}
FunctionValueDefinition::TypeConstructor(_, variant) => variant.children_mut(),
FunctionValueDefinition::TraitDeclaration(trait_decl) => {
Arc::make_mut(trait_decl).children_mut()
}
FunctionValueDefinition::TraitDeclaration(trait_decl) => trait_decl.children_mut(),
FunctionValueDefinition::TraitFunction(_, trait_func) => trait_func.children_mut(),
}
}
Expand Down
16 changes: 8 additions & 8 deletions pil-analyzer/src/statement_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,14 +672,13 @@ where
ty: self.type_processor(&type_vars).process_type(f.ty),
})
.collect();

let trait_decl = Arc::new(TraitDeclaration {
let trait_decl = TraitDeclaration {
name: self.driver.resolve_decl(&trait_decl.name),
type_vars: trait_decl.type_vars,
functions,
});
};

let trait_functions = trait_decl
let inner_items = trait_decl
.functions
.iter()
.map(|function| {
Expand All @@ -689,18 +688,19 @@ where
.relative_to(&Default::default())
.to_string(),
FunctionValueDefinition::TraitFunction(
Arc::clone(&trait_decl),
Arc::new(trait_decl.clone()),
function.clone(),
),
)
})
.collect();

let trait_functions = self.process_inner_definitions(source, trait_functions);
let trait_functions = self.process_inner_definitions(source, inner_items);

iter::once(PILItem::Definition(
symbol,
Some(FunctionValueDefinition::TraitDeclaration(trait_decl)),
Some(FunctionValueDefinition::TraitDeclaration(
trait_decl.clone(),
)),
))
.chain(trait_functions)
.collect()
Expand Down

0 comments on commit 3984590

Please sign in to comment.