Skip to content

Commit bacd46a

Browse files
committed
refactor(macro processor): compute the arg_name of a function macro only after checking the node type
1 parent e652ec3 commit bacd46a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/arkreactor/Compiler/Macros/Executors/Function.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,15 @@ namespace Ark::internal
3838
if (j >= args_needed)
3939
break;
4040

41-
// todo: this fails because we don't have a string because we are defining a (macro ! (call ...args) ...) inside another (macro ! (call ...args) ...)
42-
// most likely the first macro got applied to another macro. We shouldn't apply macro on macros
43-
// assert(args.list()[j].nodeType() == NodeType::String || args.list()[j].nodeType() == NodeType::Spread); // todo: temp
44-
const std::string& arg_name = args.list()[j].string();
4541
if (args.list()[j].nodeType() == NodeType::Symbol)
4642
{
43+
const std::string& arg_name = args.list()[j].string();
4744
args_applied[arg_name] = node.constList()[i];
4845
++j;
4946
}
5047
else if (args.list()[j].nodeType() == NodeType::Spread)
5148
{
49+
const std::string& arg_name = args.list()[j].string();
5250
if (!args_applied.contains(arg_name))
5351
{
5452
args_applied[arg_name] = Node(NodeType::List);

0 commit comments

Comments
 (0)