Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a double free of the implicit variable #50

Open
wants to merge 1 commit into
base: future
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1661,13 +1661,13 @@ ValueObject *castStringExplicit(ValueObject *node,
* prototype to allow this function to be stored in a jump table for fast
* execution.
*
* \return A pointer to the value of \a scope's implicit variable.
* \return A pointer to a copy of the value of \a scope's implicit variable.
*/
ValueObject *interpretImpVarExprNode(ExprNode *node,
ScopeObject *scope)
{
node = NULL;
return scope->impvar;
return copyValueObject(scope->impvar);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INCLUDE(AddLolTest)
ADD_LOL_TEST(12-ImplicitVariable OUTPUT test.out)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
HAI 1.3
SUM OF 1 AN 2
VISIBLE SUM OF IT AN 3
KTHXBYE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This test checks that the implicit variable (IT) for the addition operator is
functional.
1 change: 1 addition & 0 deletions test/1.3-Tests/7-Operators/1-Addition/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_subdirectory(1-Intergers)
add_subdirectory(10-ArityCheck)
add_subdirectory(11-OptionalAN)
add_subdirectory(12-ImplicitVariable)
add_subdirectory(2-FloatInteger)
add_subdirectory(3-IntegerFloat)
add_subdirectory(4-Floats)
Expand Down