Skip to content

Commit

Permalink
fix: unary parsing fixed, also added support for negative values in m…
Browse files Browse the repository at this point in the history
…emory
  • Loading branch information
alexdovzhanyn committed Aug 28, 2024
1 parent 80c06ce commit d2d5024
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/compiler/CodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ namespace Theta {

argPointers.push_back(Pointer<PointerType::Data>(memoryOffset));

// TODO: change to only increment memoryOffset after the loop finishes
memoryOffset += byteSize;
}

Expand Down Expand Up @@ -662,7 +661,7 @@ namespace Theta {
loadArgsExpressions[functionMetaData.getArity() - 1 - i] = BinaryenLoad(
module,
getByteSizeForType(argType),
false, // TODO: support negative values
true, // TODO: support negative values
0,
0,
argType,
Expand Down Expand Up @@ -1091,10 +1090,6 @@ namespace Theta {

// This is basically getting the function metadata for the function that gets generated as a result of
// currying
// TODO: This wont work if the function that is curried doesnt use all of the parameters of its parent
// function, because the generated function will have less arity than what we are inferring it
// to have here. Need to change closure generation to just make every closure capture all the
// parameters of its parents
FunctionMetaData CodeGen::getDerivedFunctionMetaData(
shared_ptr<FunctionInvocationNode> invocation,
shared_ptr<FunctionInvocationNode> reference
Expand Down
2 changes: 1 addition & 1 deletion src/parser/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ namespace Theta {
// Unary cant have a left arg, so if we get one passed in we can skip straight to primary
if (!passedLeftArg && (match(Token::OPERATOR, Lexemes::NOT) || match(Token::OPERATOR, Lexemes::MINUS))) {
shared_ptr<ASTNode> un = make_shared<UnaryOperationNode>(currentToken.getLexeme(), parent);
un->setValue(parseUnary(passedLeftArg, un));
un->setValue(parseUnary(un, passedLeftArg));

return un;
}
Expand Down

0 comments on commit d2d5024

Please sign in to comment.