Skip to content

Commit

Permalink
Fixed function call symbolization for parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Sep 13, 2024
1 parent 7d294f3 commit 1b43938
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ast/expression/FunctionDeclarationExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ DynamicObject FunctionDeclarationExpression::call(SymbolTable& symbols, const st
throw std::runtime_error("Argument count mismatch");

SymbolTable localSymbols(&symbols);
for(size_t i = 0; i < args.size(); ++i) {
auto obj = std::move(&std::move(args).at(i));
localSymbols.setSymbol(this->parameters[i]->getImage(), obj);
}
for(size_t i = 0; i < args.size(); ++i)
localSymbols.setSymbol(
this->parameters[i]->getImage(),
std::move(args).at(i)
);

return std::move(this->body->visit(localSymbols));
}

0 comments on commit 1b43938

Please sign in to comment.