git.haldean.org expel / 804ad48
maintain difference between local and global Haldean Brown 6 years ago
1 changed file(s) with 20 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
376376 if (strcmp(name, check_name->name) == 0)
377377 found = true;
378378 }
379 if (!found && scope->boundary == BOUNDARY_FUNCTION)
379 if (scope->boundary == BOUNDARY_GLOBAL)
380 highest_bdry = BOUNDARY_GLOBAL;
381 else if (!found && scope->boundary == BOUNDARY_FUNCTION)
380382 highest_bdry = BOUNDARY_FUNCTION;
381383 scope = scope->parent;
382384 }
388390 return err;
389391 }
390392
391 expr->atom->name_loc->type = highest_bdry == BOUNDARY_FUNCTION
392 ? RESOLVE_CLOSURE
393 : RESOLVE_LOCAL;
393 switch (highest_bdry)
394 {
395 case BOUNDARY_FUNCTION:
396 expr->atom->name_loc->type = RESOLVE_CLOSURE;
397 break;
398 case BOUNDARY_GLOBAL:
399 expr->atom->name_loc->type = RESOLVE_GLOBAL;
400 break;
401 case BOUNDARY_BLOCK:
402 expr->atom->name_loc->type = RESOLVE_LOCAL;
403 break;
404 }
405 printf("name %s resolves with type %s\n",
406 name,
407 expr->atom->name_loc->type == RESOLVE_CLOSURE
408 ? "closure" : (expr->atom->name_loc->type == RESOLVE_GLOBAL
409 ? "global" : "local"));
394410 }
395411
396412 err = xl_ast_subexprs(&subast, subexprs, &n_subexprs, expr);