{
environment = Environment_construct(environmentPool, environment);
- Stack stackMemory;
- Stack* stack = &stackMemory;
- Stack_initialize(stack);
+ Stack* stack = Stack_construct();
jmp_buf jump;
if(setjmp(jump) != 0)
}
Environment_setLive(environment, false);
+ Stack_destruct(stack);
+
longjmp(parentJump, 1);
}
// TODO Set the environment back to the parent environment
Environment_setLive(environment, false);
+
+ Stack_destruct(stack);
return result;
}
self->length = 0;
}
+Stack* Stack_construct()
+{
+ Stack* result = malloc(sizeof(Stack));
+ Stack_initialize(result);
+ return result;
+}
+
+void Stack_destruct(Stack* self)
+{
+ free(self);
+}
+
bool Stack_any(Stack* self)
{
return self->length > 0;