Skip to content
Prev Previous commit
Next Next commit
compiler codegen
  • Loading branch information
ShaharNaveh committed Jul 4, 2025
commit dbf0078c778c53db3333779cc22ae4e7aef6952a
4 changes: 2 additions & 2 deletions compiler/codegen/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl Default for PatternContext {
}

impl PatternContext {
pub fn new() -> Self {
pub const fn new() -> Self {
Self {
stores: Vec::new(),
allow_irrefutable: false,
Expand Down Expand Up @@ -4118,7 +4118,7 @@ impl Compiler<'_> {
code.current_block = block;
}

fn set_source_range(&mut self, range: TextRange) {
const fn set_source_range(&mut self, range: TextRange) {
self.current_source_range = range;
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/codegen/src/string_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct StringParser {
}

impl StringParser {
fn new(source: Box<str>, flags: AnyStringFlags) -> Self {
const fn new(source: Box<str>, flags: AnyStringFlags) -> Self {
Self {
source,
cursor: 0,
Expand Down
6 changes: 3 additions & 3 deletions compiler/codegen/src/symboltable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,18 @@ impl Symbol {
}
}

pub fn is_global(&self) -> bool {
pub const fn is_global(&self) -> bool {
matches!(
self.scope,
SymbolScope::GlobalExplicit | SymbolScope::GlobalImplicit
)
}

pub fn is_local(&self) -> bool {
pub const fn is_local(&self) -> bool {
matches!(self.scope, SymbolScope::Local | SymbolScope::Cell)
}

pub fn is_bound(&self) -> bool {
pub const fn is_bound(&self) -> bool {
self.flags.intersects(SymbolFlags::BOUND)
}
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/codegen/src/unparse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct Unparser<'a, 'b, 'c> {
source: &'c SourceCode<'c>,
}
impl<'a, 'b, 'c> Unparser<'a, 'b, 'c> {
fn new(f: &'b mut fmt::Formatter<'a>, source: &'c SourceCode<'c>) -> Self {
const fn new(f: &'b mut fmt::Formatter<'a>, source: &'c SourceCode<'c>) -> Self {
Unparser { f, source }
}

Expand Down Expand Up @@ -602,7 +602,7 @@ pub struct UnparseExpr<'a> {
source: &'a SourceCode<'a>,
}

pub fn unparse_expr<'a>(expr: &'a Expr, source: &'a SourceCode<'a>) -> UnparseExpr<'a> {
pub const fn unparse_expr<'a>(expr: &'a Expr, source: &'a SourceCode<'a>) -> UnparseExpr<'a> {
UnparseExpr { expr, source }
}

Expand Down