Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/modules/builtin/nameof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::modules::types::{Type, Typed};
use crate::modules::variable::variable_name_extensions;
use crate::translate::module::TranslateModule;
use crate::utils::{ParserMetadata, TranslateMetadata};
use crate::modules::function::invocation_utils::handle_function_parameters;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sort use statements alphabetically, to simplify future maintenance.

use heraclitus_compiler::prelude::*;

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -37,6 +38,10 @@ impl SyntaxModule<ParserMetadata> for Nameof {
Ok(())
} else if let Some(fun_decl) = meta.get_fun_declaration(&name) {
self.name = format!("{}__{}_v0", fun_decl.name, fun_decl.id);
Copy link
Member

@b1ek b1ek Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ph0enixKM is there even a way to properly select a variation of a function? i honestly have no idea how to go around this. hardcoding is definitely not the way for obvious reasons

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Now since we're on a different architecture, we can slowly start to build centralized system that names these functions a certain way and only ask the system for the appropriate name here


// Create an empty call to ensure referenced function gets built
let fun_decl2 = fun_decl.clone();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're not using fun_decl after this, it would be cleaner to shadow the variable name:

let fun_decl = fun_decl.clone();

let _ = handle_function_parameters(meta, fun_decl2.id, fun_decl2.clone(), &fun_decl2.arg_types, &[], None);
Ok(())
} else {
let tok = meta.get_current_token();
Expand Down