X-Git-Url: https://code.kerkeslager.com/?p=fur;a=blobdiff_plain;f=templates%2Ffunction_definition.c;h=c483bda5827ce9d47934afa660ff12ea3713f0be;hp=4635e9ccb929cbe460bbd7055a4629e5bcc4330d;hb=1f2895250c61aeb81c0f0ba7efed156c9386dfac;hpb=3eef27fe9f504e67ec74e330587007eb7b28946f diff --git a/templates/function_definition.c b/templates/function_definition.c index 4635e9c..c483bda 100644 --- a/templates/function_definition.c +++ b/templates/function_definition.c @@ -1,8 +1,7 @@ -Object user${{name}}$implementation(EnvironmentPool* environmentPool, Environment* parent, size_t argc, Stack* parentStack, jmp_buf parentJump) +Object user${{name}}$implementation(EnvironmentPool* environmentPool, Environment* environment, size_t argc, Stack* parentStack, jmp_buf parentJump) { - Environment* environment = EnvironmentPool_allocate(environmentPool); - Environment_initialize(environment, parent); + environment = Environment_construct(environmentPool, environment); Stack stackMemory; Stack* stack = &stackMemory; @@ -33,6 +32,7 @@ Object user${{name}}$implementation(EnvironmentPool* environmentPool, Environmen {{ statement }} {% endfor %} + // TODO Set the environment back to the parent environment Environment_setLive(environment, false); return result; }