let new_analysis_scope env =
        match env.locals with
        | [] ->{
                                globals = { variable_map = StringMap.empty; parent = Some env.globals };
                                num_globals = env.num_globals;
                                locals =[];
                                num_locals = env.num_locals;
                                sdepth = env.sdepth;
                                max_depth = env.max_depth;
                                errors = env.errors;
                                warnings = env.warnings;
                                unique_id = env.unique_id;
                                names = env.names;
                                varprops = env.varprops;
                                imported = env.imported;
                                templates = env.templates;
                                constants = env.constants;
                        }
        | hd:: tl -> {
                                globals = env.globals;
                                num_globals = env.num_globals;
                                locals ={ variable_map = StringMap.empty; parent = Some hd }:: tl;
                                num_locals = env.num_locals; (* on new scope, same number of locals *)
                                sdepth = env.sdepth;
                                max_depth = env.max_depth;
                                errors = env.errors;
                                warnings = env.warnings;
                                unique_id = env.unique_id;
                                names = env.names;
                                varprops = env.varprops;
                                imported = env.imported;
                                templates = env.templates;
                                constants = env.constants;
                        }