public void SaveContextAndUpToNearestDefSect() { // _scope_stack вообще не трогать - он не используется !!!!! SavedContext = new ContextState(); SavedContext.stlist_stack = convertion_data_and_alghoritms.statement_list_stack; SavedContext.cmn = _cmn; SavedContext.ctn = _ctn; SavedContext.func_stack = func_stack; SavedContext.block_stack = block_stack; SavedContext.ShortStringTypes = ShortStringTypes; SavedContext.var_defs = var_defs; SavedContext.var_defs_stack = var_defs_stack; SavedContext.special_local_vars = _special_local_vars; SavedContext.possible_incorrect_instances = possible_incorrect_instances; SavedContext.skip_check_where_sections = skip_check_where_sections; SavedContext.main_procedure = main_procedure; SavedContext.allow_inherited_ctor_call = allow_inherited_ctor_call; SavedContext.is_order_independed_method_description = is_order_independed_method_description; SavedContext.ctt = _ctt; SavedContext.compiled_tn = _compiled_tn; SavedContext.last_created_function = last_created_function; SavedContext.cycles_stack = _cycles_stack; SavedContext.num_of_for_cycles = num_of_for_cycles; SavedContext._fal = _fal; SavedContext.member_decls = member_decls; SavedContext.types_predefined = _types_predefined; SavedContext.ret_value = syntax_tree_visitor.ret.get_result(); SavedContextStack.Push(SavedContext); // SavedContext.type_stack = type_stack; convertion_data_and_alghoritms.statement_list_stack = new statement_list_stack(); //_cmn = null; //_ctn = null; //func_stack = new common_function_node_stack(); //block_stack = new Stack<code_block>(); ShortStringTypes = new Dictionary<int,short_string_type_node>(); //var_defs = new List<var_definition_node>(); //var_defs_stack = new Stack<List<var_definition_node>>(); _special_local_vars = new List<local_variable>(); possible_incorrect_instances = new List<type_instance_and_location>(); skip_check_where_sections = false; main_procedure = null; allow_inherited_ctor_call = false; is_order_independed_method_description = false; _ctt = null; _compiled_tn = null; last_created_function = null; _cycles_stack = new statement_node_stack(); _num_of_for_cycles = 0; _fal = SemanticTree.field_access_level.fal_private; member_decls = new Hashtable(); _types_predefined = new List<common_type_node>(); syntax_tree_visitor.ret.return_value(null); // _type_stack = new Stack<common_type_node>(); }
public void reset() { _cmn = null; _ctn = null; _func_stack.clear(); var_defs.Clear(); _main_procedure = null; _last_created_function = null; _cycles_stack.clear(); _num_of_for_cycles = 0; _fal = SemanticTree.field_access_level.fal_private; rec_num = 1; var_defs_stack.Clear(); type_stack.Clear(); clear_special_local_vars(); _scope_stack.Clear(); TypedFiles.Clear(); ShortStringTypes.Clear(); TypedSets.Clear(); _compiled_tn = null; _explicit_interface_type = null; _ctt = null; allow_inherited_ctor_call = false; _types_predefined.Clear(); _block_stack.Clear(); member_decls.Clear(); possible_incorrect_instances.Clear(); skip_check_where_sections = false; LambdaHelper.Reset(); //lroman// SavedContext = null; SavedContextStack.Clear(); compiled_tc_cache.Clear(); extension_method = false; _last_created_function = null; in_parameters_block = false; is_order_independed_method_description = false; }
public void RestoreCurrentContext() { SavedContext = SavedContextStack.Pop(); convertion_data_and_alghoritms.statement_list_stack = SavedContext.stlist_stack; _cmn = SavedContext.cmn; _ctn = SavedContext.ctn; func_stack = SavedContext.func_stack; block_stack = SavedContext.block_stack; ShortStringTypes = SavedContext.ShortStringTypes; var_defs = SavedContext.var_defs; var_defs_stack = SavedContext.var_defs_stack; _special_local_vars = SavedContext.special_local_vars; possible_incorrect_instances = SavedContext.possible_incorrect_instances; skip_check_where_sections = SavedContext.skip_check_where_sections; main_procedure = SavedContext.main_procedure; allow_inherited_ctor_call = SavedContext.allow_inherited_ctor_call; is_order_independed_method_description = SavedContext.is_order_independed_method_description; _ctt = SavedContext.ctt; _compiled_tn = SavedContext.compiled_tn; last_created_function = SavedContext.last_created_function; _cycles_stack = SavedContext.cycles_stack; _num_of_for_cycles = SavedContext.num_of_for_cycles; _fal = SavedContext._fal; member_decls = SavedContext.member_decls; _types_predefined = SavedContext.types_predefined; syntax_tree_visitor.ret.return_value(SavedContext.ret_value); if (SavedContextStack.Count == 0) SavedContext = null; // type_stack = cs.type_stack; оно почему-то readonly - ну и ладно }