MCPcopy Create free account
hub / github.com/Meridian59/Meridian59 / codegen_enter_loop

Function codegen_enter_loop

blakcomp/codegen.c:372–387  ·  view source on GitHub ↗

/ * codegen_enter_loop: Fix up loop stack when a loop is entered. The top of the * loop is set to the current position in the file. */

Source from the content-addressed store, hash-verified

370 * loop is set to the current position in the file.
371 */
372void codegen_enter_loop(void)
373{
374 list_type temp;
375 /* Loop info holds info needed to handle break and continue statements */
376 loop_type loop_info = (loop_type) SafeMalloc(sizeof(loop_struct));
377
378 /* Make new loop_info structure and add it to the loop "stack" */
379 loop_info->toppos = FileCurPos(outfile);
380 loop_info->break_list = NULL;
381 loop_info->for_continue_list = NULL;
382 current_loop = loop_info;
383
384 /* Add new loop to front of list */
385 temp = list_create( (void *) loop_info);
386 loop_stack = list_append(temp, loop_stack);
387}
388/************************************************************************/
389/*
390 * codegen_exit_loop: Fix up loop stack when a loop is exited. Break statements

Callers 2

codegen_whileFunction · 0.85
codegen_forFunction · 0.85

Calls 3

SafeMallocFunction · 0.70
list_createFunction · 0.70
list_appendFunction · 0.70

Tested by

no test coverage detected