fix comptime eval

This commit is contained in:
Janis 2024-12-22 19:12:15 +01:00
parent 96863e0397
commit 0994f4b187

View file

@ -1528,10 +1528,9 @@ impl Ast {
let is_comptime = match tag { let is_comptime = match tag {
Tag::Parameter => false, Tag::Parameter => false,
// TODO: figure out if there are function protos that arent const // TODO: figure out if there are function protos that arent const
Tag::FunctionProto => true, // Tag::FunctionProto | Tag::FunctionDecl | Tag::Block | Tag::BlockTrailingExpr => {
Tag::FunctionDecl | Tag::Block | Tag::BlockTrailingExpr => { // are_children_comptime(self, cache)
are_children_comptime(self, cache) // }
}
Tag::Constant => true, Tag::Constant => true,
Tag::ReturnStmt => true, Tag::ReturnStmt => true,
Tag::ReturnExprStmt => are_children_comptime(self, cache), Tag::ReturnExprStmt => are_children_comptime(self, cache),
@ -1548,7 +1547,7 @@ impl Ast {
| Tag::PointerType | Tag::PointerType
| Tag::ArrayType | Tag::ArrayType
| Tag::TypeDeclRef => true, | Tag::TypeDeclRef => true,
Tag::CallExpr => are_children_comptime(self, cache), // Tag::CallExpr => are_children_comptime(self, cache),
// Tag::FieldAccess => { // Tag::FieldAccess => {
// let parent = data.as_index_intern().0; // let parent = data.as_index_intern().0;
// cache.mark_as_dominated_by(index, parent); // cache.mark_as_dominated_by(index, parent);
@ -2253,7 +2252,7 @@ pub mod ast_gen {
let extra_nodes = cache let extra_nodes = cache
.inner .inner
.iter() .iter()
.filter(|(i, b)| **b) .filter(|(_, b)| **b)
.filter_map(|(i, _)| { .filter_map(|(i, _)| {
(!node_map.contains(i)).then(|| node_map.push(*i)) (!node_map.contains(i)).then(|| node_map.push(*i))
}) })