From b104ec55bf8dca5b16eb192f716baf392be0fc14 Mon Sep 17 00:00:00 2001 From: "Keith T. Star" Date: Fri, 17 May 2024 09:15:45 -0700 Subject: [PATCH] Fix store --- Cargo.toml | 2 +- src/v2/lu_dog_ndrwlock_vec/store.rs | 2262 +++++++++++++++++++++++++- src/v2/lu_dog_pl_vec/store.rs | 2262 +++++++++++++++++++++++++- src/v2/lu_dog_rwlock_vec/store.rs | 2262 +++++++++++++++++++++++++- src/v2/lu_dog_vec/store.rs | 2311 +++++++++++++++++++++++++-- src/v2/lu_dog_vec_tracy/store.rs | 2311 +++++++++++++++++++++++++-- 6 files changed, 10847 insertions(+), 563 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7f8e4fe5..cd22ecd7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sarzak" -version = "2.13.26" +version = "2.13.27" edition = "2021" authors = ["Keith T. Star "] categories = ["compilers", "memory-management"] diff --git a/src/v2/lu_dog_ndrwlock_vec/store.rs b/src/v2/lu_dog_ndrwlock_vec/store.rs index 6eb10674..438a68eb 100644 --- a/src/v2/lu_dog_ndrwlock_vec/store.rs +++ b/src/v2/lu_dog_ndrwlock_vec/store.rs @@ -302,254 +302,2348 @@ impl Clone for ObjectStore { fn clone(&self) -> Self { ObjectStore { argument_free_list: Mutex::new(self.argument_free_list.lock().unwrap().clone()), - argument: self.argument.clone(), + argument: Arc::new(RwLock::new(self.argument.read().unwrap().clone())), a_wait_free_list: Mutex::new(self.a_wait_free_list.lock().unwrap().clone()), - a_wait: self.a_wait.clone(), + a_wait: Arc::new(RwLock::new(self.a_wait.read().unwrap().clone())), binary_free_list: Mutex::new(self.binary_free_list.lock().unwrap().clone()), - binary: self.binary.clone(), + binary: Arc::new(RwLock::new(self.binary.read().unwrap().clone())), block_free_list: Mutex::new(self.block_free_list.lock().unwrap().clone()), - block: self.block.clone(), + block: Arc::new(RwLock::new(self.block.read().unwrap().clone())), body_free_list: Mutex::new(self.body_free_list.lock().unwrap().clone()), - body: self.body.clone(), + body: Arc::new(RwLock::new(self.body.read().unwrap().clone())), boolean_literal_free_list: Mutex::new( self.boolean_literal_free_list.lock().unwrap().clone(), ), - boolean_literal: self.boolean_literal.clone(), + boolean_literal: Arc::new(RwLock::new(self.boolean_literal.read().unwrap().clone())), boolean_operator_free_list: Mutex::new( self.boolean_operator_free_list.lock().unwrap().clone(), ), - boolean_operator: self.boolean_operator.clone(), + boolean_operator: Arc::new(RwLock::new(self.boolean_operator.read().unwrap().clone())), call_free_list: Mutex::new(self.call_free_list.lock().unwrap().clone()), - call: self.call.clone(), + call: Arc::new(RwLock::new(self.call.read().unwrap().clone())), char_literal_free_list: Mutex::new(self.char_literal_free_list.lock().unwrap().clone()), - char_literal: self.char_literal.clone(), + char_literal: Arc::new(RwLock::new(self.char_literal.read().unwrap().clone())), comparison_free_list: Mutex::new(self.comparison_free_list.lock().unwrap().clone()), - comparison: self.comparison.clone(), + comparison: Arc::new(RwLock::new(self.comparison.read().unwrap().clone())), data_structure_free_list: Mutex::new( self.data_structure_free_list.lock().unwrap().clone(), ), - data_structure: self.data_structure.clone(), + data_structure: Arc::new(RwLock::new(self.data_structure.read().unwrap().clone())), dwarf_source_file_free_list: Mutex::new( self.dwarf_source_file_free_list.lock().unwrap().clone(), ), - dwarf_source_file: self.dwarf_source_file.clone(), + dwarf_source_file: Arc::new(RwLock::new( + self.dwarf_source_file.read().unwrap().clone(), + )), enum_field_free_list: Mutex::new(self.enum_field_free_list.lock().unwrap().clone()), - enum_field: self.enum_field.clone(), + enum_field: Arc::new(RwLock::new(self.enum_field.read().unwrap().clone())), enum_generic_free_list: Mutex::new(self.enum_generic_free_list.lock().unwrap().clone()), - enum_generic: self.enum_generic.clone(), + enum_generic: Arc::new(RwLock::new(self.enum_generic.read().unwrap().clone())), enumeration_free_list: Mutex::new(self.enumeration_free_list.lock().unwrap().clone()), - enumeration: self.enumeration.clone(), + enumeration: Arc::new(RwLock::new(self.enumeration.read().unwrap().clone())), enumeration_id_by_name: self.enumeration_id_by_name.clone(), expression_free_list: Mutex::new(self.expression_free_list.lock().unwrap().clone()), - expression: self.expression.clone(), + expression: Arc::new(RwLock::new(self.expression.read().unwrap().clone())), expression_bit_free_list: Mutex::new( self.expression_bit_free_list.lock().unwrap().clone(), ), - expression_bit: self.expression_bit.clone(), + expression_bit: Arc::new(RwLock::new(self.expression_bit.read().unwrap().clone())), expression_statement_free_list: Mutex::new( self.expression_statement_free_list.lock().unwrap().clone(), ), - expression_statement: self.expression_statement.clone(), + expression_statement: Arc::new(RwLock::new( + self.expression_statement.read().unwrap().clone(), + )), external_implementation_free_list: Mutex::new( self.external_implementation_free_list .lock() .unwrap() .clone(), ), - external_implementation: self.external_implementation.clone(), + external_implementation: Arc::new(RwLock::new( + self.external_implementation.read().unwrap().clone(), + )), field_free_list: Mutex::new(self.field_free_list.lock().unwrap().clone()), - field: self.field.clone(), + field: Arc::new(RwLock::new(self.field.read().unwrap().clone())), field_id_by_name: self.field_id_by_name.clone(), field_access_free_list: Mutex::new(self.field_access_free_list.lock().unwrap().clone()), - field_access: self.field_access.clone(), + field_access: Arc::new(RwLock::new(self.field_access.read().unwrap().clone())), field_access_target_free_list: Mutex::new( self.field_access_target_free_list.lock().unwrap().clone(), ), - field_access_target: self.field_access_target.clone(), + field_access_target: Arc::new(RwLock::new( + self.field_access_target.read().unwrap().clone(), + )), field_expression_free_list: Mutex::new( self.field_expression_free_list.lock().unwrap().clone(), ), - field_expression: self.field_expression.clone(), + field_expression: Arc::new(RwLock::new(self.field_expression.read().unwrap().clone())), float_literal_free_list: Mutex::new( self.float_literal_free_list.lock().unwrap().clone(), ), - float_literal: self.float_literal.clone(), + float_literal: Arc::new(RwLock::new(self.float_literal.read().unwrap().clone())), for_loop_free_list: Mutex::new(self.for_loop_free_list.lock().unwrap().clone()), - for_loop: self.for_loop.clone(), + for_loop: Arc::new(RwLock::new(self.for_loop.read().unwrap().clone())), format_bit_free_list: Mutex::new(self.format_bit_free_list.lock().unwrap().clone()), - format_bit: self.format_bit.clone(), + format_bit: Arc::new(RwLock::new(self.format_bit.read().unwrap().clone())), format_string_free_list: Mutex::new( self.format_string_free_list.lock().unwrap().clone(), ), - format_string: self.format_string.clone(), + format_string: Arc::new(RwLock::new(self.format_string.read().unwrap().clone())), func_generic_free_list: Mutex::new(self.func_generic_free_list.lock().unwrap().clone()), - func_generic: self.func_generic.clone(), + func_generic: Arc::new(RwLock::new(self.func_generic.read().unwrap().clone())), function_free_list: Mutex::new(self.function_free_list.lock().unwrap().clone()), - function: self.function.clone(), + function: Arc::new(RwLock::new(self.function.read().unwrap().clone())), function_id_by_name: self.function_id_by_name.clone(), function_call_free_list: Mutex::new( self.function_call_free_list.lock().unwrap().clone(), ), - function_call: self.function_call.clone(), + function_call: Arc::new(RwLock::new(self.function_call.read().unwrap().clone())), x_future_free_list: Mutex::new(self.x_future_free_list.lock().unwrap().clone()), - x_future: self.x_future.clone(), + x_future: Arc::new(RwLock::new(self.x_future.read().unwrap().clone())), grouped_free_list: Mutex::new(self.grouped_free_list.lock().unwrap().clone()), - grouped: self.grouped.clone(), + grouped: Arc::new(RwLock::new(self.grouped.read().unwrap().clone())), halt_and_catch_fire_free_list: Mutex::new( self.halt_and_catch_fire_free_list.lock().unwrap().clone(), ), - halt_and_catch_fire: self.halt_and_catch_fire.clone(), + halt_and_catch_fire: Arc::new(RwLock::new( + self.halt_and_catch_fire.read().unwrap().clone(), + )), x_if_free_list: Mutex::new(self.x_if_free_list.lock().unwrap().clone()), - x_if: self.x_if.clone(), + x_if: Arc::new(RwLock::new(self.x_if.read().unwrap().clone())), implementation_block_free_list: Mutex::new( self.implementation_block_free_list.lock().unwrap().clone(), ), - implementation_block: self.implementation_block.clone(), + implementation_block: Arc::new(RwLock::new( + self.implementation_block.read().unwrap().clone(), + )), import_free_list: Mutex::new(self.import_free_list.lock().unwrap().clone()), - import: self.import.clone(), + import: Arc::new(RwLock::new(self.import.read().unwrap().clone())), index_free_list: Mutex::new(self.index_free_list.lock().unwrap().clone()), - index: self.index.clone(), + index: Arc::new(RwLock::new(self.index.read().unwrap().clone())), integer_literal_free_list: Mutex::new( self.integer_literal_free_list.lock().unwrap().clone(), ), - integer_literal: self.integer_literal.clone(), + integer_literal: Arc::new(RwLock::new(self.integer_literal.read().unwrap().clone())), item_free_list: Mutex::new(self.item_free_list.lock().unwrap().clone()), - item: self.item.clone(), + item: Arc::new(RwLock::new(self.item.read().unwrap().clone())), lambda_free_list: Mutex::new(self.lambda_free_list.lock().unwrap().clone()), - lambda: self.lambda.clone(), + lambda: Arc::new(RwLock::new(self.lambda.read().unwrap().clone())), lambda_parameter_free_list: Mutex::new( self.lambda_parameter_free_list.lock().unwrap().clone(), ), - lambda_parameter: self.lambda_parameter.clone(), + lambda_parameter: Arc::new(RwLock::new(self.lambda_parameter.read().unwrap().clone())), let_statement_free_list: Mutex::new( self.let_statement_free_list.lock().unwrap().clone(), ), - let_statement: self.let_statement.clone(), + let_statement: Arc::new(RwLock::new(self.let_statement.read().unwrap().clone())), list_free_list: Mutex::new(self.list_free_list.lock().unwrap().clone()), - list: self.list.clone(), + list: Arc::new(RwLock::new(self.list.read().unwrap().clone())), list_element_free_list: Mutex::new(self.list_element_free_list.lock().unwrap().clone()), - list_element: self.list_element.clone(), + list_element: Arc::new(RwLock::new(self.list_element.read().unwrap().clone())), list_expression_free_list: Mutex::new( self.list_expression_free_list.lock().unwrap().clone(), ), - list_expression: self.list_expression.clone(), + list_expression: Arc::new(RwLock::new(self.list_expression.read().unwrap().clone())), literal_free_list: Mutex::new(self.literal_free_list.lock().unwrap().clone()), - literal: self.literal.clone(), + literal: Arc::new(RwLock::new(self.literal.read().unwrap().clone())), local_variable_free_list: Mutex::new( self.local_variable_free_list.lock().unwrap().clone(), ), - local_variable: self.local_variable.clone(), + local_variable: Arc::new(RwLock::new(self.local_variable.read().unwrap().clone())), x_macro_free_list: Mutex::new(self.x_macro_free_list.lock().unwrap().clone()), - x_macro: self.x_macro.clone(), + x_macro: Arc::new(RwLock::new(self.x_macro.read().unwrap().clone())), map_free_list: Mutex::new(self.map_free_list.lock().unwrap().clone()), - map: self.map.clone(), + map: Arc::new(RwLock::new(self.map.read().unwrap().clone())), map_element_free_list: Mutex::new(self.map_element_free_list.lock().unwrap().clone()), - map_element: self.map_element.clone(), + map_element: Arc::new(RwLock::new(self.map_element.read().unwrap().clone())), map_expression_free_list: Mutex::new( self.map_expression_free_list.lock().unwrap().clone(), ), - map_expression: self.map_expression.clone(), + map_expression: Arc::new(RwLock::new(self.map_expression.read().unwrap().clone())), x_match_free_list: Mutex::new(self.x_match_free_list.lock().unwrap().clone()), - x_match: self.x_match.clone(), + x_match: Arc::new(RwLock::new(self.x_match.read().unwrap().clone())), method_call_free_list: Mutex::new(self.method_call_free_list.lock().unwrap().clone()), - method_call: self.method_call.clone(), + method_call: Arc::new(RwLock::new(self.method_call.read().unwrap().clone())), named_field_expression_free_list: Mutex::new( self.named_field_expression_free_list .lock() .unwrap() .clone(), ), - named_field_expression: self.named_field_expression.clone(), + named_field_expression: Arc::new(RwLock::new( + self.named_field_expression.read().unwrap().clone(), + )), z_object_store_free_list: Mutex::new( self.z_object_store_free_list.lock().unwrap().clone(), ), - z_object_store: self.z_object_store.clone(), + z_object_store: Arc::new(RwLock::new(self.z_object_store.read().unwrap().clone())), z_object_store_id_by_name: self.z_object_store_id_by_name.clone(), object_wrapper_free_list: Mutex::new( self.object_wrapper_free_list.lock().unwrap().clone(), ), - object_wrapper: self.object_wrapper.clone(), + object_wrapper: Arc::new(RwLock::new(self.object_wrapper.read().unwrap().clone())), operator_free_list: Mutex::new(self.operator_free_list.lock().unwrap().clone()), - operator: self.operator.clone(), + operator: Arc::new(RwLock::new(self.operator.read().unwrap().clone())), parameter_free_list: Mutex::new(self.parameter_free_list.lock().unwrap().clone()), - parameter: self.parameter.clone(), + parameter: Arc::new(RwLock::new(self.parameter.read().unwrap().clone())), x_path_free_list: Mutex::new(self.x_path_free_list.lock().unwrap().clone()), - x_path: self.x_path.clone(), + x_path: Arc::new(RwLock::new(self.x_path.read().unwrap().clone())), path_element_free_list: Mutex::new(self.path_element_free_list.lock().unwrap().clone()), - path_element: self.path_element.clone(), + path_element: Arc::new(RwLock::new(self.path_element.read().unwrap().clone())), pattern_free_list: Mutex::new(self.pattern_free_list.lock().unwrap().clone()), - pattern: self.pattern.clone(), + pattern: Arc::new(RwLock::new(self.pattern.read().unwrap().clone())), x_plugin_free_list: Mutex::new(self.x_plugin_free_list.lock().unwrap().clone()), - x_plugin: self.x_plugin.clone(), + x_plugin: Arc::new(RwLock::new(self.x_plugin.read().unwrap().clone())), x_plugin_id_by_name: self.x_plugin_id_by_name.clone(), x_print_free_list: Mutex::new(self.x_print_free_list.lock().unwrap().clone()), - x_print: self.x_print.clone(), + x_print: Arc::new(RwLock::new(self.x_print.read().unwrap().clone())), range_expression_free_list: Mutex::new( self.range_expression_free_list.lock().unwrap().clone(), ), - range_expression: self.range_expression.clone(), + range_expression: Arc::new(RwLock::new(self.range_expression.read().unwrap().clone())), result_statement_free_list: Mutex::new( self.result_statement_free_list.lock().unwrap().clone(), ), - result_statement: self.result_statement.clone(), + result_statement: Arc::new(RwLock::new(self.result_statement.read().unwrap().clone())), x_return_free_list: Mutex::new(self.x_return_free_list.lock().unwrap().clone()), - x_return: self.x_return.clone(), + x_return: Arc::new(RwLock::new(self.x_return.read().unwrap().clone())), span_free_list: Mutex::new(self.span_free_list.lock().unwrap().clone()), - span: self.span.clone(), + span: Arc::new(RwLock::new(self.span.read().unwrap().clone())), statement_free_list: Mutex::new(self.statement_free_list.lock().unwrap().clone()), - statement: self.statement.clone(), + statement: Arc::new(RwLock::new(self.statement.read().unwrap().clone())), static_method_call_free_list: Mutex::new( self.static_method_call_free_list.lock().unwrap().clone(), ), - static_method_call: self.static_method_call.clone(), + static_method_call: Arc::new(RwLock::new( + self.static_method_call.read().unwrap().clone(), + )), string_bit_free_list: Mutex::new(self.string_bit_free_list.lock().unwrap().clone()), - string_bit: self.string_bit.clone(), + string_bit: Arc::new(RwLock::new(self.string_bit.read().unwrap().clone())), string_literal_free_list: Mutex::new( self.string_literal_free_list.lock().unwrap().clone(), ), - string_literal: self.string_literal.clone(), + string_literal: Arc::new(RwLock::new(self.string_literal.read().unwrap().clone())), woog_struct_free_list: Mutex::new(self.woog_struct_free_list.lock().unwrap().clone()), - woog_struct: self.woog_struct.clone(), + woog_struct: Arc::new(RwLock::new(self.woog_struct.read().unwrap().clone())), woog_struct_id_by_name: self.woog_struct_id_by_name.clone(), struct_expression_free_list: Mutex::new( self.struct_expression_free_list.lock().unwrap().clone(), ), - struct_expression: self.struct_expression.clone(), + struct_expression: Arc::new(RwLock::new( + self.struct_expression.read().unwrap().clone(), + )), struct_field_free_list: Mutex::new(self.struct_field_free_list.lock().unwrap().clone()), - struct_field: self.struct_field.clone(), + struct_field: Arc::new(RwLock::new(self.struct_field.read().unwrap().clone())), struct_generic_free_list: Mutex::new( self.struct_generic_free_list.lock().unwrap().clone(), ), - struct_generic: self.struct_generic.clone(), + struct_generic: Arc::new(RwLock::new(self.struct_generic.read().unwrap().clone())), tuple_field_free_list: Mutex::new(self.tuple_field_free_list.lock().unwrap().clone()), - tuple_field: self.tuple_field.clone(), + tuple_field: Arc::new(RwLock::new(self.tuple_field.read().unwrap().clone())), type_cast_free_list: Mutex::new(self.type_cast_free_list.lock().unwrap().clone()), - type_cast: self.type_cast.clone(), + type_cast: Arc::new(RwLock::new(self.type_cast.read().unwrap().clone())), unary_free_list: Mutex::new(self.unary_free_list.lock().unwrap().clone()), - unary: self.unary.clone(), + unary: Arc::new(RwLock::new(self.unary.read().unwrap().clone())), unit_free_list: Mutex::new(self.unit_free_list.lock().unwrap().clone()), - unit: self.unit.clone(), + unit: Arc::new(RwLock::new(self.unit.read().unwrap().clone())), unnamed_field_expression_free_list: Mutex::new( self.unnamed_field_expression_free_list .lock() .unwrap() .clone(), ), - unnamed_field_expression: self.unnamed_field_expression.clone(), + unnamed_field_expression: Arc::new(RwLock::new( + self.unnamed_field_expression.read().unwrap().clone(), + )), x_value_free_list: Mutex::new(self.x_value_free_list.lock().unwrap().clone()), - x_value: self.x_value.clone(), + x_value: Arc::new(RwLock::new(self.x_value.read().unwrap().clone())), value_type_free_list: Mutex::new(self.value_type_free_list.lock().unwrap().clone()), - value_type: self.value_type.clone(), + value_type: Arc::new(RwLock::new(self.value_type.read().unwrap().clone())), variable_free_list: Mutex::new(self.variable_free_list.lock().unwrap().clone()), - variable: self.variable.clone(), + variable: Arc::new(RwLock::new(self.variable.read().unwrap().clone())), variable_expression_free_list: Mutex::new( self.variable_expression_free_list.lock().unwrap().clone(), ), - variable_expression: self.variable_expression.clone(), + variable_expression: Arc::new(RwLock::new( + self.variable_expression.read().unwrap().clone(), + )), } } } impl ObjectStore { + pub fn merge(&mut self, other: ObjectStore) { + let mut argument = self.argument.write().unwrap(); + other.argument.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in argument, if it's not there add it to argument. + if argument + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = argument.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + argument.push(Some(x.clone())); + } + } + }); + + let mut a_wait = self.a_wait.write().unwrap(); + other.a_wait.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in a_wait, if it's not there add it to a_wait. + if a_wait + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = a_wait.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + a_wait.push(Some(x.clone())); + } + } + }); + + let mut binary = self.binary.write().unwrap(); + other.binary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in binary, if it's not there add it to binary. + if binary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = binary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + binary.push(Some(x.clone())); + } + } + }); + + let mut block = self.block.write().unwrap(); + other.block.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in block, if it's not there add it to block. + if block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + block.push(Some(x.clone())); + } + } + }); + + let mut body = self.body.write().unwrap(); + other.body.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in body, if it's not there add it to body. + if body + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = body.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + body.push(Some(x.clone())); + } + } + }); + + let mut boolean_literal = self.boolean_literal.write().unwrap(); + other.boolean_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_literal, if it's not there add it to boolean_literal. + if boolean_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_literal.push(Some(x.clone())); + } + } + }); + + let mut boolean_operator = self.boolean_operator.write().unwrap(); + other.boolean_operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_operator, if it's not there add it to boolean_operator. + if boolean_operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_operator.push(Some(x.clone())); + } + } + }); + + let mut call = self.call.write().unwrap(); + other.call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in call, if it's not there add it to call. + if call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + call.push(Some(x.clone())); + } + } + }); + + let mut char_literal = self.char_literal.write().unwrap(); + other.char_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in char_literal, if it's not there add it to char_literal. + if char_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = char_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + char_literal.push(Some(x.clone())); + } + } + }); + + let mut comparison = self.comparison.write().unwrap(); + other.comparison.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in comparison, if it's not there add it to comparison. + if comparison + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = comparison.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + comparison.push(Some(x.clone())); + } + } + }); + + let mut data_structure = self.data_structure.write().unwrap(); + other.data_structure.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in data_structure, if it's not there add it to data_structure. + if data_structure + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = data_structure.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + data_structure.push(Some(x.clone())); + } + } + }); + + let mut dwarf_source_file = self.dwarf_source_file.write().unwrap(); + other + .dwarf_source_file + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. + if dwarf_source_file + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = dwarf_source_file.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + dwarf_source_file.push(Some(x.clone())); + } + } + }); + + let mut enum_field = self.enum_field.write().unwrap(); + other.enum_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_field, if it's not there add it to enum_field. + if enum_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_field.push(Some(x.clone())); + } + } + }); + + let mut enum_generic = self.enum_generic.write().unwrap(); + other.enum_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic, if it's not there add it to enum_generic. + if enum_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_generic.push(Some(x.clone())); + } + } + }); + + let mut enumeration = self.enumeration.write().unwrap(); + other.enumeration.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enumeration, if it's not there add it to enumeration. + if enumeration + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enumeration.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enumeration.push(Some(x.clone())); + } + } + }); + + let mut expression = self.expression.write().unwrap(); + other.expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression, if it's not there add it to expression. + if expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression.push(Some(x.clone())); + } + } + }); + + let mut expression_bit = self.expression_bit.write().unwrap(); + other.expression_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression_bit, if it's not there add it to expression_bit. + if expression_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_bit.push(Some(x.clone())); + } + } + }); + + let mut expression_statement = self.expression_statement.write().unwrap(); + other + .expression_statement + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in expression_statement, if it's not there add it to expression_statement. + if expression_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_statement.push(Some(x.clone())); + } + } + }); + + let mut external_implementation = self.external_implementation.write().unwrap(); + other + .external_implementation + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in external_implementation, if it's not there add it to external_implementation. + if external_implementation + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = external_implementation.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + external_implementation.push(Some(x.clone())); + } + } + }); + + let mut field = self.field.write().unwrap(); + other.field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field, if it's not there add it to field. + if field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field.push(Some(x.clone())); + } + } + }); + + let mut field_access = self.field_access.write().unwrap(); + other.field_access.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_access, if it's not there add it to field_access. + if field_access + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access.push(Some(x.clone())); + } + } + }); + + let mut field_access_target = self.field_access_target.write().unwrap(); + other + .field_access_target + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in field_access_target, if it's not there add it to field_access_target. + if field_access_target + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access_target.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access_target.push(Some(x.clone())); + } + } + }); + + let mut field_expression = self.field_expression.write().unwrap(); + other.field_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_expression, if it's not there add it to field_expression. + if field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_expression.push(Some(x.clone())); + } + } + }); + + let mut float_literal = self.float_literal.write().unwrap(); + other.float_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in float_literal, if it's not there add it to float_literal. + if float_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = float_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + float_literal.push(Some(x.clone())); + } + } + }); + + let mut for_loop = self.for_loop.write().unwrap(); + other.for_loop.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in for_loop, if it's not there add it to for_loop. + if for_loop + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = for_loop.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + for_loop.push(Some(x.clone())); + } + } + }); + + let mut format_bit = self.format_bit.write().unwrap(); + other.format_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_bit, if it's not there add it to format_bit. + if format_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_bit.push(Some(x.clone())); + } + } + }); + + let mut format_string = self.format_string.write().unwrap(); + other.format_string.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_string, if it's not there add it to format_string. + if format_string + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_string.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_string.push(Some(x.clone())); + } + } + }); + + let mut func_generic = self.func_generic.write().unwrap(); + other.func_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in func_generic, if it's not there add it to func_generic. + if func_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = func_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + func_generic.push(Some(x.clone())); + } + } + }); + + let mut function = self.function.write().unwrap(); + other.function.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function, if it's not there add it to function. + if function + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function.push(Some(x.clone())); + } + } + }); + + let mut function_call = self.function_call.write().unwrap(); + other.function_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function_call, if it's not there add it to function_call. + if function_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function_call.push(Some(x.clone())); + } + } + }); + + let mut x_future = self.x_future.write().unwrap(); + other.x_future.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_future, if it's not there add it to x_future. + if x_future + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_future.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_future.push(Some(x.clone())); + } + } + }); + + let mut grouped = self.grouped.write().unwrap(); + other.grouped.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in grouped, if it's not there add it to grouped. + if grouped + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = grouped.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + grouped.push(Some(x.clone())); + } + } + }); + + let mut halt_and_catch_fire = self.halt_and_catch_fire.write().unwrap(); + other + .halt_and_catch_fire + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. + if halt_and_catch_fire + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = halt_and_catch_fire.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + halt_and_catch_fire.push(Some(x.clone())); + } + } + }); + + let mut x_if = self.x_if.write().unwrap(); + other.x_if.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_if, if it's not there add it to x_if. + if x_if + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_if.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_if.push(Some(x.clone())); + } + } + }); + + let mut implementation_block = self.implementation_block.write().unwrap(); + other + .implementation_block + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in implementation_block, if it's not there add it to implementation_block. + if implementation_block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = implementation_block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + implementation_block.push(Some(x.clone())); + } + } + }); + + let mut import = self.import.write().unwrap(); + other.import.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in import, if it's not there add it to import. + if import + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = import.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + import.push(Some(x.clone())); + } + } + }); + + let mut index = self.index.write().unwrap(); + other.index.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in index, if it's not there add it to index. + if index + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = index.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + index.push(Some(x.clone())); + } + } + }); + + let mut integer_literal = self.integer_literal.write().unwrap(); + other.integer_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in integer_literal, if it's not there add it to integer_literal. + if integer_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = integer_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + integer_literal.push(Some(x.clone())); + } + } + }); + + let mut item = self.item.write().unwrap(); + other.item.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in item, if it's not there add it to item. + if item + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = item.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + item.push(Some(x.clone())); + } + } + }); + + let mut lambda = self.lambda.write().unwrap(); + other.lambda.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda, if it's not there add it to lambda. + if lambda + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda.push(Some(x.clone())); + } + } + }); + + let mut lambda_parameter = self.lambda_parameter.write().unwrap(); + other.lambda_parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda_parameter, if it's not there add it to lambda_parameter. + if lambda_parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda_parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda_parameter.push(Some(x.clone())); + } + } + }); + + let mut let_statement = self.let_statement.write().unwrap(); + other.let_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in let_statement, if it's not there add it to let_statement. + if let_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = let_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + let_statement.push(Some(x.clone())); + } + } + }); + + let mut list = self.list.write().unwrap(); + other.list.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list, if it's not there add it to list. + if list + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list.push(Some(x.clone())); + } + } + }); + + let mut list_element = self.list_element.write().unwrap(); + other.list_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_element, if it's not there add it to list_element. + if list_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_element.push(Some(x.clone())); + } + } + }); + + let mut list_expression = self.list_expression.write().unwrap(); + other.list_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_expression, if it's not there add it to list_expression. + if list_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_expression.push(Some(x.clone())); + } + } + }); + + let mut literal = self.literal.write().unwrap(); + other.literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in literal, if it's not there add it to literal. + if literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + literal.push(Some(x.clone())); + } + } + }); + + let mut local_variable = self.local_variable.write().unwrap(); + other.local_variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in local_variable, if it's not there add it to local_variable. + if local_variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = local_variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + local_variable.push(Some(x.clone())); + } + } + }); + + let mut x_macro = self.x_macro.write().unwrap(); + other.x_macro.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_macro, if it's not there add it to x_macro. + if x_macro + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_macro.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_macro.push(Some(x.clone())); + } + } + }); + + let mut map = self.map.write().unwrap(); + other.map.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map, if it's not there add it to map. + if map + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map.push(Some(x.clone())); + } + } + }); + + let mut map_element = self.map_element.write().unwrap(); + other.map_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_element, if it's not there add it to map_element. + if map_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_element.push(Some(x.clone())); + } + } + }); + + let mut map_expression = self.map_expression.write().unwrap(); + other.map_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_expression, if it's not there add it to map_expression. + if map_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_expression.push(Some(x.clone())); + } + } + }); + + let mut x_match = self.x_match.write().unwrap(); + other.x_match.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_match, if it's not there add it to x_match. + if x_match + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_match.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_match.push(Some(x.clone())); + } + } + }); + + let mut method_call = self.method_call.write().unwrap(); + other.method_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in method_call, if it's not there add it to method_call. + if method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + method_call.push(Some(x.clone())); + } + } + }); + + let mut named_field_expression = self.named_field_expression.write().unwrap(); + other + .named_field_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in named_field_expression, if it's not there add it to named_field_expression. + if named_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = named_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + named_field_expression.push(Some(x.clone())); + } + } + }); + + let mut z_object_store = self.z_object_store.write().unwrap(); + other.z_object_store.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in z_object_store, if it's not there add it to z_object_store. + if z_object_store + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = z_object_store.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + z_object_store.push(Some(x.clone())); + } + } + }); + + let mut object_wrapper = self.object_wrapper.write().unwrap(); + other.object_wrapper.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in object_wrapper, if it's not there add it to object_wrapper. + if object_wrapper + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = object_wrapper.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + object_wrapper.push(Some(x.clone())); + } + } + }); + + let mut operator = self.operator.write().unwrap(); + other.operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in operator, if it's not there add it to operator. + if operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + operator.push(Some(x.clone())); + } + } + }); + + let mut parameter = self.parameter.write().unwrap(); + other.parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in parameter, if it's not there add it to parameter. + if parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + parameter.push(Some(x.clone())); + } + } + }); + + let mut x_path = self.x_path.write().unwrap(); + other.x_path.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_path, if it's not there add it to x_path. + if x_path + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_path.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_path.push(Some(x.clone())); + } + } + }); + + let mut path_element = self.path_element.write().unwrap(); + other.path_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in path_element, if it's not there add it to path_element. + if path_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = path_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + path_element.push(Some(x.clone())); + } + } + }); + + let mut pattern = self.pattern.write().unwrap(); + other.pattern.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in pattern, if it's not there add it to pattern. + if pattern + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = pattern.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + pattern.push(Some(x.clone())); + } + } + }); + + let mut x_plugin = self.x_plugin.write().unwrap(); + other.x_plugin.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_plugin, if it's not there add it to x_plugin. + if x_plugin + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_plugin.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_plugin.push(Some(x.clone())); + } + } + }); + + let mut x_print = self.x_print.write().unwrap(); + other.x_print.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_print, if it's not there add it to x_print. + if x_print + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_print.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_print.push(Some(x.clone())); + } + } + }); + + let mut range_expression = self.range_expression.write().unwrap(); + other.range_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in range_expression, if it's not there add it to range_expression. + if range_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = range_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + range_expression.push(Some(x.clone())); + } + } + }); + + let mut result_statement = self.result_statement.write().unwrap(); + other.result_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in result_statement, if it's not there add it to result_statement. + if result_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = result_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + result_statement.push(Some(x.clone())); + } + } + }); + + let mut x_return = self.x_return.write().unwrap(); + other.x_return.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_return, if it's not there add it to x_return. + if x_return + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_return.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_return.push(Some(x.clone())); + } + } + }); + + let mut span = self.span.write().unwrap(); + other.span.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in span, if it's not there add it to span. + if span + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = span.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + span.push(Some(x.clone())); + } + } + }); + + let mut statement = self.statement.write().unwrap(); + other.statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in statement, if it's not there add it to statement. + if statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + statement.push(Some(x.clone())); + } + } + }); + + let mut static_method_call = self.static_method_call.write().unwrap(); + other + .static_method_call + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in static_method_call, if it's not there add it to static_method_call. + if static_method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = static_method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + static_method_call.push(Some(x.clone())); + } + } + }); + + let mut string_bit = self.string_bit.write().unwrap(); + other.string_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_bit, if it's not there add it to string_bit. + if string_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_bit.push(Some(x.clone())); + } + } + }); + + let mut string_literal = self.string_literal.write().unwrap(); + other.string_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_literal, if it's not there add it to string_literal. + if string_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_literal.push(Some(x.clone())); + } + } + }); + + let mut woog_struct = self.woog_struct.write().unwrap(); + other.woog_struct.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in woog_struct, if it's not there add it to woog_struct. + if woog_struct + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = woog_struct.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + woog_struct.push(Some(x.clone())); + } + } + }); + + let mut struct_expression = self.struct_expression.write().unwrap(); + other + .struct_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in struct_expression, if it's not there add it to struct_expression. + if struct_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_expression.push(Some(x.clone())); + } + } + }); + + let mut struct_field = self.struct_field.write().unwrap(); + other.struct_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_field, if it's not there add it to struct_field. + if struct_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_field.push(Some(x.clone())); + } + } + }); + + let mut struct_generic = self.struct_generic.write().unwrap(); + other.struct_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_generic, if it's not there add it to struct_generic. + if struct_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_generic.push(Some(x.clone())); + } + } + }); + + let mut tuple_field = self.tuple_field.write().unwrap(); + other.tuple_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in tuple_field, if it's not there add it to tuple_field. + if tuple_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = tuple_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + tuple_field.push(Some(x.clone())); + } + } + }); + + let mut type_cast = self.type_cast.write().unwrap(); + other.type_cast.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in type_cast, if it's not there add it to type_cast. + if type_cast + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = type_cast.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + type_cast.push(Some(x.clone())); + } + } + }); + + let mut unary = self.unary.write().unwrap(); + other.unary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unary, if it's not there add it to unary. + if unary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unary.push(Some(x.clone())); + } + } + }); + + let mut unit = self.unit.write().unwrap(); + other.unit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unit, if it's not there add it to unit. + if unit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unit.push(Some(x.clone())); + } + } + }); + + let mut unnamed_field_expression = self.unnamed_field_expression.write().unwrap(); + other + .unnamed_field_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. + if unnamed_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unnamed_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unnamed_field_expression.push(Some(x.clone())); + } + } + }); + + let mut x_value = self.x_value.write().unwrap(); + other.x_value.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_value, if it's not there add it to x_value. + if x_value + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_value.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_value.push(Some(x.clone())); + } + } + }); + + let mut value_type = self.value_type.write().unwrap(); + other.value_type.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in value_type, if it's not there add it to value_type. + if value_type + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = value_type.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + value_type.push(Some(x.clone())); + } + } + }); + + let mut variable = self.variable.write().unwrap(); + other.variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable, if it's not there add it to variable. + if variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable.push(Some(x.clone())); + } + } + }); + + let mut variable_expression = self.variable_expression.write().unwrap(); + other + .variable_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in variable_expression, if it's not there add it to variable_expression. + if variable_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable_expression.push(Some(x.clone())); + } + } + }); + } pub fn new() -> Self { let mut store = Self { argument_free_list: std::sync::Mutex::new(Vec::new()), diff --git a/src/v2/lu_dog_pl_vec/store.rs b/src/v2/lu_dog_pl_vec/store.rs index d81a6919..471edd93 100644 --- a/src/v2/lu_dog_pl_vec/store.rs +++ b/src/v2/lu_dog_pl_vec/store.rs @@ -307,254 +307,2348 @@ impl Clone for ObjectStore { fn clone(&self) -> Self { ObjectStore { argument_free_list: Mutex::new(self.argument_free_list.lock().unwrap().clone()), - argument: self.argument.clone(), + argument: Arc::new(RwLock::new(self.argument.read().unwrap().clone())), a_wait_free_list: Mutex::new(self.a_wait_free_list.lock().unwrap().clone()), - a_wait: self.a_wait.clone(), + a_wait: Arc::new(RwLock::new(self.a_wait.read().unwrap().clone())), binary_free_list: Mutex::new(self.binary_free_list.lock().unwrap().clone()), - binary: self.binary.clone(), + binary: Arc::new(RwLock::new(self.binary.read().unwrap().clone())), block_free_list: Mutex::new(self.block_free_list.lock().unwrap().clone()), - block: self.block.clone(), + block: Arc::new(RwLock::new(self.block.read().unwrap().clone())), body_free_list: Mutex::new(self.body_free_list.lock().unwrap().clone()), - body: self.body.clone(), + body: Arc::new(RwLock::new(self.body.read().unwrap().clone())), boolean_literal_free_list: Mutex::new( self.boolean_literal_free_list.lock().unwrap().clone(), ), - boolean_literal: self.boolean_literal.clone(), + boolean_literal: Arc::new(RwLock::new(self.boolean_literal.read().unwrap().clone())), boolean_operator_free_list: Mutex::new( self.boolean_operator_free_list.lock().unwrap().clone(), ), - boolean_operator: self.boolean_operator.clone(), + boolean_operator: Arc::new(RwLock::new(self.boolean_operator.read().unwrap().clone())), call_free_list: Mutex::new(self.call_free_list.lock().unwrap().clone()), - call: self.call.clone(), + call: Arc::new(RwLock::new(self.call.read().unwrap().clone())), char_literal_free_list: Mutex::new(self.char_literal_free_list.lock().unwrap().clone()), - char_literal: self.char_literal.clone(), + char_literal: Arc::new(RwLock::new(self.char_literal.read().unwrap().clone())), comparison_free_list: Mutex::new(self.comparison_free_list.lock().unwrap().clone()), - comparison: self.comparison.clone(), + comparison: Arc::new(RwLock::new(self.comparison.read().unwrap().clone())), data_structure_free_list: Mutex::new( self.data_structure_free_list.lock().unwrap().clone(), ), - data_structure: self.data_structure.clone(), + data_structure: Arc::new(RwLock::new(self.data_structure.read().unwrap().clone())), dwarf_source_file_free_list: Mutex::new( self.dwarf_source_file_free_list.lock().unwrap().clone(), ), - dwarf_source_file: self.dwarf_source_file.clone(), + dwarf_source_file: Arc::new(RwLock::new( + self.dwarf_source_file.read().unwrap().clone(), + )), enum_field_free_list: Mutex::new(self.enum_field_free_list.lock().unwrap().clone()), - enum_field: self.enum_field.clone(), + enum_field: Arc::new(RwLock::new(self.enum_field.read().unwrap().clone())), enum_generic_free_list: Mutex::new(self.enum_generic_free_list.lock().unwrap().clone()), - enum_generic: self.enum_generic.clone(), + enum_generic: Arc::new(RwLock::new(self.enum_generic.read().unwrap().clone())), enumeration_free_list: Mutex::new(self.enumeration_free_list.lock().unwrap().clone()), - enumeration: self.enumeration.clone(), + enumeration: Arc::new(RwLock::new(self.enumeration.read().unwrap().clone())), enumeration_id_by_name: self.enumeration_id_by_name.clone(), expression_free_list: Mutex::new(self.expression_free_list.lock().unwrap().clone()), - expression: self.expression.clone(), + expression: Arc::new(RwLock::new(self.expression.read().unwrap().clone())), expression_bit_free_list: Mutex::new( self.expression_bit_free_list.lock().unwrap().clone(), ), - expression_bit: self.expression_bit.clone(), + expression_bit: Arc::new(RwLock::new(self.expression_bit.read().unwrap().clone())), expression_statement_free_list: Mutex::new( self.expression_statement_free_list.lock().unwrap().clone(), ), - expression_statement: self.expression_statement.clone(), + expression_statement: Arc::new(RwLock::new( + self.expression_statement.read().unwrap().clone(), + )), external_implementation_free_list: Mutex::new( self.external_implementation_free_list .lock() .unwrap() .clone(), ), - external_implementation: self.external_implementation.clone(), + external_implementation: Arc::new(RwLock::new( + self.external_implementation.read().unwrap().clone(), + )), field_free_list: Mutex::new(self.field_free_list.lock().unwrap().clone()), - field: self.field.clone(), + field: Arc::new(RwLock::new(self.field.read().unwrap().clone())), field_id_by_name: self.field_id_by_name.clone(), field_access_free_list: Mutex::new(self.field_access_free_list.lock().unwrap().clone()), - field_access: self.field_access.clone(), + field_access: Arc::new(RwLock::new(self.field_access.read().unwrap().clone())), field_access_target_free_list: Mutex::new( self.field_access_target_free_list.lock().unwrap().clone(), ), - field_access_target: self.field_access_target.clone(), + field_access_target: Arc::new(RwLock::new( + self.field_access_target.read().unwrap().clone(), + )), field_expression_free_list: Mutex::new( self.field_expression_free_list.lock().unwrap().clone(), ), - field_expression: self.field_expression.clone(), + field_expression: Arc::new(RwLock::new(self.field_expression.read().unwrap().clone())), float_literal_free_list: Mutex::new( self.float_literal_free_list.lock().unwrap().clone(), ), - float_literal: self.float_literal.clone(), + float_literal: Arc::new(RwLock::new(self.float_literal.read().unwrap().clone())), for_loop_free_list: Mutex::new(self.for_loop_free_list.lock().unwrap().clone()), - for_loop: self.for_loop.clone(), + for_loop: Arc::new(RwLock::new(self.for_loop.read().unwrap().clone())), format_bit_free_list: Mutex::new(self.format_bit_free_list.lock().unwrap().clone()), - format_bit: self.format_bit.clone(), + format_bit: Arc::new(RwLock::new(self.format_bit.read().unwrap().clone())), format_string_free_list: Mutex::new( self.format_string_free_list.lock().unwrap().clone(), ), - format_string: self.format_string.clone(), + format_string: Arc::new(RwLock::new(self.format_string.read().unwrap().clone())), func_generic_free_list: Mutex::new(self.func_generic_free_list.lock().unwrap().clone()), - func_generic: self.func_generic.clone(), + func_generic: Arc::new(RwLock::new(self.func_generic.read().unwrap().clone())), function_free_list: Mutex::new(self.function_free_list.lock().unwrap().clone()), - function: self.function.clone(), + function: Arc::new(RwLock::new(self.function.read().unwrap().clone())), function_id_by_name: self.function_id_by_name.clone(), function_call_free_list: Mutex::new( self.function_call_free_list.lock().unwrap().clone(), ), - function_call: self.function_call.clone(), + function_call: Arc::new(RwLock::new(self.function_call.read().unwrap().clone())), x_future_free_list: Mutex::new(self.x_future_free_list.lock().unwrap().clone()), - x_future: self.x_future.clone(), + x_future: Arc::new(RwLock::new(self.x_future.read().unwrap().clone())), grouped_free_list: Mutex::new(self.grouped_free_list.lock().unwrap().clone()), - grouped: self.grouped.clone(), + grouped: Arc::new(RwLock::new(self.grouped.read().unwrap().clone())), halt_and_catch_fire_free_list: Mutex::new( self.halt_and_catch_fire_free_list.lock().unwrap().clone(), ), - halt_and_catch_fire: self.halt_and_catch_fire.clone(), + halt_and_catch_fire: Arc::new(RwLock::new( + self.halt_and_catch_fire.read().unwrap().clone(), + )), x_if_free_list: Mutex::new(self.x_if_free_list.lock().unwrap().clone()), - x_if: self.x_if.clone(), + x_if: Arc::new(RwLock::new(self.x_if.read().unwrap().clone())), implementation_block_free_list: Mutex::new( self.implementation_block_free_list.lock().unwrap().clone(), ), - implementation_block: self.implementation_block.clone(), + implementation_block: Arc::new(RwLock::new( + self.implementation_block.read().unwrap().clone(), + )), import_free_list: Mutex::new(self.import_free_list.lock().unwrap().clone()), - import: self.import.clone(), + import: Arc::new(RwLock::new(self.import.read().unwrap().clone())), index_free_list: Mutex::new(self.index_free_list.lock().unwrap().clone()), - index: self.index.clone(), + index: Arc::new(RwLock::new(self.index.read().unwrap().clone())), integer_literal_free_list: Mutex::new( self.integer_literal_free_list.lock().unwrap().clone(), ), - integer_literal: self.integer_literal.clone(), + integer_literal: Arc::new(RwLock::new(self.integer_literal.read().unwrap().clone())), item_free_list: Mutex::new(self.item_free_list.lock().unwrap().clone()), - item: self.item.clone(), + item: Arc::new(RwLock::new(self.item.read().unwrap().clone())), lambda_free_list: Mutex::new(self.lambda_free_list.lock().unwrap().clone()), - lambda: self.lambda.clone(), + lambda: Arc::new(RwLock::new(self.lambda.read().unwrap().clone())), lambda_parameter_free_list: Mutex::new( self.lambda_parameter_free_list.lock().unwrap().clone(), ), - lambda_parameter: self.lambda_parameter.clone(), + lambda_parameter: Arc::new(RwLock::new(self.lambda_parameter.read().unwrap().clone())), let_statement_free_list: Mutex::new( self.let_statement_free_list.lock().unwrap().clone(), ), - let_statement: self.let_statement.clone(), + let_statement: Arc::new(RwLock::new(self.let_statement.read().unwrap().clone())), list_free_list: Mutex::new(self.list_free_list.lock().unwrap().clone()), - list: self.list.clone(), + list: Arc::new(RwLock::new(self.list.read().unwrap().clone())), list_element_free_list: Mutex::new(self.list_element_free_list.lock().unwrap().clone()), - list_element: self.list_element.clone(), + list_element: Arc::new(RwLock::new(self.list_element.read().unwrap().clone())), list_expression_free_list: Mutex::new( self.list_expression_free_list.lock().unwrap().clone(), ), - list_expression: self.list_expression.clone(), + list_expression: Arc::new(RwLock::new(self.list_expression.read().unwrap().clone())), literal_free_list: Mutex::new(self.literal_free_list.lock().unwrap().clone()), - literal: self.literal.clone(), + literal: Arc::new(RwLock::new(self.literal.read().unwrap().clone())), local_variable_free_list: Mutex::new( self.local_variable_free_list.lock().unwrap().clone(), ), - local_variable: self.local_variable.clone(), + local_variable: Arc::new(RwLock::new(self.local_variable.read().unwrap().clone())), x_macro_free_list: Mutex::new(self.x_macro_free_list.lock().unwrap().clone()), - x_macro: self.x_macro.clone(), + x_macro: Arc::new(RwLock::new(self.x_macro.read().unwrap().clone())), map_free_list: Mutex::new(self.map_free_list.lock().unwrap().clone()), - map: self.map.clone(), + map: Arc::new(RwLock::new(self.map.read().unwrap().clone())), map_element_free_list: Mutex::new(self.map_element_free_list.lock().unwrap().clone()), - map_element: self.map_element.clone(), + map_element: Arc::new(RwLock::new(self.map_element.read().unwrap().clone())), map_expression_free_list: Mutex::new( self.map_expression_free_list.lock().unwrap().clone(), ), - map_expression: self.map_expression.clone(), + map_expression: Arc::new(RwLock::new(self.map_expression.read().unwrap().clone())), x_match_free_list: Mutex::new(self.x_match_free_list.lock().unwrap().clone()), - x_match: self.x_match.clone(), + x_match: Arc::new(RwLock::new(self.x_match.read().unwrap().clone())), method_call_free_list: Mutex::new(self.method_call_free_list.lock().unwrap().clone()), - method_call: self.method_call.clone(), + method_call: Arc::new(RwLock::new(self.method_call.read().unwrap().clone())), named_field_expression_free_list: Mutex::new( self.named_field_expression_free_list .lock() .unwrap() .clone(), ), - named_field_expression: self.named_field_expression.clone(), + named_field_expression: Arc::new(RwLock::new( + self.named_field_expression.read().unwrap().clone(), + )), z_object_store_free_list: Mutex::new( self.z_object_store_free_list.lock().unwrap().clone(), ), - z_object_store: self.z_object_store.clone(), + z_object_store: Arc::new(RwLock::new(self.z_object_store.read().unwrap().clone())), z_object_store_id_by_name: self.z_object_store_id_by_name.clone(), object_wrapper_free_list: Mutex::new( self.object_wrapper_free_list.lock().unwrap().clone(), ), - object_wrapper: self.object_wrapper.clone(), + object_wrapper: Arc::new(RwLock::new(self.object_wrapper.read().unwrap().clone())), operator_free_list: Mutex::new(self.operator_free_list.lock().unwrap().clone()), - operator: self.operator.clone(), + operator: Arc::new(RwLock::new(self.operator.read().unwrap().clone())), parameter_free_list: Mutex::new(self.parameter_free_list.lock().unwrap().clone()), - parameter: self.parameter.clone(), + parameter: Arc::new(RwLock::new(self.parameter.read().unwrap().clone())), x_path_free_list: Mutex::new(self.x_path_free_list.lock().unwrap().clone()), - x_path: self.x_path.clone(), + x_path: Arc::new(RwLock::new(self.x_path.read().unwrap().clone())), path_element_free_list: Mutex::new(self.path_element_free_list.lock().unwrap().clone()), - path_element: self.path_element.clone(), + path_element: Arc::new(RwLock::new(self.path_element.read().unwrap().clone())), pattern_free_list: Mutex::new(self.pattern_free_list.lock().unwrap().clone()), - pattern: self.pattern.clone(), + pattern: Arc::new(RwLock::new(self.pattern.read().unwrap().clone())), x_plugin_free_list: Mutex::new(self.x_plugin_free_list.lock().unwrap().clone()), - x_plugin: self.x_plugin.clone(), + x_plugin: Arc::new(RwLock::new(self.x_plugin.read().unwrap().clone())), x_plugin_id_by_name: self.x_plugin_id_by_name.clone(), x_print_free_list: Mutex::new(self.x_print_free_list.lock().unwrap().clone()), - x_print: self.x_print.clone(), + x_print: Arc::new(RwLock::new(self.x_print.read().unwrap().clone())), range_expression_free_list: Mutex::new( self.range_expression_free_list.lock().unwrap().clone(), ), - range_expression: self.range_expression.clone(), + range_expression: Arc::new(RwLock::new(self.range_expression.read().unwrap().clone())), result_statement_free_list: Mutex::new( self.result_statement_free_list.lock().unwrap().clone(), ), - result_statement: self.result_statement.clone(), + result_statement: Arc::new(RwLock::new(self.result_statement.read().unwrap().clone())), x_return_free_list: Mutex::new(self.x_return_free_list.lock().unwrap().clone()), - x_return: self.x_return.clone(), + x_return: Arc::new(RwLock::new(self.x_return.read().unwrap().clone())), span_free_list: Mutex::new(self.span_free_list.lock().unwrap().clone()), - span: self.span.clone(), + span: Arc::new(RwLock::new(self.span.read().unwrap().clone())), statement_free_list: Mutex::new(self.statement_free_list.lock().unwrap().clone()), - statement: self.statement.clone(), + statement: Arc::new(RwLock::new(self.statement.read().unwrap().clone())), static_method_call_free_list: Mutex::new( self.static_method_call_free_list.lock().unwrap().clone(), ), - static_method_call: self.static_method_call.clone(), + static_method_call: Arc::new(RwLock::new( + self.static_method_call.read().unwrap().clone(), + )), string_bit_free_list: Mutex::new(self.string_bit_free_list.lock().unwrap().clone()), - string_bit: self.string_bit.clone(), + string_bit: Arc::new(RwLock::new(self.string_bit.read().unwrap().clone())), string_literal_free_list: Mutex::new( self.string_literal_free_list.lock().unwrap().clone(), ), - string_literal: self.string_literal.clone(), + string_literal: Arc::new(RwLock::new(self.string_literal.read().unwrap().clone())), woog_struct_free_list: Mutex::new(self.woog_struct_free_list.lock().unwrap().clone()), - woog_struct: self.woog_struct.clone(), + woog_struct: Arc::new(RwLock::new(self.woog_struct.read().unwrap().clone())), woog_struct_id_by_name: self.woog_struct_id_by_name.clone(), struct_expression_free_list: Mutex::new( self.struct_expression_free_list.lock().unwrap().clone(), ), - struct_expression: self.struct_expression.clone(), + struct_expression: Arc::new(RwLock::new( + self.struct_expression.read().unwrap().clone(), + )), struct_field_free_list: Mutex::new(self.struct_field_free_list.lock().unwrap().clone()), - struct_field: self.struct_field.clone(), + struct_field: Arc::new(RwLock::new(self.struct_field.read().unwrap().clone())), struct_generic_free_list: Mutex::new( self.struct_generic_free_list.lock().unwrap().clone(), ), - struct_generic: self.struct_generic.clone(), + struct_generic: Arc::new(RwLock::new(self.struct_generic.read().unwrap().clone())), tuple_field_free_list: Mutex::new(self.tuple_field_free_list.lock().unwrap().clone()), - tuple_field: self.tuple_field.clone(), + tuple_field: Arc::new(RwLock::new(self.tuple_field.read().unwrap().clone())), type_cast_free_list: Mutex::new(self.type_cast_free_list.lock().unwrap().clone()), - type_cast: self.type_cast.clone(), + type_cast: Arc::new(RwLock::new(self.type_cast.read().unwrap().clone())), unary_free_list: Mutex::new(self.unary_free_list.lock().unwrap().clone()), - unary: self.unary.clone(), + unary: Arc::new(RwLock::new(self.unary.read().unwrap().clone())), unit_free_list: Mutex::new(self.unit_free_list.lock().unwrap().clone()), - unit: self.unit.clone(), + unit: Arc::new(RwLock::new(self.unit.read().unwrap().clone())), unnamed_field_expression_free_list: Mutex::new( self.unnamed_field_expression_free_list .lock() .unwrap() .clone(), ), - unnamed_field_expression: self.unnamed_field_expression.clone(), + unnamed_field_expression: Arc::new(RwLock::new( + self.unnamed_field_expression.read().unwrap().clone(), + )), x_value_free_list: Mutex::new(self.x_value_free_list.lock().unwrap().clone()), - x_value: self.x_value.clone(), + x_value: Arc::new(RwLock::new(self.x_value.read().unwrap().clone())), value_type_free_list: Mutex::new(self.value_type_free_list.lock().unwrap().clone()), - value_type: self.value_type.clone(), + value_type: Arc::new(RwLock::new(self.value_type.read().unwrap().clone())), variable_free_list: Mutex::new(self.variable_free_list.lock().unwrap().clone()), - variable: self.variable.clone(), + variable: Arc::new(RwLock::new(self.variable.read().unwrap().clone())), variable_expression_free_list: Mutex::new( self.variable_expression_free_list.lock().unwrap().clone(), ), - variable_expression: self.variable_expression.clone(), + variable_expression: Arc::new(RwLock::new( + self.variable_expression.read().unwrap().clone(), + )), } } } impl ObjectStore { + pub fn merge(&mut self, other: ObjectStore) { + let mut argument = self.argument.write().unwrap(); + other.argument.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in argument, if it's not there add it to argument. + if argument + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = argument.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + argument.push(Some(x.clone())); + } + } + }); + + let mut a_wait = self.a_wait.write().unwrap(); + other.a_wait.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in a_wait, if it's not there add it to a_wait. + if a_wait + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = a_wait.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + a_wait.push(Some(x.clone())); + } + } + }); + + let mut binary = self.binary.write().unwrap(); + other.binary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in binary, if it's not there add it to binary. + if binary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = binary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + binary.push(Some(x.clone())); + } + } + }); + + let mut block = self.block.write().unwrap(); + other.block.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in block, if it's not there add it to block. + if block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + block.push(Some(x.clone())); + } + } + }); + + let mut body = self.body.write().unwrap(); + other.body.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in body, if it's not there add it to body. + if body + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = body.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + body.push(Some(x.clone())); + } + } + }); + + let mut boolean_literal = self.boolean_literal.write().unwrap(); + other.boolean_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_literal, if it's not there add it to boolean_literal. + if boolean_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_literal.push(Some(x.clone())); + } + } + }); + + let mut boolean_operator = self.boolean_operator.write().unwrap(); + other.boolean_operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_operator, if it's not there add it to boolean_operator. + if boolean_operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_operator.push(Some(x.clone())); + } + } + }); + + let mut call = self.call.write().unwrap(); + other.call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in call, if it's not there add it to call. + if call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + call.push(Some(x.clone())); + } + } + }); + + let mut char_literal = self.char_literal.write().unwrap(); + other.char_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in char_literal, if it's not there add it to char_literal. + if char_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = char_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + char_literal.push(Some(x.clone())); + } + } + }); + + let mut comparison = self.comparison.write().unwrap(); + other.comparison.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in comparison, if it's not there add it to comparison. + if comparison + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = comparison.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + comparison.push(Some(x.clone())); + } + } + }); + + let mut data_structure = self.data_structure.write().unwrap(); + other.data_structure.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in data_structure, if it's not there add it to data_structure. + if data_structure + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = data_structure.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + data_structure.push(Some(x.clone())); + } + } + }); + + let mut dwarf_source_file = self.dwarf_source_file.write().unwrap(); + other + .dwarf_source_file + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. + if dwarf_source_file + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = dwarf_source_file.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + dwarf_source_file.push(Some(x.clone())); + } + } + }); + + let mut enum_field = self.enum_field.write().unwrap(); + other.enum_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_field, if it's not there add it to enum_field. + if enum_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_field.push(Some(x.clone())); + } + } + }); + + let mut enum_generic = self.enum_generic.write().unwrap(); + other.enum_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic, if it's not there add it to enum_generic. + if enum_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_generic.push(Some(x.clone())); + } + } + }); + + let mut enumeration = self.enumeration.write().unwrap(); + other.enumeration.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enumeration, if it's not there add it to enumeration. + if enumeration + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enumeration.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enumeration.push(Some(x.clone())); + } + } + }); + + let mut expression = self.expression.write().unwrap(); + other.expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression, if it's not there add it to expression. + if expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression.push(Some(x.clone())); + } + } + }); + + let mut expression_bit = self.expression_bit.write().unwrap(); + other.expression_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression_bit, if it's not there add it to expression_bit. + if expression_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_bit.push(Some(x.clone())); + } + } + }); + + let mut expression_statement = self.expression_statement.write().unwrap(); + other + .expression_statement + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in expression_statement, if it's not there add it to expression_statement. + if expression_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_statement.push(Some(x.clone())); + } + } + }); + + let mut external_implementation = self.external_implementation.write().unwrap(); + other + .external_implementation + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in external_implementation, if it's not there add it to external_implementation. + if external_implementation + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = external_implementation.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + external_implementation.push(Some(x.clone())); + } + } + }); + + let mut field = self.field.write().unwrap(); + other.field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field, if it's not there add it to field. + if field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field.push(Some(x.clone())); + } + } + }); + + let mut field_access = self.field_access.write().unwrap(); + other.field_access.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_access, if it's not there add it to field_access. + if field_access + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access.push(Some(x.clone())); + } + } + }); + + let mut field_access_target = self.field_access_target.write().unwrap(); + other + .field_access_target + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in field_access_target, if it's not there add it to field_access_target. + if field_access_target + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access_target.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access_target.push(Some(x.clone())); + } + } + }); + + let mut field_expression = self.field_expression.write().unwrap(); + other.field_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_expression, if it's not there add it to field_expression. + if field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_expression.push(Some(x.clone())); + } + } + }); + + let mut float_literal = self.float_literal.write().unwrap(); + other.float_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in float_literal, if it's not there add it to float_literal. + if float_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = float_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + float_literal.push(Some(x.clone())); + } + } + }); + + let mut for_loop = self.for_loop.write().unwrap(); + other.for_loop.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in for_loop, if it's not there add it to for_loop. + if for_loop + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = for_loop.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + for_loop.push(Some(x.clone())); + } + } + }); + + let mut format_bit = self.format_bit.write().unwrap(); + other.format_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_bit, if it's not there add it to format_bit. + if format_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_bit.push(Some(x.clone())); + } + } + }); + + let mut format_string = self.format_string.write().unwrap(); + other.format_string.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_string, if it's not there add it to format_string. + if format_string + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_string.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_string.push(Some(x.clone())); + } + } + }); + + let mut func_generic = self.func_generic.write().unwrap(); + other.func_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in func_generic, if it's not there add it to func_generic. + if func_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = func_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + func_generic.push(Some(x.clone())); + } + } + }); + + let mut function = self.function.write().unwrap(); + other.function.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function, if it's not there add it to function. + if function + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function.push(Some(x.clone())); + } + } + }); + + let mut function_call = self.function_call.write().unwrap(); + other.function_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function_call, if it's not there add it to function_call. + if function_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function_call.push(Some(x.clone())); + } + } + }); + + let mut x_future = self.x_future.write().unwrap(); + other.x_future.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_future, if it's not there add it to x_future. + if x_future + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_future.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_future.push(Some(x.clone())); + } + } + }); + + let mut grouped = self.grouped.write().unwrap(); + other.grouped.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in grouped, if it's not there add it to grouped. + if grouped + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = grouped.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + grouped.push(Some(x.clone())); + } + } + }); + + let mut halt_and_catch_fire = self.halt_and_catch_fire.write().unwrap(); + other + .halt_and_catch_fire + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. + if halt_and_catch_fire + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = halt_and_catch_fire.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + halt_and_catch_fire.push(Some(x.clone())); + } + } + }); + + let mut x_if = self.x_if.write().unwrap(); + other.x_if.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_if, if it's not there add it to x_if. + if x_if + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_if.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_if.push(Some(x.clone())); + } + } + }); + + let mut implementation_block = self.implementation_block.write().unwrap(); + other + .implementation_block + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in implementation_block, if it's not there add it to implementation_block. + if implementation_block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = implementation_block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + implementation_block.push(Some(x.clone())); + } + } + }); + + let mut import = self.import.write().unwrap(); + other.import.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in import, if it's not there add it to import. + if import + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = import.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + import.push(Some(x.clone())); + } + } + }); + + let mut index = self.index.write().unwrap(); + other.index.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in index, if it's not there add it to index. + if index + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = index.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + index.push(Some(x.clone())); + } + } + }); + + let mut integer_literal = self.integer_literal.write().unwrap(); + other.integer_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in integer_literal, if it's not there add it to integer_literal. + if integer_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = integer_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + integer_literal.push(Some(x.clone())); + } + } + }); + + let mut item = self.item.write().unwrap(); + other.item.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in item, if it's not there add it to item. + if item + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = item.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + item.push(Some(x.clone())); + } + } + }); + + let mut lambda = self.lambda.write().unwrap(); + other.lambda.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda, if it's not there add it to lambda. + if lambda + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda.push(Some(x.clone())); + } + } + }); + + let mut lambda_parameter = self.lambda_parameter.write().unwrap(); + other.lambda_parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda_parameter, if it's not there add it to lambda_parameter. + if lambda_parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda_parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda_parameter.push(Some(x.clone())); + } + } + }); + + let mut let_statement = self.let_statement.write().unwrap(); + other.let_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in let_statement, if it's not there add it to let_statement. + if let_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = let_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + let_statement.push(Some(x.clone())); + } + } + }); + + let mut list = self.list.write().unwrap(); + other.list.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list, if it's not there add it to list. + if list + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list.push(Some(x.clone())); + } + } + }); + + let mut list_element = self.list_element.write().unwrap(); + other.list_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_element, if it's not there add it to list_element. + if list_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_element.push(Some(x.clone())); + } + } + }); + + let mut list_expression = self.list_expression.write().unwrap(); + other.list_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_expression, if it's not there add it to list_expression. + if list_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_expression.push(Some(x.clone())); + } + } + }); + + let mut literal = self.literal.write().unwrap(); + other.literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in literal, if it's not there add it to literal. + if literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + literal.push(Some(x.clone())); + } + } + }); + + let mut local_variable = self.local_variable.write().unwrap(); + other.local_variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in local_variable, if it's not there add it to local_variable. + if local_variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = local_variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + local_variable.push(Some(x.clone())); + } + } + }); + + let mut x_macro = self.x_macro.write().unwrap(); + other.x_macro.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_macro, if it's not there add it to x_macro. + if x_macro + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_macro.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_macro.push(Some(x.clone())); + } + } + }); + + let mut map = self.map.write().unwrap(); + other.map.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map, if it's not there add it to map. + if map + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map.push(Some(x.clone())); + } + } + }); + + let mut map_element = self.map_element.write().unwrap(); + other.map_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_element, if it's not there add it to map_element. + if map_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_element.push(Some(x.clone())); + } + } + }); + + let mut map_expression = self.map_expression.write().unwrap(); + other.map_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_expression, if it's not there add it to map_expression. + if map_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_expression.push(Some(x.clone())); + } + } + }); + + let mut x_match = self.x_match.write().unwrap(); + other.x_match.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_match, if it's not there add it to x_match. + if x_match + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_match.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_match.push(Some(x.clone())); + } + } + }); + + let mut method_call = self.method_call.write().unwrap(); + other.method_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in method_call, if it's not there add it to method_call. + if method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + method_call.push(Some(x.clone())); + } + } + }); + + let mut named_field_expression = self.named_field_expression.write().unwrap(); + other + .named_field_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in named_field_expression, if it's not there add it to named_field_expression. + if named_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = named_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + named_field_expression.push(Some(x.clone())); + } + } + }); + + let mut z_object_store = self.z_object_store.write().unwrap(); + other.z_object_store.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in z_object_store, if it's not there add it to z_object_store. + if z_object_store + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = z_object_store.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + z_object_store.push(Some(x.clone())); + } + } + }); + + let mut object_wrapper = self.object_wrapper.write().unwrap(); + other.object_wrapper.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in object_wrapper, if it's not there add it to object_wrapper. + if object_wrapper + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = object_wrapper.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + object_wrapper.push(Some(x.clone())); + } + } + }); + + let mut operator = self.operator.write().unwrap(); + other.operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in operator, if it's not there add it to operator. + if operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + operator.push(Some(x.clone())); + } + } + }); + + let mut parameter = self.parameter.write().unwrap(); + other.parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in parameter, if it's not there add it to parameter. + if parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + parameter.push(Some(x.clone())); + } + } + }); + + let mut x_path = self.x_path.write().unwrap(); + other.x_path.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_path, if it's not there add it to x_path. + if x_path + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_path.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_path.push(Some(x.clone())); + } + } + }); + + let mut path_element = self.path_element.write().unwrap(); + other.path_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in path_element, if it's not there add it to path_element. + if path_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = path_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + path_element.push(Some(x.clone())); + } + } + }); + + let mut pattern = self.pattern.write().unwrap(); + other.pattern.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in pattern, if it's not there add it to pattern. + if pattern + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = pattern.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + pattern.push(Some(x.clone())); + } + } + }); + + let mut x_plugin = self.x_plugin.write().unwrap(); + other.x_plugin.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_plugin, if it's not there add it to x_plugin. + if x_plugin + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_plugin.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_plugin.push(Some(x.clone())); + } + } + }); + + let mut x_print = self.x_print.write().unwrap(); + other.x_print.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_print, if it's not there add it to x_print. + if x_print + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_print.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_print.push(Some(x.clone())); + } + } + }); + + let mut range_expression = self.range_expression.write().unwrap(); + other.range_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in range_expression, if it's not there add it to range_expression. + if range_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = range_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + range_expression.push(Some(x.clone())); + } + } + }); + + let mut result_statement = self.result_statement.write().unwrap(); + other.result_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in result_statement, if it's not there add it to result_statement. + if result_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = result_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + result_statement.push(Some(x.clone())); + } + } + }); + + let mut x_return = self.x_return.write().unwrap(); + other.x_return.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_return, if it's not there add it to x_return. + if x_return + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_return.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_return.push(Some(x.clone())); + } + } + }); + + let mut span = self.span.write().unwrap(); + other.span.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in span, if it's not there add it to span. + if span + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = span.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + span.push(Some(x.clone())); + } + } + }); + + let mut statement = self.statement.write().unwrap(); + other.statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in statement, if it's not there add it to statement. + if statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + statement.push(Some(x.clone())); + } + } + }); + + let mut static_method_call = self.static_method_call.write().unwrap(); + other + .static_method_call + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in static_method_call, if it's not there add it to static_method_call. + if static_method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = static_method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + static_method_call.push(Some(x.clone())); + } + } + }); + + let mut string_bit = self.string_bit.write().unwrap(); + other.string_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_bit, if it's not there add it to string_bit. + if string_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_bit.push(Some(x.clone())); + } + } + }); + + let mut string_literal = self.string_literal.write().unwrap(); + other.string_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_literal, if it's not there add it to string_literal. + if string_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_literal.push(Some(x.clone())); + } + } + }); + + let mut woog_struct = self.woog_struct.write().unwrap(); + other.woog_struct.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in woog_struct, if it's not there add it to woog_struct. + if woog_struct + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = woog_struct.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + woog_struct.push(Some(x.clone())); + } + } + }); + + let mut struct_expression = self.struct_expression.write().unwrap(); + other + .struct_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in struct_expression, if it's not there add it to struct_expression. + if struct_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_expression.push(Some(x.clone())); + } + } + }); + + let mut struct_field = self.struct_field.write().unwrap(); + other.struct_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_field, if it's not there add it to struct_field. + if struct_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_field.push(Some(x.clone())); + } + } + }); + + let mut struct_generic = self.struct_generic.write().unwrap(); + other.struct_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_generic, if it's not there add it to struct_generic. + if struct_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_generic.push(Some(x.clone())); + } + } + }); + + let mut tuple_field = self.tuple_field.write().unwrap(); + other.tuple_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in tuple_field, if it's not there add it to tuple_field. + if tuple_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = tuple_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + tuple_field.push(Some(x.clone())); + } + } + }); + + let mut type_cast = self.type_cast.write().unwrap(); + other.type_cast.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in type_cast, if it's not there add it to type_cast. + if type_cast + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = type_cast.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + type_cast.push(Some(x.clone())); + } + } + }); + + let mut unary = self.unary.write().unwrap(); + other.unary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unary, if it's not there add it to unary. + if unary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unary.push(Some(x.clone())); + } + } + }); + + let mut unit = self.unit.write().unwrap(); + other.unit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unit, if it's not there add it to unit. + if unit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unit.push(Some(x.clone())); + } + } + }); + + let mut unnamed_field_expression = self.unnamed_field_expression.write().unwrap(); + other + .unnamed_field_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. + if unnamed_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unnamed_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unnamed_field_expression.push(Some(x.clone())); + } + } + }); + + let mut x_value = self.x_value.write().unwrap(); + other.x_value.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_value, if it's not there add it to x_value. + if x_value + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_value.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_value.push(Some(x.clone())); + } + } + }); + + let mut value_type = self.value_type.write().unwrap(); + other.value_type.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in value_type, if it's not there add it to value_type. + if value_type + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = value_type.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + value_type.push(Some(x.clone())); + } + } + }); + + let mut variable = self.variable.write().unwrap(); + other.variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable, if it's not there add it to variable. + if variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable.push(Some(x.clone())); + } + } + }); + + let mut variable_expression = self.variable_expression.write().unwrap(); + other + .variable_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in variable_expression, if it's not there add it to variable_expression. + if variable_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable_expression.push(Some(x.clone())); + } + } + }); + } pub fn new() -> Self { let mut store = Self { argument_free_list: std::sync::Mutex::new(Vec::new()), diff --git a/src/v2/lu_dog_rwlock_vec/store.rs b/src/v2/lu_dog_rwlock_vec/store.rs index 63060353..b723c517 100644 --- a/src/v2/lu_dog_rwlock_vec/store.rs +++ b/src/v2/lu_dog_rwlock_vec/store.rs @@ -307,254 +307,2348 @@ impl Clone for ObjectStore { fn clone(&self) -> Self { ObjectStore { argument_free_list: Mutex::new(self.argument_free_list.lock().unwrap().clone()), - argument: self.argument.clone(), + argument: Arc::new(RwLock::new(self.argument.read().unwrap().clone())), a_wait_free_list: Mutex::new(self.a_wait_free_list.lock().unwrap().clone()), - a_wait: self.a_wait.clone(), + a_wait: Arc::new(RwLock::new(self.a_wait.read().unwrap().clone())), binary_free_list: Mutex::new(self.binary_free_list.lock().unwrap().clone()), - binary: self.binary.clone(), + binary: Arc::new(RwLock::new(self.binary.read().unwrap().clone())), block_free_list: Mutex::new(self.block_free_list.lock().unwrap().clone()), - block: self.block.clone(), + block: Arc::new(RwLock::new(self.block.read().unwrap().clone())), body_free_list: Mutex::new(self.body_free_list.lock().unwrap().clone()), - body: self.body.clone(), + body: Arc::new(RwLock::new(self.body.read().unwrap().clone())), boolean_literal_free_list: Mutex::new( self.boolean_literal_free_list.lock().unwrap().clone(), ), - boolean_literal: self.boolean_literal.clone(), + boolean_literal: Arc::new(RwLock::new(self.boolean_literal.read().unwrap().clone())), boolean_operator_free_list: Mutex::new( self.boolean_operator_free_list.lock().unwrap().clone(), ), - boolean_operator: self.boolean_operator.clone(), + boolean_operator: Arc::new(RwLock::new(self.boolean_operator.read().unwrap().clone())), call_free_list: Mutex::new(self.call_free_list.lock().unwrap().clone()), - call: self.call.clone(), + call: Arc::new(RwLock::new(self.call.read().unwrap().clone())), char_literal_free_list: Mutex::new(self.char_literal_free_list.lock().unwrap().clone()), - char_literal: self.char_literal.clone(), + char_literal: Arc::new(RwLock::new(self.char_literal.read().unwrap().clone())), comparison_free_list: Mutex::new(self.comparison_free_list.lock().unwrap().clone()), - comparison: self.comparison.clone(), + comparison: Arc::new(RwLock::new(self.comparison.read().unwrap().clone())), data_structure_free_list: Mutex::new( self.data_structure_free_list.lock().unwrap().clone(), ), - data_structure: self.data_structure.clone(), + data_structure: Arc::new(RwLock::new(self.data_structure.read().unwrap().clone())), dwarf_source_file_free_list: Mutex::new( self.dwarf_source_file_free_list.lock().unwrap().clone(), ), - dwarf_source_file: self.dwarf_source_file.clone(), + dwarf_source_file: Arc::new(RwLock::new( + self.dwarf_source_file.read().unwrap().clone(), + )), enum_field_free_list: Mutex::new(self.enum_field_free_list.lock().unwrap().clone()), - enum_field: self.enum_field.clone(), + enum_field: Arc::new(RwLock::new(self.enum_field.read().unwrap().clone())), enum_generic_free_list: Mutex::new(self.enum_generic_free_list.lock().unwrap().clone()), - enum_generic: self.enum_generic.clone(), + enum_generic: Arc::new(RwLock::new(self.enum_generic.read().unwrap().clone())), enumeration_free_list: Mutex::new(self.enumeration_free_list.lock().unwrap().clone()), - enumeration: self.enumeration.clone(), + enumeration: Arc::new(RwLock::new(self.enumeration.read().unwrap().clone())), enumeration_id_by_name: self.enumeration_id_by_name.clone(), expression_free_list: Mutex::new(self.expression_free_list.lock().unwrap().clone()), - expression: self.expression.clone(), + expression: Arc::new(RwLock::new(self.expression.read().unwrap().clone())), expression_bit_free_list: Mutex::new( self.expression_bit_free_list.lock().unwrap().clone(), ), - expression_bit: self.expression_bit.clone(), + expression_bit: Arc::new(RwLock::new(self.expression_bit.read().unwrap().clone())), expression_statement_free_list: Mutex::new( self.expression_statement_free_list.lock().unwrap().clone(), ), - expression_statement: self.expression_statement.clone(), + expression_statement: Arc::new(RwLock::new( + self.expression_statement.read().unwrap().clone(), + )), external_implementation_free_list: Mutex::new( self.external_implementation_free_list .lock() .unwrap() .clone(), ), - external_implementation: self.external_implementation.clone(), + external_implementation: Arc::new(RwLock::new( + self.external_implementation.read().unwrap().clone(), + )), field_free_list: Mutex::new(self.field_free_list.lock().unwrap().clone()), - field: self.field.clone(), + field: Arc::new(RwLock::new(self.field.read().unwrap().clone())), field_id_by_name: self.field_id_by_name.clone(), field_access_free_list: Mutex::new(self.field_access_free_list.lock().unwrap().clone()), - field_access: self.field_access.clone(), + field_access: Arc::new(RwLock::new(self.field_access.read().unwrap().clone())), field_access_target_free_list: Mutex::new( self.field_access_target_free_list.lock().unwrap().clone(), ), - field_access_target: self.field_access_target.clone(), + field_access_target: Arc::new(RwLock::new( + self.field_access_target.read().unwrap().clone(), + )), field_expression_free_list: Mutex::new( self.field_expression_free_list.lock().unwrap().clone(), ), - field_expression: self.field_expression.clone(), + field_expression: Arc::new(RwLock::new(self.field_expression.read().unwrap().clone())), float_literal_free_list: Mutex::new( self.float_literal_free_list.lock().unwrap().clone(), ), - float_literal: self.float_literal.clone(), + float_literal: Arc::new(RwLock::new(self.float_literal.read().unwrap().clone())), for_loop_free_list: Mutex::new(self.for_loop_free_list.lock().unwrap().clone()), - for_loop: self.for_loop.clone(), + for_loop: Arc::new(RwLock::new(self.for_loop.read().unwrap().clone())), format_bit_free_list: Mutex::new(self.format_bit_free_list.lock().unwrap().clone()), - format_bit: self.format_bit.clone(), + format_bit: Arc::new(RwLock::new(self.format_bit.read().unwrap().clone())), format_string_free_list: Mutex::new( self.format_string_free_list.lock().unwrap().clone(), ), - format_string: self.format_string.clone(), + format_string: Arc::new(RwLock::new(self.format_string.read().unwrap().clone())), func_generic_free_list: Mutex::new(self.func_generic_free_list.lock().unwrap().clone()), - func_generic: self.func_generic.clone(), + func_generic: Arc::new(RwLock::new(self.func_generic.read().unwrap().clone())), function_free_list: Mutex::new(self.function_free_list.lock().unwrap().clone()), - function: self.function.clone(), + function: Arc::new(RwLock::new(self.function.read().unwrap().clone())), function_id_by_name: self.function_id_by_name.clone(), function_call_free_list: Mutex::new( self.function_call_free_list.lock().unwrap().clone(), ), - function_call: self.function_call.clone(), + function_call: Arc::new(RwLock::new(self.function_call.read().unwrap().clone())), x_future_free_list: Mutex::new(self.x_future_free_list.lock().unwrap().clone()), - x_future: self.x_future.clone(), + x_future: Arc::new(RwLock::new(self.x_future.read().unwrap().clone())), grouped_free_list: Mutex::new(self.grouped_free_list.lock().unwrap().clone()), - grouped: self.grouped.clone(), + grouped: Arc::new(RwLock::new(self.grouped.read().unwrap().clone())), halt_and_catch_fire_free_list: Mutex::new( self.halt_and_catch_fire_free_list.lock().unwrap().clone(), ), - halt_and_catch_fire: self.halt_and_catch_fire.clone(), + halt_and_catch_fire: Arc::new(RwLock::new( + self.halt_and_catch_fire.read().unwrap().clone(), + )), x_if_free_list: Mutex::new(self.x_if_free_list.lock().unwrap().clone()), - x_if: self.x_if.clone(), + x_if: Arc::new(RwLock::new(self.x_if.read().unwrap().clone())), implementation_block_free_list: Mutex::new( self.implementation_block_free_list.lock().unwrap().clone(), ), - implementation_block: self.implementation_block.clone(), + implementation_block: Arc::new(RwLock::new( + self.implementation_block.read().unwrap().clone(), + )), import_free_list: Mutex::new(self.import_free_list.lock().unwrap().clone()), - import: self.import.clone(), + import: Arc::new(RwLock::new(self.import.read().unwrap().clone())), index_free_list: Mutex::new(self.index_free_list.lock().unwrap().clone()), - index: self.index.clone(), + index: Arc::new(RwLock::new(self.index.read().unwrap().clone())), integer_literal_free_list: Mutex::new( self.integer_literal_free_list.lock().unwrap().clone(), ), - integer_literal: self.integer_literal.clone(), + integer_literal: Arc::new(RwLock::new(self.integer_literal.read().unwrap().clone())), item_free_list: Mutex::new(self.item_free_list.lock().unwrap().clone()), - item: self.item.clone(), + item: Arc::new(RwLock::new(self.item.read().unwrap().clone())), lambda_free_list: Mutex::new(self.lambda_free_list.lock().unwrap().clone()), - lambda: self.lambda.clone(), + lambda: Arc::new(RwLock::new(self.lambda.read().unwrap().clone())), lambda_parameter_free_list: Mutex::new( self.lambda_parameter_free_list.lock().unwrap().clone(), ), - lambda_parameter: self.lambda_parameter.clone(), + lambda_parameter: Arc::new(RwLock::new(self.lambda_parameter.read().unwrap().clone())), let_statement_free_list: Mutex::new( self.let_statement_free_list.lock().unwrap().clone(), ), - let_statement: self.let_statement.clone(), + let_statement: Arc::new(RwLock::new(self.let_statement.read().unwrap().clone())), list_free_list: Mutex::new(self.list_free_list.lock().unwrap().clone()), - list: self.list.clone(), + list: Arc::new(RwLock::new(self.list.read().unwrap().clone())), list_element_free_list: Mutex::new(self.list_element_free_list.lock().unwrap().clone()), - list_element: self.list_element.clone(), + list_element: Arc::new(RwLock::new(self.list_element.read().unwrap().clone())), list_expression_free_list: Mutex::new( self.list_expression_free_list.lock().unwrap().clone(), ), - list_expression: self.list_expression.clone(), + list_expression: Arc::new(RwLock::new(self.list_expression.read().unwrap().clone())), literal_free_list: Mutex::new(self.literal_free_list.lock().unwrap().clone()), - literal: self.literal.clone(), + literal: Arc::new(RwLock::new(self.literal.read().unwrap().clone())), local_variable_free_list: Mutex::new( self.local_variable_free_list.lock().unwrap().clone(), ), - local_variable: self.local_variable.clone(), + local_variable: Arc::new(RwLock::new(self.local_variable.read().unwrap().clone())), x_macro_free_list: Mutex::new(self.x_macro_free_list.lock().unwrap().clone()), - x_macro: self.x_macro.clone(), + x_macro: Arc::new(RwLock::new(self.x_macro.read().unwrap().clone())), map_free_list: Mutex::new(self.map_free_list.lock().unwrap().clone()), - map: self.map.clone(), + map: Arc::new(RwLock::new(self.map.read().unwrap().clone())), map_element_free_list: Mutex::new(self.map_element_free_list.lock().unwrap().clone()), - map_element: self.map_element.clone(), + map_element: Arc::new(RwLock::new(self.map_element.read().unwrap().clone())), map_expression_free_list: Mutex::new( self.map_expression_free_list.lock().unwrap().clone(), ), - map_expression: self.map_expression.clone(), + map_expression: Arc::new(RwLock::new(self.map_expression.read().unwrap().clone())), x_match_free_list: Mutex::new(self.x_match_free_list.lock().unwrap().clone()), - x_match: self.x_match.clone(), + x_match: Arc::new(RwLock::new(self.x_match.read().unwrap().clone())), method_call_free_list: Mutex::new(self.method_call_free_list.lock().unwrap().clone()), - method_call: self.method_call.clone(), + method_call: Arc::new(RwLock::new(self.method_call.read().unwrap().clone())), named_field_expression_free_list: Mutex::new( self.named_field_expression_free_list .lock() .unwrap() .clone(), ), - named_field_expression: self.named_field_expression.clone(), + named_field_expression: Arc::new(RwLock::new( + self.named_field_expression.read().unwrap().clone(), + )), z_object_store_free_list: Mutex::new( self.z_object_store_free_list.lock().unwrap().clone(), ), - z_object_store: self.z_object_store.clone(), + z_object_store: Arc::new(RwLock::new(self.z_object_store.read().unwrap().clone())), z_object_store_id_by_name: self.z_object_store_id_by_name.clone(), object_wrapper_free_list: Mutex::new( self.object_wrapper_free_list.lock().unwrap().clone(), ), - object_wrapper: self.object_wrapper.clone(), + object_wrapper: Arc::new(RwLock::new(self.object_wrapper.read().unwrap().clone())), operator_free_list: Mutex::new(self.operator_free_list.lock().unwrap().clone()), - operator: self.operator.clone(), + operator: Arc::new(RwLock::new(self.operator.read().unwrap().clone())), parameter_free_list: Mutex::new(self.parameter_free_list.lock().unwrap().clone()), - parameter: self.parameter.clone(), + parameter: Arc::new(RwLock::new(self.parameter.read().unwrap().clone())), x_path_free_list: Mutex::new(self.x_path_free_list.lock().unwrap().clone()), - x_path: self.x_path.clone(), + x_path: Arc::new(RwLock::new(self.x_path.read().unwrap().clone())), path_element_free_list: Mutex::new(self.path_element_free_list.lock().unwrap().clone()), - path_element: self.path_element.clone(), + path_element: Arc::new(RwLock::new(self.path_element.read().unwrap().clone())), pattern_free_list: Mutex::new(self.pattern_free_list.lock().unwrap().clone()), - pattern: self.pattern.clone(), + pattern: Arc::new(RwLock::new(self.pattern.read().unwrap().clone())), x_plugin_free_list: Mutex::new(self.x_plugin_free_list.lock().unwrap().clone()), - x_plugin: self.x_plugin.clone(), + x_plugin: Arc::new(RwLock::new(self.x_plugin.read().unwrap().clone())), x_plugin_id_by_name: self.x_plugin_id_by_name.clone(), x_print_free_list: Mutex::new(self.x_print_free_list.lock().unwrap().clone()), - x_print: self.x_print.clone(), + x_print: Arc::new(RwLock::new(self.x_print.read().unwrap().clone())), range_expression_free_list: Mutex::new( self.range_expression_free_list.lock().unwrap().clone(), ), - range_expression: self.range_expression.clone(), + range_expression: Arc::new(RwLock::new(self.range_expression.read().unwrap().clone())), result_statement_free_list: Mutex::new( self.result_statement_free_list.lock().unwrap().clone(), ), - result_statement: self.result_statement.clone(), + result_statement: Arc::new(RwLock::new(self.result_statement.read().unwrap().clone())), x_return_free_list: Mutex::new(self.x_return_free_list.lock().unwrap().clone()), - x_return: self.x_return.clone(), + x_return: Arc::new(RwLock::new(self.x_return.read().unwrap().clone())), span_free_list: Mutex::new(self.span_free_list.lock().unwrap().clone()), - span: self.span.clone(), + span: Arc::new(RwLock::new(self.span.read().unwrap().clone())), statement_free_list: Mutex::new(self.statement_free_list.lock().unwrap().clone()), - statement: self.statement.clone(), + statement: Arc::new(RwLock::new(self.statement.read().unwrap().clone())), static_method_call_free_list: Mutex::new( self.static_method_call_free_list.lock().unwrap().clone(), ), - static_method_call: self.static_method_call.clone(), + static_method_call: Arc::new(RwLock::new( + self.static_method_call.read().unwrap().clone(), + )), string_bit_free_list: Mutex::new(self.string_bit_free_list.lock().unwrap().clone()), - string_bit: self.string_bit.clone(), + string_bit: Arc::new(RwLock::new(self.string_bit.read().unwrap().clone())), string_literal_free_list: Mutex::new( self.string_literal_free_list.lock().unwrap().clone(), ), - string_literal: self.string_literal.clone(), + string_literal: Arc::new(RwLock::new(self.string_literal.read().unwrap().clone())), woog_struct_free_list: Mutex::new(self.woog_struct_free_list.lock().unwrap().clone()), - woog_struct: self.woog_struct.clone(), + woog_struct: Arc::new(RwLock::new(self.woog_struct.read().unwrap().clone())), woog_struct_id_by_name: self.woog_struct_id_by_name.clone(), struct_expression_free_list: Mutex::new( self.struct_expression_free_list.lock().unwrap().clone(), ), - struct_expression: self.struct_expression.clone(), + struct_expression: Arc::new(RwLock::new( + self.struct_expression.read().unwrap().clone(), + )), struct_field_free_list: Mutex::new(self.struct_field_free_list.lock().unwrap().clone()), - struct_field: self.struct_field.clone(), + struct_field: Arc::new(RwLock::new(self.struct_field.read().unwrap().clone())), struct_generic_free_list: Mutex::new( self.struct_generic_free_list.lock().unwrap().clone(), ), - struct_generic: self.struct_generic.clone(), + struct_generic: Arc::new(RwLock::new(self.struct_generic.read().unwrap().clone())), tuple_field_free_list: Mutex::new(self.tuple_field_free_list.lock().unwrap().clone()), - tuple_field: self.tuple_field.clone(), + tuple_field: Arc::new(RwLock::new(self.tuple_field.read().unwrap().clone())), type_cast_free_list: Mutex::new(self.type_cast_free_list.lock().unwrap().clone()), - type_cast: self.type_cast.clone(), + type_cast: Arc::new(RwLock::new(self.type_cast.read().unwrap().clone())), unary_free_list: Mutex::new(self.unary_free_list.lock().unwrap().clone()), - unary: self.unary.clone(), + unary: Arc::new(RwLock::new(self.unary.read().unwrap().clone())), unit_free_list: Mutex::new(self.unit_free_list.lock().unwrap().clone()), - unit: self.unit.clone(), + unit: Arc::new(RwLock::new(self.unit.read().unwrap().clone())), unnamed_field_expression_free_list: Mutex::new( self.unnamed_field_expression_free_list .lock() .unwrap() .clone(), ), - unnamed_field_expression: self.unnamed_field_expression.clone(), + unnamed_field_expression: Arc::new(RwLock::new( + self.unnamed_field_expression.read().unwrap().clone(), + )), x_value_free_list: Mutex::new(self.x_value_free_list.lock().unwrap().clone()), - x_value: self.x_value.clone(), + x_value: Arc::new(RwLock::new(self.x_value.read().unwrap().clone())), value_type_free_list: Mutex::new(self.value_type_free_list.lock().unwrap().clone()), - value_type: self.value_type.clone(), + value_type: Arc::new(RwLock::new(self.value_type.read().unwrap().clone())), variable_free_list: Mutex::new(self.variable_free_list.lock().unwrap().clone()), - variable: self.variable.clone(), + variable: Arc::new(RwLock::new(self.variable.read().unwrap().clone())), variable_expression_free_list: Mutex::new( self.variable_expression_free_list.lock().unwrap().clone(), ), - variable_expression: self.variable_expression.clone(), + variable_expression: Arc::new(RwLock::new( + self.variable_expression.read().unwrap().clone(), + )), } } } impl ObjectStore { + pub fn merge(&mut self, other: &ObjectStore) { + let mut argument = self.argument.write().unwrap(); + other.argument.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in argument, if it's not there add it to argument. + if argument + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = argument.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + argument.push(Some(x.clone())); + } + } + }); + + let mut a_wait = self.a_wait.write().unwrap(); + other.a_wait.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in a_wait, if it's not there add it to a_wait. + if a_wait + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = a_wait.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + a_wait.push(Some(x.clone())); + } + } + }); + + let mut binary = self.binary.write().unwrap(); + other.binary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in binary, if it's not there add it to binary. + if binary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = binary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + binary.push(Some(x.clone())); + } + } + }); + + let mut block = self.block.write().unwrap(); + other.block.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in block, if it's not there add it to block. + if block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + block.push(Some(x.clone())); + } + } + }); + + let mut body = self.body.write().unwrap(); + other.body.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in body, if it's not there add it to body. + if body + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = body.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + body.push(Some(x.clone())); + } + } + }); + + let mut boolean_literal = self.boolean_literal.write().unwrap(); + other.boolean_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_literal, if it's not there add it to boolean_literal. + if boolean_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_literal.push(Some(x.clone())); + } + } + }); + + let mut boolean_operator = self.boolean_operator.write().unwrap(); + other.boolean_operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_operator, if it's not there add it to boolean_operator. + if boolean_operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_operator.push(Some(x.clone())); + } + } + }); + + let mut call = self.call.write().unwrap(); + other.call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in call, if it's not there add it to call. + if call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + call.push(Some(x.clone())); + } + } + }); + + let mut char_literal = self.char_literal.write().unwrap(); + other.char_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in char_literal, if it's not there add it to char_literal. + if char_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = char_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + char_literal.push(Some(x.clone())); + } + } + }); + + let mut comparison = self.comparison.write().unwrap(); + other.comparison.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in comparison, if it's not there add it to comparison. + if comparison + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = comparison.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + comparison.push(Some(x.clone())); + } + } + }); + + let mut data_structure = self.data_structure.write().unwrap(); + other.data_structure.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in data_structure, if it's not there add it to data_structure. + if data_structure + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = data_structure.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + data_structure.push(Some(x.clone())); + } + } + }); + + let mut dwarf_source_file = self.dwarf_source_file.write().unwrap(); + other + .dwarf_source_file + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. + if dwarf_source_file + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = dwarf_source_file.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + dwarf_source_file.push(Some(x.clone())); + } + } + }); + + let mut enum_field = self.enum_field.write().unwrap(); + other.enum_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_field, if it's not there add it to enum_field. + if enum_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_field.push(Some(x.clone())); + } + } + }); + + let mut enum_generic = self.enum_generic.write().unwrap(); + other.enum_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic, if it's not there add it to enum_generic. + if enum_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_generic.push(Some(x.clone())); + } + } + }); + + let mut enumeration = self.enumeration.write().unwrap(); + other.enumeration.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enumeration, if it's not there add it to enumeration. + if enumeration + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enumeration.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enumeration.push(Some(x.clone())); + } + } + }); + + let mut expression = self.expression.write().unwrap(); + other.expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression, if it's not there add it to expression. + if expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression.push(Some(x.clone())); + } + } + }); + + let mut expression_bit = self.expression_bit.write().unwrap(); + other.expression_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression_bit, if it's not there add it to expression_bit. + if expression_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_bit.push(Some(x.clone())); + } + } + }); + + let mut expression_statement = self.expression_statement.write().unwrap(); + other + .expression_statement + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in expression_statement, if it's not there add it to expression_statement. + if expression_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_statement.push(Some(x.clone())); + } + } + }); + + let mut external_implementation = self.external_implementation.write().unwrap(); + other + .external_implementation + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in external_implementation, if it's not there add it to external_implementation. + if external_implementation + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = external_implementation.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + external_implementation.push(Some(x.clone())); + } + } + }); + + let mut field = self.field.write().unwrap(); + other.field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field, if it's not there add it to field. + if field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field.push(Some(x.clone())); + } + } + }); + + let mut field_access = self.field_access.write().unwrap(); + other.field_access.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_access, if it's not there add it to field_access. + if field_access + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access.push(Some(x.clone())); + } + } + }); + + let mut field_access_target = self.field_access_target.write().unwrap(); + other + .field_access_target + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in field_access_target, if it's not there add it to field_access_target. + if field_access_target + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access_target.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access_target.push(Some(x.clone())); + } + } + }); + + let mut field_expression = self.field_expression.write().unwrap(); + other.field_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_expression, if it's not there add it to field_expression. + if field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_expression.push(Some(x.clone())); + } + } + }); + + let mut float_literal = self.float_literal.write().unwrap(); + other.float_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in float_literal, if it's not there add it to float_literal. + if float_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = float_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + float_literal.push(Some(x.clone())); + } + } + }); + + let mut for_loop = self.for_loop.write().unwrap(); + other.for_loop.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in for_loop, if it's not there add it to for_loop. + if for_loop + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = for_loop.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + for_loop.push(Some(x.clone())); + } + } + }); + + let mut format_bit = self.format_bit.write().unwrap(); + other.format_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_bit, if it's not there add it to format_bit. + if format_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_bit.push(Some(x.clone())); + } + } + }); + + let mut format_string = self.format_string.write().unwrap(); + other.format_string.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_string, if it's not there add it to format_string. + if format_string + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_string.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_string.push(Some(x.clone())); + } + } + }); + + let mut func_generic = self.func_generic.write().unwrap(); + other.func_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in func_generic, if it's not there add it to func_generic. + if func_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = func_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + func_generic.push(Some(x.clone())); + } + } + }); + + let mut function = self.function.write().unwrap(); + other.function.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function, if it's not there add it to function. + if function + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function.push(Some(x.clone())); + } + } + }); + + let mut function_call = self.function_call.write().unwrap(); + other.function_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function_call, if it's not there add it to function_call. + if function_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function_call.push(Some(x.clone())); + } + } + }); + + let mut x_future = self.x_future.write().unwrap(); + other.x_future.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_future, if it's not there add it to x_future. + if x_future + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_future.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_future.push(Some(x.clone())); + } + } + }); + + let mut grouped = self.grouped.write().unwrap(); + other.grouped.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in grouped, if it's not there add it to grouped. + if grouped + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = grouped.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + grouped.push(Some(x.clone())); + } + } + }); + + let mut halt_and_catch_fire = self.halt_and_catch_fire.write().unwrap(); + other + .halt_and_catch_fire + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. + if halt_and_catch_fire + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = halt_and_catch_fire.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + halt_and_catch_fire.push(Some(x.clone())); + } + } + }); + + let mut x_if = self.x_if.write().unwrap(); + other.x_if.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_if, if it's not there add it to x_if. + if x_if + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_if.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_if.push(Some(x.clone())); + } + } + }); + + let mut implementation_block = self.implementation_block.write().unwrap(); + other + .implementation_block + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in implementation_block, if it's not there add it to implementation_block. + if implementation_block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = implementation_block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + implementation_block.push(Some(x.clone())); + } + } + }); + + let mut import = self.import.write().unwrap(); + other.import.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in import, if it's not there add it to import. + if import + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = import.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + import.push(Some(x.clone())); + } + } + }); + + let mut index = self.index.write().unwrap(); + other.index.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in index, if it's not there add it to index. + if index + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = index.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + index.push(Some(x.clone())); + } + } + }); + + let mut integer_literal = self.integer_literal.write().unwrap(); + other.integer_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in integer_literal, if it's not there add it to integer_literal. + if integer_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = integer_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + integer_literal.push(Some(x.clone())); + } + } + }); + + let mut item = self.item.write().unwrap(); + other.item.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in item, if it's not there add it to item. + if item + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = item.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + item.push(Some(x.clone())); + } + } + }); + + let mut lambda = self.lambda.write().unwrap(); + other.lambda.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda, if it's not there add it to lambda. + if lambda + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda.push(Some(x.clone())); + } + } + }); + + let mut lambda_parameter = self.lambda_parameter.write().unwrap(); + other.lambda_parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda_parameter, if it's not there add it to lambda_parameter. + if lambda_parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda_parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda_parameter.push(Some(x.clone())); + } + } + }); + + let mut let_statement = self.let_statement.write().unwrap(); + other.let_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in let_statement, if it's not there add it to let_statement. + if let_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = let_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + let_statement.push(Some(x.clone())); + } + } + }); + + let mut list = self.list.write().unwrap(); + other.list.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list, if it's not there add it to list. + if list + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list.push(Some(x.clone())); + } + } + }); + + let mut list_element = self.list_element.write().unwrap(); + other.list_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_element, if it's not there add it to list_element. + if list_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_element.push(Some(x.clone())); + } + } + }); + + let mut list_expression = self.list_expression.write().unwrap(); + other.list_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_expression, if it's not there add it to list_expression. + if list_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_expression.push(Some(x.clone())); + } + } + }); + + let mut literal = self.literal.write().unwrap(); + other.literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in literal, if it's not there add it to literal. + if literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + literal.push(Some(x.clone())); + } + } + }); + + let mut local_variable = self.local_variable.write().unwrap(); + other.local_variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in local_variable, if it's not there add it to local_variable. + if local_variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = local_variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + local_variable.push(Some(x.clone())); + } + } + }); + + let mut x_macro = self.x_macro.write().unwrap(); + other.x_macro.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_macro, if it's not there add it to x_macro. + if x_macro + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_macro.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_macro.push(Some(x.clone())); + } + } + }); + + let mut map = self.map.write().unwrap(); + other.map.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map, if it's not there add it to map. + if map + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map.push(Some(x.clone())); + } + } + }); + + let mut map_element = self.map_element.write().unwrap(); + other.map_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_element, if it's not there add it to map_element. + if map_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_element.push(Some(x.clone())); + } + } + }); + + let mut map_expression = self.map_expression.write().unwrap(); + other.map_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_expression, if it's not there add it to map_expression. + if map_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_expression.push(Some(x.clone())); + } + } + }); + + let mut x_match = self.x_match.write().unwrap(); + other.x_match.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_match, if it's not there add it to x_match. + if x_match + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_match.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_match.push(Some(x.clone())); + } + } + }); + + let mut method_call = self.method_call.write().unwrap(); + other.method_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in method_call, if it's not there add it to method_call. + if method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + method_call.push(Some(x.clone())); + } + } + }); + + let mut named_field_expression = self.named_field_expression.write().unwrap(); + other + .named_field_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in named_field_expression, if it's not there add it to named_field_expression. + if named_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = named_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + named_field_expression.push(Some(x.clone())); + } + } + }); + + let mut z_object_store = self.z_object_store.write().unwrap(); + other.z_object_store.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in z_object_store, if it's not there add it to z_object_store. + if z_object_store + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = z_object_store.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + z_object_store.push(Some(x.clone())); + } + } + }); + + let mut object_wrapper = self.object_wrapper.write().unwrap(); + other.object_wrapper.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in object_wrapper, if it's not there add it to object_wrapper. + if object_wrapper + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = object_wrapper.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + object_wrapper.push(Some(x.clone())); + } + } + }); + + let mut operator = self.operator.write().unwrap(); + other.operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in operator, if it's not there add it to operator. + if operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + operator.push(Some(x.clone())); + } + } + }); + + let mut parameter = self.parameter.write().unwrap(); + other.parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in parameter, if it's not there add it to parameter. + if parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + parameter.push(Some(x.clone())); + } + } + }); + + let mut x_path = self.x_path.write().unwrap(); + other.x_path.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_path, if it's not there add it to x_path. + if x_path + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_path.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_path.push(Some(x.clone())); + } + } + }); + + let mut path_element = self.path_element.write().unwrap(); + other.path_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in path_element, if it's not there add it to path_element. + if path_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = path_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + path_element.push(Some(x.clone())); + } + } + }); + + let mut pattern = self.pattern.write().unwrap(); + other.pattern.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in pattern, if it's not there add it to pattern. + if pattern + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = pattern.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + pattern.push(Some(x.clone())); + } + } + }); + + let mut x_plugin = self.x_plugin.write().unwrap(); + other.x_plugin.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_plugin, if it's not there add it to x_plugin. + if x_plugin + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_plugin.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_plugin.push(Some(x.clone())); + } + } + }); + + let mut x_print = self.x_print.write().unwrap(); + other.x_print.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_print, if it's not there add it to x_print. + if x_print + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_print.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_print.push(Some(x.clone())); + } + } + }); + + let mut range_expression = self.range_expression.write().unwrap(); + other.range_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in range_expression, if it's not there add it to range_expression. + if range_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = range_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + range_expression.push(Some(x.clone())); + } + } + }); + + let mut result_statement = self.result_statement.write().unwrap(); + other.result_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in result_statement, if it's not there add it to result_statement. + if result_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = result_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + result_statement.push(Some(x.clone())); + } + } + }); + + let mut x_return = self.x_return.write().unwrap(); + other.x_return.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_return, if it's not there add it to x_return. + if x_return + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_return.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_return.push(Some(x.clone())); + } + } + }); + + let mut span = self.span.write().unwrap(); + other.span.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in span, if it's not there add it to span. + if span + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = span.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + span.push(Some(x.clone())); + } + } + }); + + let mut statement = self.statement.write().unwrap(); + other.statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in statement, if it's not there add it to statement. + if statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + statement.push(Some(x.clone())); + } + } + }); + + let mut static_method_call = self.static_method_call.write().unwrap(); + other + .static_method_call + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in static_method_call, if it's not there add it to static_method_call. + if static_method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = static_method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + static_method_call.push(Some(x.clone())); + } + } + }); + + let mut string_bit = self.string_bit.write().unwrap(); + other.string_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_bit, if it's not there add it to string_bit. + if string_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_bit.push(Some(x.clone())); + } + } + }); + + let mut string_literal = self.string_literal.write().unwrap(); + other.string_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_literal, if it's not there add it to string_literal. + if string_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_literal.push(Some(x.clone())); + } + } + }); + + let mut woog_struct = self.woog_struct.write().unwrap(); + other.woog_struct.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in woog_struct, if it's not there add it to woog_struct. + if woog_struct + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = woog_struct.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + woog_struct.push(Some(x.clone())); + } + } + }); + + let mut struct_expression = self.struct_expression.write().unwrap(); + other + .struct_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in struct_expression, if it's not there add it to struct_expression. + if struct_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_expression.push(Some(x.clone())); + } + } + }); + + let mut struct_field = self.struct_field.write().unwrap(); + other.struct_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_field, if it's not there add it to struct_field. + if struct_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_field.push(Some(x.clone())); + } + } + }); + + let mut struct_generic = self.struct_generic.write().unwrap(); + other.struct_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_generic, if it's not there add it to struct_generic. + if struct_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_generic.push(Some(x.clone())); + } + } + }); + + let mut tuple_field = self.tuple_field.write().unwrap(); + other.tuple_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in tuple_field, if it's not there add it to tuple_field. + if tuple_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = tuple_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + tuple_field.push(Some(x.clone())); + } + } + }); + + let mut type_cast = self.type_cast.write().unwrap(); + other.type_cast.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in type_cast, if it's not there add it to type_cast. + if type_cast + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = type_cast.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + type_cast.push(Some(x.clone())); + } + } + }); + + let mut unary = self.unary.write().unwrap(); + other.unary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unary, if it's not there add it to unary. + if unary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unary.push(Some(x.clone())); + } + } + }); + + let mut unit = self.unit.write().unwrap(); + other.unit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unit, if it's not there add it to unit. + if unit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unit.push(Some(x.clone())); + } + } + }); + + let mut unnamed_field_expression = self.unnamed_field_expression.write().unwrap(); + other + .unnamed_field_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. + if unnamed_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unnamed_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unnamed_field_expression.push(Some(x.clone())); + } + } + }); + + let mut x_value = self.x_value.write().unwrap(); + other.x_value.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_value, if it's not there add it to x_value. + if x_value + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_value.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_value.push(Some(x.clone())); + } + } + }); + + let mut value_type = self.value_type.write().unwrap(); + other.value_type.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in value_type, if it's not there add it to value_type. + if value_type + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = value_type.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + value_type.push(Some(x.clone())); + } + } + }); + + let mut variable = self.variable.write().unwrap(); + other.variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable, if it's not there add it to variable. + if variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable.push(Some(x.clone())); + } + } + }); + + let mut variable_expression = self.variable_expression.write().unwrap(); + other + .variable_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in variable_expression, if it's not there add it to variable_expression. + if variable_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable_expression.push(Some(x.clone())); + } + } + }); + } pub fn new() -> Self { let mut store = Self { argument_free_list: std::sync::Mutex::new(Vec::new()), diff --git a/src/v2/lu_dog_vec/store.rs b/src/v2/lu_dog_vec/store.rs index 869069ec..16d94a83 100644 --- a/src/v2/lu_dog_vec/store.rs +++ b/src/v2/lu_dog_vec/store.rs @@ -305,255 +305,2256 @@ pub struct ObjectStore { impl Clone for ObjectStore { fn clone(&self) -> Self { ObjectStore { - argument_free_list: Mutex::new(self.argument_free_list.lock().unwrap().clone()), + argument_free_list: self.argument_free_list.clone(), argument: self.argument.clone(), - a_wait_free_list: Mutex::new(self.a_wait_free_list.lock().unwrap().clone()), + a_wait_free_list: self.a_wait_free_list.clone(), a_wait: self.a_wait.clone(), - binary_free_list: Mutex::new(self.binary_free_list.lock().unwrap().clone()), + binary_free_list: self.binary_free_list.clone(), binary: self.binary.clone(), - block_free_list: Mutex::new(self.block_free_list.lock().unwrap().clone()), + block_free_list: self.block_free_list.clone(), block: self.block.clone(), - body_free_list: Mutex::new(self.body_free_list.lock().unwrap().clone()), + body_free_list: self.body_free_list.clone(), body: self.body.clone(), - boolean_literal_free_list: Mutex::new( - self.boolean_literal_free_list.lock().unwrap().clone(), - ), + boolean_literal_free_list: self.boolean_literal_free_list.clone(), boolean_literal: self.boolean_literal.clone(), - boolean_operator_free_list: Mutex::new( - self.boolean_operator_free_list.lock().unwrap().clone(), - ), + boolean_operator_free_list: self.boolean_operator_free_list.clone(), boolean_operator: self.boolean_operator.clone(), - call_free_list: Mutex::new(self.call_free_list.lock().unwrap().clone()), + call_free_list: self.call_free_list.clone(), call: self.call.clone(), - char_literal_free_list: Mutex::new(self.char_literal_free_list.lock().unwrap().clone()), + char_literal_free_list: self.char_literal_free_list.clone(), char_literal: self.char_literal.clone(), - comparison_free_list: Mutex::new(self.comparison_free_list.lock().unwrap().clone()), + comparison_free_list: self.comparison_free_list.clone(), comparison: self.comparison.clone(), - data_structure_free_list: Mutex::new( - self.data_structure_free_list.lock().unwrap().clone(), - ), + data_structure_free_list: self.data_structure_free_list.clone(), data_structure: self.data_structure.clone(), - dwarf_source_file_free_list: Mutex::new( - self.dwarf_source_file_free_list.lock().unwrap().clone(), - ), + dwarf_source_file_free_list: self.dwarf_source_file_free_list.clone(), dwarf_source_file: self.dwarf_source_file.clone(), - enum_field_free_list: Mutex::new(self.enum_field_free_list.lock().unwrap().clone()), + enum_field_free_list: self.enum_field_free_list.clone(), enum_field: self.enum_field.clone(), - enum_generic_free_list: Mutex::new(self.enum_generic_free_list.lock().unwrap().clone()), + enum_generic_free_list: self.enum_generic_free_list.clone(), enum_generic: self.enum_generic.clone(), - enumeration_free_list: Mutex::new(self.enumeration_free_list.lock().unwrap().clone()), + enumeration_free_list: self.enumeration_free_list.clone(), enumeration: self.enumeration.clone(), enumeration_id_by_name: self.enumeration_id_by_name.clone(), - expression_free_list: Mutex::new(self.expression_free_list.lock().unwrap().clone()), + expression_free_list: self.expression_free_list.clone(), expression: self.expression.clone(), - expression_bit_free_list: Mutex::new( - self.expression_bit_free_list.lock().unwrap().clone(), - ), + expression_bit_free_list: self.expression_bit_free_list.clone(), expression_bit: self.expression_bit.clone(), - expression_statement_free_list: Mutex::new( - self.expression_statement_free_list.lock().unwrap().clone(), - ), + expression_statement_free_list: self.expression_statement_free_list.clone(), expression_statement: self.expression_statement.clone(), - external_implementation_free_list: Mutex::new( - self.external_implementation_free_list - .lock() - .unwrap() - .clone(), - ), + external_implementation_free_list: self.external_implementation_free_list.clone(), external_implementation: self.external_implementation.clone(), - field_free_list: Mutex::new(self.field_free_list.lock().unwrap().clone()), + field_free_list: self.field_free_list.clone(), field: self.field.clone(), field_id_by_name: self.field_id_by_name.clone(), - field_access_free_list: Mutex::new(self.field_access_free_list.lock().unwrap().clone()), + field_access_free_list: self.field_access_free_list.clone(), field_access: self.field_access.clone(), - field_access_target_free_list: Mutex::new( - self.field_access_target_free_list.lock().unwrap().clone(), - ), + field_access_target_free_list: self.field_access_target_free_list.clone(), field_access_target: self.field_access_target.clone(), - field_expression_free_list: Mutex::new( - self.field_expression_free_list.lock().unwrap().clone(), - ), + field_expression_free_list: self.field_expression_free_list.clone(), field_expression: self.field_expression.clone(), - float_literal_free_list: Mutex::new( - self.float_literal_free_list.lock().unwrap().clone(), - ), + float_literal_free_list: self.float_literal_free_list.clone(), float_literal: self.float_literal.clone(), - for_loop_free_list: Mutex::new(self.for_loop_free_list.lock().unwrap().clone()), + for_loop_free_list: self.for_loop_free_list.clone(), for_loop: self.for_loop.clone(), - format_bit_free_list: Mutex::new(self.format_bit_free_list.lock().unwrap().clone()), + format_bit_free_list: self.format_bit_free_list.clone(), format_bit: self.format_bit.clone(), - format_string_free_list: Mutex::new( - self.format_string_free_list.lock().unwrap().clone(), - ), + format_string_free_list: self.format_string_free_list.clone(), format_string: self.format_string.clone(), - func_generic_free_list: Mutex::new(self.func_generic_free_list.lock().unwrap().clone()), + func_generic_free_list: self.func_generic_free_list.clone(), func_generic: self.func_generic.clone(), - function_free_list: Mutex::new(self.function_free_list.lock().unwrap().clone()), + function_free_list: self.function_free_list.clone(), function: self.function.clone(), function_id_by_name: self.function_id_by_name.clone(), - function_call_free_list: Mutex::new( - self.function_call_free_list.lock().unwrap().clone(), - ), + function_call_free_list: self.function_call_free_list.clone(), function_call: self.function_call.clone(), - x_future_free_list: Mutex::new(self.x_future_free_list.lock().unwrap().clone()), + x_future_free_list: self.x_future_free_list.clone(), x_future: self.x_future.clone(), - grouped_free_list: Mutex::new(self.grouped_free_list.lock().unwrap().clone()), + grouped_free_list: self.grouped_free_list.clone(), grouped: self.grouped.clone(), - halt_and_catch_fire_free_list: Mutex::new( - self.halt_and_catch_fire_free_list.lock().unwrap().clone(), - ), + halt_and_catch_fire_free_list: self.halt_and_catch_fire_free_list.clone(), halt_and_catch_fire: self.halt_and_catch_fire.clone(), - x_if_free_list: Mutex::new(self.x_if_free_list.lock().unwrap().clone()), + x_if_free_list: self.x_if_free_list.clone(), x_if: self.x_if.clone(), - implementation_block_free_list: Mutex::new( - self.implementation_block_free_list.lock().unwrap().clone(), - ), + implementation_block_free_list: self.implementation_block_free_list.clone(), implementation_block: self.implementation_block.clone(), - import_free_list: Mutex::new(self.import_free_list.lock().unwrap().clone()), + import_free_list: self.import_free_list.clone(), import: self.import.clone(), - index_free_list: Mutex::new(self.index_free_list.lock().unwrap().clone()), + index_free_list: self.index_free_list.clone(), index: self.index.clone(), - integer_literal_free_list: Mutex::new( - self.integer_literal_free_list.lock().unwrap().clone(), - ), + integer_literal_free_list: self.integer_literal_free_list.clone(), integer_literal: self.integer_literal.clone(), - item_free_list: Mutex::new(self.item_free_list.lock().unwrap().clone()), + item_free_list: self.item_free_list.clone(), item: self.item.clone(), - lambda_free_list: Mutex::new(self.lambda_free_list.lock().unwrap().clone()), + lambda_free_list: self.lambda_free_list.clone(), lambda: self.lambda.clone(), - lambda_parameter_free_list: Mutex::new( - self.lambda_parameter_free_list.lock().unwrap().clone(), - ), + lambda_parameter_free_list: self.lambda_parameter_free_list.clone(), lambda_parameter: self.lambda_parameter.clone(), - let_statement_free_list: Mutex::new( - self.let_statement_free_list.lock().unwrap().clone(), - ), + let_statement_free_list: self.let_statement_free_list.clone(), let_statement: self.let_statement.clone(), - list_free_list: Mutex::new(self.list_free_list.lock().unwrap().clone()), + list_free_list: self.list_free_list.clone(), list: self.list.clone(), - list_element_free_list: Mutex::new(self.list_element_free_list.lock().unwrap().clone()), + list_element_free_list: self.list_element_free_list.clone(), list_element: self.list_element.clone(), - list_expression_free_list: Mutex::new( - self.list_expression_free_list.lock().unwrap().clone(), - ), + list_expression_free_list: self.list_expression_free_list.clone(), list_expression: self.list_expression.clone(), - literal_free_list: Mutex::new(self.literal_free_list.lock().unwrap().clone()), + literal_free_list: self.literal_free_list.clone(), literal: self.literal.clone(), - local_variable_free_list: Mutex::new( - self.local_variable_free_list.lock().unwrap().clone(), - ), + local_variable_free_list: self.local_variable_free_list.clone(), local_variable: self.local_variable.clone(), - x_macro_free_list: Mutex::new(self.x_macro_free_list.lock().unwrap().clone()), + x_macro_free_list: self.x_macro_free_list.clone(), x_macro: self.x_macro.clone(), - map_free_list: Mutex::new(self.map_free_list.lock().unwrap().clone()), + map_free_list: self.map_free_list.clone(), map: self.map.clone(), - map_element_free_list: Mutex::new(self.map_element_free_list.lock().unwrap().clone()), + map_element_free_list: self.map_element_free_list.clone(), map_element: self.map_element.clone(), - map_expression_free_list: Mutex::new( - self.map_expression_free_list.lock().unwrap().clone(), - ), + map_expression_free_list: self.map_expression_free_list.clone(), map_expression: self.map_expression.clone(), - x_match_free_list: Mutex::new(self.x_match_free_list.lock().unwrap().clone()), + x_match_free_list: self.x_match_free_list.clone(), x_match: self.x_match.clone(), - method_call_free_list: Mutex::new(self.method_call_free_list.lock().unwrap().clone()), + method_call_free_list: self.method_call_free_list.clone(), method_call: self.method_call.clone(), - named_field_expression_free_list: Mutex::new( - self.named_field_expression_free_list - .lock() - .unwrap() - .clone(), - ), + named_field_expression_free_list: self.named_field_expression_free_list.clone(), named_field_expression: self.named_field_expression.clone(), - z_object_store_free_list: Mutex::new( - self.z_object_store_free_list.lock().unwrap().clone(), - ), + z_object_store_free_list: self.z_object_store_free_list.clone(), z_object_store: self.z_object_store.clone(), z_object_store_id_by_name: self.z_object_store_id_by_name.clone(), - object_wrapper_free_list: Mutex::new( - self.object_wrapper_free_list.lock().unwrap().clone(), - ), + object_wrapper_free_list: self.object_wrapper_free_list.clone(), object_wrapper: self.object_wrapper.clone(), - operator_free_list: Mutex::new(self.operator_free_list.lock().unwrap().clone()), + operator_free_list: self.operator_free_list.clone(), operator: self.operator.clone(), - parameter_free_list: Mutex::new(self.parameter_free_list.lock().unwrap().clone()), + parameter_free_list: self.parameter_free_list.clone(), parameter: self.parameter.clone(), - x_path_free_list: Mutex::new(self.x_path_free_list.lock().unwrap().clone()), + x_path_free_list: self.x_path_free_list.clone(), x_path: self.x_path.clone(), - path_element_free_list: Mutex::new(self.path_element_free_list.lock().unwrap().clone()), + path_element_free_list: self.path_element_free_list.clone(), path_element: self.path_element.clone(), - pattern_free_list: Mutex::new(self.pattern_free_list.lock().unwrap().clone()), + pattern_free_list: self.pattern_free_list.clone(), pattern: self.pattern.clone(), - x_plugin_free_list: Mutex::new(self.x_plugin_free_list.lock().unwrap().clone()), + x_plugin_free_list: self.x_plugin_free_list.clone(), x_plugin: self.x_plugin.clone(), x_plugin_id_by_name: self.x_plugin_id_by_name.clone(), - x_print_free_list: Mutex::new(self.x_print_free_list.lock().unwrap().clone()), + x_print_free_list: self.x_print_free_list.clone(), x_print: self.x_print.clone(), - range_expression_free_list: Mutex::new( - self.range_expression_free_list.lock().unwrap().clone(), - ), + range_expression_free_list: self.range_expression_free_list.clone(), range_expression: self.range_expression.clone(), - result_statement_free_list: Mutex::new( - self.result_statement_free_list.lock().unwrap().clone(), - ), + result_statement_free_list: self.result_statement_free_list.clone(), result_statement: self.result_statement.clone(), - x_return_free_list: Mutex::new(self.x_return_free_list.lock().unwrap().clone()), + x_return_free_list: self.x_return_free_list.clone(), x_return: self.x_return.clone(), - span_free_list: Mutex::new(self.span_free_list.lock().unwrap().clone()), + span_free_list: self.span_free_list.clone(), span: self.span.clone(), - statement_free_list: Mutex::new(self.statement_free_list.lock().unwrap().clone()), + statement_free_list: self.statement_free_list.clone(), statement: self.statement.clone(), - static_method_call_free_list: Mutex::new( - self.static_method_call_free_list.lock().unwrap().clone(), - ), + static_method_call_free_list: self.static_method_call_free_list.clone(), static_method_call: self.static_method_call.clone(), - string_bit_free_list: Mutex::new(self.string_bit_free_list.lock().unwrap().clone()), + string_bit_free_list: self.string_bit_free_list.clone(), string_bit: self.string_bit.clone(), - string_literal_free_list: Mutex::new( - self.string_literal_free_list.lock().unwrap().clone(), - ), + string_literal_free_list: self.string_literal_free_list.clone(), string_literal: self.string_literal.clone(), - woog_struct_free_list: Mutex::new(self.woog_struct_free_list.lock().unwrap().clone()), + woog_struct_free_list: self.woog_struct_free_list.clone(), woog_struct: self.woog_struct.clone(), woog_struct_id_by_name: self.woog_struct_id_by_name.clone(), - struct_expression_free_list: Mutex::new( - self.struct_expression_free_list.lock().unwrap().clone(), - ), + struct_expression_free_list: self.struct_expression_free_list.clone(), struct_expression: self.struct_expression.clone(), - struct_field_free_list: Mutex::new(self.struct_field_free_list.lock().unwrap().clone()), + struct_field_free_list: self.struct_field_free_list.clone(), struct_field: self.struct_field.clone(), - struct_generic_free_list: Mutex::new( - self.struct_generic_free_list.lock().unwrap().clone(), - ), + struct_generic_free_list: self.struct_generic_free_list.clone(), struct_generic: self.struct_generic.clone(), - tuple_field_free_list: Mutex::new(self.tuple_field_free_list.lock().unwrap().clone()), + tuple_field_free_list: self.tuple_field_free_list.clone(), tuple_field: self.tuple_field.clone(), - type_cast_free_list: Mutex::new(self.type_cast_free_list.lock().unwrap().clone()), + type_cast_free_list: self.type_cast_free_list.clone(), type_cast: self.type_cast.clone(), - unary_free_list: Mutex::new(self.unary_free_list.lock().unwrap().clone()), + unary_free_list: self.unary_free_list.clone(), unary: self.unary.clone(), - unit_free_list: Mutex::new(self.unit_free_list.lock().unwrap().clone()), + unit_free_list: self.unit_free_list.clone(), unit: self.unit.clone(), - unnamed_field_expression_free_list: Mutex::new( - self.unnamed_field_expression_free_list - .lock() - .unwrap() - .clone(), - ), + unnamed_field_expression_free_list: self.unnamed_field_expression_free_list.clone(), unnamed_field_expression: self.unnamed_field_expression.clone(), - x_value_free_list: Mutex::new(self.x_value_free_list.lock().unwrap().clone()), + x_value_free_list: self.x_value_free_list.clone(), x_value: self.x_value.clone(), - value_type_free_list: Mutex::new(self.value_type_free_list.lock().unwrap().clone()), + value_type_free_list: self.value_type_free_list.clone(), value_type: self.value_type.clone(), - variable_free_list: Mutex::new(self.variable_free_list.lock().unwrap().clone()), + variable_free_list: self.variable_free_list.clone(), variable: self.variable.clone(), - variable_expression_free_list: Mutex::new( - self.variable_expression_free_list.lock().unwrap().clone(), - ), + variable_expression_free_list: self.variable_expression_free_list.clone(), variable_expression: self.variable_expression.clone(), } } } impl ObjectStore { + pub fn merge(&mut self, other: ObjectStore) { + let mut argument = self.argument.write().unwrap(); + other.argument.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in argument, if it's not there add it to argument. + if argument + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = argument.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + argument.push(Some(x.clone())); + } + } + }); + + let mut a_wait = self.a_wait.write().unwrap(); + other.a_wait.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in a_wait, if it's not there add it to a_wait. + if a_wait + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = a_wait.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + a_wait.push(Some(x.clone())); + } + } + }); + + let mut binary = self.binary.write().unwrap(); + other.binary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in binary, if it's not there add it to binary. + if binary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = binary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + binary.push(Some(x.clone())); + } + } + }); + + let mut block = self.block.write().unwrap(); + other.block.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in block, if it's not there add it to block. + if block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + block.push(Some(x.clone())); + } + } + }); + + let mut body = self.body.write().unwrap(); + other.body.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in body, if it's not there add it to body. + if body + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = body.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + body.push(Some(x.clone())); + } + } + }); + + let mut boolean_literal = self.boolean_literal.write().unwrap(); + other.boolean_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_literal, if it's not there add it to boolean_literal. + if boolean_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_literal.push(Some(x.clone())); + } + } + }); + + let mut boolean_operator = self.boolean_operator.write().unwrap(); + other.boolean_operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_operator, if it's not there add it to boolean_operator. + if boolean_operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_operator.push(Some(x.clone())); + } + } + }); + + let mut call = self.call.write().unwrap(); + other.call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in call, if it's not there add it to call. + if call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + call.push(Some(x.clone())); + } + } + }); + + let mut char_literal = self.char_literal.write().unwrap(); + other.char_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in char_literal, if it's not there add it to char_literal. + if char_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = char_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + char_literal.push(Some(x.clone())); + } + } + }); + + let mut comparison = self.comparison.write().unwrap(); + other.comparison.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in comparison, if it's not there add it to comparison. + if comparison + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = comparison.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + comparison.push(Some(x.clone())); + } + } + }); + + let mut data_structure = self.data_structure.write().unwrap(); + other.data_structure.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in data_structure, if it's not there add it to data_structure. + if data_structure + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = data_structure.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + data_structure.push(Some(x.clone())); + } + } + }); + + let mut dwarf_source_file = self.dwarf_source_file.write().unwrap(); + other + .dwarf_source_file + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. + if dwarf_source_file + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = dwarf_source_file.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + dwarf_source_file.push(Some(x.clone())); + } + } + }); + + let mut enum_field = self.enum_field.write().unwrap(); + other.enum_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_field, if it's not there add it to enum_field. + if enum_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_field.push(Some(x.clone())); + } + } + }); + + let mut enum_generic = self.enum_generic.write().unwrap(); + other.enum_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic, if it's not there add it to enum_generic. + if enum_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_generic.push(Some(x.clone())); + } + } + }); + + let mut enumeration = self.enumeration.write().unwrap(); + other.enumeration.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enumeration, if it's not there add it to enumeration. + if enumeration + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enumeration.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enumeration.push(Some(x.clone())); + } + } + }); + + let mut expression = self.expression.write().unwrap(); + other.expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression, if it's not there add it to expression. + if expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression.push(Some(x.clone())); + } + } + }); + + let mut expression_bit = self.expression_bit.write().unwrap(); + other.expression_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression_bit, if it's not there add it to expression_bit. + if expression_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_bit.push(Some(x.clone())); + } + } + }); + + let mut expression_statement = self.expression_statement.write().unwrap(); + other + .expression_statement + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in expression_statement, if it's not there add it to expression_statement. + if expression_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_statement.push(Some(x.clone())); + } + } + }); + + let mut external_implementation = self.external_implementation.write().unwrap(); + other + .external_implementation + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in external_implementation, if it's not there add it to external_implementation. + if external_implementation + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = external_implementation.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + external_implementation.push(Some(x.clone())); + } + } + }); + + let mut field = self.field.write().unwrap(); + other.field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field, if it's not there add it to field. + if field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field.push(Some(x.clone())); + } + } + }); + + let mut field_access = self.field_access.write().unwrap(); + other.field_access.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_access, if it's not there add it to field_access. + if field_access + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access.push(Some(x.clone())); + } + } + }); + + let mut field_access_target = self.field_access_target.write().unwrap(); + other + .field_access_target + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in field_access_target, if it's not there add it to field_access_target. + if field_access_target + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access_target.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access_target.push(Some(x.clone())); + } + } + }); + + let mut field_expression = self.field_expression.write().unwrap(); + other.field_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_expression, if it's not there add it to field_expression. + if field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_expression.push(Some(x.clone())); + } + } + }); + + let mut float_literal = self.float_literal.write().unwrap(); + other.float_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in float_literal, if it's not there add it to float_literal. + if float_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = float_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + float_literal.push(Some(x.clone())); + } + } + }); + + let mut for_loop = self.for_loop.write().unwrap(); + other.for_loop.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in for_loop, if it's not there add it to for_loop. + if for_loop + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = for_loop.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + for_loop.push(Some(x.clone())); + } + } + }); + + let mut format_bit = self.format_bit.write().unwrap(); + other.format_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_bit, if it's not there add it to format_bit. + if format_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_bit.push(Some(x.clone())); + } + } + }); + + let mut format_string = self.format_string.write().unwrap(); + other.format_string.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_string, if it's not there add it to format_string. + if format_string + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_string.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_string.push(Some(x.clone())); + } + } + }); + + let mut func_generic = self.func_generic.write().unwrap(); + other.func_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in func_generic, if it's not there add it to func_generic. + if func_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = func_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + func_generic.push(Some(x.clone())); + } + } + }); + + let mut function = self.function.write().unwrap(); + other.function.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function, if it's not there add it to function. + if function + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function.push(Some(x.clone())); + } + } + }); + + let mut function_call = self.function_call.write().unwrap(); + other.function_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function_call, if it's not there add it to function_call. + if function_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function_call.push(Some(x.clone())); + } + } + }); + + let mut x_future = self.x_future.write().unwrap(); + other.x_future.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_future, if it's not there add it to x_future. + if x_future + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_future.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_future.push(Some(x.clone())); + } + } + }); + + let mut grouped = self.grouped.write().unwrap(); + other.grouped.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in grouped, if it's not there add it to grouped. + if grouped + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = grouped.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + grouped.push(Some(x.clone())); + } + } + }); + + let mut halt_and_catch_fire = self.halt_and_catch_fire.write().unwrap(); + other + .halt_and_catch_fire + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. + if halt_and_catch_fire + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = halt_and_catch_fire.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + halt_and_catch_fire.push(Some(x.clone())); + } + } + }); + + let mut x_if = self.x_if.write().unwrap(); + other.x_if.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_if, if it's not there add it to x_if. + if x_if + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_if.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_if.push(Some(x.clone())); + } + } + }); + + let mut implementation_block = self.implementation_block.write().unwrap(); + other + .implementation_block + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in implementation_block, if it's not there add it to implementation_block. + if implementation_block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = implementation_block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + implementation_block.push(Some(x.clone())); + } + } + }); + + let mut import = self.import.write().unwrap(); + other.import.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in import, if it's not there add it to import. + if import + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = import.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + import.push(Some(x.clone())); + } + } + }); + + let mut index = self.index.write().unwrap(); + other.index.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in index, if it's not there add it to index. + if index + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = index.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + index.push(Some(x.clone())); + } + } + }); + + let mut integer_literal = self.integer_literal.write().unwrap(); + other.integer_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in integer_literal, if it's not there add it to integer_literal. + if integer_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = integer_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + integer_literal.push(Some(x.clone())); + } + } + }); + + let mut item = self.item.write().unwrap(); + other.item.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in item, if it's not there add it to item. + if item + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = item.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + item.push(Some(x.clone())); + } + } + }); + + let mut lambda = self.lambda.write().unwrap(); + other.lambda.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda, if it's not there add it to lambda. + if lambda + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda.push(Some(x.clone())); + } + } + }); + + let mut lambda_parameter = self.lambda_parameter.write().unwrap(); + other.lambda_parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda_parameter, if it's not there add it to lambda_parameter. + if lambda_parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda_parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda_parameter.push(Some(x.clone())); + } + } + }); + + let mut let_statement = self.let_statement.write().unwrap(); + other.let_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in let_statement, if it's not there add it to let_statement. + if let_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = let_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + let_statement.push(Some(x.clone())); + } + } + }); + + let mut list = self.list.write().unwrap(); + other.list.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list, if it's not there add it to list. + if list + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list.push(Some(x.clone())); + } + } + }); + + let mut list_element = self.list_element.write().unwrap(); + other.list_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_element, if it's not there add it to list_element. + if list_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_element.push(Some(x.clone())); + } + } + }); + + let mut list_expression = self.list_expression.write().unwrap(); + other.list_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_expression, if it's not there add it to list_expression. + if list_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_expression.push(Some(x.clone())); + } + } + }); + + let mut literal = self.literal.write().unwrap(); + other.literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in literal, if it's not there add it to literal. + if literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + literal.push(Some(x.clone())); + } + } + }); + + let mut local_variable = self.local_variable.write().unwrap(); + other.local_variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in local_variable, if it's not there add it to local_variable. + if local_variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = local_variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + local_variable.push(Some(x.clone())); + } + } + }); + + let mut x_macro = self.x_macro.write().unwrap(); + other.x_macro.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_macro, if it's not there add it to x_macro. + if x_macro + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_macro.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_macro.push(Some(x.clone())); + } + } + }); + + let mut map = self.map.write().unwrap(); + other.map.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map, if it's not there add it to map. + if map + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map.push(Some(x.clone())); + } + } + }); + + let mut map_element = self.map_element.write().unwrap(); + other.map_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_element, if it's not there add it to map_element. + if map_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_element.push(Some(x.clone())); + } + } + }); + + let mut map_expression = self.map_expression.write().unwrap(); + other.map_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_expression, if it's not there add it to map_expression. + if map_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_expression.push(Some(x.clone())); + } + } + }); + + let mut x_match = self.x_match.write().unwrap(); + other.x_match.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_match, if it's not there add it to x_match. + if x_match + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_match.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_match.push(Some(x.clone())); + } + } + }); + + let mut method_call = self.method_call.write().unwrap(); + other.method_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in method_call, if it's not there add it to method_call. + if method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + method_call.push(Some(x.clone())); + } + } + }); + + let mut named_field_expression = self.named_field_expression.write().unwrap(); + other + .named_field_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in named_field_expression, if it's not there add it to named_field_expression. + if named_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = named_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + named_field_expression.push(Some(x.clone())); + } + } + }); + + let mut z_object_store = self.z_object_store.write().unwrap(); + other.z_object_store.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in z_object_store, if it's not there add it to z_object_store. + if z_object_store + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = z_object_store.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + z_object_store.push(Some(x.clone())); + } + } + }); + + let mut object_wrapper = self.object_wrapper.write().unwrap(); + other.object_wrapper.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in object_wrapper, if it's not there add it to object_wrapper. + if object_wrapper + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = object_wrapper.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + object_wrapper.push(Some(x.clone())); + } + } + }); + + let mut operator = self.operator.write().unwrap(); + other.operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in operator, if it's not there add it to operator. + if operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + operator.push(Some(x.clone())); + } + } + }); + + let mut parameter = self.parameter.write().unwrap(); + other.parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in parameter, if it's not there add it to parameter. + if parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + parameter.push(Some(x.clone())); + } + } + }); + + let mut x_path = self.x_path.write().unwrap(); + other.x_path.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_path, if it's not there add it to x_path. + if x_path + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_path.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_path.push(Some(x.clone())); + } + } + }); + + let mut path_element = self.path_element.write().unwrap(); + other.path_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in path_element, if it's not there add it to path_element. + if path_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = path_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + path_element.push(Some(x.clone())); + } + } + }); + + let mut pattern = self.pattern.write().unwrap(); + other.pattern.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in pattern, if it's not there add it to pattern. + if pattern + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = pattern.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + pattern.push(Some(x.clone())); + } + } + }); + + let mut x_plugin = self.x_plugin.write().unwrap(); + other.x_plugin.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_plugin, if it's not there add it to x_plugin. + if x_plugin + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_plugin.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_plugin.push(Some(x.clone())); + } + } + }); + + let mut x_print = self.x_print.write().unwrap(); + other.x_print.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_print, if it's not there add it to x_print. + if x_print + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_print.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_print.push(Some(x.clone())); + } + } + }); + + let mut range_expression = self.range_expression.write().unwrap(); + other.range_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in range_expression, if it's not there add it to range_expression. + if range_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = range_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + range_expression.push(Some(x.clone())); + } + } + }); + + let mut result_statement = self.result_statement.write().unwrap(); + other.result_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in result_statement, if it's not there add it to result_statement. + if result_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = result_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + result_statement.push(Some(x.clone())); + } + } + }); + + let mut x_return = self.x_return.write().unwrap(); + other.x_return.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_return, if it's not there add it to x_return. + if x_return + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_return.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_return.push(Some(x.clone())); + } + } + }); + + let mut span = self.span.write().unwrap(); + other.span.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in span, if it's not there add it to span. + if span + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = span.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + span.push(Some(x.clone())); + } + } + }); + + let mut statement = self.statement.write().unwrap(); + other.statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in statement, if it's not there add it to statement. + if statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + statement.push(Some(x.clone())); + } + } + }); + + let mut static_method_call = self.static_method_call.write().unwrap(); + other + .static_method_call + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in static_method_call, if it's not there add it to static_method_call. + if static_method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = static_method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + static_method_call.push(Some(x.clone())); + } + } + }); + + let mut string_bit = self.string_bit.write().unwrap(); + other.string_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_bit, if it's not there add it to string_bit. + if string_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_bit.push(Some(x.clone())); + } + } + }); + + let mut string_literal = self.string_literal.write().unwrap(); + other.string_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_literal, if it's not there add it to string_literal. + if string_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_literal.push(Some(x.clone())); + } + } + }); + + let mut woog_struct = self.woog_struct.write().unwrap(); + other.woog_struct.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in woog_struct, if it's not there add it to woog_struct. + if woog_struct + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = woog_struct.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + woog_struct.push(Some(x.clone())); + } + } + }); + + let mut struct_expression = self.struct_expression.write().unwrap(); + other + .struct_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in struct_expression, if it's not there add it to struct_expression. + if struct_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_expression.push(Some(x.clone())); + } + } + }); + + let mut struct_field = self.struct_field.write().unwrap(); + other.struct_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_field, if it's not there add it to struct_field. + if struct_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_field.push(Some(x.clone())); + } + } + }); + + let mut struct_generic = self.struct_generic.write().unwrap(); + other.struct_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_generic, if it's not there add it to struct_generic. + if struct_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_generic.push(Some(x.clone())); + } + } + }); + + let mut tuple_field = self.tuple_field.write().unwrap(); + other.tuple_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in tuple_field, if it's not there add it to tuple_field. + if tuple_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = tuple_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + tuple_field.push(Some(x.clone())); + } + } + }); + + let mut type_cast = self.type_cast.write().unwrap(); + other.type_cast.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in type_cast, if it's not there add it to type_cast. + if type_cast + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = type_cast.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + type_cast.push(Some(x.clone())); + } + } + }); + + let mut unary = self.unary.write().unwrap(); + other.unary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unary, if it's not there add it to unary. + if unary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unary.push(Some(x.clone())); + } + } + }); + + let mut unit = self.unit.write().unwrap(); + other.unit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unit, if it's not there add it to unit. + if unit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unit.push(Some(x.clone())); + } + } + }); + + let mut unnamed_field_expression = self.unnamed_field_expression.write().unwrap(); + other + .unnamed_field_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. + if unnamed_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unnamed_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unnamed_field_expression.push(Some(x.clone())); + } + } + }); + + let mut x_value = self.x_value.write().unwrap(); + other.x_value.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_value, if it's not there add it to x_value. + if x_value + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_value.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_value.push(Some(x.clone())); + } + } + }); + + let mut value_type = self.value_type.write().unwrap(); + other.value_type.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in value_type, if it's not there add it to value_type. + if value_type + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = value_type.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + value_type.push(Some(x.clone())); + } + } + }); + + let mut variable = self.variable.write().unwrap(); + other.variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable, if it's not there add it to variable. + if variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable.push(Some(x.clone())); + } + } + }); + + let mut variable_expression = self.variable_expression.write().unwrap(); + other + .variable_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in variable_expression, if it's not there add it to variable_expression. + if variable_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable_expression.push(Some(x.clone())); + } + } + }); + } pub fn new() -> Self { let mut store = Self { argument_free_list: Vec::new(), diff --git a/src/v2/lu_dog_vec_tracy/store.rs b/src/v2/lu_dog_vec_tracy/store.rs index 64dcfb38..04de9d53 100644 --- a/src/v2/lu_dog_vec_tracy/store.rs +++ b/src/v2/lu_dog_vec_tracy/store.rs @@ -305,255 +305,2256 @@ pub struct ObjectStore { impl Clone for ObjectStore { fn clone(&self) -> Self { ObjectStore { - argument_free_list: Mutex::new(self.argument_free_list.lock().unwrap().clone()), + argument_free_list: self.argument_free_list.clone(), argument: self.argument.clone(), - a_wait_free_list: Mutex::new(self.a_wait_free_list.lock().unwrap().clone()), + a_wait_free_list: self.a_wait_free_list.clone(), a_wait: self.a_wait.clone(), - binary_free_list: Mutex::new(self.binary_free_list.lock().unwrap().clone()), + binary_free_list: self.binary_free_list.clone(), binary: self.binary.clone(), - block_free_list: Mutex::new(self.block_free_list.lock().unwrap().clone()), + block_free_list: self.block_free_list.clone(), block: self.block.clone(), - body_free_list: Mutex::new(self.body_free_list.lock().unwrap().clone()), + body_free_list: self.body_free_list.clone(), body: self.body.clone(), - boolean_literal_free_list: Mutex::new( - self.boolean_literal_free_list.lock().unwrap().clone(), - ), + boolean_literal_free_list: self.boolean_literal_free_list.clone(), boolean_literal: self.boolean_literal.clone(), - boolean_operator_free_list: Mutex::new( - self.boolean_operator_free_list.lock().unwrap().clone(), - ), + boolean_operator_free_list: self.boolean_operator_free_list.clone(), boolean_operator: self.boolean_operator.clone(), - call_free_list: Mutex::new(self.call_free_list.lock().unwrap().clone()), + call_free_list: self.call_free_list.clone(), call: self.call.clone(), - char_literal_free_list: Mutex::new(self.char_literal_free_list.lock().unwrap().clone()), + char_literal_free_list: self.char_literal_free_list.clone(), char_literal: self.char_literal.clone(), - comparison_free_list: Mutex::new(self.comparison_free_list.lock().unwrap().clone()), + comparison_free_list: self.comparison_free_list.clone(), comparison: self.comparison.clone(), - data_structure_free_list: Mutex::new( - self.data_structure_free_list.lock().unwrap().clone(), - ), + data_structure_free_list: self.data_structure_free_list.clone(), data_structure: self.data_structure.clone(), - dwarf_source_file_free_list: Mutex::new( - self.dwarf_source_file_free_list.lock().unwrap().clone(), - ), + dwarf_source_file_free_list: self.dwarf_source_file_free_list.clone(), dwarf_source_file: self.dwarf_source_file.clone(), - enum_field_free_list: Mutex::new(self.enum_field_free_list.lock().unwrap().clone()), + enum_field_free_list: self.enum_field_free_list.clone(), enum_field: self.enum_field.clone(), - enum_generic_free_list: Mutex::new(self.enum_generic_free_list.lock().unwrap().clone()), + enum_generic_free_list: self.enum_generic_free_list.clone(), enum_generic: self.enum_generic.clone(), - enumeration_free_list: Mutex::new(self.enumeration_free_list.lock().unwrap().clone()), + enumeration_free_list: self.enumeration_free_list.clone(), enumeration: self.enumeration.clone(), enumeration_id_by_name: self.enumeration_id_by_name.clone(), - expression_free_list: Mutex::new(self.expression_free_list.lock().unwrap().clone()), + expression_free_list: self.expression_free_list.clone(), expression: self.expression.clone(), - expression_bit_free_list: Mutex::new( - self.expression_bit_free_list.lock().unwrap().clone(), - ), + expression_bit_free_list: self.expression_bit_free_list.clone(), expression_bit: self.expression_bit.clone(), - expression_statement_free_list: Mutex::new( - self.expression_statement_free_list.lock().unwrap().clone(), - ), + expression_statement_free_list: self.expression_statement_free_list.clone(), expression_statement: self.expression_statement.clone(), - external_implementation_free_list: Mutex::new( - self.external_implementation_free_list - .lock() - .unwrap() - .clone(), - ), + external_implementation_free_list: self.external_implementation_free_list.clone(), external_implementation: self.external_implementation.clone(), - field_free_list: Mutex::new(self.field_free_list.lock().unwrap().clone()), + field_free_list: self.field_free_list.clone(), field: self.field.clone(), field_id_by_name: self.field_id_by_name.clone(), - field_access_free_list: Mutex::new(self.field_access_free_list.lock().unwrap().clone()), + field_access_free_list: self.field_access_free_list.clone(), field_access: self.field_access.clone(), - field_access_target_free_list: Mutex::new( - self.field_access_target_free_list.lock().unwrap().clone(), - ), + field_access_target_free_list: self.field_access_target_free_list.clone(), field_access_target: self.field_access_target.clone(), - field_expression_free_list: Mutex::new( - self.field_expression_free_list.lock().unwrap().clone(), - ), + field_expression_free_list: self.field_expression_free_list.clone(), field_expression: self.field_expression.clone(), - float_literal_free_list: Mutex::new( - self.float_literal_free_list.lock().unwrap().clone(), - ), + float_literal_free_list: self.float_literal_free_list.clone(), float_literal: self.float_literal.clone(), - for_loop_free_list: Mutex::new(self.for_loop_free_list.lock().unwrap().clone()), + for_loop_free_list: self.for_loop_free_list.clone(), for_loop: self.for_loop.clone(), - format_bit_free_list: Mutex::new(self.format_bit_free_list.lock().unwrap().clone()), + format_bit_free_list: self.format_bit_free_list.clone(), format_bit: self.format_bit.clone(), - format_string_free_list: Mutex::new( - self.format_string_free_list.lock().unwrap().clone(), - ), + format_string_free_list: self.format_string_free_list.clone(), format_string: self.format_string.clone(), - func_generic_free_list: Mutex::new(self.func_generic_free_list.lock().unwrap().clone()), + func_generic_free_list: self.func_generic_free_list.clone(), func_generic: self.func_generic.clone(), - function_free_list: Mutex::new(self.function_free_list.lock().unwrap().clone()), + function_free_list: self.function_free_list.clone(), function: self.function.clone(), function_id_by_name: self.function_id_by_name.clone(), - function_call_free_list: Mutex::new( - self.function_call_free_list.lock().unwrap().clone(), - ), + function_call_free_list: self.function_call_free_list.clone(), function_call: self.function_call.clone(), - x_future_free_list: Mutex::new(self.x_future_free_list.lock().unwrap().clone()), + x_future_free_list: self.x_future_free_list.clone(), x_future: self.x_future.clone(), - grouped_free_list: Mutex::new(self.grouped_free_list.lock().unwrap().clone()), + grouped_free_list: self.grouped_free_list.clone(), grouped: self.grouped.clone(), - halt_and_catch_fire_free_list: Mutex::new( - self.halt_and_catch_fire_free_list.lock().unwrap().clone(), - ), + halt_and_catch_fire_free_list: self.halt_and_catch_fire_free_list.clone(), halt_and_catch_fire: self.halt_and_catch_fire.clone(), - x_if_free_list: Mutex::new(self.x_if_free_list.lock().unwrap().clone()), + x_if_free_list: self.x_if_free_list.clone(), x_if: self.x_if.clone(), - implementation_block_free_list: Mutex::new( - self.implementation_block_free_list.lock().unwrap().clone(), - ), + implementation_block_free_list: self.implementation_block_free_list.clone(), implementation_block: self.implementation_block.clone(), - import_free_list: Mutex::new(self.import_free_list.lock().unwrap().clone()), + import_free_list: self.import_free_list.clone(), import: self.import.clone(), - index_free_list: Mutex::new(self.index_free_list.lock().unwrap().clone()), + index_free_list: self.index_free_list.clone(), index: self.index.clone(), - integer_literal_free_list: Mutex::new( - self.integer_literal_free_list.lock().unwrap().clone(), - ), + integer_literal_free_list: self.integer_literal_free_list.clone(), integer_literal: self.integer_literal.clone(), - item_free_list: Mutex::new(self.item_free_list.lock().unwrap().clone()), + item_free_list: self.item_free_list.clone(), item: self.item.clone(), - lambda_free_list: Mutex::new(self.lambda_free_list.lock().unwrap().clone()), + lambda_free_list: self.lambda_free_list.clone(), lambda: self.lambda.clone(), - lambda_parameter_free_list: Mutex::new( - self.lambda_parameter_free_list.lock().unwrap().clone(), - ), + lambda_parameter_free_list: self.lambda_parameter_free_list.clone(), lambda_parameter: self.lambda_parameter.clone(), - let_statement_free_list: Mutex::new( - self.let_statement_free_list.lock().unwrap().clone(), - ), + let_statement_free_list: self.let_statement_free_list.clone(), let_statement: self.let_statement.clone(), - list_free_list: Mutex::new(self.list_free_list.lock().unwrap().clone()), + list_free_list: self.list_free_list.clone(), list: self.list.clone(), - list_element_free_list: Mutex::new(self.list_element_free_list.lock().unwrap().clone()), + list_element_free_list: self.list_element_free_list.clone(), list_element: self.list_element.clone(), - list_expression_free_list: Mutex::new( - self.list_expression_free_list.lock().unwrap().clone(), - ), + list_expression_free_list: self.list_expression_free_list.clone(), list_expression: self.list_expression.clone(), - literal_free_list: Mutex::new(self.literal_free_list.lock().unwrap().clone()), + literal_free_list: self.literal_free_list.clone(), literal: self.literal.clone(), - local_variable_free_list: Mutex::new( - self.local_variable_free_list.lock().unwrap().clone(), - ), + local_variable_free_list: self.local_variable_free_list.clone(), local_variable: self.local_variable.clone(), - x_macro_free_list: Mutex::new(self.x_macro_free_list.lock().unwrap().clone()), + x_macro_free_list: self.x_macro_free_list.clone(), x_macro: self.x_macro.clone(), - map_free_list: Mutex::new(self.map_free_list.lock().unwrap().clone()), + map_free_list: self.map_free_list.clone(), map: self.map.clone(), - map_element_free_list: Mutex::new(self.map_element_free_list.lock().unwrap().clone()), + map_element_free_list: self.map_element_free_list.clone(), map_element: self.map_element.clone(), - map_expression_free_list: Mutex::new( - self.map_expression_free_list.lock().unwrap().clone(), - ), + map_expression_free_list: self.map_expression_free_list.clone(), map_expression: self.map_expression.clone(), - x_match_free_list: Mutex::new(self.x_match_free_list.lock().unwrap().clone()), + x_match_free_list: self.x_match_free_list.clone(), x_match: self.x_match.clone(), - method_call_free_list: Mutex::new(self.method_call_free_list.lock().unwrap().clone()), + method_call_free_list: self.method_call_free_list.clone(), method_call: self.method_call.clone(), - named_field_expression_free_list: Mutex::new( - self.named_field_expression_free_list - .lock() - .unwrap() - .clone(), - ), + named_field_expression_free_list: self.named_field_expression_free_list.clone(), named_field_expression: self.named_field_expression.clone(), - z_object_store_free_list: Mutex::new( - self.z_object_store_free_list.lock().unwrap().clone(), - ), + z_object_store_free_list: self.z_object_store_free_list.clone(), z_object_store: self.z_object_store.clone(), z_object_store_id_by_name: self.z_object_store_id_by_name.clone(), - object_wrapper_free_list: Mutex::new( - self.object_wrapper_free_list.lock().unwrap().clone(), - ), + object_wrapper_free_list: self.object_wrapper_free_list.clone(), object_wrapper: self.object_wrapper.clone(), - operator_free_list: Mutex::new(self.operator_free_list.lock().unwrap().clone()), + operator_free_list: self.operator_free_list.clone(), operator: self.operator.clone(), - parameter_free_list: Mutex::new(self.parameter_free_list.lock().unwrap().clone()), + parameter_free_list: self.parameter_free_list.clone(), parameter: self.parameter.clone(), - x_path_free_list: Mutex::new(self.x_path_free_list.lock().unwrap().clone()), + x_path_free_list: self.x_path_free_list.clone(), x_path: self.x_path.clone(), - path_element_free_list: Mutex::new(self.path_element_free_list.lock().unwrap().clone()), + path_element_free_list: self.path_element_free_list.clone(), path_element: self.path_element.clone(), - pattern_free_list: Mutex::new(self.pattern_free_list.lock().unwrap().clone()), + pattern_free_list: self.pattern_free_list.clone(), pattern: self.pattern.clone(), - x_plugin_free_list: Mutex::new(self.x_plugin_free_list.lock().unwrap().clone()), + x_plugin_free_list: self.x_plugin_free_list.clone(), x_plugin: self.x_plugin.clone(), x_plugin_id_by_name: self.x_plugin_id_by_name.clone(), - x_print_free_list: Mutex::new(self.x_print_free_list.lock().unwrap().clone()), + x_print_free_list: self.x_print_free_list.clone(), x_print: self.x_print.clone(), - range_expression_free_list: Mutex::new( - self.range_expression_free_list.lock().unwrap().clone(), - ), + range_expression_free_list: self.range_expression_free_list.clone(), range_expression: self.range_expression.clone(), - result_statement_free_list: Mutex::new( - self.result_statement_free_list.lock().unwrap().clone(), - ), + result_statement_free_list: self.result_statement_free_list.clone(), result_statement: self.result_statement.clone(), - x_return_free_list: Mutex::new(self.x_return_free_list.lock().unwrap().clone()), + x_return_free_list: self.x_return_free_list.clone(), x_return: self.x_return.clone(), - span_free_list: Mutex::new(self.span_free_list.lock().unwrap().clone()), + span_free_list: self.span_free_list.clone(), span: self.span.clone(), - statement_free_list: Mutex::new(self.statement_free_list.lock().unwrap().clone()), + statement_free_list: self.statement_free_list.clone(), statement: self.statement.clone(), - static_method_call_free_list: Mutex::new( - self.static_method_call_free_list.lock().unwrap().clone(), - ), + static_method_call_free_list: self.static_method_call_free_list.clone(), static_method_call: self.static_method_call.clone(), - string_bit_free_list: Mutex::new(self.string_bit_free_list.lock().unwrap().clone()), + string_bit_free_list: self.string_bit_free_list.clone(), string_bit: self.string_bit.clone(), - string_literal_free_list: Mutex::new( - self.string_literal_free_list.lock().unwrap().clone(), - ), + string_literal_free_list: self.string_literal_free_list.clone(), string_literal: self.string_literal.clone(), - woog_struct_free_list: Mutex::new(self.woog_struct_free_list.lock().unwrap().clone()), + woog_struct_free_list: self.woog_struct_free_list.clone(), woog_struct: self.woog_struct.clone(), woog_struct_id_by_name: self.woog_struct_id_by_name.clone(), - struct_expression_free_list: Mutex::new( - self.struct_expression_free_list.lock().unwrap().clone(), - ), + struct_expression_free_list: self.struct_expression_free_list.clone(), struct_expression: self.struct_expression.clone(), - struct_field_free_list: Mutex::new(self.struct_field_free_list.lock().unwrap().clone()), + struct_field_free_list: self.struct_field_free_list.clone(), struct_field: self.struct_field.clone(), - struct_generic_free_list: Mutex::new( - self.struct_generic_free_list.lock().unwrap().clone(), - ), + struct_generic_free_list: self.struct_generic_free_list.clone(), struct_generic: self.struct_generic.clone(), - tuple_field_free_list: Mutex::new(self.tuple_field_free_list.lock().unwrap().clone()), + tuple_field_free_list: self.tuple_field_free_list.clone(), tuple_field: self.tuple_field.clone(), - type_cast_free_list: Mutex::new(self.type_cast_free_list.lock().unwrap().clone()), + type_cast_free_list: self.type_cast_free_list.clone(), type_cast: self.type_cast.clone(), - unary_free_list: Mutex::new(self.unary_free_list.lock().unwrap().clone()), + unary_free_list: self.unary_free_list.clone(), unary: self.unary.clone(), - unit_free_list: Mutex::new(self.unit_free_list.lock().unwrap().clone()), + unit_free_list: self.unit_free_list.clone(), unit: self.unit.clone(), - unnamed_field_expression_free_list: Mutex::new( - self.unnamed_field_expression_free_list - .lock() - .unwrap() - .clone(), - ), + unnamed_field_expression_free_list: self.unnamed_field_expression_free_list.clone(), unnamed_field_expression: self.unnamed_field_expression.clone(), - x_value_free_list: Mutex::new(self.x_value_free_list.lock().unwrap().clone()), + x_value_free_list: self.x_value_free_list.clone(), x_value: self.x_value.clone(), - value_type_free_list: Mutex::new(self.value_type_free_list.lock().unwrap().clone()), + value_type_free_list: self.value_type_free_list.clone(), value_type: self.value_type.clone(), - variable_free_list: Mutex::new(self.variable_free_list.lock().unwrap().clone()), + variable_free_list: self.variable_free_list.clone(), variable: self.variable.clone(), - variable_expression_free_list: Mutex::new( - self.variable_expression_free_list.lock().unwrap().clone(), - ), + variable_expression_free_list: self.variable_expression_free_list.clone(), variable_expression: self.variable_expression.clone(), } } } impl ObjectStore { + pub fn merge(&mut self, other: ObjectStore) { + let mut argument = self.argument.write().unwrap(); + other.argument.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in argument, if it's not there add it to argument. + if argument + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = argument.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + argument.push(Some(x.clone())); + } + } + }); + + let mut a_wait = self.a_wait.write().unwrap(); + other.a_wait.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in a_wait, if it's not there add it to a_wait. + if a_wait + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = a_wait.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + a_wait.push(Some(x.clone())); + } + } + }); + + let mut binary = self.binary.write().unwrap(); + other.binary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in binary, if it's not there add it to binary. + if binary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = binary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + binary.push(Some(x.clone())); + } + } + }); + + let mut block = self.block.write().unwrap(); + other.block.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in block, if it's not there add it to block. + if block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + block.push(Some(x.clone())); + } + } + }); + + let mut body = self.body.write().unwrap(); + other.body.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in body, if it's not there add it to body. + if body + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = body.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + body.push(Some(x.clone())); + } + } + }); + + let mut boolean_literal = self.boolean_literal.write().unwrap(); + other.boolean_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_literal, if it's not there add it to boolean_literal. + if boolean_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_literal.push(Some(x.clone())); + } + } + }); + + let mut boolean_operator = self.boolean_operator.write().unwrap(); + other.boolean_operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_operator, if it's not there add it to boolean_operator. + if boolean_operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_operator.push(Some(x.clone())); + } + } + }); + + let mut call = self.call.write().unwrap(); + other.call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in call, if it's not there add it to call. + if call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + call.push(Some(x.clone())); + } + } + }); + + let mut char_literal = self.char_literal.write().unwrap(); + other.char_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in char_literal, if it's not there add it to char_literal. + if char_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = char_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + char_literal.push(Some(x.clone())); + } + } + }); + + let mut comparison = self.comparison.write().unwrap(); + other.comparison.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in comparison, if it's not there add it to comparison. + if comparison + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = comparison.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + comparison.push(Some(x.clone())); + } + } + }); + + let mut data_structure = self.data_structure.write().unwrap(); + other.data_structure.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in data_structure, if it's not there add it to data_structure. + if data_structure + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = data_structure.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + data_structure.push(Some(x.clone())); + } + } + }); + + let mut dwarf_source_file = self.dwarf_source_file.write().unwrap(); + other + .dwarf_source_file + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. + if dwarf_source_file + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = dwarf_source_file.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + dwarf_source_file.push(Some(x.clone())); + } + } + }); + + let mut enum_field = self.enum_field.write().unwrap(); + other.enum_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_field, if it's not there add it to enum_field. + if enum_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_field.push(Some(x.clone())); + } + } + }); + + let mut enum_generic = self.enum_generic.write().unwrap(); + other.enum_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic, if it's not there add it to enum_generic. + if enum_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_generic.push(Some(x.clone())); + } + } + }); + + let mut enumeration = self.enumeration.write().unwrap(); + other.enumeration.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enumeration, if it's not there add it to enumeration. + if enumeration + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enumeration.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enumeration.push(Some(x.clone())); + } + } + }); + + let mut expression = self.expression.write().unwrap(); + other.expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression, if it's not there add it to expression. + if expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression.push(Some(x.clone())); + } + } + }); + + let mut expression_bit = self.expression_bit.write().unwrap(); + other.expression_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression_bit, if it's not there add it to expression_bit. + if expression_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_bit.push(Some(x.clone())); + } + } + }); + + let mut expression_statement = self.expression_statement.write().unwrap(); + other + .expression_statement + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in expression_statement, if it's not there add it to expression_statement. + if expression_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_statement.push(Some(x.clone())); + } + } + }); + + let mut external_implementation = self.external_implementation.write().unwrap(); + other + .external_implementation + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in external_implementation, if it's not there add it to external_implementation. + if external_implementation + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = external_implementation.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + external_implementation.push(Some(x.clone())); + } + } + }); + + let mut field = self.field.write().unwrap(); + other.field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field, if it's not there add it to field. + if field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field.push(Some(x.clone())); + } + } + }); + + let mut field_access = self.field_access.write().unwrap(); + other.field_access.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_access, if it's not there add it to field_access. + if field_access + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access.push(Some(x.clone())); + } + } + }); + + let mut field_access_target = self.field_access_target.write().unwrap(); + other + .field_access_target + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in field_access_target, if it's not there add it to field_access_target. + if field_access_target + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access_target.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access_target.push(Some(x.clone())); + } + } + }); + + let mut field_expression = self.field_expression.write().unwrap(); + other.field_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_expression, if it's not there add it to field_expression. + if field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_expression.push(Some(x.clone())); + } + } + }); + + let mut float_literal = self.float_literal.write().unwrap(); + other.float_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in float_literal, if it's not there add it to float_literal. + if float_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = float_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + float_literal.push(Some(x.clone())); + } + } + }); + + let mut for_loop = self.for_loop.write().unwrap(); + other.for_loop.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in for_loop, if it's not there add it to for_loop. + if for_loop + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = for_loop.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + for_loop.push(Some(x.clone())); + } + } + }); + + let mut format_bit = self.format_bit.write().unwrap(); + other.format_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_bit, if it's not there add it to format_bit. + if format_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_bit.push(Some(x.clone())); + } + } + }); + + let mut format_string = self.format_string.write().unwrap(); + other.format_string.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_string, if it's not there add it to format_string. + if format_string + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_string.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_string.push(Some(x.clone())); + } + } + }); + + let mut func_generic = self.func_generic.write().unwrap(); + other.func_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in func_generic, if it's not there add it to func_generic. + if func_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = func_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + func_generic.push(Some(x.clone())); + } + } + }); + + let mut function = self.function.write().unwrap(); + other.function.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function, if it's not there add it to function. + if function + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function.push(Some(x.clone())); + } + } + }); + + let mut function_call = self.function_call.write().unwrap(); + other.function_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function_call, if it's not there add it to function_call. + if function_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function_call.push(Some(x.clone())); + } + } + }); + + let mut x_future = self.x_future.write().unwrap(); + other.x_future.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_future, if it's not there add it to x_future. + if x_future + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_future.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_future.push(Some(x.clone())); + } + } + }); + + let mut grouped = self.grouped.write().unwrap(); + other.grouped.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in grouped, if it's not there add it to grouped. + if grouped + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = grouped.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + grouped.push(Some(x.clone())); + } + } + }); + + let mut halt_and_catch_fire = self.halt_and_catch_fire.write().unwrap(); + other + .halt_and_catch_fire + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. + if halt_and_catch_fire + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = halt_and_catch_fire.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + halt_and_catch_fire.push(Some(x.clone())); + } + } + }); + + let mut x_if = self.x_if.write().unwrap(); + other.x_if.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_if, if it's not there add it to x_if. + if x_if + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_if.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_if.push(Some(x.clone())); + } + } + }); + + let mut implementation_block = self.implementation_block.write().unwrap(); + other + .implementation_block + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in implementation_block, if it's not there add it to implementation_block. + if implementation_block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = implementation_block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + implementation_block.push(Some(x.clone())); + } + } + }); + + let mut import = self.import.write().unwrap(); + other.import.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in import, if it's not there add it to import. + if import + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = import.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + import.push(Some(x.clone())); + } + } + }); + + let mut index = self.index.write().unwrap(); + other.index.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in index, if it's not there add it to index. + if index + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = index.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + index.push(Some(x.clone())); + } + } + }); + + let mut integer_literal = self.integer_literal.write().unwrap(); + other.integer_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in integer_literal, if it's not there add it to integer_literal. + if integer_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = integer_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + integer_literal.push(Some(x.clone())); + } + } + }); + + let mut item = self.item.write().unwrap(); + other.item.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in item, if it's not there add it to item. + if item + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = item.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + item.push(Some(x.clone())); + } + } + }); + + let mut lambda = self.lambda.write().unwrap(); + other.lambda.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda, if it's not there add it to lambda. + if lambda + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda.push(Some(x.clone())); + } + } + }); + + let mut lambda_parameter = self.lambda_parameter.write().unwrap(); + other.lambda_parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda_parameter, if it's not there add it to lambda_parameter. + if lambda_parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda_parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda_parameter.push(Some(x.clone())); + } + } + }); + + let mut let_statement = self.let_statement.write().unwrap(); + other.let_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in let_statement, if it's not there add it to let_statement. + if let_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = let_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + let_statement.push(Some(x.clone())); + } + } + }); + + let mut list = self.list.write().unwrap(); + other.list.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list, if it's not there add it to list. + if list + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list.push(Some(x.clone())); + } + } + }); + + let mut list_element = self.list_element.write().unwrap(); + other.list_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_element, if it's not there add it to list_element. + if list_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_element.push(Some(x.clone())); + } + } + }); + + let mut list_expression = self.list_expression.write().unwrap(); + other.list_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_expression, if it's not there add it to list_expression. + if list_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_expression.push(Some(x.clone())); + } + } + }); + + let mut literal = self.literal.write().unwrap(); + other.literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in literal, if it's not there add it to literal. + if literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + literal.push(Some(x.clone())); + } + } + }); + + let mut local_variable = self.local_variable.write().unwrap(); + other.local_variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in local_variable, if it's not there add it to local_variable. + if local_variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = local_variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + local_variable.push(Some(x.clone())); + } + } + }); + + let mut x_macro = self.x_macro.write().unwrap(); + other.x_macro.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_macro, if it's not there add it to x_macro. + if x_macro + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_macro.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_macro.push(Some(x.clone())); + } + } + }); + + let mut map = self.map.write().unwrap(); + other.map.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map, if it's not there add it to map. + if map + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map.push(Some(x.clone())); + } + } + }); + + let mut map_element = self.map_element.write().unwrap(); + other.map_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_element, if it's not there add it to map_element. + if map_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_element.push(Some(x.clone())); + } + } + }); + + let mut map_expression = self.map_expression.write().unwrap(); + other.map_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_expression, if it's not there add it to map_expression. + if map_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_expression.push(Some(x.clone())); + } + } + }); + + let mut x_match = self.x_match.write().unwrap(); + other.x_match.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_match, if it's not there add it to x_match. + if x_match + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_match.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_match.push(Some(x.clone())); + } + } + }); + + let mut method_call = self.method_call.write().unwrap(); + other.method_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in method_call, if it's not there add it to method_call. + if method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + method_call.push(Some(x.clone())); + } + } + }); + + let mut named_field_expression = self.named_field_expression.write().unwrap(); + other + .named_field_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in named_field_expression, if it's not there add it to named_field_expression. + if named_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = named_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + named_field_expression.push(Some(x.clone())); + } + } + }); + + let mut z_object_store = self.z_object_store.write().unwrap(); + other.z_object_store.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in z_object_store, if it's not there add it to z_object_store. + if z_object_store + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = z_object_store.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + z_object_store.push(Some(x.clone())); + } + } + }); + + let mut object_wrapper = self.object_wrapper.write().unwrap(); + other.object_wrapper.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in object_wrapper, if it's not there add it to object_wrapper. + if object_wrapper + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = object_wrapper.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + object_wrapper.push(Some(x.clone())); + } + } + }); + + let mut operator = self.operator.write().unwrap(); + other.operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in operator, if it's not there add it to operator. + if operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + operator.push(Some(x.clone())); + } + } + }); + + let mut parameter = self.parameter.write().unwrap(); + other.parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in parameter, if it's not there add it to parameter. + if parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + parameter.push(Some(x.clone())); + } + } + }); + + let mut x_path = self.x_path.write().unwrap(); + other.x_path.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_path, if it's not there add it to x_path. + if x_path + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_path.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_path.push(Some(x.clone())); + } + } + }); + + let mut path_element = self.path_element.write().unwrap(); + other.path_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in path_element, if it's not there add it to path_element. + if path_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = path_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + path_element.push(Some(x.clone())); + } + } + }); + + let mut pattern = self.pattern.write().unwrap(); + other.pattern.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in pattern, if it's not there add it to pattern. + if pattern + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = pattern.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + pattern.push(Some(x.clone())); + } + } + }); + + let mut x_plugin = self.x_plugin.write().unwrap(); + other.x_plugin.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_plugin, if it's not there add it to x_plugin. + if x_plugin + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_plugin.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_plugin.push(Some(x.clone())); + } + } + }); + + let mut x_print = self.x_print.write().unwrap(); + other.x_print.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_print, if it's not there add it to x_print. + if x_print + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_print.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_print.push(Some(x.clone())); + } + } + }); + + let mut range_expression = self.range_expression.write().unwrap(); + other.range_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in range_expression, if it's not there add it to range_expression. + if range_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = range_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + range_expression.push(Some(x.clone())); + } + } + }); + + let mut result_statement = self.result_statement.write().unwrap(); + other.result_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in result_statement, if it's not there add it to result_statement. + if result_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = result_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + result_statement.push(Some(x.clone())); + } + } + }); + + let mut x_return = self.x_return.write().unwrap(); + other.x_return.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_return, if it's not there add it to x_return. + if x_return + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_return.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_return.push(Some(x.clone())); + } + } + }); + + let mut span = self.span.write().unwrap(); + other.span.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in span, if it's not there add it to span. + if span + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = span.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + span.push(Some(x.clone())); + } + } + }); + + let mut statement = self.statement.write().unwrap(); + other.statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in statement, if it's not there add it to statement. + if statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + statement.push(Some(x.clone())); + } + } + }); + + let mut static_method_call = self.static_method_call.write().unwrap(); + other + .static_method_call + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in static_method_call, if it's not there add it to static_method_call. + if static_method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = static_method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + static_method_call.push(Some(x.clone())); + } + } + }); + + let mut string_bit = self.string_bit.write().unwrap(); + other.string_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_bit, if it's not there add it to string_bit. + if string_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_bit.push(Some(x.clone())); + } + } + }); + + let mut string_literal = self.string_literal.write().unwrap(); + other.string_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_literal, if it's not there add it to string_literal. + if string_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_literal.push(Some(x.clone())); + } + } + }); + + let mut woog_struct = self.woog_struct.write().unwrap(); + other.woog_struct.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in woog_struct, if it's not there add it to woog_struct. + if woog_struct + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = woog_struct.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + woog_struct.push(Some(x.clone())); + } + } + }); + + let mut struct_expression = self.struct_expression.write().unwrap(); + other + .struct_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in struct_expression, if it's not there add it to struct_expression. + if struct_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_expression.push(Some(x.clone())); + } + } + }); + + let mut struct_field = self.struct_field.write().unwrap(); + other.struct_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_field, if it's not there add it to struct_field. + if struct_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_field.push(Some(x.clone())); + } + } + }); + + let mut struct_generic = self.struct_generic.write().unwrap(); + other.struct_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_generic, if it's not there add it to struct_generic. + if struct_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_generic.push(Some(x.clone())); + } + } + }); + + let mut tuple_field = self.tuple_field.write().unwrap(); + other.tuple_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in tuple_field, if it's not there add it to tuple_field. + if tuple_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = tuple_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + tuple_field.push(Some(x.clone())); + } + } + }); + + let mut type_cast = self.type_cast.write().unwrap(); + other.type_cast.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in type_cast, if it's not there add it to type_cast. + if type_cast + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = type_cast.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + type_cast.push(Some(x.clone())); + } + } + }); + + let mut unary = self.unary.write().unwrap(); + other.unary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unary, if it's not there add it to unary. + if unary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unary.push(Some(x.clone())); + } + } + }); + + let mut unit = self.unit.write().unwrap(); + other.unit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unit, if it's not there add it to unit. + if unit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unit.push(Some(x.clone())); + } + } + }); + + let mut unnamed_field_expression = self.unnamed_field_expression.write().unwrap(); + other + .unnamed_field_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. + if unnamed_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unnamed_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unnamed_field_expression.push(Some(x.clone())); + } + } + }); + + let mut x_value = self.x_value.write().unwrap(); + other.x_value.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_value, if it's not there add it to x_value. + if x_value + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_value.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_value.push(Some(x.clone())); + } + } + }); + + let mut value_type = self.value_type.write().unwrap(); + other.value_type.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in value_type, if it's not there add it to value_type. + if value_type + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = value_type.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + value_type.push(Some(x.clone())); + } + } + }); + + let mut variable = self.variable.write().unwrap(); + other.variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable, if it's not there add it to variable. + if variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable.push(Some(x.clone())); + } + } + }); + + let mut variable_expression = self.variable_expression.write().unwrap(); + other + .variable_expression + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in variable_expression, if it's not there add it to variable_expression. + if variable_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable_expression.push(Some(x.clone())); + } + } + }); + } pub fn new() -> Self { let mut store = Self { argument_free_list: Vec::new(),