Skip to content

Commit

Permalink
chore: remove is_unconstrained_fn field from elaborator
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Jun 26, 2024
1 parent 03e25b4 commit caa319d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions compiler/noirc_frontend/src/elaborator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ pub struct Elaborator<'context> {

file: FileId,

in_unconstrained_fn: bool,
nested_loops: usize,

/// Contains a mapping of the current struct or functions's generics to
Expand Down Expand Up @@ -317,10 +316,6 @@ impl<'context> Elaborator<'context> {

self.trait_bounds = func_meta.trait_constraints.clone();

if self.interner.function_modifiers(&id).is_unconstrained {
self.in_unconstrained_fn = true;
}

// Introduce all numeric generics into scope
for generic in &func_meta.all_generics {
if let Kind::Numeric(typ) = &generic.kind {
Expand Down Expand Up @@ -412,7 +407,6 @@ impl<'context> Elaborator<'context> {

self.trait_bounds.clear();
self.type_variables.clear();
self.in_unconstrained_fn = false;
self.interner.update_fn(id, hir_func);
self.current_function = old_function;
self.current_item = old_item;
Expand Down
5 changes: 4 additions & 1 deletion compiler/noirc_frontend/src/elaborator/statements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ impl<'context> Elaborator<'context> {
}

fn elaborate_jump(&mut self, is_break: bool, span: noirc_errors::Span) -> (HirStatement, Type) {
if !self.in_unconstrained_fn {
let in_constrained_function = self
.current_function
.map_or(true, |func_id| !self.interner.function_modifiers(&func_id).is_unconstrained);
if in_constrained_function {
self.push_err(ResolverError::JumpInConstrainedFn { is_break, span });
}
if self.nested_loops == 0 {
Expand Down

0 comments on commit caa319d

Please sign in to comment.