From 1b9d07ca2a4c437edc1a401a1b3174801e950e4b Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 27 Sep 2024 16:38:52 -0400 Subject: [PATCH] fix: try using fully qualified name for return enum in astnode --- src/compiler/CodeGen.cpp | 2 +- src/compiler/StandardLibrary.hpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compiler/CodeGen.cpp b/src/compiler/CodeGen.cpp index ea7975a..c6b48fd 100644 --- a/src/compiler/CodeGen.cpp +++ b/src/compiler/CodeGen.cpp @@ -91,7 +91,7 @@ namespace Theta { return generateAssignment(dynamic_pointer_cast(node), module); } else if (node->getNodeType() == ASTNode::BLOCK) { return generateBlock(dynamic_pointer_cast(node), module); - } else if (node->getNodeType() == ASTNode::RETURN) { + } else if (node->getNodeType() == Theta::ASTNode::RETURN) { return generateReturn(dynamic_pointer_cast(node), module); } else if (node->getNodeType() == ASTNode::FUNCTION_DECLARATION) { // The only time we should get here is if we have a function defined inside a function, diff --git a/src/compiler/StandardLibrary.hpp b/src/compiler/StandardLibrary.hpp index db2069e..7e169d7 100644 --- a/src/compiler/StandardLibrary.hpp +++ b/src/compiler/StandardLibrary.hpp @@ -110,14 +110,15 @@ namespace Theta { BinaryenLocalGet(module, 2, BinaryenTypeInt64()) }; - BinaryenType fnTypes[2] = { BinaryenTypeInt64(), BinaryenTypeInt64() }; + BinaryenType paramTypes[2] = { BinaryenTypeInt64(), BinaryenTypeInt64() }; + BinaryenType varTypes[1] = { BinaryenTypeInt64() }; BinaryenFunctionRef powFn = BinaryenAddFunction( module, "Theta.Math.pow", - BinaryenTypeCreate(fnTypes, 2), + BinaryenTypeCreate(paramTypes, 2), BinaryenTypeInt64(), - (BinaryenType[]){ BinaryenTypeInt64() }, + varTypes, 1, BinaryenBlock( module,