From 00f2f64875b1a9e8e292386fe308906e240aeb37 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 11 Jan 2026 11:59:00 +0100 Subject: chore: Nectar codegen improvements, release prep. Signed-off-by: Amlal El Mahrouss --- .../src/Compilers/NectarCompiler+AMD64.cc | 45 ++++------------------ 1 file changed, 8 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/CompilerKit/src/Compilers/NectarCompiler+AMD64.cc b/src/CompilerKit/src/Compilers/NectarCompiler+AMD64.cc index 0959103..f774541 100644 --- a/src/CompilerKit/src/Compilers/NectarCompiler+AMD64.cc +++ b/src/CompilerKit/src/Compilers/NectarCompiler+AMD64.cc @@ -706,45 +706,16 @@ CompilerKit::SyntaxLeafList::SyntaxLeaf CompilerFrontendNectarAMD64::Compile( subText = subText.erase(subText.find(";")); size_t indxReg = 0UL; - if (subText.ends_with(");")) { - // Check for namespace resolution - if (subText.find("::") != CompilerKit::STLString::npos) { - auto colonPos = subText.find("::"); - auto nsName = subText.substr(0, colonPos); - auto funcPart = subText.substr(colonPos + 2); - - // Trim - while (!nsName.empty() && (nsName.front() == ' ' || nsName.front() == '\t')) { - nsName.erase(0, 1); - } - while (!nsName.empty() && (nsName.back() == ' ' || nsName.back() == '\t')) { - nsName.pop_back(); - } - - // Extract function name - auto funcName = funcPart; - if (funcName.find("(") != CompilerKit::STLString::npos) { - funcName = funcName.substr(0, funcName.find("(")); - } + if (subText.find("(") != CompilerKit::STLString::npos) + subText.erase(subText.find("(")); - // Trim - while (!funcName.empty() && (funcName.front() == ' ' || funcName.front() == '\t')) { - funcName.erase(0, 1); - } + auto ref = nectar_get_variable_ref(subText); - while (!funcName.empty() && (funcName.back() == ' ' || funcName.back() == '\t')) { - funcName.pop_back(); - } - - // Generate mangled name - nectar_push_scope(ScopeKind::kScopeNamespace, nsName); - auto mangled = nectar_mangle_name(funcName); - nectar_pop_scope(); - - kOrigin += 3UL; - break; - } - } + if (ref.empty() == false) + syntax_tree.fUserValue += "mov rax, " + ref + "\n"; + + if (subText.starts_with("'") || isnumber(subText[0])) + syntax_tree.fUserValue += "mov rax, " + subText + "\n"; syntax_tree.fUserValue += nectar_generate_epilogue() + "ret\n"; kOrigin += 2UL; -- cgit v1.2.3