diff --git a/Cargo.toml b/Cargo.toml index b8a0f61a..db1c42cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sarzak" -version = "2.14.0" +version = "2.14.1" 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 f8110b68..581b06fa 100644 --- a/src/v2/lu_dog_ndrwlock_vec/store.rs +++ b/src/v2/lu_dog_ndrwlock_vec/store.rs @@ -93,8748 +93,10745 @@ //! * [`Variable`] //! * [`VariableExpression`] // {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"v2::lu_dog_ndrwlock_vec-object-store-definition"}}} -use std::sync::Arc; use no_deadlocks::RwLock; +use std::sync::Arc; use std::sync::Mutex; -use rustc_hash::FxHashMap as HashMap; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; -use heck::ToUpperCamelCase; - - -use crate::v2::lu_dog_ndrwlock_vec::types::{ -Argument, -AWait, -Binary, -Block, -Body, -BooleanLiteral, -BooleanOperator, -Call, -CharLiteral, -Comparison, -DataStructure, -DwarfSourceFile, -EnumField, -EnumGeneric, -EnumGenericType, -Enumeration, -Expression, -ExpressionBit, -ExpressionStatement, -ExternalImplementation, -Field, -FieldAccess, -FieldAccessTarget, -FieldExpression, -FloatLiteral, -ForLoop, -FormatBit, -FormatString, -FuncGeneric, -Function, -FunctionCall, -XFuture, -Grouped, -HaltAndCatchFire, -XIf, -ImplementationBlock, -Import, -Index, -IntegerLiteral, -Item, -Lambda, -LambdaParameter, -LetStatement, -List, -ListElement, -ListExpression, -Literal, -LocalVariable, -XMacro, -Map, -MapElement, -MapExpression, -XMatch, -MethodCall, -NamedFieldExpression, -ZObjectStore, -ObjectWrapper, -Operator, -Parameter, -XPath, -PathElement, -Pattern, -XPlugin, -XPrint, -RangeExpression, -ResultStatement, -XReturn, -Span, -Statement, -StaticMethodCall, -StringBit, -StringLiteral, -WoogStruct, -StructExpression, -StructField, -StructGeneric, -TupleField, -TypeCast, -Unary, -Unit, -UnnamedFieldExpression, -XValue, -ValueType, -Variable, -VariableExpression, -EMPTY, -EQUAL, -NOT, -MULTIPLICATION, -TO_INCLUSIVE, -OR, -MACRO_CALL, -EMPTY_EXPRESSION, -ITEM_STATEMENT, -X_DEBUGGER, -ANY_LIST, -ASSIGNMENT, -TO, -AND, -TRUE_LITERAL, -NEGATION, -INCLUSIVE, -FALSE_LITERAL, -RANGE, -CHAR, -LESS_THAN_OR_EQUAL, -TASK, -ADDITION, -GREATER_THAN_OR_EQUAL, -UNKNOWN, -FROM, -DIVISION, -FULL, -NOT_EQUAL, -LESS_THAN, -GREATER_THAN, -SUBTRACTION, -}; - -#[derive(Debug)] -pub struct ObjectStore { -argument_free_list: std::sync::Mutex>, -argument: Arc>>>>>, -a_wait_free_list: std::sync::Mutex>, -a_wait: Arc>>>>>, -binary_free_list: std::sync::Mutex>, -binary: Arc>>>>>, -block_free_list: std::sync::Mutex>, -block: Arc>>>>>, -body_free_list: std::sync::Mutex>, -body: Arc>>>>>, -boolean_literal_free_list: std::sync::Mutex>, -boolean_literal: Arc>>>>>, -boolean_operator_free_list: std::sync::Mutex>, -boolean_operator: Arc>>>>>, -call_free_list: std::sync::Mutex>, -call: Arc>>>>>, -char_literal_free_list: std::sync::Mutex>, -char_literal: Arc>>>>>, -comparison_free_list: std::sync::Mutex>, -comparison: Arc>>>>>, -data_structure_free_list: std::sync::Mutex>, -data_structure: Arc>>>>>, -dwarf_source_file_free_list: std::sync::Mutex>, -dwarf_source_file: Arc>>>>>, -enum_field_free_list: std::sync::Mutex>, -enum_field: Arc>>>>>, -enum_generic_free_list: std::sync::Mutex>, -enum_generic: Arc>>>>>, -enum_generic_type_free_list: std::sync::Mutex>, -enum_generic_type: Arc>>>>>, -enumeration_free_list: std::sync::Mutex>, -enumeration: Arc>>>>>, -enumeration_id_by_name: Arc>>, -expression_free_list: std::sync::Mutex>, -expression: Arc>>>>>, -expression_bit_free_list: std::sync::Mutex>, -expression_bit: Arc>>>>>, -expression_statement_free_list: std::sync::Mutex>, -expression_statement: Arc>>>>>, -external_implementation_free_list: std::sync::Mutex>, -external_implementation: Arc>>>>>, -field_free_list: std::sync::Mutex>, -field: Arc>>>>>, -field_id_by_name: Arc>>, -field_access_free_list: std::sync::Mutex>, -field_access: Arc>>>>>, -field_access_target_free_list: std::sync::Mutex>, -field_access_target: Arc>>>>>, -field_expression_free_list: std::sync::Mutex>, -field_expression: Arc>>>>>, -float_literal_free_list: std::sync::Mutex>, -float_literal: Arc>>>>>, -for_loop_free_list: std::sync::Mutex>, -for_loop: Arc>>>>>, -format_bit_free_list: std::sync::Mutex>, -format_bit: Arc>>>>>, -format_string_free_list: std::sync::Mutex>, -format_string: Arc>>>>>, -func_generic_free_list: std::sync::Mutex>, -func_generic: Arc>>>>>, -function_free_list: std::sync::Mutex>, -function: Arc>>>>>, -function_id_by_name: Arc>>, -function_call_free_list: std::sync::Mutex>, -function_call: Arc>>>>>, -x_future_free_list: std::sync::Mutex>, -x_future: Arc>>>>>, -grouped_free_list: std::sync::Mutex>, -grouped: Arc>>>>>, -halt_and_catch_fire_free_list: std::sync::Mutex>, -halt_and_catch_fire: Arc>>>>>, -x_if_free_list: std::sync::Mutex>, -x_if: Arc>>>>>, -implementation_block_free_list: std::sync::Mutex>, -implementation_block: Arc>>>>>, -import_free_list: std::sync::Mutex>, -import: Arc>>>>>, -index_free_list: std::sync::Mutex>, -index: Arc>>>>>, -integer_literal_free_list: std::sync::Mutex>, -integer_literal: Arc>>>>>, -item_free_list: std::sync::Mutex>, -item: Arc>>>>>, -lambda_free_list: std::sync::Mutex>, -lambda: Arc>>>>>, -lambda_parameter_free_list: std::sync::Mutex>, -lambda_parameter: Arc>>>>>, -let_statement_free_list: std::sync::Mutex>, -let_statement: Arc>>>>>, -list_free_list: std::sync::Mutex>, -list: Arc>>>>>, -list_element_free_list: std::sync::Mutex>, -list_element: Arc>>>>>, -list_expression_free_list: std::sync::Mutex>, -list_expression: Arc>>>>>, -literal_free_list: std::sync::Mutex>, -literal: Arc>>>>>, -local_variable_free_list: std::sync::Mutex>, -local_variable: Arc>>>>>, -x_macro_free_list: std::sync::Mutex>, -x_macro: Arc>>>>>, -map_free_list: std::sync::Mutex>, -map: Arc>>>>>, -map_element_free_list: std::sync::Mutex>, -map_element: Arc>>>>>, -map_expression_free_list: std::sync::Mutex>, -map_expression: Arc>>>>>, -x_match_free_list: std::sync::Mutex>, -x_match: Arc>>>>>, -method_call_free_list: std::sync::Mutex>, -method_call: Arc>>>>>, -named_field_expression_free_list: std::sync::Mutex>, -named_field_expression: Arc>>>>>, -z_object_store_free_list: std::sync::Mutex>, -z_object_store: Arc>>>>>, -z_object_store_id_by_name: Arc>>, -object_wrapper_free_list: std::sync::Mutex>, -object_wrapper: Arc>>>>>, -operator_free_list: std::sync::Mutex>, -operator: Arc>>>>>, -parameter_free_list: std::sync::Mutex>, -parameter: Arc>>>>>, -x_path_free_list: std::sync::Mutex>, -x_path: Arc>>>>>, -path_element_free_list: std::sync::Mutex>, -path_element: Arc>>>>>, -pattern_free_list: std::sync::Mutex>, -pattern: Arc>>>>>, -x_plugin_free_list: std::sync::Mutex>, -x_plugin: Arc>>>>>, -x_plugin_id_by_name: Arc>>, -x_print_free_list: std::sync::Mutex>, -x_print: Arc>>>>>, -range_expression_free_list: std::sync::Mutex>, -range_expression: Arc>>>>>, -result_statement_free_list: std::sync::Mutex>, -result_statement: Arc>>>>>, -x_return_free_list: std::sync::Mutex>, -x_return: Arc>>>>>, -span_free_list: std::sync::Mutex>, -span: Arc>>>>>, -statement_free_list: std::sync::Mutex>, -statement: Arc>>>>>, -static_method_call_free_list: std::sync::Mutex>, -static_method_call: Arc>>>>>, -string_bit_free_list: std::sync::Mutex>, -string_bit: Arc>>>>>, -string_literal_free_list: std::sync::Mutex>, -string_literal: Arc>>>>>, -woog_struct_free_list: std::sync::Mutex>, -woog_struct: Arc>>>>>, -woog_struct_id_by_name: Arc>>, -struct_expression_free_list: std::sync::Mutex>, -struct_expression: Arc>>>>>, -struct_field_free_list: std::sync::Mutex>, -struct_field: Arc>>>>>, -struct_generic_free_list: std::sync::Mutex>, -struct_generic: Arc>>>>>, -tuple_field_free_list: std::sync::Mutex>, -tuple_field: Arc>>>>>, -type_cast_free_list: std::sync::Mutex>, -type_cast: Arc>>>>>, -unary_free_list: std::sync::Mutex>, -unary: Arc>>>>>, -unit_free_list: std::sync::Mutex>, -unit: Arc>>>>>, -unnamed_field_expression_free_list: std::sync::Mutex>, -unnamed_field_expression: Arc>>>>>, -x_value_free_list: std::sync::Mutex>, -x_value: Arc>>>>>, -value_type_free_list: std::sync::Mutex>, -value_type: Arc>>>>>, -variable_free_list: std::sync::Mutex>, -variable: Arc>>>>>, -variable_expression_free_list: std::sync::Mutex>, -variable_expression: Arc>>>>>, -} - -impl Clone for ObjectStore { -fn clone(&self) -> Self { -ObjectStore { -argument_free_list: Mutex::new(self.argument_free_list.lock().unwrap().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: Arc::new(RwLock::new(self.a_wait.read().unwrap().clone())), -binary_free_list: Mutex::new(self.binary_free_list.lock().unwrap().clone()), -binary: Arc::new(RwLock::new(self.binary.read().unwrap().clone())), -block_free_list: Mutex::new(self.block_free_list.lock().unwrap().clone()), -block: Arc::new(RwLock::new(self.block.read().unwrap().clone())), -body_free_list: Mutex::new(self.body_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.boolean_operator.read().unwrap().clone())), -call_free_list: Mutex::new(self.call_free_list.lock().unwrap().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: Arc::new(RwLock::new(self.char_literal.read().unwrap().clone())), -comparison_free_list: Mutex::new(self.comparison_free_list.lock().unwrap().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: 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: 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: 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: Arc::new(RwLock::new(self.enum_generic.read().unwrap().clone())), -enum_generic_type_free_list: Mutex::new(self.enum_generic_type_free_list.lock().unwrap().clone()), -enum_generic_type: Arc::new(RwLock::new(self.enum_generic_type.read().unwrap().clone())), -enumeration_free_list: Mutex::new(self.enumeration_free_list.lock().unwrap().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: 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: 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: 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: Arc::new(RwLock::new(self.external_implementation.read().unwrap().clone())), -field_free_list: Mutex::new(self.field_free_list.lock().unwrap().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: 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: 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: 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: 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: 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: 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: 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: Arc::new(RwLock::new(self.func_generic.read().unwrap().clone())), -function_free_list: Mutex::new(self.function_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.x_future.read().unwrap().clone())), -grouped_free_list: Mutex::new(self.grouped_free_list.lock().unwrap().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: 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: 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: Arc::new(RwLock::new(self.implementation_block.read().unwrap().clone())), -import_free_list: Mutex::new(self.import_free_list.lock().unwrap().clone()), -import: Arc::new(RwLock::new(self.import.read().unwrap().clone())), -index_free_list: Mutex::new(self.index_free_list.lock().unwrap().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: Arc::new(RwLock::new(self.integer_literal.read().unwrap().clone())), -item_free_list: Mutex::new(self.item_free_list.lock().unwrap().clone()), -item: Arc::new(RwLock::new(self.item.read().unwrap().clone())), -lambda_free_list: Mutex::new(self.lambda_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.let_statement.read().unwrap().clone())), -list_free_list: Mutex::new(self.list_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.list_expression.read().unwrap().clone())), -literal_free_list: Mutex::new(self.literal_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.x_macro.read().unwrap().clone())), -map_free_list: Mutex::new(self.map_free_list.lock().unwrap().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: 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: 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: 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: 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: 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: 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: Arc::new(RwLock::new(self.object_wrapper.read().unwrap().clone())), -operator_free_list: Mutex::new(self.operator_free_list.lock().unwrap().clone()), -operator: Arc::new(RwLock::new(self.operator.read().unwrap().clone())), -parameter_free_list: Mutex::new(self.parameter_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.path_element.read().unwrap().clone())), -pattern_free_list: Mutex::new(self.pattern_free_list.lock().unwrap().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: 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: 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: 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: 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: Arc::new(RwLock::new(self.x_return.read().unwrap().clone())), -span_free_list: Mutex::new(self.span_free_list.lock().unwrap().clone()), -span: Arc::new(RwLock::new(self.span.read().unwrap().clone())), -statement_free_list: Mutex::new(self.statement_free_list.lock().unwrap().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: 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: 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: 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: 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: 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: 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: 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: 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: Arc::new(RwLock::new(self.type_cast.read().unwrap().clone())), -unary_free_list: Mutex::new(self.unary_free_list.lock().unwrap().clone()), -unary: Arc::new(RwLock::new(self.unary.read().unwrap().clone())), -unit_free_list: Mutex::new(self.unit_free_list.lock().unwrap().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: 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: 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: Arc::new(RwLock::new(self.value_type.read().unwrap().clone())), -variable_free_list: Mutex::new(self.variable_free_list.lock().unwrap().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: Arc::new(RwLock::new(self.variable_expression.read().unwrap().clone())), -} -} -} -impl ObjectStore { -pub fn merge(&mut self, other: &ObjectStore) { - - if self.argument.read().unwrap().len() != other.argument.read().unwrap().len() { - let mut argument = self.argument.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.a_wait.read().unwrap().len() != other.a_wait.read().unwrap().len() { - let mut a_wait = self.a_wait.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.binary.read().unwrap().len() != other.binary.read().unwrap().len() { - let mut binary = self.binary.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.block.read().unwrap().len() != other.block.read().unwrap().len() { - let mut block = self.block.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.body.read().unwrap().len() != other.body.read().unwrap().len() { - let mut body = self.body.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.boolean_literal.read().unwrap().len() != other.boolean_literal.read().unwrap().len() { - let mut boolean_literal = self.boolean_literal.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.boolean_operator.read().unwrap().len() != other.boolean_operator.read().unwrap().len() { - let mut boolean_operator = self.boolean_operator.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.call.read().unwrap().len() != other.call.read().unwrap().len() { - let mut call = self.call.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.char_literal.read().unwrap().len() != other.char_literal.read().unwrap().len() { - let mut char_literal = self.char_literal.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.comparison.read().unwrap().len() != other.comparison.read().unwrap().len() { - let mut comparison = self.comparison.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.data_structure.read().unwrap().len() != other.data_structure.read().unwrap().len() { - let mut data_structure = self.data_structure.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.dwarf_source_file.read().unwrap().len() != other.dwarf_source_file.read().unwrap().len() { - let mut dwarf_source_file = self.dwarf_source_file.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.enum_field.read().unwrap().len() != other.enum_field.read().unwrap().len() { - let mut enum_field = self.enum_field.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.enum_generic.read().unwrap().len() != other.enum_generic.read().unwrap().len() { - let mut enum_generic = self.enum_generic.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.enum_generic_type.read().unwrap().len() != other.enum_generic_type.read().unwrap().len() { - let mut enum_generic_type = self.enum_generic_type.write().unwrap();kts - other.enum_generic_type.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. - if enum_generic_type - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_generic_type.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - enum_generic_type.push(Some(x.clone())); - } - } - }); - } - - - if self.enumeration.read().unwrap().len() != other.enumeration.read().unwrap().len() { - let mut enumeration = self.enumeration.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.expression.read().unwrap().len() != other.expression.read().unwrap().len() { - let mut expression = self.expression.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.expression_bit.read().unwrap().len() != other.expression_bit.read().unwrap().len() { - let mut expression_bit = self.expression_bit.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.expression_statement.read().unwrap().len() != other.expression_statement.read().unwrap().len() { - let mut expression_statement = self.expression_statement.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.external_implementation.read().unwrap().len() != other.external_implementation.read().unwrap().len() { - let mut external_implementation = self.external_implementation.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.field.read().unwrap().len() != other.field.read().unwrap().len() { - let mut field = self.field.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.field_access.read().unwrap().len() != other.field_access.read().unwrap().len() { - let mut field_access = self.field_access.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.field_access_target.read().unwrap().len() != other.field_access_target.read().unwrap().len() { - let mut field_access_target = self.field_access_target.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.field_expression.read().unwrap().len() != other.field_expression.read().unwrap().len() { - let mut field_expression = self.field_expression.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.float_literal.read().unwrap().len() != other.float_literal.read().unwrap().len() { - let mut float_literal = self.float_literal.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.for_loop.read().unwrap().len() != other.for_loop.read().unwrap().len() { - let mut for_loop = self.for_loop.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.format_bit.read().unwrap().len() != other.format_bit.read().unwrap().len() { - let mut format_bit = self.format_bit.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.format_string.read().unwrap().len() != other.format_string.read().unwrap().len() { - let mut format_string = self.format_string.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.func_generic.read().unwrap().len() != other.func_generic.read().unwrap().len() { - let mut func_generic = self.func_generic.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.function.read().unwrap().len() != other.function.read().unwrap().len() { - let mut function = self.function.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.function_call.read().unwrap().len() != other.function_call.read().unwrap().len() { - let mut function_call = self.function_call.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.x_future.read().unwrap().len() != other.x_future.read().unwrap().len() { - let mut x_future = self.x_future.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.grouped.read().unwrap().len() != other.grouped.read().unwrap().len() { - let mut grouped = self.grouped.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.halt_and_catch_fire.read().unwrap().len() != other.halt_and_catch_fire.read().unwrap().len() { - let mut halt_and_catch_fire = self.halt_and_catch_fire.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.x_if.read().unwrap().len() != other.x_if.read().unwrap().len() { - let mut x_if = self.x_if.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.implementation_block.read().unwrap().len() != other.implementation_block.read().unwrap().len() { - let mut implementation_block = self.implementation_block.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.import.read().unwrap().len() != other.import.read().unwrap().len() { - let mut import = self.import.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.index.read().unwrap().len() != other.index.read().unwrap().len() { - let mut index = self.index.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.integer_literal.read().unwrap().len() != other.integer_literal.read().unwrap().len() { - let mut integer_literal = self.integer_literal.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.item.read().unwrap().len() != other.item.read().unwrap().len() { - let mut item = self.item.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.lambda.read().unwrap().len() != other.lambda.read().unwrap().len() { - let mut lambda = self.lambda.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.lambda_parameter.read().unwrap().len() != other.lambda_parameter.read().unwrap().len() { - let mut lambda_parameter = self.lambda_parameter.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.let_statement.read().unwrap().len() != other.let_statement.read().unwrap().len() { - let mut let_statement = self.let_statement.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.list.read().unwrap().len() != other.list.read().unwrap().len() { - let mut list = self.list.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.list_element.read().unwrap().len() != other.list_element.read().unwrap().len() { - let mut list_element = self.list_element.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.list_expression.read().unwrap().len() != other.list_expression.read().unwrap().len() { - let mut list_expression = self.list_expression.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.literal.read().unwrap().len() != other.literal.read().unwrap().len() { - let mut literal = self.literal.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.local_variable.read().unwrap().len() != other.local_variable.read().unwrap().len() { - let mut local_variable = self.local_variable.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.x_macro.read().unwrap().len() != other.x_macro.read().unwrap().len() { - let mut x_macro = self.x_macro.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.map.read().unwrap().len() != other.map.read().unwrap().len() { - let mut map = self.map.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.map_element.read().unwrap().len() != other.map_element.read().unwrap().len() { - let mut map_element = self.map_element.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.map_expression.read().unwrap().len() != other.map_expression.read().unwrap().len() { - let mut map_expression = self.map_expression.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.x_match.read().unwrap().len() != other.x_match.read().unwrap().len() { - let mut x_match = self.x_match.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.method_call.read().unwrap().len() != other.method_call.read().unwrap().len() { - let mut method_call = self.method_call.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.named_field_expression.read().unwrap().len() != other.named_field_expression.read().unwrap().len() { - let mut named_field_expression = self.named_field_expression.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.z_object_store.read().unwrap().len() != other.z_object_store.read().unwrap().len() { - let mut z_object_store = self.z_object_store.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.object_wrapper.read().unwrap().len() != other.object_wrapper.read().unwrap().len() { - let mut object_wrapper = self.object_wrapper.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.operator.read().unwrap().len() != other.operator.read().unwrap().len() { - let mut operator = self.operator.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.parameter.read().unwrap().len() != other.parameter.read().unwrap().len() { - let mut parameter = self.parameter.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.x_path.read().unwrap().len() != other.x_path.read().unwrap().len() { - let mut x_path = self.x_path.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.path_element.read().unwrap().len() != other.path_element.read().unwrap().len() { - let mut path_element = self.path_element.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.pattern.read().unwrap().len() != other.pattern.read().unwrap().len() { - let mut pattern = self.pattern.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.x_plugin.read().unwrap().len() != other.x_plugin.read().unwrap().len() { - let mut x_plugin = self.x_plugin.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.x_print.read().unwrap().len() != other.x_print.read().unwrap().len() { - let mut x_print = self.x_print.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.range_expression.read().unwrap().len() != other.range_expression.read().unwrap().len() { - let mut range_expression = self.range_expression.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.result_statement.read().unwrap().len() != other.result_statement.read().unwrap().len() { - let mut result_statement = self.result_statement.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.x_return.read().unwrap().len() != other.x_return.read().unwrap().len() { - let mut x_return = self.x_return.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.span.read().unwrap().len() != other.span.read().unwrap().len() { - let mut span = self.span.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.statement.read().unwrap().len() != other.statement.read().unwrap().len() { - let mut statement = self.statement.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.static_method_call.read().unwrap().len() != other.static_method_call.read().unwrap().len() { - let mut static_method_call = self.static_method_call.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.string_bit.read().unwrap().len() != other.string_bit.read().unwrap().len() { - let mut string_bit = self.string_bit.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.string_literal.read().unwrap().len() != other.string_literal.read().unwrap().len() { - let mut string_literal = self.string_literal.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.woog_struct.read().unwrap().len() != other.woog_struct.read().unwrap().len() { - let mut woog_struct = self.woog_struct.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.struct_expression.read().unwrap().len() != other.struct_expression.read().unwrap().len() { - let mut struct_expression = self.struct_expression.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.struct_field.read().unwrap().len() != other.struct_field.read().unwrap().len() { - let mut struct_field = self.struct_field.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.struct_generic.read().unwrap().len() != other.struct_generic.read().unwrap().len() { - let mut struct_generic = self.struct_generic.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.tuple_field.read().unwrap().len() != other.tuple_field.read().unwrap().len() { - let mut tuple_field = self.tuple_field.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.type_cast.read().unwrap().len() != other.type_cast.read().unwrap().len() { - let mut type_cast = self.type_cast.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.unary.read().unwrap().len() != other.unary.read().unwrap().len() { - let mut unary = self.unary.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.unit.read().unwrap().len() != other.unit.read().unwrap().len() { - let mut unit = self.unit.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.unnamed_field_expression.read().unwrap().len() != other.unnamed_field_expression.read().unwrap().len() { - let mut unnamed_field_expression = self.unnamed_field_expression.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.x_value.read().unwrap().len() != other.x_value.read().unwrap().len() { - let mut x_value = self.x_value.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.value_type.read().unwrap().len() != other.value_type.read().unwrap().len() { - let mut value_type = self.value_type.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.variable.read().unwrap().len() != other.variable.read().unwrap().len() { - let mut variable = self.variable.write().unwrap();kts - 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())); - } - } - }); - } - - - if self.variable_expression.read().unwrap().len() != other.variable_expression.read().unwrap().len() { - let mut variable_expression = self.variable_expression.write().unwrap();kts - 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()), -argument: Arc::new(RwLock::new(Vec::new())), -a_wait_free_list: std::sync::Mutex::new(Vec::new()), -a_wait: Arc::new(RwLock::new(Vec::new())), -binary_free_list: std::sync::Mutex::new(Vec::new()), -binary: Arc::new(RwLock::new(Vec::new())), -block_free_list: std::sync::Mutex::new(Vec::new()), -block: Arc::new(RwLock::new(Vec::new())), -body_free_list: std::sync::Mutex::new(Vec::new()), -body: Arc::new(RwLock::new(Vec::new())), -boolean_literal_free_list: std::sync::Mutex::new(Vec::new()), -boolean_literal: Arc::new(RwLock::new(Vec::new())), -boolean_operator_free_list: std::sync::Mutex::new(Vec::new()), -boolean_operator: Arc::new(RwLock::new(Vec::new())), -call_free_list: std::sync::Mutex::new(Vec::new()), -call: Arc::new(RwLock::new(Vec::new())), -char_literal_free_list: std::sync::Mutex::new(Vec::new()), -char_literal: Arc::new(RwLock::new(Vec::new())), -comparison_free_list: std::sync::Mutex::new(Vec::new()), -comparison: Arc::new(RwLock::new(Vec::new())), -data_structure_free_list: std::sync::Mutex::new(Vec::new()), -data_structure: Arc::new(RwLock::new(Vec::new())), -dwarf_source_file_free_list: std::sync::Mutex::new(Vec::new()), -dwarf_source_file: Arc::new(RwLock::new(Vec::new())), -enum_field_free_list: std::sync::Mutex::new(Vec::new()), -enum_field: Arc::new(RwLock::new(Vec::new())), -enum_generic_free_list: std::sync::Mutex::new(Vec::new()), -enum_generic: Arc::new(RwLock::new(Vec::new())), -enum_generic_type_free_list: std::sync::Mutex::new(Vec::new()), -enum_generic_type: Arc::new(RwLock::new(Vec::new())), -enumeration_free_list: std::sync::Mutex::new(Vec::new()), -enumeration: Arc::new(RwLock::new(Vec::new())), -enumeration_id_by_name: Arc::new(RwLock::new(HashMap::default())), -expression_free_list: std::sync::Mutex::new(Vec::new()), -expression: Arc::new(RwLock::new(Vec::new())), -expression_bit_free_list: std::sync::Mutex::new(Vec::new()), -expression_bit: Arc::new(RwLock::new(Vec::new())), -expression_statement_free_list: std::sync::Mutex::new(Vec::new()), -expression_statement: Arc::new(RwLock::new(Vec::new())), -external_implementation_free_list: std::sync::Mutex::new(Vec::new()), -external_implementation: Arc::new(RwLock::new(Vec::new())), -field_free_list: std::sync::Mutex::new(Vec::new()), -field: Arc::new(RwLock::new(Vec::new())), -field_id_by_name: Arc::new(RwLock::new(HashMap::default())), -field_access_free_list: std::sync::Mutex::new(Vec::new()), -field_access: Arc::new(RwLock::new(Vec::new())), -field_access_target_free_list: std::sync::Mutex::new(Vec::new()), -field_access_target: Arc::new(RwLock::new(Vec::new())), -field_expression_free_list: std::sync::Mutex::new(Vec::new()), -field_expression: Arc::new(RwLock::new(Vec::new())), -float_literal_free_list: std::sync::Mutex::new(Vec::new()), -float_literal: Arc::new(RwLock::new(Vec::new())), -for_loop_free_list: std::sync::Mutex::new(Vec::new()), -for_loop: Arc::new(RwLock::new(Vec::new())), -format_bit_free_list: std::sync::Mutex::new(Vec::new()), -format_bit: Arc::new(RwLock::new(Vec::new())), -format_string_free_list: std::sync::Mutex::new(Vec::new()), -format_string: Arc::new(RwLock::new(Vec::new())), -func_generic_free_list: std::sync::Mutex::new(Vec::new()), -func_generic: Arc::new(RwLock::new(Vec::new())), -function_free_list: std::sync::Mutex::new(Vec::new()), -function: Arc::new(RwLock::new(Vec::new())), -function_id_by_name: Arc::new(RwLock::new(HashMap::default())), -function_call_free_list: std::sync::Mutex::new(Vec::new()), -function_call: Arc::new(RwLock::new(Vec::new())), -x_future_free_list: std::sync::Mutex::new(Vec::new()), -x_future: Arc::new(RwLock::new(Vec::new())), -grouped_free_list: std::sync::Mutex::new(Vec::new()), -grouped: Arc::new(RwLock::new(Vec::new())), -halt_and_catch_fire_free_list: std::sync::Mutex::new(Vec::new()), -halt_and_catch_fire: Arc::new(RwLock::new(Vec::new())), -x_if_free_list: std::sync::Mutex::new(Vec::new()), -x_if: Arc::new(RwLock::new(Vec::new())), -implementation_block_free_list: std::sync::Mutex::new(Vec::new()), -implementation_block: Arc::new(RwLock::new(Vec::new())), -import_free_list: std::sync::Mutex::new(Vec::new()), -import: Arc::new(RwLock::new(Vec::new())), -index_free_list: std::sync::Mutex::new(Vec::new()), -index: Arc::new(RwLock::new(Vec::new())), -integer_literal_free_list: std::sync::Mutex::new(Vec::new()), -integer_literal: Arc::new(RwLock::new(Vec::new())), -item_free_list: std::sync::Mutex::new(Vec::new()), -item: Arc::new(RwLock::new(Vec::new())), -lambda_free_list: std::sync::Mutex::new(Vec::new()), -lambda: Arc::new(RwLock::new(Vec::new())), -lambda_parameter_free_list: std::sync::Mutex::new(Vec::new()), -lambda_parameter: Arc::new(RwLock::new(Vec::new())), -let_statement_free_list: std::sync::Mutex::new(Vec::new()), -let_statement: Arc::new(RwLock::new(Vec::new())), -list_free_list: std::sync::Mutex::new(Vec::new()), -list: Arc::new(RwLock::new(Vec::new())), -list_element_free_list: std::sync::Mutex::new(Vec::new()), -list_element: Arc::new(RwLock::new(Vec::new())), -list_expression_free_list: std::sync::Mutex::new(Vec::new()), -list_expression: Arc::new(RwLock::new(Vec::new())), -literal_free_list: std::sync::Mutex::new(Vec::new()), -literal: Arc::new(RwLock::new(Vec::new())), -local_variable_free_list: std::sync::Mutex::new(Vec::new()), -local_variable: Arc::new(RwLock::new(Vec::new())), -x_macro_free_list: std::sync::Mutex::new(Vec::new()), -x_macro: Arc::new(RwLock::new(Vec::new())), -map_free_list: std::sync::Mutex::new(Vec::new()), -map: Arc::new(RwLock::new(Vec::new())), -map_element_free_list: std::sync::Mutex::new(Vec::new()), -map_element: Arc::new(RwLock::new(Vec::new())), -map_expression_free_list: std::sync::Mutex::new(Vec::new()), -map_expression: Arc::new(RwLock::new(Vec::new())), -x_match_free_list: std::sync::Mutex::new(Vec::new()), -x_match: Arc::new(RwLock::new(Vec::new())), -method_call_free_list: std::sync::Mutex::new(Vec::new()), -method_call: Arc::new(RwLock::new(Vec::new())), -named_field_expression_free_list: std::sync::Mutex::new(Vec::new()), -named_field_expression: Arc::new(RwLock::new(Vec::new())), -z_object_store_free_list: std::sync::Mutex::new(Vec::new()), -z_object_store: Arc::new(RwLock::new(Vec::new())), -z_object_store_id_by_name: Arc::new(RwLock::new(HashMap::default())), -object_wrapper_free_list: std::sync::Mutex::new(Vec::new()), -object_wrapper: Arc::new(RwLock::new(Vec::new())), -operator_free_list: std::sync::Mutex::new(Vec::new()), -operator: Arc::new(RwLock::new(Vec::new())), -parameter_free_list: std::sync::Mutex::new(Vec::new()), -parameter: Arc::new(RwLock::new(Vec::new())), -x_path_free_list: std::sync::Mutex::new(Vec::new()), -x_path: Arc::new(RwLock::new(Vec::new())), -path_element_free_list: std::sync::Mutex::new(Vec::new()), -path_element: Arc::new(RwLock::new(Vec::new())), -pattern_free_list: std::sync::Mutex::new(Vec::new()), -pattern: Arc::new(RwLock::new(Vec::new())), -x_plugin_free_list: std::sync::Mutex::new(Vec::new()), -x_plugin: Arc::new(RwLock::new(Vec::new())), -x_plugin_id_by_name: Arc::new(RwLock::new(HashMap::default())), -x_print_free_list: std::sync::Mutex::new(Vec::new()), -x_print: Arc::new(RwLock::new(Vec::new())), -range_expression_free_list: std::sync::Mutex::new(Vec::new()), -range_expression: Arc::new(RwLock::new(Vec::new())), -result_statement_free_list: std::sync::Mutex::new(Vec::new()), -result_statement: Arc::new(RwLock::new(Vec::new())), -x_return_free_list: std::sync::Mutex::new(Vec::new()), -x_return: Arc::new(RwLock::new(Vec::new())), -span_free_list: std::sync::Mutex::new(Vec::new()), -span: Arc::new(RwLock::new(Vec::new())), -statement_free_list: std::sync::Mutex::new(Vec::new()), -statement: Arc::new(RwLock::new(Vec::new())), -static_method_call_free_list: std::sync::Mutex::new(Vec::new()), -static_method_call: Arc::new(RwLock::new(Vec::new())), -string_bit_free_list: std::sync::Mutex::new(Vec::new()), -string_bit: Arc::new(RwLock::new(Vec::new())), -string_literal_free_list: std::sync::Mutex::new(Vec::new()), -string_literal: Arc::new(RwLock::new(Vec::new())), -woog_struct_free_list: std::sync::Mutex::new(Vec::new()), -woog_struct: Arc::new(RwLock::new(Vec::new())), -woog_struct_id_by_name: Arc::new(RwLock::new(HashMap::default())), -struct_expression_free_list: std::sync::Mutex::new(Vec::new()), -struct_expression: Arc::new(RwLock::new(Vec::new())), -struct_field_free_list: std::sync::Mutex::new(Vec::new()), -struct_field: Arc::new(RwLock::new(Vec::new())), -struct_generic_free_list: std::sync::Mutex::new(Vec::new()), -struct_generic: Arc::new(RwLock::new(Vec::new())), -tuple_field_free_list: std::sync::Mutex::new(Vec::new()), -tuple_field: Arc::new(RwLock::new(Vec::new())), -type_cast_free_list: std::sync::Mutex::new(Vec::new()), -type_cast: Arc::new(RwLock::new(Vec::new())), -unary_free_list: std::sync::Mutex::new(Vec::new()), -unary: Arc::new(RwLock::new(Vec::new())), -unit_free_list: std::sync::Mutex::new(Vec::new()), -unit: Arc::new(RwLock::new(Vec::new())), -unnamed_field_expression_free_list: std::sync::Mutex::new(Vec::new()), -unnamed_field_expression: Arc::new(RwLock::new(Vec::new())), -x_value_free_list: std::sync::Mutex::new(Vec::new()), -x_value: Arc::new(RwLock::new(Vec::new())), -value_type_free_list: std::sync::Mutex::new(Vec::new()), -value_type: Arc::new(RwLock::new(Vec::new())), -variable_free_list: std::sync::Mutex::new(Vec::new()), -variable: Arc::new(RwLock::new(Vec::new())), -variable_expression_free_list: std::sync::Mutex::new(Vec::new()), -variable_expression: Arc::new(RwLock::new(Vec::new())), -}; - -// Initialize Singleton Subtypes -// 💥 Look at how beautiful this generated code is for super/sub-type graphs! -// I remember having a bit of a struggle making it work. It's recursive, with -// a lot of special cases, and I think it calls other recursive functions...💥 - -store -} - -// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"v2::lu_dog_ndrwlock_vec-object-store-methods"}}} -/// Inter (insert) [`Argument`] into the store. -/// -#[inline] -pub fn inter_argument(&mut self, argument: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.argument_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.argument.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.argument.write().unwrap().push(None); -_index -}; - -let argument = argument(_index); - -let found = if let Some(argument) = self.argument.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *argument.read().unwrap() -} else { -false -} -}) { -argument.clone() -} else { -None -}; - -if let Some(argument) = found { -tracing::debug!(target: "store", "found duplicate {argument:?}."); -self.argument_free_list.lock().unwrap().push(_index); -argument.clone() -} else { -tracing::debug!(target: "store", "interring {argument:?}."); -self.argument.write().unwrap()[_index] = Some(argument.clone()); -argument -} -} - -/// Exhume (get) [`Argument`] from the store. -/// -#[inline] -pub fn exhume_argument(&self, id: &usize) -> Option>> { -match self.argument.read().unwrap().get(*id) { -Some(argument) => argument.clone(), -None => None -} -} - -/// Exorcise (remove) [`Argument`] from the store. -/// -#[inline] -pub fn exorcise_argument(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising argument slot: {id}."); -let result = self.argument.write().unwrap()[*id].take(); -self.argument_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Argument>`. -/// -#[inline] -pub fn iter_argument(&self) -> impl Iterator>> + '_ { -let len = self.argument.read().unwrap().len(); -(0..len).filter(|i| self.argument.read().unwrap()[*i].is_some()).map(move|i|{self.argument.read().unwrap()[i].as_ref().map(|argument| argument.clone()).unwrap()}) -} - -/// Inter (insert) [`AWait`] into the store. -/// -#[inline] -pub fn inter_a_wait(&mut self, a_wait: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.a_wait_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.a_wait.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.a_wait.write().unwrap().push(None); -_index -}; - -let a_wait = a_wait(_index); - -let found = if let Some(a_wait) = self.a_wait.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *a_wait.read().unwrap() -} else { -false -} -}) { -a_wait.clone() -} else { -None -}; - -if let Some(a_wait) = found { -tracing::debug!(target: "store", "found duplicate {a_wait:?}."); -self.a_wait_free_list.lock().unwrap().push(_index); -a_wait.clone() -} else { -tracing::debug!(target: "store", "interring {a_wait:?}."); -self.a_wait.write().unwrap()[_index] = Some(a_wait.clone()); -a_wait -} -} - -/// Exhume (get) [`AWait`] from the store. -/// -#[inline] -pub fn exhume_a_wait(&self, id: &usize) -> Option>> { -match self.a_wait.read().unwrap().get(*id) { -Some(a_wait) => a_wait.clone(), -None => None -} -} - -/// Exorcise (remove) [`AWait`] from the store. -/// -#[inline] -pub fn exorcise_a_wait(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising a_wait slot: {id}."); -let result = self.a_wait.write().unwrap()[*id].take(); -self.a_wait_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, AWait>`. -/// -#[inline] -pub fn iter_a_wait(&self) -> impl Iterator>> + '_ { -let len = self.a_wait.read().unwrap().len(); -(0..len).filter(|i| self.a_wait.read().unwrap()[*i].is_some()).map(move|i|{self.a_wait.read().unwrap()[i].as_ref().map(|a_wait| a_wait.clone()).unwrap()}) -} - -/// Inter (insert) [`Binary`] into the store. -/// -#[inline] -pub fn inter_binary(&mut self, binary: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.binary_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.binary.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.binary.write().unwrap().push(None); -_index -}; - -let binary = binary(_index); - -let found = if let Some(binary) = self.binary.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *binary.read().unwrap() -} else { -false -} -}) { -binary.clone() -} else { -None -}; - -if let Some(binary) = found { -tracing::debug!(target: "store", "found duplicate {binary:?}."); -self.binary_free_list.lock().unwrap().push(_index); -binary.clone() -} else { -tracing::debug!(target: "store", "interring {binary:?}."); -self.binary.write().unwrap()[_index] = Some(binary.clone()); -binary -} -} - -/// Exhume (get) [`Binary`] from the store. -/// -#[inline] -pub fn exhume_binary(&self, id: &usize) -> Option>> { -match self.binary.read().unwrap().get(*id) { -Some(binary) => binary.clone(), -None => None -} -} - -/// Exorcise (remove) [`Binary`] from the store. -/// -#[inline] -pub fn exorcise_binary(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising binary slot: {id}."); -let result = self.binary.write().unwrap()[*id].take(); -self.binary_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Binary>`. -/// -#[inline] -pub fn iter_binary(&self) -> impl Iterator>> + '_ { -let len = self.binary.read().unwrap().len(); -(0..len).filter(|i| self.binary.read().unwrap()[*i].is_some()).map(move|i|{self.binary.read().unwrap()[i].as_ref().map(|binary| binary.clone()).unwrap()}) -} - -/// Inter (insert) [`Block`] into the store. -/// -#[inline] -pub fn inter_block(&mut self, block: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.block_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.block.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.block.write().unwrap().push(None); -_index -}; - -let block = block(_index); - -let found = if let Some(block) = self.block.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *block.read().unwrap() -} else { -false -} -}) { -block.clone() -} else { -None -}; - -if let Some(block) = found { -tracing::debug!(target: "store", "found duplicate {block:?}."); -self.block_free_list.lock().unwrap().push(_index); -block.clone() -} else { -tracing::debug!(target: "store", "interring {block:?}."); -self.block.write().unwrap()[_index] = Some(block.clone()); -block -} -} - -/// Exhume (get) [`Block`] from the store. -/// -#[inline] -pub fn exhume_block(&self, id: &usize) -> Option>> { -match self.block.read().unwrap().get(*id) { -Some(block) => block.clone(), -None => None -} -} - -/// Exorcise (remove) [`Block`] from the store. -/// -#[inline] -pub fn exorcise_block(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising block slot: {id}."); -let result = self.block.write().unwrap()[*id].take(); -self.block_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Block>`. -/// -#[inline] -pub fn iter_block(&self) -> impl Iterator>> + '_ { -let len = self.block.read().unwrap().len(); -(0..len).filter(|i| self.block.read().unwrap()[*i].is_some()).map(move|i|{self.block.read().unwrap()[i].as_ref().map(|block| block.clone()).unwrap()}) -} - -/// Inter (insert) [`Body`] into the store. -/// -#[inline] -pub fn inter_body(&mut self, body: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.body_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.body.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.body.write().unwrap().push(None); -_index -}; - -let body = body(_index); - -let found = if let Some(body) = self.body.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *body.read().unwrap() -} else { -false -} -}) { -body.clone() -} else { -None -}; - -if let Some(body) = found { -tracing::debug!(target: "store", "found duplicate {body:?}."); -self.body_free_list.lock().unwrap().push(_index); -body.clone() -} else { -tracing::debug!(target: "store", "interring {body:?}."); -self.body.write().unwrap()[_index] = Some(body.clone()); -body -} -} - -/// Exhume (get) [`Body`] from the store. -/// -#[inline] -pub fn exhume_body(&self, id: &usize) -> Option>> { -match self.body.read().unwrap().get(*id) { -Some(body) => body.clone(), -None => None -} -} - -/// Exorcise (remove) [`Body`] from the store. -/// -#[inline] -pub fn exorcise_body(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising body slot: {id}."); -let result = self.body.write().unwrap()[*id].take(); -self.body_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Body>`. -/// -#[inline] -pub fn iter_body(&self) -> impl Iterator>> + '_ { -let len = self.body.read().unwrap().len(); -(0..len).filter(|i| self.body.read().unwrap()[*i].is_some()).map(move|i|{self.body.read().unwrap()[i].as_ref().map(|body| body.clone()).unwrap()}) -} - -/// Inter (insert) [`BooleanLiteral`] into the store. -/// -#[inline] -pub fn inter_boolean_literal(&mut self, boolean_literal: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.boolean_literal_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.boolean_literal.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.boolean_literal.write().unwrap().push(None); -_index -}; - -let boolean_literal = boolean_literal(_index); - -let found = if let Some(boolean_literal) = self.boolean_literal.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *boolean_literal.read().unwrap() -} else { -false -} -}) { -boolean_literal.clone() -} else { -None -}; - -if let Some(boolean_literal) = found { -tracing::debug!(target: "store", "found duplicate {boolean_literal:?}."); -self.boolean_literal_free_list.lock().unwrap().push(_index); -boolean_literal.clone() -} else { -tracing::debug!(target: "store", "interring {boolean_literal:?}."); -self.boolean_literal.write().unwrap()[_index] = Some(boolean_literal.clone()); -boolean_literal -} -} - -/// Exhume (get) [`BooleanLiteral`] from the store. -/// -#[inline] -pub fn exhume_boolean_literal(&self, id: &usize) -> Option>> { -match self.boolean_literal.read().unwrap().get(*id) { -Some(boolean_literal) => boolean_literal.clone(), -None => None -} -} - -/// Exorcise (remove) [`BooleanLiteral`] from the store. -/// -#[inline] -pub fn exorcise_boolean_literal(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising boolean_literal slot: {id}."); -let result = self.boolean_literal.write().unwrap()[*id].take(); -self.boolean_literal_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, BooleanLiteral>`. -/// -#[inline] -pub fn iter_boolean_literal(&self) -> impl Iterator>> + '_ { -let len = self.boolean_literal.read().unwrap().len(); -(0..len).filter(|i| self.boolean_literal.read().unwrap()[*i].is_some()).map(move|i|{self.boolean_literal.read().unwrap()[i].as_ref().map(|boolean_literal| boolean_literal.clone()).unwrap()}) -} - -/// Inter (insert) [`BooleanOperator`] into the store. -/// -#[inline] -pub fn inter_boolean_operator(&mut self, boolean_operator: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.boolean_operator_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.boolean_operator.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.boolean_operator.write().unwrap().push(None); -_index -}; - -let boolean_operator = boolean_operator(_index); - -let found = if let Some(boolean_operator) = self.boolean_operator.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *boolean_operator.read().unwrap() -} else { -false -} -}) { -boolean_operator.clone() -} else { -None -}; - -if let Some(boolean_operator) = found { -tracing::debug!(target: "store", "found duplicate {boolean_operator:?}."); -self.boolean_operator_free_list.lock().unwrap().push(_index); -boolean_operator.clone() -} else { -tracing::debug!(target: "store", "interring {boolean_operator:?}."); -self.boolean_operator.write().unwrap()[_index] = Some(boolean_operator.clone()); -boolean_operator -} -} - -/// Exhume (get) [`BooleanOperator`] from the store. -/// -#[inline] -pub fn exhume_boolean_operator(&self, id: &usize) -> Option>> { -match self.boolean_operator.read().unwrap().get(*id) { -Some(boolean_operator) => boolean_operator.clone(), -None => None -} -} - -/// Exorcise (remove) [`BooleanOperator`] from the store. -/// -#[inline] -pub fn exorcise_boolean_operator(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising boolean_operator slot: {id}."); -let result = self.boolean_operator.write().unwrap()[*id].take(); -self.boolean_operator_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, BooleanOperator>`. -/// -#[inline] -pub fn iter_boolean_operator(&self) -> impl Iterator>> + '_ { -let len = self.boolean_operator.read().unwrap().len(); -(0..len).filter(|i| self.boolean_operator.read().unwrap()[*i].is_some()).map(move|i|{self.boolean_operator.read().unwrap()[i].as_ref().map(|boolean_operator| boolean_operator.clone()).unwrap()}) -} - -/// Inter (insert) [`Call`] into the store. -/// -#[inline] -pub fn inter_call(&mut self, call: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.call_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.call.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.call.write().unwrap().push(None); -_index -}; - -let call = call(_index); - -let found = if let Some(call) = self.call.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *call.read().unwrap() -} else { -false -} -}) { -call.clone() -} else { -None -}; - -if let Some(call) = found { -tracing::debug!(target: "store", "found duplicate {call:?}."); -self.call_free_list.lock().unwrap().push(_index); -call.clone() -} else { -tracing::debug!(target: "store", "interring {call:?}."); -self.call.write().unwrap()[_index] = Some(call.clone()); -call -} -} - -/// Exhume (get) [`Call`] from the store. -/// -#[inline] -pub fn exhume_call(&self, id: &usize) -> Option>> { -match self.call.read().unwrap().get(*id) { -Some(call) => call.clone(), -None => None -} -} - -/// Exorcise (remove) [`Call`] from the store. -/// -#[inline] -pub fn exorcise_call(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising call slot: {id}."); -let result = self.call.write().unwrap()[*id].take(); -self.call_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Call>`. -/// -#[inline] -pub fn iter_call(&self) -> impl Iterator>> + '_ { -let len = self.call.read().unwrap().len(); -(0..len).filter(|i| self.call.read().unwrap()[*i].is_some()).map(move|i|{self.call.read().unwrap()[i].as_ref().map(|call| call.clone()).unwrap()}) -} - -/// Inter (insert) [`CharLiteral`] into the store. -/// -#[inline] -pub fn inter_char_literal(&mut self, char_literal: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.char_literal_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.char_literal.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.char_literal.write().unwrap().push(None); -_index -}; - -let char_literal = char_literal(_index); - -let found = if let Some(char_literal) = self.char_literal.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *char_literal.read().unwrap() -} else { -false -} -}) { -char_literal.clone() -} else { -None -}; - -if let Some(char_literal) = found { -tracing::debug!(target: "store", "found duplicate {char_literal:?}."); -self.char_literal_free_list.lock().unwrap().push(_index); -char_literal.clone() -} else { -tracing::debug!(target: "store", "interring {char_literal:?}."); -self.char_literal.write().unwrap()[_index] = Some(char_literal.clone()); -char_literal -} -} - -/// Exhume (get) [`CharLiteral`] from the store. -/// -#[inline] -pub fn exhume_char_literal(&self, id: &usize) -> Option>> { -match self.char_literal.read().unwrap().get(*id) { -Some(char_literal) => char_literal.clone(), -None => None -} -} - -/// Exorcise (remove) [`CharLiteral`] from the store. -/// -#[inline] -pub fn exorcise_char_literal(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising char_literal slot: {id}."); -let result = self.char_literal.write().unwrap()[*id].take(); -self.char_literal_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, CharLiteral>`. -/// -#[inline] -pub fn iter_char_literal(&self) -> impl Iterator>> + '_ { -let len = self.char_literal.read().unwrap().len(); -(0..len).filter(|i| self.char_literal.read().unwrap()[*i].is_some()).map(move|i|{self.char_literal.read().unwrap()[i].as_ref().map(|char_literal| char_literal.clone()).unwrap()}) -} - -/// Inter (insert) [`Comparison`] into the store. -/// -#[inline] -pub fn inter_comparison(&mut self, comparison: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.comparison_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.comparison.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.comparison.write().unwrap().push(None); -_index -}; - -let comparison = comparison(_index); - -let found = if let Some(comparison) = self.comparison.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *comparison.read().unwrap() -} else { -false -} -}) { -comparison.clone() -} else { -None -}; - -if let Some(comparison) = found { -tracing::debug!(target: "store", "found duplicate {comparison:?}."); -self.comparison_free_list.lock().unwrap().push(_index); -comparison.clone() -} else { -tracing::debug!(target: "store", "interring {comparison:?}."); -self.comparison.write().unwrap()[_index] = Some(comparison.clone()); -comparison -} -} - -/// Exhume (get) [`Comparison`] from the store. -/// -#[inline] -pub fn exhume_comparison(&self, id: &usize) -> Option>> { -match self.comparison.read().unwrap().get(*id) { -Some(comparison) => comparison.clone(), -None => None -} -} - -/// Exorcise (remove) [`Comparison`] from the store. -/// -#[inline] -pub fn exorcise_comparison(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising comparison slot: {id}."); -let result = self.comparison.write().unwrap()[*id].take(); -self.comparison_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Comparison>`. -/// -#[inline] -pub fn iter_comparison(&self) -> impl Iterator>> + '_ { -let len = self.comparison.read().unwrap().len(); -(0..len).filter(|i| self.comparison.read().unwrap()[*i].is_some()).map(move|i|{self.comparison.read().unwrap()[i].as_ref().map(|comparison| comparison.clone()).unwrap()}) -} - -/// Inter (insert) [`DataStructure`] into the store. -/// -#[inline] -pub fn inter_data_structure(&mut self, data_structure: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.data_structure_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.data_structure.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.data_structure.write().unwrap().push(None); -_index -}; - -let data_structure = data_structure(_index); - -let found = if let Some(data_structure) = self.data_structure.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *data_structure.read().unwrap() -} else { -false -} -}) { -data_structure.clone() -} else { -None -}; - -if let Some(data_structure) = found { -tracing::debug!(target: "store", "found duplicate {data_structure:?}."); -self.data_structure_free_list.lock().unwrap().push(_index); -data_structure.clone() -} else { -tracing::debug!(target: "store", "interring {data_structure:?}."); -self.data_structure.write().unwrap()[_index] = Some(data_structure.clone()); -data_structure -} -} - -/// Exhume (get) [`DataStructure`] from the store. -/// -#[inline] -pub fn exhume_data_structure(&self, id: &usize) -> Option>> { -match self.data_structure.read().unwrap().get(*id) { -Some(data_structure) => data_structure.clone(), -None => None -} -} - -/// Exorcise (remove) [`DataStructure`] from the store. -/// -#[inline] -pub fn exorcise_data_structure(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising data_structure slot: {id}."); -let result = self.data_structure.write().unwrap()[*id].take(); -self.data_structure_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, DataStructure>`. -/// -#[inline] -pub fn iter_data_structure(&self) -> impl Iterator>> + '_ { -let len = self.data_structure.read().unwrap().len(); -(0..len).filter(|i| self.data_structure.read().unwrap()[*i].is_some()).map(move|i|{self.data_structure.read().unwrap()[i].as_ref().map(|data_structure| data_structure.clone()).unwrap()}) -} - -/// Inter (insert) [`DwarfSourceFile`] into the store. -/// -#[inline] -pub fn inter_dwarf_source_file(&mut self, dwarf_source_file: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.dwarf_source_file_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.dwarf_source_file.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.dwarf_source_file.write().unwrap().push(None); -_index -}; - -let dwarf_source_file = dwarf_source_file(_index); - -let found = if let Some(dwarf_source_file) = self.dwarf_source_file.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *dwarf_source_file.read().unwrap() -} else { -false -} -}) { -dwarf_source_file.clone() -} else { -None -}; - -if let Some(dwarf_source_file) = found { -tracing::debug!(target: "store", "found duplicate {dwarf_source_file:?}."); -self.dwarf_source_file_free_list.lock().unwrap().push(_index); -dwarf_source_file.clone() -} else { -tracing::debug!(target: "store", "interring {dwarf_source_file:?}."); -self.dwarf_source_file.write().unwrap()[_index] = Some(dwarf_source_file.clone()); -dwarf_source_file -} -} - -/// Exhume (get) [`DwarfSourceFile`] from the store. -/// -#[inline] -pub fn exhume_dwarf_source_file(&self, id: &usize) -> Option>> { -match self.dwarf_source_file.read().unwrap().get(*id) { -Some(dwarf_source_file) => dwarf_source_file.clone(), -None => None -} -} - -/// Exorcise (remove) [`DwarfSourceFile`] from the store. -/// -#[inline] -pub fn exorcise_dwarf_source_file(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising dwarf_source_file slot: {id}."); -let result = self.dwarf_source_file.write().unwrap()[*id].take(); -self.dwarf_source_file_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, DwarfSourceFile>`. -/// -#[inline] -pub fn iter_dwarf_source_file(&self) -> impl Iterator>> + '_ { -let len = self.dwarf_source_file.read().unwrap().len(); -(0..len).filter(|i| self.dwarf_source_file.read().unwrap()[*i].is_some()).map(move|i|{self.dwarf_source_file.read().unwrap()[i].as_ref().map(|dwarf_source_file| dwarf_source_file.clone()).unwrap()}) -} - -/// Inter (insert) [`EnumField`] into the store. -/// -#[inline] -pub fn inter_enum_field(&mut self, enum_field: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.enum_field_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.enum_field.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.enum_field.write().unwrap().push(None); -_index -}; - -let enum_field = enum_field(_index); - -let found = if let Some(enum_field) = self.enum_field.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *enum_field.read().unwrap() -} else { -false -} -}) { -enum_field.clone() -} else { -None -}; - -if let Some(enum_field) = found { -tracing::debug!(target: "store", "found duplicate {enum_field:?}."); -self.enum_field_free_list.lock().unwrap().push(_index); -enum_field.clone() -} else { -tracing::debug!(target: "store", "interring {enum_field:?}."); -self.enum_field.write().unwrap()[_index] = Some(enum_field.clone()); -enum_field -} -} - -/// Exhume (get) [`EnumField`] from the store. -/// -#[inline] -pub fn exhume_enum_field(&self, id: &usize) -> Option>> { -match self.enum_field.read().unwrap().get(*id) { -Some(enum_field) => enum_field.clone(), -None => None -} -} - -/// Exorcise (remove) [`EnumField`] from the store. -/// -#[inline] -pub fn exorcise_enum_field(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising enum_field slot: {id}."); -let result = self.enum_field.write().unwrap()[*id].take(); -self.enum_field_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, EnumField>`. -/// -#[inline] -pub fn iter_enum_field(&self) -> impl Iterator>> + '_ { -let len = self.enum_field.read().unwrap().len(); -(0..len).filter(|i| self.enum_field.read().unwrap()[*i].is_some()).map(move|i|{self.enum_field.read().unwrap()[i].as_ref().map(|enum_field| enum_field.clone()).unwrap()}) -} - -/// Inter (insert) [`EnumGeneric`] into the store. -/// -#[inline] -pub fn inter_enum_generic(&mut self, enum_generic: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.enum_generic_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.enum_generic.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.enum_generic.write().unwrap().push(None); -_index -}; - -let enum_generic = enum_generic(_index); - -let found = if let Some(enum_generic) = self.enum_generic.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *enum_generic.read().unwrap() -} else { -false -} -}) { -enum_generic.clone() -} else { -None -}; - -if let Some(enum_generic) = found { -tracing::debug!(target: "store", "found duplicate {enum_generic:?}."); -self.enum_generic_free_list.lock().unwrap().push(_index); -enum_generic.clone() -} else { -tracing::debug!(target: "store", "interring {enum_generic:?}."); -self.enum_generic.write().unwrap()[_index] = Some(enum_generic.clone()); -enum_generic -} -} - -/// Exhume (get) [`EnumGeneric`] from the store. -/// -#[inline] -pub fn exhume_enum_generic(&self, id: &usize) -> Option>> { -match self.enum_generic.read().unwrap().get(*id) { -Some(enum_generic) => enum_generic.clone(), -None => None -} -} - -/// Exorcise (remove) [`EnumGeneric`] from the store. -/// -#[inline] -pub fn exorcise_enum_generic(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising enum_generic slot: {id}."); -let result = self.enum_generic.write().unwrap()[*id].take(); -self.enum_generic_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, EnumGeneric>`. -/// -#[inline] -pub fn iter_enum_generic(&self) -> impl Iterator>> + '_ { -let len = self.enum_generic.read().unwrap().len(); -(0..len).filter(|i| self.enum_generic.read().unwrap()[*i].is_some()).map(move|i|{self.enum_generic.read().unwrap()[i].as_ref().map(|enum_generic| enum_generic.clone()).unwrap()}) -} - -/// Inter (insert) [`EnumGenericType`] into the store. -/// -#[inline] -pub fn inter_enum_generic_type(&mut self, enum_generic_type: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.enum_generic_type_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.enum_generic_type.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.enum_generic_type.write().unwrap().push(None); -_index -}; - -let enum_generic_type = enum_generic_type(_index); - -let found = if let Some(enum_generic_type) = self.enum_generic_type.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *enum_generic_type.read().unwrap() -} else { -false -} -}) { -enum_generic_type.clone() -} else { -None -}; - -if let Some(enum_generic_type) = found { -tracing::debug!(target: "store", "found duplicate {enum_generic_type:?}."); -self.enum_generic_type_free_list.lock().unwrap().push(_index); -enum_generic_type.clone() -} else { -tracing::debug!(target: "store", "interring {enum_generic_type:?}."); -self.enum_generic_type.write().unwrap()[_index] = Some(enum_generic_type.clone()); -enum_generic_type -} -} - -/// Exhume (get) [`EnumGenericType`] from the store. -/// -#[inline] -pub fn exhume_enum_generic_type(&self, id: &usize) -> Option>> { -match self.enum_generic_type.read().unwrap().get(*id) { -Some(enum_generic_type) => enum_generic_type.clone(), -None => None -} -} - -/// Exorcise (remove) [`EnumGenericType`] from the store. -/// -#[inline] -pub fn exorcise_enum_generic_type(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising enum_generic_type slot: {id}."); -let result = self.enum_generic_type.write().unwrap()[*id].take(); -self.enum_generic_type_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, EnumGenericType>`. -/// -#[inline] -pub fn iter_enum_generic_type(&self) -> impl Iterator>> + '_ { -let len = self.enum_generic_type.read().unwrap().len(); -(0..len).filter(|i| self.enum_generic_type.read().unwrap()[*i].is_some()).map(move|i|{self.enum_generic_type.read().unwrap()[i].as_ref().map(|enum_generic_type| enum_generic_type.clone()).unwrap()}) -} - -/// Inter (insert) [`Enumeration`] into the store. -/// -#[inline] -pub fn inter_enumeration(&mut self, enumeration: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.enumeration_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.enumeration.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.enumeration.write().unwrap().push(None); -_index -}; - -let enumeration = enumeration(_index); - -let found = if let Some(enumeration) = self.enumeration.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *enumeration.read().unwrap() -} else { -false -} -}) { -enumeration.clone() -} else { -None -}; - -let enumeration = -if let Some(enumeration) = found { -tracing::debug!(target: "store", "found duplicate {enumeration:?}."); -self.enumeration_free_list.lock().unwrap().push(_index); -enumeration.clone() -} else { -tracing::debug!(target: "store", "interring {enumeration:?}."); -self.enumeration.write().unwrap()[_index] = Some(enumeration.clone()); -enumeration -} -; -self.enumeration_id_by_name.write().unwrap().insert(enumeration.read().unwrap().name.to_owned(), enumeration.read().unwrap().id); -enumeration -} - -/// Exhume (get) [`Enumeration`] from the store. -/// -#[inline] -pub fn exhume_enumeration(&self, id: &usize) -> Option>> { -match self.enumeration.read().unwrap().get(*id) { -Some(enumeration) => enumeration.clone(), -None => None -} -} - -/// Exorcise (remove) [`Enumeration`] from the store. -/// -#[inline] -pub fn exorcise_enumeration(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising enumeration slot: {id}."); -let result = self.enumeration.write().unwrap()[*id].take(); -self.enumeration_free_list.lock().unwrap().push(*id); -result -} - -/// Exorcise [`Enumeration`] id from the store by name. -/// -#[inline] -pub fn exhume_enumeration_id_by_name(&self, name: &str) -> Option { -self.enumeration_id_by_name.read().unwrap().get(name).map(|enumeration| *enumeration) -} - -/// Get an iterator over the internal `HashMap<&Uuid, Enumeration>`. -/// -#[inline] -pub fn iter_enumeration(&self) -> impl Iterator>> + '_ { -let len = self.enumeration.read().unwrap().len(); -(0..len).filter(|i| self.enumeration.read().unwrap()[*i].is_some()).map(move|i|{self.enumeration.read().unwrap()[i].as_ref().map(|enumeration| enumeration.clone()).unwrap()}) -} - -/// Inter (insert) [`Expression`] into the store. -/// -#[inline] -pub fn inter_expression(&mut self, expression: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.expression_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.expression.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.expression.write().unwrap().push(None); -_index -}; - -let expression = expression(_index); - -let found = if let Some(expression) = self.expression.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *expression.read().unwrap() -} else { -false -} -}) { -expression.clone() -} else { -None -}; - -if let Some(expression) = found { -tracing::debug!(target: "store", "found duplicate {expression:?}."); -self.expression_free_list.lock().unwrap().push(_index); -expression.clone() -} else { -tracing::debug!(target: "store", "interring {expression:?}."); -self.expression.write().unwrap()[_index] = Some(expression.clone()); -expression -} -} - -/// Exhume (get) [`Expression`] from the store. -/// -#[inline] -pub fn exhume_expression(&self, id: &usize) -> Option>> { -match self.expression.read().unwrap().get(*id) { -Some(expression) => expression.clone(), -None => None -} -} - -/// Exorcise (remove) [`Expression`] from the store. -/// -#[inline] -pub fn exorcise_expression(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising expression slot: {id}."); -let result = self.expression.write().unwrap()[*id].take(); -self.expression_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Expression>`. -/// -#[inline] -pub fn iter_expression(&self) -> impl Iterator>> + '_ { -let len = self.expression.read().unwrap().len(); -(0..len).filter(|i| self.expression.read().unwrap()[*i].is_some()).map(move|i|{self.expression.read().unwrap()[i].as_ref().map(|expression| expression.clone()).unwrap()}) -} - -/// Inter (insert) [`ExpressionBit`] into the store. -/// -#[inline] -pub fn inter_expression_bit(&mut self, expression_bit: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.expression_bit_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.expression_bit.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.expression_bit.write().unwrap().push(None); -_index -}; - -let expression_bit = expression_bit(_index); - -let found = if let Some(expression_bit) = self.expression_bit.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *expression_bit.read().unwrap() -} else { -false -} -}) { -expression_bit.clone() -} else { -None -}; - -if let Some(expression_bit) = found { -tracing::debug!(target: "store", "found duplicate {expression_bit:?}."); -self.expression_bit_free_list.lock().unwrap().push(_index); -expression_bit.clone() -} else { -tracing::debug!(target: "store", "interring {expression_bit:?}."); -self.expression_bit.write().unwrap()[_index] = Some(expression_bit.clone()); -expression_bit -} -} - -/// Exhume (get) [`ExpressionBit`] from the store. -/// -#[inline] -pub fn exhume_expression_bit(&self, id: &usize) -> Option>> { -match self.expression_bit.read().unwrap().get(*id) { -Some(expression_bit) => expression_bit.clone(), -None => None -} -} - -/// Exorcise (remove) [`ExpressionBit`] from the store. -/// -#[inline] -pub fn exorcise_expression_bit(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising expression_bit slot: {id}."); -let result = self.expression_bit.write().unwrap()[*id].take(); -self.expression_bit_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, ExpressionBit>`. -/// -#[inline] -pub fn iter_expression_bit(&self) -> impl Iterator>> + '_ { -let len = self.expression_bit.read().unwrap().len(); -(0..len).filter(|i| self.expression_bit.read().unwrap()[*i].is_some()).map(move|i|{self.expression_bit.read().unwrap()[i].as_ref().map(|expression_bit| expression_bit.clone()).unwrap()}) -} - -/// Inter (insert) [`ExpressionStatement`] into the store. -/// -#[inline] -pub fn inter_expression_statement(&mut self, expression_statement: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.expression_statement_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.expression_statement.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.expression_statement.write().unwrap().push(None); -_index -}; - -let expression_statement = expression_statement(_index); - -let found = if let Some(expression_statement) = self.expression_statement.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *expression_statement.read().unwrap() -} else { -false -} -}) { -expression_statement.clone() -} else { -None -}; - -if let Some(expression_statement) = found { -tracing::debug!(target: "store", "found duplicate {expression_statement:?}."); -self.expression_statement_free_list.lock().unwrap().push(_index); -expression_statement.clone() -} else { -tracing::debug!(target: "store", "interring {expression_statement:?}."); -self.expression_statement.write().unwrap()[_index] = Some(expression_statement.clone()); -expression_statement -} -} - -/// Exhume (get) [`ExpressionStatement`] from the store. -/// -#[inline] -pub fn exhume_expression_statement(&self, id: &usize) -> Option>> { -match self.expression_statement.read().unwrap().get(*id) { -Some(expression_statement) => expression_statement.clone(), -None => None -} -} - -/// Exorcise (remove) [`ExpressionStatement`] from the store. -/// -#[inline] -pub fn exorcise_expression_statement(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising expression_statement slot: {id}."); -let result = self.expression_statement.write().unwrap()[*id].take(); -self.expression_statement_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, ExpressionStatement>`. -/// -#[inline] -pub fn iter_expression_statement(&self) -> impl Iterator>> + '_ { -let len = self.expression_statement.read().unwrap().len(); -(0..len).filter(|i| self.expression_statement.read().unwrap()[*i].is_some()).map(move|i|{self.expression_statement.read().unwrap()[i].as_ref().map(|expression_statement| expression_statement.clone()).unwrap()}) -} - -/// Inter (insert) [`ExternalImplementation`] into the store. -/// -#[inline] -pub fn inter_external_implementation(&mut self, external_implementation: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.external_implementation_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.external_implementation.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.external_implementation.write().unwrap().push(None); -_index -}; - -let external_implementation = external_implementation(_index); - -let found = if let Some(external_implementation) = self.external_implementation.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *external_implementation.read().unwrap() -} else { -false -} -}) { -external_implementation.clone() -} else { -None -}; - -if let Some(external_implementation) = found { -tracing::debug!(target: "store", "found duplicate {external_implementation:?}."); -self.external_implementation_free_list.lock().unwrap().push(_index); -external_implementation.clone() -} else { -tracing::debug!(target: "store", "interring {external_implementation:?}."); -self.external_implementation.write().unwrap()[_index] = Some(external_implementation.clone()); -external_implementation -} -} - -/// Exhume (get) [`ExternalImplementation`] from the store. -/// -#[inline] -pub fn exhume_external_implementation(&self, id: &usize) -> Option>> { -match self.external_implementation.read().unwrap().get(*id) { -Some(external_implementation) => external_implementation.clone(), -None => None -} -} - -/// Exorcise (remove) [`ExternalImplementation`] from the store. -/// -#[inline] -pub fn exorcise_external_implementation(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising external_implementation slot: {id}."); -let result = self.external_implementation.write().unwrap()[*id].take(); -self.external_implementation_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, ExternalImplementation>`. -/// -#[inline] -pub fn iter_external_implementation(&self) -> impl Iterator>> + '_ { -let len = self.external_implementation.read().unwrap().len(); -(0..len).filter(|i| self.external_implementation.read().unwrap()[*i].is_some()).map(move|i|{self.external_implementation.read().unwrap()[i].as_ref().map(|external_implementation| external_implementation.clone()).unwrap()}) -} - -/// Inter (insert) [`Field`] into the store. -/// -#[inline] -pub fn inter_field(&mut self, field: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.field_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.field.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.field.write().unwrap().push(None); -_index -}; - -let field = field(_index); - -let found = if let Some(field) = self.field.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *field.read().unwrap() -} else { -false -} -}) { -field.clone() -} else { -None -}; - -let field = -if let Some(field) = found { -tracing::debug!(target: "store", "found duplicate {field:?}."); -self.field_free_list.lock().unwrap().push(_index); -field.clone() -} else { -tracing::debug!(target: "store", "interring {field:?}."); -self.field.write().unwrap()[_index] = Some(field.clone()); -field -} -; -self.field_id_by_name.write().unwrap().insert(field.read().unwrap().name.to_owned(), field.read().unwrap().id); -field -} - -/// Exhume (get) [`Field`] from the store. -/// -#[inline] -pub fn exhume_field(&self, id: &usize) -> Option>> { -match self.field.read().unwrap().get(*id) { -Some(field) => field.clone(), -None => None -} -} - -/// Exorcise (remove) [`Field`] from the store. -/// -#[inline] -pub fn exorcise_field(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising field slot: {id}."); -let result = self.field.write().unwrap()[*id].take(); -self.field_free_list.lock().unwrap().push(*id); -result -} - -/// Exorcise [`Field`] id from the store by name. -/// -#[inline] -pub fn exhume_field_id_by_name(&self, name: &str) -> Option { -self.field_id_by_name.read().unwrap().get(name).map(|field| *field) -} - -/// Get an iterator over the internal `HashMap<&Uuid, Field>`. -/// -#[inline] -pub fn iter_field(&self) -> impl Iterator>> + '_ { -let len = self.field.read().unwrap().len(); -(0..len).filter(|i| self.field.read().unwrap()[*i].is_some()).map(move|i|{self.field.read().unwrap()[i].as_ref().map(|field| field.clone()).unwrap()}) -} - -/// Inter (insert) [`FieldAccess`] into the store. -/// -#[inline] -pub fn inter_field_access(&mut self, field_access: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.field_access_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.field_access.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.field_access.write().unwrap().push(None); -_index -}; - -let field_access = field_access(_index); - -let found = if let Some(field_access) = self.field_access.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *field_access.read().unwrap() -} else { -false -} -}) { -field_access.clone() -} else { -None -}; - -if let Some(field_access) = found { -tracing::debug!(target: "store", "found duplicate {field_access:?}."); -self.field_access_free_list.lock().unwrap().push(_index); -field_access.clone() -} else { -tracing::debug!(target: "store", "interring {field_access:?}."); -self.field_access.write().unwrap()[_index] = Some(field_access.clone()); -field_access -} -} - -/// Exhume (get) [`FieldAccess`] from the store. -/// -#[inline] -pub fn exhume_field_access(&self, id: &usize) -> Option>> { -match self.field_access.read().unwrap().get(*id) { -Some(field_access) => field_access.clone(), -None => None -} -} - -/// Exorcise (remove) [`FieldAccess`] from the store. -/// -#[inline] -pub fn exorcise_field_access(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising field_access slot: {id}."); -let result = self.field_access.write().unwrap()[*id].take(); -self.field_access_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, FieldAccess>`. -/// -#[inline] -pub fn iter_field_access(&self) -> impl Iterator>> + '_ { -let len = self.field_access.read().unwrap().len(); -(0..len).filter(|i| self.field_access.read().unwrap()[*i].is_some()).map(move|i|{self.field_access.read().unwrap()[i].as_ref().map(|field_access| field_access.clone()).unwrap()}) -} - -/// Inter (insert) [`FieldAccessTarget`] into the store. -/// -#[inline] -pub fn inter_field_access_target(&mut self, field_access_target: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.field_access_target_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.field_access_target.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.field_access_target.write().unwrap().push(None); -_index -}; - -let field_access_target = field_access_target(_index); - -let found = if let Some(field_access_target) = self.field_access_target.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *field_access_target.read().unwrap() -} else { -false -} -}) { -field_access_target.clone() -} else { -None -}; - -if let Some(field_access_target) = found { -tracing::debug!(target: "store", "found duplicate {field_access_target:?}."); -self.field_access_target_free_list.lock().unwrap().push(_index); -field_access_target.clone() -} else { -tracing::debug!(target: "store", "interring {field_access_target:?}."); -self.field_access_target.write().unwrap()[_index] = Some(field_access_target.clone()); -field_access_target -} -} - -/// Exhume (get) [`FieldAccessTarget`] from the store. -/// -#[inline] -pub fn exhume_field_access_target(&self, id: &usize) -> Option>> { -match self.field_access_target.read().unwrap().get(*id) { -Some(field_access_target) => field_access_target.clone(), -None => None -} -} - -/// Exorcise (remove) [`FieldAccessTarget`] from the store. -/// -#[inline] -pub fn exorcise_field_access_target(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising field_access_target slot: {id}."); -let result = self.field_access_target.write().unwrap()[*id].take(); -self.field_access_target_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, FieldAccessTarget>`. -/// -#[inline] -pub fn iter_field_access_target(&self) -> impl Iterator>> + '_ { -let len = self.field_access_target.read().unwrap().len(); -(0..len).filter(|i| self.field_access_target.read().unwrap()[*i].is_some()).map(move|i|{self.field_access_target.read().unwrap()[i].as_ref().map(|field_access_target| field_access_target.clone()).unwrap()}) -} - -/// Inter (insert) [`FieldExpression`] into the store. -/// -#[inline] -pub fn inter_field_expression(&mut self, field_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.field_expression_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.field_expression.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.field_expression.write().unwrap().push(None); -_index -}; - -let field_expression = field_expression(_index); - -let found = if let Some(field_expression) = self.field_expression.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *field_expression.read().unwrap() -} else { -false -} -}) { -field_expression.clone() -} else { -None -}; - -if let Some(field_expression) = found { -tracing::debug!(target: "store", "found duplicate {field_expression:?}."); -self.field_expression_free_list.lock().unwrap().push(_index); -field_expression.clone() -} else { -tracing::debug!(target: "store", "interring {field_expression:?}."); -self.field_expression.write().unwrap()[_index] = Some(field_expression.clone()); -field_expression -} -} - -/// Exhume (get) [`FieldExpression`] from the store. -/// -#[inline] -pub fn exhume_field_expression(&self, id: &usize) -> Option>> { -match self.field_expression.read().unwrap().get(*id) { -Some(field_expression) => field_expression.clone(), -None => None -} -} - -/// Exorcise (remove) [`FieldExpression`] from the store. -/// -#[inline] -pub fn exorcise_field_expression(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising field_expression slot: {id}."); -let result = self.field_expression.write().unwrap()[*id].take(); -self.field_expression_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, FieldExpression>`. -/// -#[inline] -pub fn iter_field_expression(&self) -> impl Iterator>> + '_ { -let len = self.field_expression.read().unwrap().len(); -(0..len).filter(|i| self.field_expression.read().unwrap()[*i].is_some()).map(move|i|{self.field_expression.read().unwrap()[i].as_ref().map(|field_expression| field_expression.clone()).unwrap()}) -} - -/// Inter (insert) [`FloatLiteral`] into the store. -/// -#[inline] -pub fn inter_float_literal(&mut self, float_literal: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.float_literal_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.float_literal.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.float_literal.write().unwrap().push(None); -_index -}; - -let float_literal = float_literal(_index); - -let found = if let Some(float_literal) = self.float_literal.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *float_literal.read().unwrap() -} else { -false -} -}) { -float_literal.clone() -} else { -None -}; - -if let Some(float_literal) = found { -tracing::debug!(target: "store", "found duplicate {float_literal:?}."); -self.float_literal_free_list.lock().unwrap().push(_index); -float_literal.clone() -} else { -tracing::debug!(target: "store", "interring {float_literal:?}."); -self.float_literal.write().unwrap()[_index] = Some(float_literal.clone()); -float_literal -} -} - -/// Exhume (get) [`FloatLiteral`] from the store. -/// -#[inline] -pub fn exhume_float_literal(&self, id: &usize) -> Option>> { -match self.float_literal.read().unwrap().get(*id) { -Some(float_literal) => float_literal.clone(), -None => None -} -} - -/// Exorcise (remove) [`FloatLiteral`] from the store. -/// -#[inline] -pub fn exorcise_float_literal(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising float_literal slot: {id}."); -let result = self.float_literal.write().unwrap()[*id].take(); -self.float_literal_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, FloatLiteral>`. -/// -#[inline] -pub fn iter_float_literal(&self) -> impl Iterator>> + '_ { -let len = self.float_literal.read().unwrap().len(); -(0..len).filter(|i| self.float_literal.read().unwrap()[*i].is_some()).map(move|i|{self.float_literal.read().unwrap()[i].as_ref().map(|float_literal| float_literal.clone()).unwrap()}) -} - -/// Inter (insert) [`ForLoop`] into the store. -/// -#[inline] -pub fn inter_for_loop(&mut self, for_loop: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.for_loop_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.for_loop.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.for_loop.write().unwrap().push(None); -_index -}; - -let for_loop = for_loop(_index); - -let found = if let Some(for_loop) = self.for_loop.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *for_loop.read().unwrap() -} else { -false -} -}) { -for_loop.clone() -} else { -None -}; - -if let Some(for_loop) = found { -tracing::debug!(target: "store", "found duplicate {for_loop:?}."); -self.for_loop_free_list.lock().unwrap().push(_index); -for_loop.clone() -} else { -tracing::debug!(target: "store", "interring {for_loop:?}."); -self.for_loop.write().unwrap()[_index] = Some(for_loop.clone()); -for_loop -} -} - -/// Exhume (get) [`ForLoop`] from the store. -/// -#[inline] -pub fn exhume_for_loop(&self, id: &usize) -> Option>> { -match self.for_loop.read().unwrap().get(*id) { -Some(for_loop) => for_loop.clone(), -None => None -} -} - -/// Exorcise (remove) [`ForLoop`] from the store. -/// -#[inline] -pub fn exorcise_for_loop(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising for_loop slot: {id}."); -let result = self.for_loop.write().unwrap()[*id].take(); -self.for_loop_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, ForLoop>`. -/// -#[inline] -pub fn iter_for_loop(&self) -> impl Iterator>> + '_ { -let len = self.for_loop.read().unwrap().len(); -(0..len).filter(|i| self.for_loop.read().unwrap()[*i].is_some()).map(move|i|{self.for_loop.read().unwrap()[i].as_ref().map(|for_loop| for_loop.clone()).unwrap()}) -} - -/// Inter (insert) [`FormatBit`] into the store. -/// -#[inline] -pub fn inter_format_bit(&mut self, format_bit: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.format_bit_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.format_bit.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.format_bit.write().unwrap().push(None); -_index -}; - -let format_bit = format_bit(_index); - -let found = if let Some(format_bit) = self.format_bit.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *format_bit.read().unwrap() -} else { -false -} -}) { -format_bit.clone() -} else { -None -}; - -if let Some(format_bit) = found { -tracing::debug!(target: "store", "found duplicate {format_bit:?}."); -self.format_bit_free_list.lock().unwrap().push(_index); -format_bit.clone() -} else { -tracing::debug!(target: "store", "interring {format_bit:?}."); -self.format_bit.write().unwrap()[_index] = Some(format_bit.clone()); -format_bit -} -} - -/// Exhume (get) [`FormatBit`] from the store. -/// -#[inline] -pub fn exhume_format_bit(&self, id: &usize) -> Option>> { -match self.format_bit.read().unwrap().get(*id) { -Some(format_bit) => format_bit.clone(), -None => None -} -} - -/// Exorcise (remove) [`FormatBit`] from the store. -/// -#[inline] -pub fn exorcise_format_bit(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising format_bit slot: {id}."); -let result = self.format_bit.write().unwrap()[*id].take(); -self.format_bit_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, FormatBit>`. -/// -#[inline] -pub fn iter_format_bit(&self) -> impl Iterator>> + '_ { -let len = self.format_bit.read().unwrap().len(); -(0..len).filter(|i| self.format_bit.read().unwrap()[*i].is_some()).map(move|i|{self.format_bit.read().unwrap()[i].as_ref().map(|format_bit| format_bit.clone()).unwrap()}) -} - -/// Inter (insert) [`FormatString`] into the store. -/// -#[inline] -pub fn inter_format_string(&mut self, format_string: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.format_string_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.format_string.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.format_string.write().unwrap().push(None); -_index -}; - -let format_string = format_string(_index); - -let found = if let Some(format_string) = self.format_string.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *format_string.read().unwrap() -} else { -false -} -}) { -format_string.clone() -} else { -None -}; - -if let Some(format_string) = found { -tracing::debug!(target: "store", "found duplicate {format_string:?}."); -self.format_string_free_list.lock().unwrap().push(_index); -format_string.clone() -} else { -tracing::debug!(target: "store", "interring {format_string:?}."); -self.format_string.write().unwrap()[_index] = Some(format_string.clone()); -format_string -} -} - -/// Exhume (get) [`FormatString`] from the store. -/// -#[inline] -pub fn exhume_format_string(&self, id: &usize) -> Option>> { -match self.format_string.read().unwrap().get(*id) { -Some(format_string) => format_string.clone(), -None => None -} -} - -/// Exorcise (remove) [`FormatString`] from the store. -/// -#[inline] -pub fn exorcise_format_string(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising format_string slot: {id}."); -let result = self.format_string.write().unwrap()[*id].take(); -self.format_string_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, FormatString>`. -/// -#[inline] -pub fn iter_format_string(&self) -> impl Iterator>> + '_ { -let len = self.format_string.read().unwrap().len(); -(0..len).filter(|i| self.format_string.read().unwrap()[*i].is_some()).map(move|i|{self.format_string.read().unwrap()[i].as_ref().map(|format_string| format_string.clone()).unwrap()}) -} - -/// Inter (insert) [`FuncGeneric`] into the store. -/// -#[inline] -pub fn inter_func_generic(&mut self, func_generic: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.func_generic_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.func_generic.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.func_generic.write().unwrap().push(None); -_index -}; - -let func_generic = func_generic(_index); - -let found = if let Some(func_generic) = self.func_generic.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *func_generic.read().unwrap() -} else { -false -} -}) { -func_generic.clone() -} else { -None -}; - -if let Some(func_generic) = found { -tracing::debug!(target: "store", "found duplicate {func_generic:?}."); -self.func_generic_free_list.lock().unwrap().push(_index); -func_generic.clone() -} else { -tracing::debug!(target: "store", "interring {func_generic:?}."); -self.func_generic.write().unwrap()[_index] = Some(func_generic.clone()); -func_generic -} -} - -/// Exhume (get) [`FuncGeneric`] from the store. -/// -#[inline] -pub fn exhume_func_generic(&self, id: &usize) -> Option>> { -match self.func_generic.read().unwrap().get(*id) { -Some(func_generic) => func_generic.clone(), -None => None -} -} - -/// Exorcise (remove) [`FuncGeneric`] from the store. -/// -#[inline] -pub fn exorcise_func_generic(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising func_generic slot: {id}."); -let result = self.func_generic.write().unwrap()[*id].take(); -self.func_generic_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, FuncGeneric>`. -/// -#[inline] -pub fn iter_func_generic(&self) -> impl Iterator>> + '_ { -let len = self.func_generic.read().unwrap().len(); -(0..len).filter(|i| self.func_generic.read().unwrap()[*i].is_some()).map(move|i|{self.func_generic.read().unwrap()[i].as_ref().map(|func_generic| func_generic.clone()).unwrap()}) -} - -/// Inter (insert) [`Function`] into the store. -/// -#[inline] -pub fn inter_function(&mut self, function: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.function_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.function.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.function.write().unwrap().push(None); -_index -}; - -let function = function(_index); - -let found = if let Some(function) = self.function.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *function.read().unwrap() -} else { -false -} -}) { -function.clone() -} else { -None -}; - -let function = -if let Some(function) = found { -tracing::debug!(target: "store", "found duplicate {function:?}."); -self.function_free_list.lock().unwrap().push(_index); -function.clone() -} else { -tracing::debug!(target: "store", "interring {function:?}."); -self.function.write().unwrap()[_index] = Some(function.clone()); -function -} -; -self.function_id_by_name.write().unwrap().insert(function.read().unwrap().name.to_owned(), function.read().unwrap().id); -function -} - -/// Exhume (get) [`Function`] from the store. -/// -#[inline] -pub fn exhume_function(&self, id: &usize) -> Option>> { -match self.function.read().unwrap().get(*id) { -Some(function) => function.clone(), -None => None -} -} - -/// Exorcise (remove) [`Function`] from the store. -/// -#[inline] -pub fn exorcise_function(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising function slot: {id}."); -let result = self.function.write().unwrap()[*id].take(); -self.function_free_list.lock().unwrap().push(*id); -result -} - -/// Exorcise [`Function`] id from the store by name. -/// -#[inline] -pub fn exhume_function_id_by_name(&self, name: &str) -> Option { -self.function_id_by_name.read().unwrap().get(name).map(|function| *function) -} - -/// Get an iterator over the internal `HashMap<&Uuid, Function>`. -/// -#[inline] -pub fn iter_function(&self) -> impl Iterator>> + '_ { -let len = self.function.read().unwrap().len(); -(0..len).filter(|i| self.function.read().unwrap()[*i].is_some()).map(move|i|{self.function.read().unwrap()[i].as_ref().map(|function| function.clone()).unwrap()}) -} - -/// Inter (insert) [`FunctionCall`] into the store. -/// -#[inline] -pub fn inter_function_call(&mut self, function_call: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.function_call_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.function_call.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.function_call.write().unwrap().push(None); -_index -}; - -let function_call = function_call(_index); - -let found = if let Some(function_call) = self.function_call.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *function_call.read().unwrap() -} else { -false -} -}) { -function_call.clone() -} else { -None -}; - -if let Some(function_call) = found { -tracing::debug!(target: "store", "found duplicate {function_call:?}."); -self.function_call_free_list.lock().unwrap().push(_index); -function_call.clone() -} else { -tracing::debug!(target: "store", "interring {function_call:?}."); -self.function_call.write().unwrap()[_index] = Some(function_call.clone()); -function_call -} -} - -/// Exhume (get) [`FunctionCall`] from the store. -/// -#[inline] -pub fn exhume_function_call(&self, id: &usize) -> Option>> { -match self.function_call.read().unwrap().get(*id) { -Some(function_call) => function_call.clone(), -None => None -} -} - -/// Exorcise (remove) [`FunctionCall`] from the store. -/// -#[inline] -pub fn exorcise_function_call(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising function_call slot: {id}."); -let result = self.function_call.write().unwrap()[*id].take(); -self.function_call_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, FunctionCall>`. -/// -#[inline] -pub fn iter_function_call(&self) -> impl Iterator>> + '_ { -let len = self.function_call.read().unwrap().len(); -(0..len).filter(|i| self.function_call.read().unwrap()[*i].is_some()).map(move|i|{self.function_call.read().unwrap()[i].as_ref().map(|function_call| function_call.clone()).unwrap()}) -} - -/// Inter (insert) [`XFuture`] into the store. -/// -#[inline] -pub fn inter_x_future(&mut self, x_future: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.x_future_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.x_future.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.x_future.write().unwrap().push(None); -_index -}; - -let x_future = x_future(_index); - -let found = if let Some(x_future) = self.x_future.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *x_future.read().unwrap() -} else { -false -} -}) { -x_future.clone() -} else { -None -}; - -if let Some(x_future) = found { -tracing::debug!(target: "store", "found duplicate {x_future:?}."); -self.x_future_free_list.lock().unwrap().push(_index); -x_future.clone() -} else { -tracing::debug!(target: "store", "interring {x_future:?}."); -self.x_future.write().unwrap()[_index] = Some(x_future.clone()); -x_future -} -} - -/// Exhume (get) [`XFuture`] from the store. -/// -#[inline] -pub fn exhume_x_future(&self, id: &usize) -> Option>> { -match self.x_future.read().unwrap().get(*id) { -Some(x_future) => x_future.clone(), -None => None -} -} - -/// Exorcise (remove) [`XFuture`] from the store. -/// -#[inline] -pub fn exorcise_x_future(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising x_future slot: {id}."); -let result = self.x_future.write().unwrap()[*id].take(); -self.x_future_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, XFuture>`. -/// -#[inline] -pub fn iter_x_future(&self) -> impl Iterator>> + '_ { -let len = self.x_future.read().unwrap().len(); -(0..len).filter(|i| self.x_future.read().unwrap()[*i].is_some()).map(move|i|{self.x_future.read().unwrap()[i].as_ref().map(|x_future| x_future.clone()).unwrap()}) -} - -/// Inter (insert) [`Grouped`] into the store. -/// -#[inline] -pub fn inter_grouped(&mut self, grouped: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.grouped_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.grouped.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.grouped.write().unwrap().push(None); -_index -}; - -let grouped = grouped(_index); - -let found = if let Some(grouped) = self.grouped.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *grouped.read().unwrap() -} else { -false -} -}) { -grouped.clone() -} else { -None -}; - -if let Some(grouped) = found { -tracing::debug!(target: "store", "found duplicate {grouped:?}."); -self.grouped_free_list.lock().unwrap().push(_index); -grouped.clone() -} else { -tracing::debug!(target: "store", "interring {grouped:?}."); -self.grouped.write().unwrap()[_index] = Some(grouped.clone()); -grouped -} -} - -/// Exhume (get) [`Grouped`] from the store. -/// -#[inline] -pub fn exhume_grouped(&self, id: &usize) -> Option>> { -match self.grouped.read().unwrap().get(*id) { -Some(grouped) => grouped.clone(), -None => None -} -} - -/// Exorcise (remove) [`Grouped`] from the store. -/// -#[inline] -pub fn exorcise_grouped(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising grouped slot: {id}."); -let result = self.grouped.write().unwrap()[*id].take(); -self.grouped_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Grouped>`. -/// -#[inline] -pub fn iter_grouped(&self) -> impl Iterator>> + '_ { -let len = self.grouped.read().unwrap().len(); -(0..len).filter(|i| self.grouped.read().unwrap()[*i].is_some()).map(move|i|{self.grouped.read().unwrap()[i].as_ref().map(|grouped| grouped.clone()).unwrap()}) -} - -/// Inter (insert) [`HaltAndCatchFire`] into the store. -/// -#[inline] -pub fn inter_halt_and_catch_fire(&mut self, halt_and_catch_fire: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.halt_and_catch_fire_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.halt_and_catch_fire.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.halt_and_catch_fire.write().unwrap().push(None); -_index -}; - -let halt_and_catch_fire = halt_and_catch_fire(_index); - -let found = if let Some(halt_and_catch_fire) = self.halt_and_catch_fire.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *halt_and_catch_fire.read().unwrap() -} else { -false -} -}) { -halt_and_catch_fire.clone() -} else { -None -}; - -if let Some(halt_and_catch_fire) = found { -tracing::debug!(target: "store", "found duplicate {halt_and_catch_fire:?}."); -self.halt_and_catch_fire_free_list.lock().unwrap().push(_index); -halt_and_catch_fire.clone() -} else { -tracing::debug!(target: "store", "interring {halt_and_catch_fire:?}."); -self.halt_and_catch_fire.write().unwrap()[_index] = Some(halt_and_catch_fire.clone()); -halt_and_catch_fire -} -} - -/// Exhume (get) [`HaltAndCatchFire`] from the store. -/// -#[inline] -pub fn exhume_halt_and_catch_fire(&self, id: &usize) -> Option>> { -match self.halt_and_catch_fire.read().unwrap().get(*id) { -Some(halt_and_catch_fire) => halt_and_catch_fire.clone(), -None => None -} -} - -/// Exorcise (remove) [`HaltAndCatchFire`] from the store. -/// -#[inline] -pub fn exorcise_halt_and_catch_fire(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising halt_and_catch_fire slot: {id}."); -let result = self.halt_and_catch_fire.write().unwrap()[*id].take(); -self.halt_and_catch_fire_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, HaltAndCatchFire>`. -/// -#[inline] -pub fn iter_halt_and_catch_fire(&self) -> impl Iterator>> + '_ { -let len = self.halt_and_catch_fire.read().unwrap().len(); -(0..len).filter(|i| self.halt_and_catch_fire.read().unwrap()[*i].is_some()).map(move|i|{self.halt_and_catch_fire.read().unwrap()[i].as_ref().map(|halt_and_catch_fire| halt_and_catch_fire.clone()).unwrap()}) -} - -/// Inter (insert) [`XIf`] into the store. -/// -#[inline] -pub fn inter_x_if(&mut self, x_if: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.x_if_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.x_if.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.x_if.write().unwrap().push(None); -_index -}; - -let x_if = x_if(_index); - -let found = if let Some(x_if) = self.x_if.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *x_if.read().unwrap() -} else { -false -} -}) { -x_if.clone() -} else { -None -}; - -if let Some(x_if) = found { -tracing::debug!(target: "store", "found duplicate {x_if:?}."); -self.x_if_free_list.lock().unwrap().push(_index); -x_if.clone() -} else { -tracing::debug!(target: "store", "interring {x_if:?}."); -self.x_if.write().unwrap()[_index] = Some(x_if.clone()); -x_if -} -} - -/// Exhume (get) [`XIf`] from the store. -/// -#[inline] -pub fn exhume_x_if(&self, id: &usize) -> Option>> { -match self.x_if.read().unwrap().get(*id) { -Some(x_if) => x_if.clone(), -None => None -} -} - -/// Exorcise (remove) [`XIf`] from the store. -/// -#[inline] -pub fn exorcise_x_if(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising x_if slot: {id}."); -let result = self.x_if.write().unwrap()[*id].take(); -self.x_if_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, XIf>`. -/// -#[inline] -pub fn iter_x_if(&self) -> impl Iterator>> + '_ { -let len = self.x_if.read().unwrap().len(); -(0..len).filter(|i| self.x_if.read().unwrap()[*i].is_some()).map(move|i|{self.x_if.read().unwrap()[i].as_ref().map(|x_if| x_if.clone()).unwrap()}) -} - -/// Inter (insert) [`ImplementationBlock`] into the store. -/// -#[inline] -pub fn inter_implementation_block(&mut self, implementation_block: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.implementation_block_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.implementation_block.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.implementation_block.write().unwrap().push(None); -_index -}; - -let implementation_block = implementation_block(_index); - -let found = if let Some(implementation_block) = self.implementation_block.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *implementation_block.read().unwrap() -} else { -false -} -}) { -implementation_block.clone() -} else { -None -}; - -if let Some(implementation_block) = found { -tracing::debug!(target: "store", "found duplicate {implementation_block:?}."); -self.implementation_block_free_list.lock().unwrap().push(_index); -implementation_block.clone() -} else { -tracing::debug!(target: "store", "interring {implementation_block:?}."); -self.implementation_block.write().unwrap()[_index] = Some(implementation_block.clone()); -implementation_block -} -} - -/// Exhume (get) [`ImplementationBlock`] from the store. -/// -#[inline] -pub fn exhume_implementation_block(&self, id: &usize) -> Option>> { -match self.implementation_block.read().unwrap().get(*id) { -Some(implementation_block) => implementation_block.clone(), -None => None -} -} - -/// Exorcise (remove) [`ImplementationBlock`] from the store. -/// -#[inline] -pub fn exorcise_implementation_block(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising implementation_block slot: {id}."); -let result = self.implementation_block.write().unwrap()[*id].take(); -self.implementation_block_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, ImplementationBlock>`. -/// -#[inline] -pub fn iter_implementation_block(&self) -> impl Iterator>> + '_ { -let len = self.implementation_block.read().unwrap().len(); -(0..len).filter(|i| self.implementation_block.read().unwrap()[*i].is_some()).map(move|i|{self.implementation_block.read().unwrap()[i].as_ref().map(|implementation_block| implementation_block.clone()).unwrap()}) -} - -/// Inter (insert) [`Import`] into the store. -/// -#[inline] -pub fn inter_import(&mut self, import: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.import_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.import.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.import.write().unwrap().push(None); -_index -}; - -let import = import(_index); - -let found = if let Some(import) = self.import.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *import.read().unwrap() -} else { -false -} -}) { -import.clone() -} else { -None -}; - -if let Some(import) = found { -tracing::debug!(target: "store", "found duplicate {import:?}."); -self.import_free_list.lock().unwrap().push(_index); -import.clone() -} else { -tracing::debug!(target: "store", "interring {import:?}."); -self.import.write().unwrap()[_index] = Some(import.clone()); -import -} -} - -/// Exhume (get) [`Import`] from the store. -/// -#[inline] -pub fn exhume_import(&self, id: &usize) -> Option>> { -match self.import.read().unwrap().get(*id) { -Some(import) => import.clone(), -None => None -} -} - -/// Exorcise (remove) [`Import`] from the store. -/// -#[inline] -pub fn exorcise_import(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising import slot: {id}."); -let result = self.import.write().unwrap()[*id].take(); -self.import_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Import>`. -/// -#[inline] -pub fn iter_import(&self) -> impl Iterator>> + '_ { -let len = self.import.read().unwrap().len(); -(0..len).filter(|i| self.import.read().unwrap()[*i].is_some()).map(move|i|{self.import.read().unwrap()[i].as_ref().map(|import| import.clone()).unwrap()}) -} - -/// Inter (insert) [`Index`] into the store. -/// -#[inline] -pub fn inter_index(&mut self, index: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.index_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.index.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.index.write().unwrap().push(None); -_index -}; - -let index = index(_index); - -let found = if let Some(index) = self.index.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *index.read().unwrap() -} else { -false -} -}) { -index.clone() -} else { -None -}; - -if let Some(index) = found { -tracing::debug!(target: "store", "found duplicate {index:?}."); -self.index_free_list.lock().unwrap().push(_index); -index.clone() -} else { -tracing::debug!(target: "store", "interring {index:?}."); -self.index.write().unwrap()[_index] = Some(index.clone()); -index -} -} - -/// Exhume (get) [`Index`] from the store. -/// -#[inline] -pub fn exhume_index(&self, id: &usize) -> Option>> { -match self.index.read().unwrap().get(*id) { -Some(index) => index.clone(), -None => None -} -} - -/// Exorcise (remove) [`Index`] from the store. -/// -#[inline] -pub fn exorcise_index(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising index slot: {id}."); -let result = self.index.write().unwrap()[*id].take(); -self.index_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Index>`. -/// -#[inline] -pub fn iter_index(&self) -> impl Iterator>> + '_ { -let len = self.index.read().unwrap().len(); -(0..len).filter(|i| self.index.read().unwrap()[*i].is_some()).map(move|i|{self.index.read().unwrap()[i].as_ref().map(|index| index.clone()).unwrap()}) -} - -/// Inter (insert) [`IntegerLiteral`] into the store. -/// -#[inline] -pub fn inter_integer_literal(&mut self, integer_literal: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.integer_literal_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.integer_literal.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.integer_literal.write().unwrap().push(None); -_index -}; - -let integer_literal = integer_literal(_index); - -let found = if let Some(integer_literal) = self.integer_literal.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *integer_literal.read().unwrap() -} else { -false -} -}) { -integer_literal.clone() -} else { -None -}; - -if let Some(integer_literal) = found { -tracing::debug!(target: "store", "found duplicate {integer_literal:?}."); -self.integer_literal_free_list.lock().unwrap().push(_index); -integer_literal.clone() -} else { -tracing::debug!(target: "store", "interring {integer_literal:?}."); -self.integer_literal.write().unwrap()[_index] = Some(integer_literal.clone()); -integer_literal -} -} - -/// Exhume (get) [`IntegerLiteral`] from the store. -/// -#[inline] -pub fn exhume_integer_literal(&self, id: &usize) -> Option>> { -match self.integer_literal.read().unwrap().get(*id) { -Some(integer_literal) => integer_literal.clone(), -None => None -} -} - -/// Exorcise (remove) [`IntegerLiteral`] from the store. -/// -#[inline] -pub fn exorcise_integer_literal(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising integer_literal slot: {id}."); -let result = self.integer_literal.write().unwrap()[*id].take(); -self.integer_literal_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, IntegerLiteral>`. -/// -#[inline] -pub fn iter_integer_literal(&self) -> impl Iterator>> + '_ { -let len = self.integer_literal.read().unwrap().len(); -(0..len).filter(|i| self.integer_literal.read().unwrap()[*i].is_some()).map(move|i|{self.integer_literal.read().unwrap()[i].as_ref().map(|integer_literal| integer_literal.clone()).unwrap()}) -} - -/// Inter (insert) [`Item`] into the store. -/// -#[inline] -pub fn inter_item(&mut self, item: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.item_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.item.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.item.write().unwrap().push(None); -_index -}; - -let item = item(_index); - -let found = if let Some(item) = self.item.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *item.read().unwrap() -} else { -false -} -}) { -item.clone() -} else { -None -}; - -if let Some(item) = found { -tracing::debug!(target: "store", "found duplicate {item:?}."); -self.item_free_list.lock().unwrap().push(_index); -item.clone() -} else { -tracing::debug!(target: "store", "interring {item:?}."); -self.item.write().unwrap()[_index] = Some(item.clone()); -item -} -} - -/// Exhume (get) [`Item`] from the store. -/// -#[inline] -pub fn exhume_item(&self, id: &usize) -> Option>> { -match self.item.read().unwrap().get(*id) { -Some(item) => item.clone(), -None => None -} -} - -/// Exorcise (remove) [`Item`] from the store. -/// -#[inline] -pub fn exorcise_item(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising item slot: {id}."); -let result = self.item.write().unwrap()[*id].take(); -self.item_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Item>`. -/// -#[inline] -pub fn iter_item(&self) -> impl Iterator>> + '_ { -let len = self.item.read().unwrap().len(); -(0..len).filter(|i| self.item.read().unwrap()[*i].is_some()).map(move|i|{self.item.read().unwrap()[i].as_ref().map(|item| item.clone()).unwrap()}) -} - -/// Inter (insert) [`Lambda`] into the store. -/// -#[inline] -pub fn inter_lambda(&mut self, lambda: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.lambda_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.lambda.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.lambda.write().unwrap().push(None); -_index -}; - -let lambda = lambda(_index); - -let found = if let Some(lambda) = self.lambda.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *lambda.read().unwrap() -} else { -false -} -}) { -lambda.clone() -} else { -None -}; - -if let Some(lambda) = found { -tracing::debug!(target: "store", "found duplicate {lambda:?}."); -self.lambda_free_list.lock().unwrap().push(_index); -lambda.clone() -} else { -tracing::debug!(target: "store", "interring {lambda:?}."); -self.lambda.write().unwrap()[_index] = Some(lambda.clone()); -lambda -} -} - -/// Exhume (get) [`Lambda`] from the store. -/// -#[inline] -pub fn exhume_lambda(&self, id: &usize) -> Option>> { -match self.lambda.read().unwrap().get(*id) { -Some(lambda) => lambda.clone(), -None => None -} -} - -/// Exorcise (remove) [`Lambda`] from the store. -/// -#[inline] -pub fn exorcise_lambda(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising lambda slot: {id}."); -let result = self.lambda.write().unwrap()[*id].take(); -self.lambda_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Lambda>`. -/// -#[inline] -pub fn iter_lambda(&self) -> impl Iterator>> + '_ { -let len = self.lambda.read().unwrap().len(); -(0..len).filter(|i| self.lambda.read().unwrap()[*i].is_some()).map(move|i|{self.lambda.read().unwrap()[i].as_ref().map(|lambda| lambda.clone()).unwrap()}) -} - -/// Inter (insert) [`LambdaParameter`] into the store. -/// -#[inline] -pub fn inter_lambda_parameter(&mut self, lambda_parameter: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.lambda_parameter_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.lambda_parameter.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.lambda_parameter.write().unwrap().push(None); -_index -}; - -let lambda_parameter = lambda_parameter(_index); - -let found = if let Some(lambda_parameter) = self.lambda_parameter.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *lambda_parameter.read().unwrap() -} else { -false -} -}) { -lambda_parameter.clone() -} else { -None -}; - -if let Some(lambda_parameter) = found { -tracing::debug!(target: "store", "found duplicate {lambda_parameter:?}."); -self.lambda_parameter_free_list.lock().unwrap().push(_index); -lambda_parameter.clone() -} else { -tracing::debug!(target: "store", "interring {lambda_parameter:?}."); -self.lambda_parameter.write().unwrap()[_index] = Some(lambda_parameter.clone()); -lambda_parameter -} -} - -/// Exhume (get) [`LambdaParameter`] from the store. -/// -#[inline] -pub fn exhume_lambda_parameter(&self, id: &usize) -> Option>> { -match self.lambda_parameter.read().unwrap().get(*id) { -Some(lambda_parameter) => lambda_parameter.clone(), -None => None -} -} - -/// Exorcise (remove) [`LambdaParameter`] from the store. -/// -#[inline] -pub fn exorcise_lambda_parameter(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising lambda_parameter slot: {id}."); -let result = self.lambda_parameter.write().unwrap()[*id].take(); -self.lambda_parameter_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, LambdaParameter>`. -/// -#[inline] -pub fn iter_lambda_parameter(&self) -> impl Iterator>> + '_ { -let len = self.lambda_parameter.read().unwrap().len(); -(0..len).filter(|i| self.lambda_parameter.read().unwrap()[*i].is_some()).map(move|i|{self.lambda_parameter.read().unwrap()[i].as_ref().map(|lambda_parameter| lambda_parameter.clone()).unwrap()}) -} - -/// Inter (insert) [`LetStatement`] into the store. -/// -#[inline] -pub fn inter_let_statement(&mut self, let_statement: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.let_statement_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.let_statement.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.let_statement.write().unwrap().push(None); -_index -}; - -let let_statement = let_statement(_index); - -let found = if let Some(let_statement) = self.let_statement.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *let_statement.read().unwrap() -} else { -false -} -}) { -let_statement.clone() -} else { -None -}; - -if let Some(let_statement) = found { -tracing::debug!(target: "store", "found duplicate {let_statement:?}."); -self.let_statement_free_list.lock().unwrap().push(_index); -let_statement.clone() -} else { -tracing::debug!(target: "store", "interring {let_statement:?}."); -self.let_statement.write().unwrap()[_index] = Some(let_statement.clone()); -let_statement -} -} - -/// Exhume (get) [`LetStatement`] from the store. -/// -#[inline] -pub fn exhume_let_statement(&self, id: &usize) -> Option>> { -match self.let_statement.read().unwrap().get(*id) { -Some(let_statement) => let_statement.clone(), -None => None -} -} - -/// Exorcise (remove) [`LetStatement`] from the store. -/// -#[inline] -pub fn exorcise_let_statement(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising let_statement slot: {id}."); -let result = self.let_statement.write().unwrap()[*id].take(); -self.let_statement_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, LetStatement>`. -/// -#[inline] -pub fn iter_let_statement(&self) -> impl Iterator>> + '_ { -let len = self.let_statement.read().unwrap().len(); -(0..len).filter(|i| self.let_statement.read().unwrap()[*i].is_some()).map(move|i|{self.let_statement.read().unwrap()[i].as_ref().map(|let_statement| let_statement.clone()).unwrap()}) -} - -/// Inter (insert) [`List`] into the store. -/// -#[inline] -pub fn inter_list(&mut self, list: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.list_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.list.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.list.write().unwrap().push(None); -_index -}; - -let list = list(_index); - -let found = if let Some(list) = self.list.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *list.read().unwrap() -} else { -false -} -}) { -list.clone() -} else { -None -}; - -if let Some(list) = found { -tracing::debug!(target: "store", "found duplicate {list:?}."); -self.list_free_list.lock().unwrap().push(_index); -list.clone() -} else { -tracing::debug!(target: "store", "interring {list:?}."); -self.list.write().unwrap()[_index] = Some(list.clone()); -list -} -} - -/// Exhume (get) [`List`] from the store. -/// -#[inline] -pub fn exhume_list(&self, id: &usize) -> Option>> { -match self.list.read().unwrap().get(*id) { -Some(list) => list.clone(), -None => None -} -} - -/// Exorcise (remove) [`List`] from the store. -/// -#[inline] -pub fn exorcise_list(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising list slot: {id}."); -let result = self.list.write().unwrap()[*id].take(); -self.list_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, List>`. -/// -#[inline] -pub fn iter_list(&self) -> impl Iterator>> + '_ { -let len = self.list.read().unwrap().len(); -(0..len).filter(|i| self.list.read().unwrap()[*i].is_some()).map(move|i|{self.list.read().unwrap()[i].as_ref().map(|list| list.clone()).unwrap()}) -} - -/// Inter (insert) [`ListElement`] into the store. -/// -#[inline] -pub fn inter_list_element(&mut self, list_element: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.list_element_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.list_element.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.list_element.write().unwrap().push(None); -_index -}; - -let list_element = list_element(_index); - -let found = if let Some(list_element) = self.list_element.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *list_element.read().unwrap() -} else { -false -} -}) { -list_element.clone() -} else { -None -}; - -if let Some(list_element) = found { -tracing::debug!(target: "store", "found duplicate {list_element:?}."); -self.list_element_free_list.lock().unwrap().push(_index); -list_element.clone() -} else { -tracing::debug!(target: "store", "interring {list_element:?}."); -self.list_element.write().unwrap()[_index] = Some(list_element.clone()); -list_element -} -} - -/// Exhume (get) [`ListElement`] from the store. -/// -#[inline] -pub fn exhume_list_element(&self, id: &usize) -> Option>> { -match self.list_element.read().unwrap().get(*id) { -Some(list_element) => list_element.clone(), -None => None -} -} - -/// Exorcise (remove) [`ListElement`] from the store. -/// -#[inline] -pub fn exorcise_list_element(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising list_element slot: {id}."); -let result = self.list_element.write().unwrap()[*id].take(); -self.list_element_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, ListElement>`. -/// -#[inline] -pub fn iter_list_element(&self) -> impl Iterator>> + '_ { -let len = self.list_element.read().unwrap().len(); -(0..len).filter(|i| self.list_element.read().unwrap()[*i].is_some()).map(move|i|{self.list_element.read().unwrap()[i].as_ref().map(|list_element| list_element.clone()).unwrap()}) -} - -/// Inter (insert) [`ListExpression`] into the store. -/// -#[inline] -pub fn inter_list_expression(&mut self, list_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.list_expression_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.list_expression.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.list_expression.write().unwrap().push(None); -_index -}; - -let list_expression = list_expression(_index); - -let found = if let Some(list_expression) = self.list_expression.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *list_expression.read().unwrap() -} else { -false -} -}) { -list_expression.clone() -} else { -None -}; - -if let Some(list_expression) = found { -tracing::debug!(target: "store", "found duplicate {list_expression:?}."); -self.list_expression_free_list.lock().unwrap().push(_index); -list_expression.clone() -} else { -tracing::debug!(target: "store", "interring {list_expression:?}."); -self.list_expression.write().unwrap()[_index] = Some(list_expression.clone()); -list_expression -} -} - -/// Exhume (get) [`ListExpression`] from the store. -/// -#[inline] -pub fn exhume_list_expression(&self, id: &usize) -> Option>> { -match self.list_expression.read().unwrap().get(*id) { -Some(list_expression) => list_expression.clone(), -None => None -} -} - -/// Exorcise (remove) [`ListExpression`] from the store. -/// -#[inline] -pub fn exorcise_list_expression(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising list_expression slot: {id}."); -let result = self.list_expression.write().unwrap()[*id].take(); -self.list_expression_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, ListExpression>`. -/// -#[inline] -pub fn iter_list_expression(&self) -> impl Iterator>> + '_ { -let len = self.list_expression.read().unwrap().len(); -(0..len).filter(|i| self.list_expression.read().unwrap()[*i].is_some()).map(move|i|{self.list_expression.read().unwrap()[i].as_ref().map(|list_expression| list_expression.clone()).unwrap()}) -} - -/// Inter (insert) [`Literal`] into the store. -/// -#[inline] -pub fn inter_literal(&mut self, literal: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.literal_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.literal.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.literal.write().unwrap().push(None); -_index -}; - -let literal = literal(_index); - -let found = if let Some(literal) = self.literal.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *literal.read().unwrap() -} else { -false -} -}) { -literal.clone() -} else { -None -}; - -if let Some(literal) = found { -tracing::debug!(target: "store", "found duplicate {literal:?}."); -self.literal_free_list.lock().unwrap().push(_index); -literal.clone() -} else { -tracing::debug!(target: "store", "interring {literal:?}."); -self.literal.write().unwrap()[_index] = Some(literal.clone()); -literal -} -} - -/// Exhume (get) [`Literal`] from the store. -/// -#[inline] -pub fn exhume_literal(&self, id: &usize) -> Option>> { -match self.literal.read().unwrap().get(*id) { -Some(literal) => literal.clone(), -None => None -} -} - -/// Exorcise (remove) [`Literal`] from the store. -/// -#[inline] -pub fn exorcise_literal(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising literal slot: {id}."); -let result = self.literal.write().unwrap()[*id].take(); -self.literal_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Literal>`. -/// -#[inline] -pub fn iter_literal(&self) -> impl Iterator>> + '_ { -let len = self.literal.read().unwrap().len(); -(0..len).filter(|i| self.literal.read().unwrap()[*i].is_some()).map(move|i|{self.literal.read().unwrap()[i].as_ref().map(|literal| literal.clone()).unwrap()}) -} - -/// Inter (insert) [`LocalVariable`] into the store. -/// -#[inline] -pub fn inter_local_variable(&mut self, local_variable: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.local_variable_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.local_variable.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.local_variable.write().unwrap().push(None); -_index -}; - -let local_variable = local_variable(_index); - -let found = if let Some(local_variable) = self.local_variable.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *local_variable.read().unwrap() -} else { -false -} -}) { -local_variable.clone() -} else { -None -}; - -if let Some(local_variable) = found { -tracing::debug!(target: "store", "found duplicate {local_variable:?}."); -self.local_variable_free_list.lock().unwrap().push(_index); -local_variable.clone() -} else { -tracing::debug!(target: "store", "interring {local_variable:?}."); -self.local_variable.write().unwrap()[_index] = Some(local_variable.clone()); -local_variable -} -} - -/// Exhume (get) [`LocalVariable`] from the store. -/// -#[inline] -pub fn exhume_local_variable(&self, id: &usize) -> Option>> { -match self.local_variable.read().unwrap().get(*id) { -Some(local_variable) => local_variable.clone(), -None => None -} -} - -/// Exorcise (remove) [`LocalVariable`] from the store. -/// -#[inline] -pub fn exorcise_local_variable(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising local_variable slot: {id}."); -let result = self.local_variable.write().unwrap()[*id].take(); -self.local_variable_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, LocalVariable>`. -/// -#[inline] -pub fn iter_local_variable(&self) -> impl Iterator>> + '_ { -let len = self.local_variable.read().unwrap().len(); -(0..len).filter(|i| self.local_variable.read().unwrap()[*i].is_some()).map(move|i|{self.local_variable.read().unwrap()[i].as_ref().map(|local_variable| local_variable.clone()).unwrap()}) -} - -/// Inter (insert) [`XMacro`] into the store. -/// -#[inline] -pub fn inter_x_macro(&mut self, x_macro: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.x_macro_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.x_macro.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.x_macro.write().unwrap().push(None); -_index -}; - -let x_macro = x_macro(_index); - -let found = if let Some(x_macro) = self.x_macro.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *x_macro.read().unwrap() -} else { -false -} -}) { -x_macro.clone() -} else { -None -}; - -if let Some(x_macro) = found { -tracing::debug!(target: "store", "found duplicate {x_macro:?}."); -self.x_macro_free_list.lock().unwrap().push(_index); -x_macro.clone() -} else { -tracing::debug!(target: "store", "interring {x_macro:?}."); -self.x_macro.write().unwrap()[_index] = Some(x_macro.clone()); -x_macro -} -} - -/// Exhume (get) [`XMacro`] from the store. -/// -#[inline] -pub fn exhume_x_macro(&self, id: &usize) -> Option>> { -match self.x_macro.read().unwrap().get(*id) { -Some(x_macro) => x_macro.clone(), -None => None -} -} - -/// Exorcise (remove) [`XMacro`] from the store. -/// -#[inline] -pub fn exorcise_x_macro(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising x_macro slot: {id}."); -let result = self.x_macro.write().unwrap()[*id].take(); -self.x_macro_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, XMacro>`. -/// -#[inline] -pub fn iter_x_macro(&self) -> impl Iterator>> + '_ { -let len = self.x_macro.read().unwrap().len(); -(0..len).filter(|i| self.x_macro.read().unwrap()[*i].is_some()).map(move|i|{self.x_macro.read().unwrap()[i].as_ref().map(|x_macro| x_macro.clone()).unwrap()}) -} - -/// Inter (insert) [`Map`] into the store. -/// -#[inline] -pub fn inter_map(&mut self, map: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.map_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.map.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.map.write().unwrap().push(None); -_index -}; - -let map = map(_index); - -let found = if let Some(map) = self.map.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *map.read().unwrap() -} else { -false -} -}) { -map.clone() -} else { -None -}; - -if let Some(map) = found { -tracing::debug!(target: "store", "found duplicate {map:?}."); -self.map_free_list.lock().unwrap().push(_index); -map.clone() -} else { -tracing::debug!(target: "store", "interring {map:?}."); -self.map.write().unwrap()[_index] = Some(map.clone()); -map -} -} - -/// Exhume (get) [`Map`] from the store. -/// -#[inline] -pub fn exhume_map(&self, id: &usize) -> Option>> { -match self.map.read().unwrap().get(*id) { -Some(map) => map.clone(), -None => None -} -} - -/// Exorcise (remove) [`Map`] from the store. -/// -#[inline] -pub fn exorcise_map(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising map slot: {id}."); -let result = self.map.write().unwrap()[*id].take(); -self.map_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Map>`. -/// -#[inline] -pub fn iter_map(&self) -> impl Iterator>> + '_ { -let len = self.map.read().unwrap().len(); -(0..len).filter(|i| self.map.read().unwrap()[*i].is_some()).map(move|i|{self.map.read().unwrap()[i].as_ref().map(|map| map.clone()).unwrap()}) -} - -/// Inter (insert) [`MapElement`] into the store. -/// -#[inline] -pub fn inter_map_element(&mut self, map_element: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.map_element_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.map_element.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.map_element.write().unwrap().push(None); -_index -}; - -let map_element = map_element(_index); - -let found = if let Some(map_element) = self.map_element.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *map_element.read().unwrap() -} else { -false -} -}) { -map_element.clone() -} else { -None -}; - -if let Some(map_element) = found { -tracing::debug!(target: "store", "found duplicate {map_element:?}."); -self.map_element_free_list.lock().unwrap().push(_index); -map_element.clone() -} else { -tracing::debug!(target: "store", "interring {map_element:?}."); -self.map_element.write().unwrap()[_index] = Some(map_element.clone()); -map_element -} -} - -/// Exhume (get) [`MapElement`] from the store. -/// -#[inline] -pub fn exhume_map_element(&self, id: &usize) -> Option>> { -match self.map_element.read().unwrap().get(*id) { -Some(map_element) => map_element.clone(), -None => None -} -} - -/// Exorcise (remove) [`MapElement`] from the store. -/// -#[inline] -pub fn exorcise_map_element(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising map_element slot: {id}."); -let result = self.map_element.write().unwrap()[*id].take(); -self.map_element_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, MapElement>`. -/// -#[inline] -pub fn iter_map_element(&self) -> impl Iterator>> + '_ { -let len = self.map_element.read().unwrap().len(); -(0..len).filter(|i| self.map_element.read().unwrap()[*i].is_some()).map(move|i|{self.map_element.read().unwrap()[i].as_ref().map(|map_element| map_element.clone()).unwrap()}) -} - -/// Inter (insert) [`MapExpression`] into the store. -/// -#[inline] -pub fn inter_map_expression(&mut self, map_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.map_expression_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.map_expression.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.map_expression.write().unwrap().push(None); -_index -}; - -let map_expression = map_expression(_index); - -let found = if let Some(map_expression) = self.map_expression.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *map_expression.read().unwrap() -} else { -false -} -}) { -map_expression.clone() -} else { -None -}; - -if let Some(map_expression) = found { -tracing::debug!(target: "store", "found duplicate {map_expression:?}."); -self.map_expression_free_list.lock().unwrap().push(_index); -map_expression.clone() -} else { -tracing::debug!(target: "store", "interring {map_expression:?}."); -self.map_expression.write().unwrap()[_index] = Some(map_expression.clone()); -map_expression -} -} - -/// Exhume (get) [`MapExpression`] from the store. -/// -#[inline] -pub fn exhume_map_expression(&self, id: &usize) -> Option>> { -match self.map_expression.read().unwrap().get(*id) { -Some(map_expression) => map_expression.clone(), -None => None -} -} - -/// Exorcise (remove) [`MapExpression`] from the store. -/// -#[inline] -pub fn exorcise_map_expression(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising map_expression slot: {id}."); -let result = self.map_expression.write().unwrap()[*id].take(); -self.map_expression_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, MapExpression>`. -/// -#[inline] -pub fn iter_map_expression(&self) -> impl Iterator>> + '_ { -let len = self.map_expression.read().unwrap().len(); -(0..len).filter(|i| self.map_expression.read().unwrap()[*i].is_some()).map(move|i|{self.map_expression.read().unwrap()[i].as_ref().map(|map_expression| map_expression.clone()).unwrap()}) -} - -/// Inter (insert) [`XMatch`] into the store. -/// -#[inline] -pub fn inter_x_match(&mut self, x_match: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.x_match_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.x_match.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.x_match.write().unwrap().push(None); -_index -}; - -let x_match = x_match(_index); - -let found = if let Some(x_match) = self.x_match.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *x_match.read().unwrap() -} else { -false -} -}) { -x_match.clone() -} else { -None -}; - -if let Some(x_match) = found { -tracing::debug!(target: "store", "found duplicate {x_match:?}."); -self.x_match_free_list.lock().unwrap().push(_index); -x_match.clone() -} else { -tracing::debug!(target: "store", "interring {x_match:?}."); -self.x_match.write().unwrap()[_index] = Some(x_match.clone()); -x_match -} -} - -/// Exhume (get) [`XMatch`] from the store. -/// -#[inline] -pub fn exhume_x_match(&self, id: &usize) -> Option>> { -match self.x_match.read().unwrap().get(*id) { -Some(x_match) => x_match.clone(), -None => None -} -} - -/// Exorcise (remove) [`XMatch`] from the store. -/// -#[inline] -pub fn exorcise_x_match(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising x_match slot: {id}."); -let result = self.x_match.write().unwrap()[*id].take(); -self.x_match_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, XMatch>`. -/// -#[inline] -pub fn iter_x_match(&self) -> impl Iterator>> + '_ { -let len = self.x_match.read().unwrap().len(); -(0..len).filter(|i| self.x_match.read().unwrap()[*i].is_some()).map(move|i|{self.x_match.read().unwrap()[i].as_ref().map(|x_match| x_match.clone()).unwrap()}) -} - -/// Inter (insert) [`MethodCall`] into the store. -/// -#[inline] -pub fn inter_method_call(&mut self, method_call: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.method_call_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.method_call.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.method_call.write().unwrap().push(None); -_index -}; - -let method_call = method_call(_index); - -let found = if let Some(method_call) = self.method_call.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *method_call.read().unwrap() -} else { -false -} -}) { -method_call.clone() -} else { -None -}; - -if let Some(method_call) = found { -tracing::debug!(target: "store", "found duplicate {method_call:?}."); -self.method_call_free_list.lock().unwrap().push(_index); -method_call.clone() -} else { -tracing::debug!(target: "store", "interring {method_call:?}."); -self.method_call.write().unwrap()[_index] = Some(method_call.clone()); -method_call -} -} - -/// Exhume (get) [`MethodCall`] from the store. -/// -#[inline] -pub fn exhume_method_call(&self, id: &usize) -> Option>> { -match self.method_call.read().unwrap().get(*id) { -Some(method_call) => method_call.clone(), -None => None -} -} - -/// Exorcise (remove) [`MethodCall`] from the store. -/// -#[inline] -pub fn exorcise_method_call(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising method_call slot: {id}."); -let result = self.method_call.write().unwrap()[*id].take(); -self.method_call_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, MethodCall>`. -/// -#[inline] -pub fn iter_method_call(&self) -> impl Iterator>> + '_ { -let len = self.method_call.read().unwrap().len(); -(0..len).filter(|i| self.method_call.read().unwrap()[*i].is_some()).map(move|i|{self.method_call.read().unwrap()[i].as_ref().map(|method_call| method_call.clone()).unwrap()}) -} - -/// Inter (insert) [`NamedFieldExpression`] into the store. -/// -#[inline] -pub fn inter_named_field_expression(&mut self, named_field_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.named_field_expression_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.named_field_expression.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.named_field_expression.write().unwrap().push(None); -_index -}; - -let named_field_expression = named_field_expression(_index); - -let found = if let Some(named_field_expression) = self.named_field_expression.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *named_field_expression.read().unwrap() -} else { -false -} -}) { -named_field_expression.clone() -} else { -None -}; - -if let Some(named_field_expression) = found { -tracing::debug!(target: "store", "found duplicate {named_field_expression:?}."); -self.named_field_expression_free_list.lock().unwrap().push(_index); -named_field_expression.clone() -} else { -tracing::debug!(target: "store", "interring {named_field_expression:?}."); -self.named_field_expression.write().unwrap()[_index] = Some(named_field_expression.clone()); -named_field_expression -} -} - -/// Exhume (get) [`NamedFieldExpression`] from the store. -/// -#[inline] -pub fn exhume_named_field_expression(&self, id: &usize) -> Option>> { -match self.named_field_expression.read().unwrap().get(*id) { -Some(named_field_expression) => named_field_expression.clone(), -None => None -} -} - -/// Exorcise (remove) [`NamedFieldExpression`] from the store. -/// -#[inline] -pub fn exorcise_named_field_expression(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising named_field_expression slot: {id}."); -let result = self.named_field_expression.write().unwrap()[*id].take(); -self.named_field_expression_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, NamedFieldExpression>`. -/// -#[inline] -pub fn iter_named_field_expression(&self) -> impl Iterator>> + '_ { -let len = self.named_field_expression.read().unwrap().len(); -(0..len).filter(|i| self.named_field_expression.read().unwrap()[*i].is_some()).map(move|i|{self.named_field_expression.read().unwrap()[i].as_ref().map(|named_field_expression| named_field_expression.clone()).unwrap()}) -} - -/// Inter (insert) [`ZObjectStore`] into the store. -/// -#[inline] -pub fn inter_z_object_store(&mut self, z_object_store: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.z_object_store_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.z_object_store.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.z_object_store.write().unwrap().push(None); -_index -}; - -let z_object_store = z_object_store(_index); - -let found = if let Some(z_object_store) = self.z_object_store.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *z_object_store.read().unwrap() -} else { -false -} -}) { -z_object_store.clone() -} else { -None -}; - -let z_object_store = -if let Some(z_object_store) = found { -tracing::debug!(target: "store", "found duplicate {z_object_store:?}."); -self.z_object_store_free_list.lock().unwrap().push(_index); -z_object_store.clone() -} else { -tracing::debug!(target: "store", "interring {z_object_store:?}."); -self.z_object_store.write().unwrap()[_index] = Some(z_object_store.clone()); -z_object_store -} -; -self.z_object_store_id_by_name.write().unwrap().insert(z_object_store.read().unwrap().name.to_owned(), z_object_store.read().unwrap().id); -z_object_store -} - -/// Exhume (get) [`ZObjectStore`] from the store. -/// -#[inline] -pub fn exhume_z_object_store(&self, id: &usize) -> Option>> { -match self.z_object_store.read().unwrap().get(*id) { -Some(z_object_store) => z_object_store.clone(), -None => None -} -} - -/// Exorcise (remove) [`ZObjectStore`] from the store. -/// -#[inline] -pub fn exorcise_z_object_store(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising z_object_store slot: {id}."); -let result = self.z_object_store.write().unwrap()[*id].take(); -self.z_object_store_free_list.lock().unwrap().push(*id); -result -} - -/// Exorcise [`ZObjectStore`] id from the store by name. -/// -#[inline] -pub fn exhume_z_object_store_id_by_name(&self, name: &str) -> Option { -self.z_object_store_id_by_name.read().unwrap().get(name).map(|z_object_store| *z_object_store) -} - -/// Get an iterator over the internal `HashMap<&Uuid, ZObjectStore>`. -/// -#[inline] -pub fn iter_z_object_store(&self) -> impl Iterator>> + '_ { -let len = self.z_object_store.read().unwrap().len(); -(0..len).filter(|i| self.z_object_store.read().unwrap()[*i].is_some()).map(move|i|{self.z_object_store.read().unwrap()[i].as_ref().map(|z_object_store| z_object_store.clone()).unwrap()}) -} - -/// Inter (insert) [`ObjectWrapper`] into the store. -/// -#[inline] -pub fn inter_object_wrapper(&mut self, object_wrapper: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.object_wrapper_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.object_wrapper.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.object_wrapper.write().unwrap().push(None); -_index -}; - -let object_wrapper = object_wrapper(_index); - -let found = if let Some(object_wrapper) = self.object_wrapper.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *object_wrapper.read().unwrap() -} else { -false -} -}) { -object_wrapper.clone() -} else { -None -}; - -if let Some(object_wrapper) = found { -tracing::debug!(target: "store", "found duplicate {object_wrapper:?}."); -self.object_wrapper_free_list.lock().unwrap().push(_index); -object_wrapper.clone() -} else { -tracing::debug!(target: "store", "interring {object_wrapper:?}."); -self.object_wrapper.write().unwrap()[_index] = Some(object_wrapper.clone()); -object_wrapper -} -} - -/// Exhume (get) [`ObjectWrapper`] from the store. -/// -#[inline] -pub fn exhume_object_wrapper(&self, id: &usize) -> Option>> { -match self.object_wrapper.read().unwrap().get(*id) { -Some(object_wrapper) => object_wrapper.clone(), -None => None -} -} - -/// Exorcise (remove) [`ObjectWrapper`] from the store. -/// -#[inline] -pub fn exorcise_object_wrapper(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising object_wrapper slot: {id}."); -let result = self.object_wrapper.write().unwrap()[*id].take(); -self.object_wrapper_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, ObjectWrapper>`. -/// -#[inline] -pub fn iter_object_wrapper(&self) -> impl Iterator>> + '_ { -let len = self.object_wrapper.read().unwrap().len(); -(0..len).filter(|i| self.object_wrapper.read().unwrap()[*i].is_some()).map(move|i|{self.object_wrapper.read().unwrap()[i].as_ref().map(|object_wrapper| object_wrapper.clone()).unwrap()}) -} - -/// Inter (insert) [`Operator`] into the store. -/// -#[inline] -pub fn inter_operator(&mut self, operator: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.operator_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.operator.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.operator.write().unwrap().push(None); -_index -}; - -let operator = operator(_index); - -let found = if let Some(operator) = self.operator.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *operator.read().unwrap() -} else { -false -} -}) { -operator.clone() -} else { -None -}; - -if let Some(operator) = found { -tracing::debug!(target: "store", "found duplicate {operator:?}."); -self.operator_free_list.lock().unwrap().push(_index); -operator.clone() -} else { -tracing::debug!(target: "store", "interring {operator:?}."); -self.operator.write().unwrap()[_index] = Some(operator.clone()); -operator -} -} - -/// Exhume (get) [`Operator`] from the store. -/// -#[inline] -pub fn exhume_operator(&self, id: &usize) -> Option>> { -match self.operator.read().unwrap().get(*id) { -Some(operator) => operator.clone(), -None => None -} -} - -/// Exorcise (remove) [`Operator`] from the store. -/// -#[inline] -pub fn exorcise_operator(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising operator slot: {id}."); -let result = self.operator.write().unwrap()[*id].take(); -self.operator_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Operator>`. -/// -#[inline] -pub fn iter_operator(&self) -> impl Iterator>> + '_ { -let len = self.operator.read().unwrap().len(); -(0..len).filter(|i| self.operator.read().unwrap()[*i].is_some()).map(move|i|{self.operator.read().unwrap()[i].as_ref().map(|operator| operator.clone()).unwrap()}) -} - -/// Inter (insert) [`Parameter`] into the store. -/// -#[inline] -pub fn inter_parameter(&mut self, parameter: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.parameter_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.parameter.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.parameter.write().unwrap().push(None); -_index -}; - -let parameter = parameter(_index); - -let found = if let Some(parameter) = self.parameter.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *parameter.read().unwrap() -} else { -false -} -}) { -parameter.clone() -} else { -None -}; - -if let Some(parameter) = found { -tracing::debug!(target: "store", "found duplicate {parameter:?}."); -self.parameter_free_list.lock().unwrap().push(_index); -parameter.clone() -} else { -tracing::debug!(target: "store", "interring {parameter:?}."); -self.parameter.write().unwrap()[_index] = Some(parameter.clone()); -parameter -} -} - -/// Exhume (get) [`Parameter`] from the store. -/// -#[inline] -pub fn exhume_parameter(&self, id: &usize) -> Option>> { -match self.parameter.read().unwrap().get(*id) { -Some(parameter) => parameter.clone(), -None => None -} -} - -/// Exorcise (remove) [`Parameter`] from the store. -/// -#[inline] -pub fn exorcise_parameter(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising parameter slot: {id}."); -let result = self.parameter.write().unwrap()[*id].take(); -self.parameter_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Parameter>`. -/// -#[inline] -pub fn iter_parameter(&self) -> impl Iterator>> + '_ { -let len = self.parameter.read().unwrap().len(); -(0..len).filter(|i| self.parameter.read().unwrap()[*i].is_some()).map(move|i|{self.parameter.read().unwrap()[i].as_ref().map(|parameter| parameter.clone()).unwrap()}) -} - -/// Inter (insert) [`XPath`] into the store. -/// -#[inline] -pub fn inter_x_path(&mut self, x_path: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.x_path_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.x_path.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.x_path.write().unwrap().push(None); -_index -}; - -let x_path = x_path(_index); - -let found = if let Some(x_path) = self.x_path.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *x_path.read().unwrap() -} else { -false -} -}) { -x_path.clone() -} else { -None -}; - -if let Some(x_path) = found { -tracing::debug!(target: "store", "found duplicate {x_path:?}."); -self.x_path_free_list.lock().unwrap().push(_index); -x_path.clone() -} else { -tracing::debug!(target: "store", "interring {x_path:?}."); -self.x_path.write().unwrap()[_index] = Some(x_path.clone()); -x_path -} -} - -/// Exhume (get) [`XPath`] from the store. -/// -#[inline] -pub fn exhume_x_path(&self, id: &usize) -> Option>> { -match self.x_path.read().unwrap().get(*id) { -Some(x_path) => x_path.clone(), -None => None -} -} - -/// Exorcise (remove) [`XPath`] from the store. -/// -#[inline] -pub fn exorcise_x_path(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising x_path slot: {id}."); -let result = self.x_path.write().unwrap()[*id].take(); -self.x_path_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, XPath>`. -/// -#[inline] -pub fn iter_x_path(&self) -> impl Iterator>> + '_ { -let len = self.x_path.read().unwrap().len(); -(0..len).filter(|i| self.x_path.read().unwrap()[*i].is_some()).map(move|i|{self.x_path.read().unwrap()[i].as_ref().map(|x_path| x_path.clone()).unwrap()}) -} - -/// Inter (insert) [`PathElement`] into the store. -/// -#[inline] -pub fn inter_path_element(&mut self, path_element: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.path_element_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.path_element.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.path_element.write().unwrap().push(None); -_index -}; - -let path_element = path_element(_index); - -let found = if let Some(path_element) = self.path_element.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *path_element.read().unwrap() -} else { -false -} -}) { -path_element.clone() -} else { -None -}; - -if let Some(path_element) = found { -tracing::debug!(target: "store", "found duplicate {path_element:?}."); -self.path_element_free_list.lock().unwrap().push(_index); -path_element.clone() -} else { -tracing::debug!(target: "store", "interring {path_element:?}."); -self.path_element.write().unwrap()[_index] = Some(path_element.clone()); -path_element -} -} - -/// Exhume (get) [`PathElement`] from the store. -/// -#[inline] -pub fn exhume_path_element(&self, id: &usize) -> Option>> { -match self.path_element.read().unwrap().get(*id) { -Some(path_element) => path_element.clone(), -None => None -} -} - -/// Exorcise (remove) [`PathElement`] from the store. -/// -#[inline] -pub fn exorcise_path_element(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising path_element slot: {id}."); -let result = self.path_element.write().unwrap()[*id].take(); -self.path_element_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, PathElement>`. -/// -#[inline] -pub fn iter_path_element(&self) -> impl Iterator>> + '_ { -let len = self.path_element.read().unwrap().len(); -(0..len).filter(|i| self.path_element.read().unwrap()[*i].is_some()).map(move|i|{self.path_element.read().unwrap()[i].as_ref().map(|path_element| path_element.clone()).unwrap()}) -} - -/// Inter (insert) [`Pattern`] into the store. -/// -#[inline] -pub fn inter_pattern(&mut self, pattern: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.pattern_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.pattern.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.pattern.write().unwrap().push(None); -_index -}; - -let pattern = pattern(_index); - -let found = if let Some(pattern) = self.pattern.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *pattern.read().unwrap() -} else { -false -} -}) { -pattern.clone() -} else { -None -}; - -if let Some(pattern) = found { -tracing::debug!(target: "store", "found duplicate {pattern:?}."); -self.pattern_free_list.lock().unwrap().push(_index); -pattern.clone() -} else { -tracing::debug!(target: "store", "interring {pattern:?}."); -self.pattern.write().unwrap()[_index] = Some(pattern.clone()); -pattern -} -} - -/// Exhume (get) [`Pattern`] from the store. -/// -#[inline] -pub fn exhume_pattern(&self, id: &usize) -> Option>> { -match self.pattern.read().unwrap().get(*id) { -Some(pattern) => pattern.clone(), -None => None -} -} - -/// Exorcise (remove) [`Pattern`] from the store. -/// -#[inline] -pub fn exorcise_pattern(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising pattern slot: {id}."); -let result = self.pattern.write().unwrap()[*id].take(); -self.pattern_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Pattern>`. -/// -#[inline] -pub fn iter_pattern(&self) -> impl Iterator>> + '_ { -let len = self.pattern.read().unwrap().len(); -(0..len).filter(|i| self.pattern.read().unwrap()[*i].is_some()).map(move|i|{self.pattern.read().unwrap()[i].as_ref().map(|pattern| pattern.clone()).unwrap()}) -} - -/// Inter (insert) [`XPlugin`] into the store. -/// -#[inline] -pub fn inter_x_plugin(&mut self, x_plugin: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.x_plugin_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.x_plugin.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.x_plugin.write().unwrap().push(None); -_index -}; - -let x_plugin = x_plugin(_index); - -let found = if let Some(x_plugin) = self.x_plugin.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *x_plugin.read().unwrap() -} else { -false -} -}) { -x_plugin.clone() -} else { -None -}; - -let x_plugin = -if let Some(x_plugin) = found { -tracing::debug!(target: "store", "found duplicate {x_plugin:?}."); -self.x_plugin_free_list.lock().unwrap().push(_index); -x_plugin.clone() -} else { -tracing::debug!(target: "store", "interring {x_plugin:?}."); -self.x_plugin.write().unwrap()[_index] = Some(x_plugin.clone()); -x_plugin -} -; -self.x_plugin_id_by_name.write().unwrap().insert(x_plugin.read().unwrap().name.to_owned(), x_plugin.read().unwrap().id); -x_plugin -} - -/// Exhume (get) [`XPlugin`] from the store. -/// -#[inline] -pub fn exhume_x_plugin(&self, id: &usize) -> Option>> { -match self.x_plugin.read().unwrap().get(*id) { -Some(x_plugin) => x_plugin.clone(), -None => None -} -} - -/// Exorcise (remove) [`XPlugin`] from the store. -/// -#[inline] -pub fn exorcise_x_plugin(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising x_plugin slot: {id}."); -let result = self.x_plugin.write().unwrap()[*id].take(); -self.x_plugin_free_list.lock().unwrap().push(*id); -result -} - -/// Exorcise [`XPlugin`] id from the store by name. -/// -#[inline] -pub fn exhume_x_plugin_id_by_name(&self, name: &str) -> Option { -self.x_plugin_id_by_name.read().unwrap().get(name).map(|x_plugin| *x_plugin) -} - -/// Get an iterator over the internal `HashMap<&Uuid, XPlugin>`. -/// -#[inline] -pub fn iter_x_plugin(&self) -> impl Iterator>> + '_ { -let len = self.x_plugin.read().unwrap().len(); -(0..len).filter(|i| self.x_plugin.read().unwrap()[*i].is_some()).map(move|i|{self.x_plugin.read().unwrap()[i].as_ref().map(|x_plugin| x_plugin.clone()).unwrap()}) -} - -/// Inter (insert) [`XPrint`] into the store. -/// -#[inline] -pub fn inter_x_print(&mut self, x_print: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.x_print_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.x_print.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.x_print.write().unwrap().push(None); -_index -}; - -let x_print = x_print(_index); - -let found = if let Some(x_print) = self.x_print.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *x_print.read().unwrap() -} else { -false -} -}) { -x_print.clone() -} else { -None -}; - -if let Some(x_print) = found { -tracing::debug!(target: "store", "found duplicate {x_print:?}."); -self.x_print_free_list.lock().unwrap().push(_index); -x_print.clone() -} else { -tracing::debug!(target: "store", "interring {x_print:?}."); -self.x_print.write().unwrap()[_index] = Some(x_print.clone()); -x_print -} -} - -/// Exhume (get) [`XPrint`] from the store. -/// -#[inline] -pub fn exhume_x_print(&self, id: &usize) -> Option>> { -match self.x_print.read().unwrap().get(*id) { -Some(x_print) => x_print.clone(), -None => None -} -} - -/// Exorcise (remove) [`XPrint`] from the store. -/// -#[inline] -pub fn exorcise_x_print(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising x_print slot: {id}."); -let result = self.x_print.write().unwrap()[*id].take(); -self.x_print_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, XPrint>`. -/// -#[inline] -pub fn iter_x_print(&self) -> impl Iterator>> + '_ { -let len = self.x_print.read().unwrap().len(); -(0..len).filter(|i| self.x_print.read().unwrap()[*i].is_some()).map(move|i|{self.x_print.read().unwrap()[i].as_ref().map(|x_print| x_print.clone()).unwrap()}) -} - -/// Inter (insert) [`RangeExpression`] into the store. -/// -#[inline] -pub fn inter_range_expression(&mut self, range_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.range_expression_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.range_expression.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.range_expression.write().unwrap().push(None); -_index -}; - -let range_expression = range_expression(_index); - -let found = if let Some(range_expression) = self.range_expression.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *range_expression.read().unwrap() -} else { -false -} -}) { -range_expression.clone() -} else { -None -}; - -if let Some(range_expression) = found { -tracing::debug!(target: "store", "found duplicate {range_expression:?}."); -self.range_expression_free_list.lock().unwrap().push(_index); -range_expression.clone() -} else { -tracing::debug!(target: "store", "interring {range_expression:?}."); -self.range_expression.write().unwrap()[_index] = Some(range_expression.clone()); -range_expression -} -} - -/// Exhume (get) [`RangeExpression`] from the store. -/// -#[inline] -pub fn exhume_range_expression(&self, id: &usize) -> Option>> { -match self.range_expression.read().unwrap().get(*id) { -Some(range_expression) => range_expression.clone(), -None => None -} -} - -/// Exorcise (remove) [`RangeExpression`] from the store. -/// -#[inline] -pub fn exorcise_range_expression(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising range_expression slot: {id}."); -let result = self.range_expression.write().unwrap()[*id].take(); -self.range_expression_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, RangeExpression>`. -/// -#[inline] -pub fn iter_range_expression(&self) -> impl Iterator>> + '_ { -let len = self.range_expression.read().unwrap().len(); -(0..len).filter(|i| self.range_expression.read().unwrap()[*i].is_some()).map(move|i|{self.range_expression.read().unwrap()[i].as_ref().map(|range_expression| range_expression.clone()).unwrap()}) -} - -/// Inter (insert) [`ResultStatement`] into the store. -/// -#[inline] -pub fn inter_result_statement(&mut self, result_statement: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.result_statement_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.result_statement.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.result_statement.write().unwrap().push(None); -_index -}; - -let result_statement = result_statement(_index); - -let found = if let Some(result_statement) = self.result_statement.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *result_statement.read().unwrap() -} else { -false -} -}) { -result_statement.clone() -} else { -None -}; - -if let Some(result_statement) = found { -tracing::debug!(target: "store", "found duplicate {result_statement:?}."); -self.result_statement_free_list.lock().unwrap().push(_index); -result_statement.clone() -} else { -tracing::debug!(target: "store", "interring {result_statement:?}."); -self.result_statement.write().unwrap()[_index] = Some(result_statement.clone()); -result_statement -} -} - -/// Exhume (get) [`ResultStatement`] from the store. -/// -#[inline] -pub fn exhume_result_statement(&self, id: &usize) -> Option>> { -match self.result_statement.read().unwrap().get(*id) { -Some(result_statement) => result_statement.clone(), -None => None -} -} - -/// Exorcise (remove) [`ResultStatement`] from the store. -/// -#[inline] -pub fn exorcise_result_statement(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising result_statement slot: {id}."); -let result = self.result_statement.write().unwrap()[*id].take(); -self.result_statement_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, ResultStatement>`. -/// -#[inline] -pub fn iter_result_statement(&self) -> impl Iterator>> + '_ { -let len = self.result_statement.read().unwrap().len(); -(0..len).filter(|i| self.result_statement.read().unwrap()[*i].is_some()).map(move|i|{self.result_statement.read().unwrap()[i].as_ref().map(|result_statement| result_statement.clone()).unwrap()}) -} - -/// Inter (insert) [`XReturn`] into the store. -/// -#[inline] -pub fn inter_x_return(&mut self, x_return: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.x_return_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.x_return.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.x_return.write().unwrap().push(None); -_index -}; - -let x_return = x_return(_index); - -let found = if let Some(x_return) = self.x_return.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *x_return.read().unwrap() -} else { -false -} -}) { -x_return.clone() -} else { -None -}; - -if let Some(x_return) = found { -tracing::debug!(target: "store", "found duplicate {x_return:?}."); -self.x_return_free_list.lock().unwrap().push(_index); -x_return.clone() -} else { -tracing::debug!(target: "store", "interring {x_return:?}."); -self.x_return.write().unwrap()[_index] = Some(x_return.clone()); -x_return -} -} - -/// Exhume (get) [`XReturn`] from the store. -/// -#[inline] -pub fn exhume_x_return(&self, id: &usize) -> Option>> { -match self.x_return.read().unwrap().get(*id) { -Some(x_return) => x_return.clone(), -None => None -} -} - -/// Exorcise (remove) [`XReturn`] from the store. -/// -#[inline] -pub fn exorcise_x_return(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising x_return slot: {id}."); -let result = self.x_return.write().unwrap()[*id].take(); -self.x_return_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, XReturn>`. -/// -#[inline] -pub fn iter_x_return(&self) -> impl Iterator>> + '_ { -let len = self.x_return.read().unwrap().len(); -(0..len).filter(|i| self.x_return.read().unwrap()[*i].is_some()).map(move|i|{self.x_return.read().unwrap()[i].as_ref().map(|x_return| x_return.clone()).unwrap()}) -} - -/// Inter (insert) [`Span`] into the store. -/// -#[inline] -pub fn inter_span(&mut self, span: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.span_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.span.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.span.write().unwrap().push(None); -_index -}; - -let span = span(_index); - -let found = if let Some(span) = self.span.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *span.read().unwrap() -} else { -false -} -}) { -span.clone() -} else { -None -}; - -if let Some(span) = found { -tracing::debug!(target: "store", "found duplicate {span:?}."); -self.span_free_list.lock().unwrap().push(_index); -span.clone() -} else { -tracing::debug!(target: "store", "interring {span:?}."); -self.span.write().unwrap()[_index] = Some(span.clone()); -span -} -} - -/// Exhume (get) [`Span`] from the store. -/// -#[inline] -pub fn exhume_span(&self, id: &usize) -> Option>> { -match self.span.read().unwrap().get(*id) { -Some(span) => span.clone(), -None => None -} -} - -/// Exorcise (remove) [`Span`] from the store. -/// -#[inline] -pub fn exorcise_span(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising span slot: {id}."); -let result = self.span.write().unwrap()[*id].take(); -self.span_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Span>`. -/// -#[inline] -pub fn iter_span(&self) -> impl Iterator>> + '_ { -let len = self.span.read().unwrap().len(); -(0..len).filter(|i| self.span.read().unwrap()[*i].is_some()).map(move|i|{self.span.read().unwrap()[i].as_ref().map(|span| span.clone()).unwrap()}) -} - -/// Inter (insert) [`Statement`] into the store. -/// -#[inline] -pub fn inter_statement(&mut self, statement: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.statement_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.statement.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.statement.write().unwrap().push(None); -_index -}; - -let statement = statement(_index); - -let found = if let Some(statement) = self.statement.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *statement.read().unwrap() -} else { -false -} -}) { -statement.clone() -} else { -None -}; - -if let Some(statement) = found { -tracing::debug!(target: "store", "found duplicate {statement:?}."); -self.statement_free_list.lock().unwrap().push(_index); -statement.clone() -} else { -tracing::debug!(target: "store", "interring {statement:?}."); -self.statement.write().unwrap()[_index] = Some(statement.clone()); -statement -} -} - -/// Exhume (get) [`Statement`] from the store. -/// -#[inline] -pub fn exhume_statement(&self, id: &usize) -> Option>> { -match self.statement.read().unwrap().get(*id) { -Some(statement) => statement.clone(), -None => None -} -} - -/// Exorcise (remove) [`Statement`] from the store. -/// -#[inline] -pub fn exorcise_statement(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising statement slot: {id}."); -let result = self.statement.write().unwrap()[*id].take(); -self.statement_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, Statement>`. -/// -#[inline] -pub fn iter_statement(&self) -> impl Iterator>> + '_ { -let len = self.statement.read().unwrap().len(); -(0..len).filter(|i| self.statement.read().unwrap()[*i].is_some()).map(move|i|{self.statement.read().unwrap()[i].as_ref().map(|statement| statement.clone()).unwrap()}) -} - -/// Inter (insert) [`StaticMethodCall`] into the store. -/// -#[inline] -pub fn inter_static_method_call(&mut self, static_method_call: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.static_method_call_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.static_method_call.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.static_method_call.write().unwrap().push(None); -_index -}; - -let static_method_call = static_method_call(_index); - -let found = if let Some(static_method_call) = self.static_method_call.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *static_method_call.read().unwrap() -} else { -false -} -}) { -static_method_call.clone() -} else { -None -}; - -if let Some(static_method_call) = found { -tracing::debug!(target: "store", "found duplicate {static_method_call:?}."); -self.static_method_call_free_list.lock().unwrap().push(_index); -static_method_call.clone() -} else { -tracing::debug!(target: "store", "interring {static_method_call:?}."); -self.static_method_call.write().unwrap()[_index] = Some(static_method_call.clone()); -static_method_call -} -} - -/// Exhume (get) [`StaticMethodCall`] from the store. -/// -#[inline] -pub fn exhume_static_method_call(&self, id: &usize) -> Option>> { -match self.static_method_call.read().unwrap().get(*id) { -Some(static_method_call) => static_method_call.clone(), -None => None -} -} - -/// Exorcise (remove) [`StaticMethodCall`] from the store. -/// -#[inline] -pub fn exorcise_static_method_call(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising static_method_call slot: {id}."); -let result = self.static_method_call.write().unwrap()[*id].take(); -self.static_method_call_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, StaticMethodCall>`. -/// -#[inline] -pub fn iter_static_method_call(&self) -> impl Iterator>> + '_ { -let len = self.static_method_call.read().unwrap().len(); -(0..len).filter(|i| self.static_method_call.read().unwrap()[*i].is_some()).map(move|i|{self.static_method_call.read().unwrap()[i].as_ref().map(|static_method_call| static_method_call.clone()).unwrap()}) -} - -/// Inter (insert) [`StringBit`] into the store. -/// -#[inline] -pub fn inter_string_bit(&mut self, string_bit: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.string_bit_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.string_bit.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.string_bit.write().unwrap().push(None); -_index -}; - -let string_bit = string_bit(_index); - -let found = if let Some(string_bit) = self.string_bit.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *string_bit.read().unwrap() -} else { -false -} -}) { -string_bit.clone() -} else { -None -}; - -if let Some(string_bit) = found { -tracing::debug!(target: "store", "found duplicate {string_bit:?}."); -self.string_bit_free_list.lock().unwrap().push(_index); -string_bit.clone() -} else { -tracing::debug!(target: "store", "interring {string_bit:?}."); -self.string_bit.write().unwrap()[_index] = Some(string_bit.clone()); -string_bit -} -} - -/// Exhume (get) [`StringBit`] from the store. -/// -#[inline] -pub fn exhume_string_bit(&self, id: &usize) -> Option>> { -match self.string_bit.read().unwrap().get(*id) { -Some(string_bit) => string_bit.clone(), -None => None -} -} - -/// Exorcise (remove) [`StringBit`] from the store. -/// -#[inline] -pub fn exorcise_string_bit(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising string_bit slot: {id}."); -let result = self.string_bit.write().unwrap()[*id].take(); -self.string_bit_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, StringBit>`. -/// -#[inline] -pub fn iter_string_bit(&self) -> impl Iterator>> + '_ { -let len = self.string_bit.read().unwrap().len(); -(0..len).filter(|i| self.string_bit.read().unwrap()[*i].is_some()).map(move|i|{self.string_bit.read().unwrap()[i].as_ref().map(|string_bit| string_bit.clone()).unwrap()}) -} - -/// Inter (insert) [`StringLiteral`] into the store. -/// -#[inline] -pub fn inter_string_literal(&mut self, string_literal: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.string_literal_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.string_literal.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.string_literal.write().unwrap().push(None); -_index -}; - -let string_literal = string_literal(_index); - -let found = if let Some(string_literal) = self.string_literal.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *string_literal.read().unwrap() -} else { -false -} -}) { -string_literal.clone() -} else { -None -}; - -if let Some(string_literal) = found { -tracing::debug!(target: "store", "found duplicate {string_literal:?}."); -self.string_literal_free_list.lock().unwrap().push(_index); -string_literal.clone() -} else { -tracing::debug!(target: "store", "interring {string_literal:?}."); -self.string_literal.write().unwrap()[_index] = Some(string_literal.clone()); -string_literal -} -} - -/// Exhume (get) [`StringLiteral`] from the store. -/// -#[inline] -pub fn exhume_string_literal(&self, id: &usize) -> Option>> { -match self.string_literal.read().unwrap().get(*id) { -Some(string_literal) => string_literal.clone(), -None => None -} -} - -/// Exorcise (remove) [`StringLiteral`] from the store. -/// -#[inline] -pub fn exorcise_string_literal(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising string_literal slot: {id}."); -let result = self.string_literal.write().unwrap()[*id].take(); -self.string_literal_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, StringLiteral>`. -/// -#[inline] -pub fn iter_string_literal(&self) -> impl Iterator>> + '_ { -let len = self.string_literal.read().unwrap().len(); -(0..len).filter(|i| self.string_literal.read().unwrap()[*i].is_some()).map(move|i|{self.string_literal.read().unwrap()[i].as_ref().map(|string_literal| string_literal.clone()).unwrap()}) -} - -/// Inter (insert) [`WoogStruct`] into the store. -/// -#[inline] -pub fn inter_woog_struct(&mut self, woog_struct: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.woog_struct_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.woog_struct.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.woog_struct.write().unwrap().push(None); -_index -}; - -let woog_struct = woog_struct(_index); - -let found = if let Some(woog_struct) = self.woog_struct.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *woog_struct.read().unwrap() -} else { -false -} -}) { -woog_struct.clone() -} else { -None -}; - -let woog_struct = -if let Some(woog_struct) = found { -tracing::debug!(target: "store", "found duplicate {woog_struct:?}."); -self.woog_struct_free_list.lock().unwrap().push(_index); -woog_struct.clone() -} else { -tracing::debug!(target: "store", "interring {woog_struct:?}."); -self.woog_struct.write().unwrap()[_index] = Some(woog_struct.clone()); -woog_struct -} -; -self.woog_struct_id_by_name.write().unwrap().insert(woog_struct.read().unwrap().name.to_owned(), woog_struct.read().unwrap().id); -woog_struct -} - -/// Exhume (get) [`WoogStruct`] from the store. -/// -#[inline] -pub fn exhume_woog_struct(&self, id: &usize) -> Option>> { -match self.woog_struct.read().unwrap().get(*id) { -Some(woog_struct) => woog_struct.clone(), -None => None -} -} - -/// Exorcise (remove) [`WoogStruct`] from the store. -/// -#[inline] -pub fn exorcise_woog_struct(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising woog_struct slot: {id}."); -let result = self.woog_struct.write().unwrap()[*id].take(); -self.woog_struct_free_list.lock().unwrap().push(*id); -result -} - -/// Exorcise [`WoogStruct`] id from the store by name. -/// -#[inline] -pub fn exhume_woog_struct_id_by_name(&self, name: &str) -> Option { -self.woog_struct_id_by_name.read().unwrap().get(name).map(|woog_struct| *woog_struct) -} - -/// Get an iterator over the internal `HashMap<&Uuid, WoogStruct>`. -/// -#[inline] -pub fn iter_woog_struct(&self) -> impl Iterator>> + '_ { -let len = self.woog_struct.read().unwrap().len(); -(0..len).filter(|i| self.woog_struct.read().unwrap()[*i].is_some()).map(move|i|{self.woog_struct.read().unwrap()[i].as_ref().map(|woog_struct| woog_struct.clone()).unwrap()}) -} - -/// Inter (insert) [`StructExpression`] into the store. -/// -#[inline] -pub fn inter_struct_expression(&mut self, struct_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.struct_expression_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.struct_expression.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.struct_expression.write().unwrap().push(None); -_index -}; - -let struct_expression = struct_expression(_index); - -let found = if let Some(struct_expression) = self.struct_expression.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *struct_expression.read().unwrap() -} else { -false -} -}) { -struct_expression.clone() -} else { -None -}; - -if let Some(struct_expression) = found { -tracing::debug!(target: "store", "found duplicate {struct_expression:?}."); -self.struct_expression_free_list.lock().unwrap().push(_index); -struct_expression.clone() -} else { -tracing::debug!(target: "store", "interring {struct_expression:?}."); -self.struct_expression.write().unwrap()[_index] = Some(struct_expression.clone()); -struct_expression -} -} - -/// Exhume (get) [`StructExpression`] from the store. -/// -#[inline] -pub fn exhume_struct_expression(&self, id: &usize) -> Option>> { -match self.struct_expression.read().unwrap().get(*id) { -Some(struct_expression) => struct_expression.clone(), -None => None -} -} - -/// Exorcise (remove) [`StructExpression`] from the store. -/// -#[inline] -pub fn exorcise_struct_expression(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising struct_expression slot: {id}."); -let result = self.struct_expression.write().unwrap()[*id].take(); -self.struct_expression_free_list.lock().unwrap().push(*id); -result -} - -/// Get an iterator over the internal `HashMap<&Uuid, StructExpression>`. -/// -#[inline] -pub fn iter_struct_expression(&self) -> impl Iterator>> + '_ { -let len = self.struct_expression.read().unwrap().len(); -(0..len).filter(|i| self.struct_expression.read().unwrap()[*i].is_some()).map(move|i|{self.struct_expression.read().unwrap()[i].as_ref().map(|struct_expression| struct_expression.clone()).unwrap()}) -} - -/// Inter (insert) [`StructField`] into the store. -/// -#[inline] -pub fn inter_struct_field(&mut self, struct_field: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.struct_field_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.struct_field.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.struct_field.write().unwrap().push(None); -_index -}; - -let struct_field = struct_field(_index); +use heck::ToUpperCamelCase; +use rustc_hash::FxHashMap as HashMap; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; -let found = if let Some(struct_field) = self.struct_field.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *struct_field.read().unwrap() -} else { -false -} -}) { -struct_field.clone() -} else { -None +use crate::v2::lu_dog_ndrwlock_vec::types::{ + AWait, Argument, Binary, Block, Body, BooleanLiteral, BooleanOperator, Call, CharLiteral, + Comparison, DataStructure, DwarfSourceFile, EnumField, EnumGeneric, EnumGenericType, + Enumeration, Expression, ExpressionBit, ExpressionStatement, ExternalImplementation, Field, + FieldAccess, FieldAccessTarget, FieldExpression, FloatLiteral, ForLoop, FormatBit, + FormatString, FuncGeneric, Function, FunctionCall, Grouped, HaltAndCatchFire, + ImplementationBlock, Import, Index, IntegerLiteral, Item, Lambda, LambdaParameter, + LetStatement, List, ListElement, ListExpression, Literal, LocalVariable, Map, MapElement, + MapExpression, MethodCall, NamedFieldExpression, ObjectWrapper, Operator, Parameter, + PathElement, Pattern, RangeExpression, ResultStatement, Span, Statement, StaticMethodCall, + StringBit, StringLiteral, StructExpression, StructField, StructGeneric, TupleField, TypeCast, + Unary, Unit, UnnamedFieldExpression, ValueType, Variable, VariableExpression, WoogStruct, + XFuture, XIf, XMacro, XMatch, XPath, XPlugin, XPrint, XReturn, XValue, ZObjectStore, ADDITION, + AND, ANY_LIST, ASSIGNMENT, CHAR, DIVISION, EMPTY, EMPTY_EXPRESSION, EQUAL, FALSE_LITERAL, FROM, + FULL, GREATER_THAN, GREATER_THAN_OR_EQUAL, INCLUSIVE, ITEM_STATEMENT, LESS_THAN, + LESS_THAN_OR_EQUAL, MACRO_CALL, MULTIPLICATION, NEGATION, NOT, NOT_EQUAL, OR, RANGE, + SUBTRACTION, TASK, TO, TO_INCLUSIVE, TRUE_LITERAL, UNKNOWN, X_DEBUGGER, }; -if let Some(struct_field) = found { -tracing::debug!(target: "store", "found duplicate {struct_field:?}."); -self.struct_field_free_list.lock().unwrap().push(_index); -struct_field.clone() -} else { -tracing::debug!(target: "store", "interring {struct_field:?}."); -self.struct_field.write().unwrap()[_index] = Some(struct_field.clone()); -struct_field -} +#[derive(Debug)] +pub struct ObjectStore { + argument_free_list: std::sync::Mutex>, + argument: Arc>>>>>, + a_wait_free_list: std::sync::Mutex>, + a_wait: Arc>>>>>, + binary_free_list: std::sync::Mutex>, + binary: Arc>>>>>, + block_free_list: std::sync::Mutex>, + block: Arc>>>>>, + body_free_list: std::sync::Mutex>, + body: Arc>>>>>, + boolean_literal_free_list: std::sync::Mutex>, + boolean_literal: Arc>>>>>, + boolean_operator_free_list: std::sync::Mutex>, + boolean_operator: Arc>>>>>, + call_free_list: std::sync::Mutex>, + call: Arc>>>>>, + char_literal_free_list: std::sync::Mutex>, + char_literal: Arc>>>>>, + comparison_free_list: std::sync::Mutex>, + comparison: Arc>>>>>, + data_structure_free_list: std::sync::Mutex>, + data_structure: Arc>>>>>, + dwarf_source_file_free_list: std::sync::Mutex>, + dwarf_source_file: Arc>>>>>, + enum_field_free_list: std::sync::Mutex>, + enum_field: Arc>>>>>, + enum_generic_free_list: std::sync::Mutex>, + enum_generic: Arc>>>>>, + enum_generic_type_free_list: std::sync::Mutex>, + enum_generic_type: Arc>>>>>, + enumeration_free_list: std::sync::Mutex>, + enumeration: Arc>>>>>, + enumeration_id_by_name: Arc>>, + expression_free_list: std::sync::Mutex>, + expression: Arc>>>>>, + expression_bit_free_list: std::sync::Mutex>, + expression_bit: Arc>>>>>, + expression_statement_free_list: std::sync::Mutex>, + expression_statement: Arc>>>>>, + external_implementation_free_list: std::sync::Mutex>, + external_implementation: Arc>>>>>, + field_free_list: std::sync::Mutex>, + field: Arc>>>>>, + field_id_by_name: Arc>>, + field_access_free_list: std::sync::Mutex>, + field_access: Arc>>>>>, + field_access_target_free_list: std::sync::Mutex>, + field_access_target: Arc>>>>>, + field_expression_free_list: std::sync::Mutex>, + field_expression: Arc>>>>>, + float_literal_free_list: std::sync::Mutex>, + float_literal: Arc>>>>>, + for_loop_free_list: std::sync::Mutex>, + for_loop: Arc>>>>>, + format_bit_free_list: std::sync::Mutex>, + format_bit: Arc>>>>>, + format_string_free_list: std::sync::Mutex>, + format_string: Arc>>>>>, + func_generic_free_list: std::sync::Mutex>, + func_generic: Arc>>>>>, + function_free_list: std::sync::Mutex>, + function: Arc>>>>>, + function_id_by_name: Arc>>, + function_call_free_list: std::sync::Mutex>, + function_call: Arc>>>>>, + x_future_free_list: std::sync::Mutex>, + x_future: Arc>>>>>, + grouped_free_list: std::sync::Mutex>, + grouped: Arc>>>>>, + halt_and_catch_fire_free_list: std::sync::Mutex>, + halt_and_catch_fire: Arc>>>>>, + x_if_free_list: std::sync::Mutex>, + x_if: Arc>>>>>, + implementation_block_free_list: std::sync::Mutex>, + implementation_block: Arc>>>>>, + import_free_list: std::sync::Mutex>, + import: Arc>>>>>, + index_free_list: std::sync::Mutex>, + index: Arc>>>>>, + integer_literal_free_list: std::sync::Mutex>, + integer_literal: Arc>>>>>, + item_free_list: std::sync::Mutex>, + item: Arc>>>>>, + lambda_free_list: std::sync::Mutex>, + lambda: Arc>>>>>, + lambda_parameter_free_list: std::sync::Mutex>, + lambda_parameter: Arc>>>>>, + let_statement_free_list: std::sync::Mutex>, + let_statement: Arc>>>>>, + list_free_list: std::sync::Mutex>, + list: Arc>>>>>, + list_element_free_list: std::sync::Mutex>, + list_element: Arc>>>>>, + list_expression_free_list: std::sync::Mutex>, + list_expression: Arc>>>>>, + literal_free_list: std::sync::Mutex>, + literal: Arc>>>>>, + local_variable_free_list: std::sync::Mutex>, + local_variable: Arc>>>>>, + x_macro_free_list: std::sync::Mutex>, + x_macro: Arc>>>>>, + map_free_list: std::sync::Mutex>, + map: Arc>>>>>, + map_element_free_list: std::sync::Mutex>, + map_element: Arc>>>>>, + map_expression_free_list: std::sync::Mutex>, + map_expression: Arc>>>>>, + x_match_free_list: std::sync::Mutex>, + x_match: Arc>>>>>, + method_call_free_list: std::sync::Mutex>, + method_call: Arc>>>>>, + named_field_expression_free_list: std::sync::Mutex>, + named_field_expression: Arc>>>>>, + z_object_store_free_list: std::sync::Mutex>, + z_object_store: Arc>>>>>, + z_object_store_id_by_name: Arc>>, + object_wrapper_free_list: std::sync::Mutex>, + object_wrapper: Arc>>>>>, + operator_free_list: std::sync::Mutex>, + operator: Arc>>>>>, + parameter_free_list: std::sync::Mutex>, + parameter: Arc>>>>>, + x_path_free_list: std::sync::Mutex>, + x_path: Arc>>>>>, + path_element_free_list: std::sync::Mutex>, + path_element: Arc>>>>>, + pattern_free_list: std::sync::Mutex>, + pattern: Arc>>>>>, + x_plugin_free_list: std::sync::Mutex>, + x_plugin: Arc>>>>>, + x_plugin_id_by_name: Arc>>, + x_print_free_list: std::sync::Mutex>, + x_print: Arc>>>>>, + range_expression_free_list: std::sync::Mutex>, + range_expression: Arc>>>>>, + result_statement_free_list: std::sync::Mutex>, + result_statement: Arc>>>>>, + x_return_free_list: std::sync::Mutex>, + x_return: Arc>>>>>, + span_free_list: std::sync::Mutex>, + span: Arc>>>>>, + statement_free_list: std::sync::Mutex>, + statement: Arc>>>>>, + static_method_call_free_list: std::sync::Mutex>, + static_method_call: Arc>>>>>, + string_bit_free_list: std::sync::Mutex>, + string_bit: Arc>>>>>, + string_literal_free_list: std::sync::Mutex>, + string_literal: Arc>>>>>, + woog_struct_free_list: std::sync::Mutex>, + woog_struct: Arc>>>>>, + woog_struct_id_by_name: Arc>>, + struct_expression_free_list: std::sync::Mutex>, + struct_expression: Arc>>>>>, + struct_field_free_list: std::sync::Mutex>, + struct_field: Arc>>>>>, + struct_generic_free_list: std::sync::Mutex>, + struct_generic: Arc>>>>>, + tuple_field_free_list: std::sync::Mutex>, + tuple_field: Arc>>>>>, + type_cast_free_list: std::sync::Mutex>, + type_cast: Arc>>>>>, + unary_free_list: std::sync::Mutex>, + unary: Arc>>>>>, + unit_free_list: std::sync::Mutex>, + unit: Arc>>>>>, + unnamed_field_expression_free_list: std::sync::Mutex>, + unnamed_field_expression: Arc>>>>>, + x_value_free_list: std::sync::Mutex>, + x_value: Arc>>>>>, + value_type_free_list: std::sync::Mutex>, + value_type: Arc>>>>>, + variable_free_list: std::sync::Mutex>, + variable: Arc>>>>>, + variable_expression_free_list: std::sync::Mutex>, + variable_expression: Arc>>>>>, } -/// Exhume (get) [`StructField`] from the store. -/// -#[inline] -pub fn exhume_struct_field(&self, id: &usize) -> Option>> { -match self.struct_field.read().unwrap().get(*id) { -Some(struct_field) => struct_field.clone(), -None => None -} +impl Clone for ObjectStore { + fn clone(&self) -> Self { + ObjectStore { + argument_free_list: Mutex::new(self.argument_free_list.lock().unwrap().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: Arc::new(RwLock::new(self.a_wait.read().unwrap().clone())), + binary_free_list: Mutex::new(self.binary_free_list.lock().unwrap().clone()), + binary: Arc::new(RwLock::new(self.binary.read().unwrap().clone())), + block_free_list: Mutex::new(self.block_free_list.lock().unwrap().clone()), + block: Arc::new(RwLock::new(self.block.read().unwrap().clone())), + body_free_list: Mutex::new(self.body_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.boolean_operator.read().unwrap().clone())), + call_free_list: Mutex::new(self.call_free_list.lock().unwrap().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: Arc::new(RwLock::new(self.char_literal.read().unwrap().clone())), + comparison_free_list: Mutex::new(self.comparison_free_list.lock().unwrap().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: 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: 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: 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: Arc::new(RwLock::new(self.enum_generic.read().unwrap().clone())), + enum_generic_type_free_list: Mutex::new( + self.enum_generic_type_free_list.lock().unwrap().clone(), + ), + enum_generic_type: Arc::new(RwLock::new( + self.enum_generic_type.read().unwrap().clone(), + )), + enumeration_free_list: Mutex::new(self.enumeration_free_list.lock().unwrap().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: 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: 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: 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: Arc::new(RwLock::new( + self.external_implementation.read().unwrap().clone(), + )), + field_free_list: Mutex::new(self.field_free_list.lock().unwrap().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: 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: 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: 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: 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: 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: 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: 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: Arc::new(RwLock::new(self.func_generic.read().unwrap().clone())), + function_free_list: Mutex::new(self.function_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.x_future.read().unwrap().clone())), + grouped_free_list: Mutex::new(self.grouped_free_list.lock().unwrap().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: 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: 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: Arc::new(RwLock::new( + self.implementation_block.read().unwrap().clone(), + )), + import_free_list: Mutex::new(self.import_free_list.lock().unwrap().clone()), + import: Arc::new(RwLock::new(self.import.read().unwrap().clone())), + index_free_list: Mutex::new(self.index_free_list.lock().unwrap().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: Arc::new(RwLock::new(self.integer_literal.read().unwrap().clone())), + item_free_list: Mutex::new(self.item_free_list.lock().unwrap().clone()), + item: Arc::new(RwLock::new(self.item.read().unwrap().clone())), + lambda_free_list: Mutex::new(self.lambda_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.let_statement.read().unwrap().clone())), + list_free_list: Mutex::new(self.list_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.list_expression.read().unwrap().clone())), + literal_free_list: Mutex::new(self.literal_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.x_macro.read().unwrap().clone())), + map_free_list: Mutex::new(self.map_free_list.lock().unwrap().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: 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: 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: 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: 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: 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: 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: Arc::new(RwLock::new(self.object_wrapper.read().unwrap().clone())), + operator_free_list: Mutex::new(self.operator_free_list.lock().unwrap().clone()), + operator: Arc::new(RwLock::new(self.operator.read().unwrap().clone())), + parameter_free_list: Mutex::new(self.parameter_free_list.lock().unwrap().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: 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: Arc::new(RwLock::new(self.path_element.read().unwrap().clone())), + pattern_free_list: Mutex::new(self.pattern_free_list.lock().unwrap().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: 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: 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: 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: 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: Arc::new(RwLock::new(self.x_return.read().unwrap().clone())), + span_free_list: Mutex::new(self.span_free_list.lock().unwrap().clone()), + span: Arc::new(RwLock::new(self.span.read().unwrap().clone())), + statement_free_list: Mutex::new(self.statement_free_list.lock().unwrap().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: 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: 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: 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: 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: 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: 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: 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: 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: Arc::new(RwLock::new(self.type_cast.read().unwrap().clone())), + unary_free_list: Mutex::new(self.unary_free_list.lock().unwrap().clone()), + unary: Arc::new(RwLock::new(self.unary.read().unwrap().clone())), + unit_free_list: Mutex::new(self.unit_free_list.lock().unwrap().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: 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: 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: Arc::new(RwLock::new(self.value_type.read().unwrap().clone())), + variable_free_list: Mutex::new(self.variable_free_list.lock().unwrap().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: Arc::new(RwLock::new( + self.variable_expression.read().unwrap().clone(), + )), + } + } } +impl ObjectStore { + pub fn merge(&mut self, other: &ObjectStore) { + // if self.argument.read().unwrap().len() != other.argument.read().unwrap().len() { + 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 self + .argument + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.argument.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_argument(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exorcise (remove) [`StructField`] from the store. -/// -#[inline] -pub fn exorcise_struct_field(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising struct_field slot: {id}."); -let result = self.struct_field.write().unwrap()[*id].take(); -self.struct_field_free_list.lock().unwrap().push(*id); -result -} + x.clone() + }); + } + } + }); + // } + + // if self.a_wait.read().unwrap().len() != other.a_wait.read().unwrap().len() { + 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 self + .a_wait + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.a_wait.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_a_wait(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Get an iterator over the internal `HashMap<&Uuid, StructField>`. -/// -#[inline] -pub fn iter_struct_field(&self) -> impl Iterator>> + '_ { -let len = self.struct_field.read().unwrap().len(); -(0..len).filter(|i| self.struct_field.read().unwrap()[*i].is_some()).map(move|i|{self.struct_field.read().unwrap()[i].as_ref().map(|struct_field| struct_field.clone()).unwrap()}) -} + x.clone() + }); + } + } + }); + // } + + // if self.binary.read().unwrap().len() != other.binary.read().unwrap().len() { + 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 self + .binary + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.binary.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_binary(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Inter (insert) [`StructGeneric`] into the store. -/// -#[inline] -pub fn inter_struct_generic(&mut self, struct_generic: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.struct_generic_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.struct_generic.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.struct_generic.write().unwrap().push(None); -_index -}; + x.clone() + }); + } + } + }); + // } + + // if self.block.read().unwrap().len() != other.block.read().unwrap().len() { + 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 self + .block + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.block.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_block(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let struct_generic = struct_generic(_index); + x.clone() + }); + } + } + }); + // } + + // if self.body.read().unwrap().len() != other.body.read().unwrap().len() { + 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 self + .body + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.body.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_body(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let found = if let Some(struct_generic) = self.struct_generic.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *struct_generic.read().unwrap() -} else { -false -} -}) { -struct_generic.clone() -} else { -None -}; + x.clone() + }); + } + } + }); + // } + + // if self.boolean_literal.read().unwrap().len() != other.boolean_literal.read().unwrap().len() { + 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 self + .boolean_literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.boolean_literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_boolean_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -if let Some(struct_generic) = found { -tracing::debug!(target: "store", "found duplicate {struct_generic:?}."); -self.struct_generic_free_list.lock().unwrap().push(_index); -struct_generic.clone() -} else { -tracing::debug!(target: "store", "interring {struct_generic:?}."); -self.struct_generic.write().unwrap()[_index] = Some(struct_generic.clone()); -struct_generic -} -} + x.clone() + }); + } + } + }); + // } + + // if self.boolean_operator.read().unwrap().len() != other.boolean_operator.read().unwrap().len() { + 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 self + .boolean_operator + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.boolean_operator.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_boolean_operator(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exhume (get) [`StructGeneric`] from the store. -/// -#[inline] -pub fn exhume_struct_generic(&self, id: &usize) -> Option>> { -match self.struct_generic.read().unwrap().get(*id) { -Some(struct_generic) => struct_generic.clone(), -None => None -} -} + x.clone() + }); + } + } + }); + // } + + // if self.call.read().unwrap().len() != other.call.read().unwrap().len() { + 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 self + .call + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.call.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_call(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exorcise (remove) [`StructGeneric`] from the store. -/// -#[inline] -pub fn exorcise_struct_generic(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising struct_generic slot: {id}."); -let result = self.struct_generic.write().unwrap()[*id].take(); -self.struct_generic_free_list.lock().unwrap().push(*id); -result -} + x.clone() + }); + } + } + }); + // } + + // if self.char_literal.read().unwrap().len() != other.char_literal.read().unwrap().len() { + 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 self + .char_literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.char_literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_char_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Get an iterator over the internal `HashMap<&Uuid, StructGeneric>`. -/// -#[inline] -pub fn iter_struct_generic(&self) -> impl Iterator>> + '_ { -let len = self.struct_generic.read().unwrap().len(); -(0..len).filter(|i| self.struct_generic.read().unwrap()[*i].is_some()).map(move|i|{self.struct_generic.read().unwrap()[i].as_ref().map(|struct_generic| struct_generic.clone()).unwrap()}) -} + x.clone() + }); + } + } + }); + // } + + // if self.comparison.read().unwrap().len() != other.comparison.read().unwrap().len() { + 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 self + .comparison + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.comparison.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_comparison(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Inter (insert) [`TupleField`] into the store. -/// -#[inline] -pub fn inter_tuple_field(&mut self, tuple_field: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.tuple_field_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.tuple_field.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.tuple_field.write().unwrap().push(None); -_index -}; + x.clone() + }); + } + } + }); + // } + + // if self.data_structure.read().unwrap().len() != other.data_structure.read().unwrap().len() { + 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 self + .data_structure + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.data_structure.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_data_structure(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let tuple_field = tuple_field(_index); + x.clone() + }); + } + } + }); + // } + + // if self.dwarf_source_file.read().unwrap().len() != other.dwarf_source_file.read().unwrap().len() { + 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 self + .dwarf_source_file + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.dwarf_source_file.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_dwarf_source_file(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.enum_field.read().unwrap().len() != other.enum_field.read().unwrap().len() { + 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 self + .enum_field + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.enum_field.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_enum_field(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let found = if let Some(tuple_field) = self.tuple_field.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *tuple_field.read().unwrap() -} else { -false -} -}) { -tuple_field.clone() -} else { -None -}; + x.clone() + }); + } + } + }); + // } + + // if self.enum_generic.read().unwrap().len() != other.enum_generic.read().unwrap().len() { + 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 self + .enum_generic + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.enum_generic.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_enum_generic(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -if let Some(tuple_field) = found { -tracing::debug!(target: "store", "found duplicate {tuple_field:?}."); -self.tuple_field_free_list.lock().unwrap().push(_index); -tuple_field.clone() -} else { -tracing::debug!(target: "store", "interring {tuple_field:?}."); -self.tuple_field.write().unwrap()[_index] = Some(tuple_field.clone()); -tuple_field -} -} + x.clone() + }); + } + } + }); + // } + + // if self.enum_generic_type.read().unwrap().len() != other.enum_generic_type.read().unwrap().len() { + other + .enum_generic_type + .read() + .unwrap() + .iter() + .for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. + if self + .enum_generic_type + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.enum_generic_type.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_enum_generic_type(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.enumeration.read().unwrap().len() != other.enumeration.read().unwrap().len() { + 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 self + .enumeration + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.enumeration.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_enumeration(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exhume (get) [`TupleField`] from the store. -/// -#[inline] -pub fn exhume_tuple_field(&self, id: &usize) -> Option>> { -match self.tuple_field.read().unwrap().get(*id) { -Some(tuple_field) => tuple_field.clone(), -None => None -} -} + x.clone() + }); + } + } + }); + // } + + // if self.expression.read().unwrap().len() != other.expression.read().unwrap().len() { + 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 self + .expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exorcise (remove) [`TupleField`] from the store. -/// -#[inline] -pub fn exorcise_tuple_field(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising tuple_field slot: {id}."); -let result = self.tuple_field.write().unwrap()[*id].take(); -self.tuple_field_free_list.lock().unwrap().push(*id); -result -} + x.clone() + }); + } + } + }); + // } + + // if self.expression_bit.read().unwrap().len() != other.expression_bit.read().unwrap().len() { + 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 self + .expression_bit + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.expression_bit.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_expression_bit(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Get an iterator over the internal `HashMap<&Uuid, TupleField>`. -/// -#[inline] -pub fn iter_tuple_field(&self) -> impl Iterator>> + '_ { -let len = self.tuple_field.read().unwrap().len(); -(0..len).filter(|i| self.tuple_field.read().unwrap()[*i].is_some()).map(move|i|{self.tuple_field.read().unwrap()[i].as_ref().map(|tuple_field| tuple_field.clone()).unwrap()}) -} + x.clone() + }); + } + } + }); + // } + + // if self.expression_statement.read().unwrap().len() != other.expression_statement.read().unwrap().len() { + 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 self + .expression_statement + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.expression_statement.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_expression_statement(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.external_implementation.read().unwrap().len() != other.external_implementation.read().unwrap().len() { + 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 self + .external_implementation + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.external_implementation.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_external_implementation( + |id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Inter (insert) [`TypeCast`] into the store. -/// -#[inline] -pub fn inter_type_cast(&mut self, type_cast: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.type_cast_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.type_cast.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.type_cast.write().unwrap().push(None); -_index -}; + x.clone() + }, + ); + } + } + }); + // } + + // if self.field.read().unwrap().len() != other.field.read().unwrap().len() { + 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 self + .field + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.field.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_field(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let type_cast = type_cast(_index); + x.clone() + }); + } + } + }); + // } + + // if self.field_access.read().unwrap().len() != other.field_access.read().unwrap().len() { + 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 self + .field_access + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.field_access.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_field_access(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let found = if let Some(type_cast) = self.type_cast.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *type_cast.read().unwrap() -} else { -false -} -}) { -type_cast.clone() -} else { -None -}; + x.clone() + }); + } + } + }); + // } + + // if self.field_access_target.read().unwrap().len() != other.field_access_target.read().unwrap().len() { + 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 self + .field_access_target + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.field_access_target.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_field_access_target(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.field_expression.read().unwrap().len() != other.field_expression.read().unwrap().len() { + 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 self + .field_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.field_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_field_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -if let Some(type_cast) = found { -tracing::debug!(target: "store", "found duplicate {type_cast:?}."); -self.type_cast_free_list.lock().unwrap().push(_index); -type_cast.clone() -} else { -tracing::debug!(target: "store", "interring {type_cast:?}."); -self.type_cast.write().unwrap()[_index] = Some(type_cast.clone()); -type_cast -} -} + x.clone() + }); + } + } + }); + // } + + // if self.float_literal.read().unwrap().len() != other.float_literal.read().unwrap().len() { + 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 self + .float_literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.float_literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_float_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exhume (get) [`TypeCast`] from the store. -/// -#[inline] -pub fn exhume_type_cast(&self, id: &usize) -> Option>> { -match self.type_cast.read().unwrap().get(*id) { -Some(type_cast) => type_cast.clone(), -None => None -} -} + x.clone() + }); + } + } + }); + // } + + // if self.for_loop.read().unwrap().len() != other.for_loop.read().unwrap().len() { + 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 self + .for_loop + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.for_loop.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_for_loop(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exorcise (remove) [`TypeCast`] from the store. -/// -#[inline] -pub fn exorcise_type_cast(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising type_cast slot: {id}."); -let result = self.type_cast.write().unwrap()[*id].take(); -self.type_cast_free_list.lock().unwrap().push(*id); -result -} + x.clone() + }); + } + } + }); + // } + + // if self.format_bit.read().unwrap().len() != other.format_bit.read().unwrap().len() { + 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 self + .format_bit + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.format_bit.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_format_bit(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Get an iterator over the internal `HashMap<&Uuid, TypeCast>`. -/// -#[inline] -pub fn iter_type_cast(&self) -> impl Iterator>> + '_ { -let len = self.type_cast.read().unwrap().len(); -(0..len).filter(|i| self.type_cast.read().unwrap()[*i].is_some()).map(move|i|{self.type_cast.read().unwrap()[i].as_ref().map(|type_cast| type_cast.clone()).unwrap()}) -} + x.clone() + }); + } + } + }); + // } + + // if self.format_string.read().unwrap().len() != other.format_string.read().unwrap().len() { + 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 self + .format_string + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.format_string.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_format_string(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Inter (insert) [`Unary`] into the store. -/// -#[inline] -pub fn inter_unary(&mut self, unary: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.unary_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.unary.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.unary.write().unwrap().push(None); -_index -}; + x.clone() + }); + } + } + }); + // } + + // if self.func_generic.read().unwrap().len() != other.func_generic.read().unwrap().len() { + 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 self + .func_generic + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.func_generic.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_func_generic(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let unary = unary(_index); + x.clone() + }); + } + } + }); + // } + + // if self.function.read().unwrap().len() != other.function.read().unwrap().len() { + 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 self + .function + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.function.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_function(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let found = if let Some(unary) = self.unary.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *unary.read().unwrap() -} else { -false -} -}) { -unary.clone() -} else { -None -}; + x.clone() + }); + } + } + }); + // } + + // if self.function_call.read().unwrap().len() != other.function_call.read().unwrap().len() { + 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 self + .function_call + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.function_call.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_function_call(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -if let Some(unary) = found { -tracing::debug!(target: "store", "found duplicate {unary:?}."); -self.unary_free_list.lock().unwrap().push(_index); -unary.clone() -} else { -tracing::debug!(target: "store", "interring {unary:?}."); -self.unary.write().unwrap()[_index] = Some(unary.clone()); -unary -} -} + x.clone() + }); + } + } + }); + // } + + // if self.x_future.read().unwrap().len() != other.x_future.read().unwrap().len() { + 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 self + .x_future + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_future.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_future(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exhume (get) [`Unary`] from the store. -/// -#[inline] -pub fn exhume_unary(&self, id: &usize) -> Option>> { -match self.unary.read().unwrap().get(*id) { -Some(unary) => unary.clone(), -None => None -} -} + x.clone() + }); + } + } + }); + // } + + // if self.grouped.read().unwrap().len() != other.grouped.read().unwrap().len() { + 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 self + .grouped + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.grouped.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_grouped(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exorcise (remove) [`Unary`] from the store. -/// -#[inline] -pub fn exorcise_unary(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising unary slot: {id}."); -let result = self.unary.write().unwrap()[*id].take(); -self.unary_free_list.lock().unwrap().push(*id); -result -} + x.clone() + }); + } + } + }); + // } + + // if self.halt_and_catch_fire.read().unwrap().len() != other.halt_and_catch_fire.read().unwrap().len() { + 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 self + .halt_and_catch_fire + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.halt_and_catch_fire.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_halt_and_catch_fire(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.x_if.read().unwrap().len() != other.x_if.read().unwrap().len() { + 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 self + .x_if + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_if.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_if(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Get an iterator over the internal `HashMap<&Uuid, Unary>`. -/// -#[inline] -pub fn iter_unary(&self) -> impl Iterator>> + '_ { -let len = self.unary.read().unwrap().len(); -(0..len).filter(|i| self.unary.read().unwrap()[*i].is_some()).map(move|i|{self.unary.read().unwrap()[i].as_ref().map(|unary| unary.clone()).unwrap()}) -} + x.clone() + }); + } + } + }); + // } + + // if self.implementation_block.read().unwrap().len() != other.implementation_block.read().unwrap().len() { + 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 self + .implementation_block + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.implementation_block.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_implementation_block(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.import.read().unwrap().len() != other.import.read().unwrap().len() { + 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 self + .import + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.import.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_import(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Inter (insert) [`Unit`] into the store. -/// -#[inline] -pub fn inter_unit(&mut self, unit: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.unit_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.unit.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.unit.write().unwrap().push(None); -_index -}; + x.clone() + }); + } + } + }); + // } + + // if self.index.read().unwrap().len() != other.index.read().unwrap().len() { + 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 self + .index + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.index.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_index(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let unit = unit(_index); + x.clone() + }); + } + } + }); + // } + + // if self.integer_literal.read().unwrap().len() != other.integer_literal.read().unwrap().len() { + 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 self + .integer_literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.integer_literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_integer_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let found = if let Some(unit) = self.unit.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *unit.read().unwrap() -} else { -false -} -}) { -unit.clone() -} else { -None -}; + x.clone() + }); + } + } + }); + // } + + // if self.item.read().unwrap().len() != other.item.read().unwrap().len() { + 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 self + .item + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.item.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_item(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -if let Some(unit) = found { -tracing::debug!(target: "store", "found duplicate {unit:?}."); -self.unit_free_list.lock().unwrap().push(_index); -unit.clone() -} else { -tracing::debug!(target: "store", "interring {unit:?}."); -self.unit.write().unwrap()[_index] = Some(unit.clone()); -unit -} -} + x.clone() + }); + } + } + }); + // } + + // if self.lambda.read().unwrap().len() != other.lambda.read().unwrap().len() { + 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 self + .lambda + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.lambda.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_lambda(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exhume (get) [`Unit`] from the store. -/// -#[inline] -pub fn exhume_unit(&self, id: &usize) -> Option>> { -match self.unit.read().unwrap().get(*id) { -Some(unit) => unit.clone(), -None => None -} -} + x.clone() + }); + } + } + }); + // } + + // if self.lambda_parameter.read().unwrap().len() != other.lambda_parameter.read().unwrap().len() { + 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 self + .lambda_parameter + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.lambda_parameter.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_lambda_parameter(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exorcise (remove) [`Unit`] from the store. -/// -#[inline] -pub fn exorcise_unit(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising unit slot: {id}."); -let result = self.unit.write().unwrap()[*id].take(); -self.unit_free_list.lock().unwrap().push(*id); -result -} + x.clone() + }); + } + } + }); + // } + + // if self.let_statement.read().unwrap().len() != other.let_statement.read().unwrap().len() { + 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 self + .let_statement + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.let_statement.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_let_statement(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Get an iterator over the internal `HashMap<&Uuid, Unit>`. -/// -#[inline] -pub fn iter_unit(&self) -> impl Iterator>> + '_ { -let len = self.unit.read().unwrap().len(); -(0..len).filter(|i| self.unit.read().unwrap()[*i].is_some()).map(move|i|{self.unit.read().unwrap()[i].as_ref().map(|unit| unit.clone()).unwrap()}) -} + x.clone() + }); + } + } + }); + // } + + // if self.list.read().unwrap().len() != other.list.read().unwrap().len() { + 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 self + .list + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.list.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_list(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Inter (insert) [`UnnamedFieldExpression`] into the store. -/// -#[inline] -pub fn inter_unnamed_field_expression(&mut self, unnamed_field_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.unnamed_field_expression_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.unnamed_field_expression.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.unnamed_field_expression.write().unwrap().push(None); -_index -}; + x.clone() + }); + } + } + }); + // } + + // if self.list_element.read().unwrap().len() != other.list_element.read().unwrap().len() { + 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 self + .list_element + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.list_element.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_list_element(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let unnamed_field_expression = unnamed_field_expression(_index); + x.clone() + }); + } + } + }); + // } + + // if self.list_expression.read().unwrap().len() != other.list_expression.read().unwrap().len() { + 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 self + .list_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.list_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_list_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let found = if let Some(unnamed_field_expression) = self.unnamed_field_expression.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *unnamed_field_expression.read().unwrap() -} else { -false -} -}) { -unnamed_field_expression.clone() -} else { -None -}; + x.clone() + }); + } + } + }); + // } + + // if self.literal.read().unwrap().len() != other.literal.read().unwrap().len() { + 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 self + .literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -if let Some(unnamed_field_expression) = found { -tracing::debug!(target: "store", "found duplicate {unnamed_field_expression:?}."); -self.unnamed_field_expression_free_list.lock().unwrap().push(_index); -unnamed_field_expression.clone() -} else { -tracing::debug!(target: "store", "interring {unnamed_field_expression:?}."); -self.unnamed_field_expression.write().unwrap()[_index] = Some(unnamed_field_expression.clone()); -unnamed_field_expression -} -} + x.clone() + }); + } + } + }); + // } + + // if self.local_variable.read().unwrap().len() != other.local_variable.read().unwrap().len() { + 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 self + .local_variable + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.local_variable.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_local_variable(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exhume (get) [`UnnamedFieldExpression`] from the store. -/// -#[inline] -pub fn exhume_unnamed_field_expression(&self, id: &usize) -> Option>> { -match self.unnamed_field_expression.read().unwrap().get(*id) { -Some(unnamed_field_expression) => unnamed_field_expression.clone(), -None => None -} -} + x.clone() + }); + } + } + }); + // } + + // if self.x_macro.read().unwrap().len() != other.x_macro.read().unwrap().len() { + 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 self + .x_macro + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_macro.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_macro(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exorcise (remove) [`UnnamedFieldExpression`] from the store. -/// -#[inline] -pub fn exorcise_unnamed_field_expression(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising unnamed_field_expression slot: {id}."); -let result = self.unnamed_field_expression.write().unwrap()[*id].take(); -self.unnamed_field_expression_free_list.lock().unwrap().push(*id); -result -} + x.clone() + }); + } + } + }); + // } + + // if self.map.read().unwrap().len() != other.map.read().unwrap().len() { + 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 self + .map + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.map.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_map(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Get an iterator over the internal `HashMap<&Uuid, UnnamedFieldExpression>`. -/// -#[inline] -pub fn iter_unnamed_field_expression(&self) -> impl Iterator>> + '_ { -let len = self.unnamed_field_expression.read().unwrap().len(); -(0..len).filter(|i| self.unnamed_field_expression.read().unwrap()[*i].is_some()).map(move|i|{self.unnamed_field_expression.read().unwrap()[i].as_ref().map(|unnamed_field_expression| unnamed_field_expression.clone()).unwrap()}) -} + x.clone() + }); + } + } + }); + // } + + // if self.map_element.read().unwrap().len() != other.map_element.read().unwrap().len() { + 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 self + .map_element + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.map_element.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_map_element(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Inter (insert) [`XValue`] into the store. -/// -#[inline] -pub fn inter_x_value(&mut self, x_value: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.x_value_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.x_value.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.x_value.write().unwrap().push(None); -_index -}; + x.clone() + }); + } + } + }); + // } + + // if self.map_expression.read().unwrap().len() != other.map_expression.read().unwrap().len() { + 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 self + .map_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.map_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_map_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let x_value = x_value(_index); + x.clone() + }); + } + } + }); + // } + + // if self.x_match.read().unwrap().len() != other.x_match.read().unwrap().len() { + 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 self + .x_match + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_match.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_match(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let found = if let Some(x_value) = self.x_value.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *x_value.read().unwrap() -} else { -false -} -}) { -x_value.clone() -} else { -None -}; + x.clone() + }); + } + } + }); + // } + + // if self.method_call.read().unwrap().len() != other.method_call.read().unwrap().len() { + 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 self + .method_call + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.method_call.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_method_call(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -if let Some(x_value) = found { -tracing::debug!(target: "store", "found duplicate {x_value:?}."); -self.x_value_free_list.lock().unwrap().push(_index); -x_value.clone() -} else { -tracing::debug!(target: "store", "interring {x_value:?}."); -self.x_value.write().unwrap()[_index] = Some(x_value.clone()); -x_value -} -} + x.clone() + }); + } + } + }); + // } + + // if self.named_field_expression.read().unwrap().len() != other.named_field_expression.read().unwrap().len() { + 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 self + .named_field_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.named_field_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_named_field_expression( + |id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exhume (get) [`XValue`] from the store. -/// -#[inline] -pub fn exhume_x_value(&self, id: &usize) -> Option>> { -match self.x_value.read().unwrap().get(*id) { -Some(x_value) => x_value.clone(), -None => None -} -} + x.clone() + }, + ); + } + } + }); + // } + + // if self.z_object_store.read().unwrap().len() != other.z_object_store.read().unwrap().len() { + 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 self + .z_object_store + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.z_object_store.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_z_object_store(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exorcise (remove) [`XValue`] from the store. -/// -#[inline] -pub fn exorcise_x_value(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising x_value slot: {id}."); -let result = self.x_value.write().unwrap()[*id].take(); -self.x_value_free_list.lock().unwrap().push(*id); -result -} + x.clone() + }); + } + } + }); + // } + + // if self.object_wrapper.read().unwrap().len() != other.object_wrapper.read().unwrap().len() { + 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 self + .object_wrapper + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.object_wrapper.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_object_wrapper(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Get an iterator over the internal `HashMap<&Uuid, XValue>`. -/// -#[inline] -pub fn iter_x_value(&self) -> impl Iterator>> + '_ { -let len = self.x_value.read().unwrap().len(); -(0..len).filter(|i| self.x_value.read().unwrap()[*i].is_some()).map(move|i|{self.x_value.read().unwrap()[i].as_ref().map(|x_value| x_value.clone()).unwrap()}) -} + x.clone() + }); + } + } + }); + // } + + // if self.operator.read().unwrap().len() != other.operator.read().unwrap().len() { + 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 self + .operator + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.operator.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_operator(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Inter (insert) [`ValueType`] into the store. -/// -#[inline] -pub fn inter_value_type(&mut self, value_type: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.value_type_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.value_type.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.value_type.write().unwrap().push(None); -_index -}; + x.clone() + }); + } + } + }); + // } + + // if self.parameter.read().unwrap().len() != other.parameter.read().unwrap().len() { + 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 self + .parameter + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.parameter.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_parameter(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let value_type = value_type(_index); + x.clone() + }); + } + } + }); + // } + + // if self.x_path.read().unwrap().len() != other.x_path.read().unwrap().len() { + 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 self + .x_path + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_path.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_path(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let found = if let Some(value_type) = self.value_type.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *value_type.read().unwrap() -} else { -false -} -}) { -value_type.clone() -} else { -None -}; + x.clone() + }); + } + } + }); + // } + + // if self.path_element.read().unwrap().len() != other.path_element.read().unwrap().len() { + 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 self + .path_element + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.path_element.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_path_element(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -if let Some(value_type) = found { -tracing::debug!(target: "store", "found duplicate {value_type:?}."); -self.value_type_free_list.lock().unwrap().push(_index); -value_type.clone() -} else { -tracing::debug!(target: "store", "interring {value_type:?}."); -self.value_type.write().unwrap()[_index] = Some(value_type.clone()); -value_type -} -} + x.clone() + }); + } + } + }); + // } + + // if self.pattern.read().unwrap().len() != other.pattern.read().unwrap().len() { + 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 self + .pattern + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.pattern.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_pattern(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exhume (get) [`ValueType`] from the store. -/// -#[inline] -pub fn exhume_value_type(&self, id: &usize) -> Option>> { -match self.value_type.read().unwrap().get(*id) { -Some(value_type) => value_type.clone(), -None => None -} -} + x.clone() + }); + } + } + }); + // } + + // if self.x_plugin.read().unwrap().len() != other.x_plugin.read().unwrap().len() { + 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 self + .x_plugin + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_plugin.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_plugin(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exorcise (remove) [`ValueType`] from the store. -/// -#[inline] -pub fn exorcise_value_type(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising value_type slot: {id}."); -let result = self.value_type.write().unwrap()[*id].take(); -self.value_type_free_list.lock().unwrap().push(*id); -result -} + x.clone() + }); + } + } + }); + // } + + // if self.x_print.read().unwrap().len() != other.x_print.read().unwrap().len() { + 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 self + .x_print + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_print.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_print(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Get an iterator over the internal `HashMap<&Uuid, ValueType>`. -/// -#[inline] -pub fn iter_value_type(&self) -> impl Iterator>> + '_ { -let len = self.value_type.read().unwrap().len(); -(0..len).filter(|i| self.value_type.read().unwrap()[*i].is_some()).map(move|i|{self.value_type.read().unwrap()[i].as_ref().map(|value_type| value_type.clone()).unwrap()}) -} + x.clone() + }); + } + } + }); + // } + + // if self.range_expression.read().unwrap().len() != other.range_expression.read().unwrap().len() { + 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 self + .range_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.range_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_range_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Inter (insert) [`Variable`] into the store. -/// -#[inline] -pub fn inter_variable(&mut self, variable: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.variable_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.variable.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.variable.write().unwrap().push(None); -_index -}; + x.clone() + }); + } + } + }); + // } + + // if self.result_statement.read().unwrap().len() != other.result_statement.read().unwrap().len() { + 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 self + .result_statement + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.result_statement.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_result_statement(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let variable = variable(_index); + x.clone() + }); + } + } + }); + // } + + // if self.x_return.read().unwrap().len() != other.x_return.read().unwrap().len() { + 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 self + .x_return + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_return.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_return(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let found = if let Some(variable) = self.variable.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *variable.read().unwrap() -} else { -false -} -}) { -variable.clone() -} else { -None -}; + x.clone() + }); + } + } + }); + // } + + // if self.span.read().unwrap().len() != other.span.read().unwrap().len() { + 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 self + .span + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.span.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_span(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -if let Some(variable) = found { -tracing::debug!(target: "store", "found duplicate {variable:?}."); -self.variable_free_list.lock().unwrap().push(_index); -variable.clone() -} else { -tracing::debug!(target: "store", "interring {variable:?}."); -self.variable.write().unwrap()[_index] = Some(variable.clone()); -variable -} -} + x.clone() + }); + } + } + }); + // } + + // if self.statement.read().unwrap().len() != other.statement.read().unwrap().len() { + 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 self + .statement + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.statement.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_statement(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exhume (get) [`Variable`] from the store. -/// -#[inline] -pub fn exhume_variable(&self, id: &usize) -> Option>> { -match self.variable.read().unwrap().get(*id) { -Some(variable) => variable.clone(), -None => None -} -} + x.clone() + }); + } + } + }); + // } + + // if self.static_method_call.read().unwrap().len() != other.static_method_call.read().unwrap().len() { + 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 self + .static_method_call + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.static_method_call.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_static_method_call(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.string_bit.read().unwrap().len() != other.string_bit.read().unwrap().len() { + 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 self + .string_bit + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.string_bit.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_string_bit(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exorcise (remove) [`Variable`] from the store. -/// -#[inline] -pub fn exorcise_variable(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising variable slot: {id}."); -let result = self.variable.write().unwrap()[*id].take(); -self.variable_free_list.lock().unwrap().push(*id); -result -} + x.clone() + }); + } + } + }); + // } + + // if self.string_literal.read().unwrap().len() != other.string_literal.read().unwrap().len() { + 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 self + .string_literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.string_literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_string_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Get an iterator over the internal `HashMap<&Uuid, Variable>`. -/// -#[inline] -pub fn iter_variable(&self) -> impl Iterator>> + '_ { -let len = self.variable.read().unwrap().len(); -(0..len).filter(|i| self.variable.read().unwrap()[*i].is_some()).map(move|i|{self.variable.read().unwrap()[i].as_ref().map(|variable| variable.clone()).unwrap()}) -} + x.clone() + }); + } + } + }); + // } + + // if self.woog_struct.read().unwrap().len() != other.woog_struct.read().unwrap().len() { + 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 self + .woog_struct + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.woog_struct.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_woog_struct(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Inter (insert) [`VariableExpression`] into the store. -/// -#[inline] -pub fn inter_variable_expression(&mut self, variable_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { -let _index = if let Some(_index) = self.variable_expression_free_list.lock().unwrap().pop() { -tracing::trace!(target: "store", "recycling block {_index}."); -_index -} else { -let _index = self.variable_expression.read().unwrap().len(); -tracing::trace!(target: "store", "allocating block {_index}."); -self.variable_expression.write().unwrap().push(None); -_index -}; + x.clone() + }); + } + } + }); + // } + + // if self.struct_expression.read().unwrap().len() != other.struct_expression.read().unwrap().len() { + 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 self + .struct_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.struct_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_struct_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.struct_field.read().unwrap().len() != other.struct_field.read().unwrap().len() { + 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 self + .struct_field + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.struct_field.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_struct_field(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let variable_expression = variable_expression(_index); + x.clone() + }); + } + } + }); + // } + + // if self.struct_generic.read().unwrap().len() != other.struct_generic.read().unwrap().len() { + 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 self + .struct_generic + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.struct_generic.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_struct_generic(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -let found = if let Some(variable_expression) = self.variable_expression.read().unwrap().iter().find(|stored| { -if let Some(stored) = stored { -*stored.read().unwrap() == *variable_expression.read().unwrap() -} else { -false -} -}) { -variable_expression.clone() -} else { -None -}; + x.clone() + }); + } + } + }); + // } + + // if self.tuple_field.read().unwrap().len() != other.tuple_field.read().unwrap().len() { + 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 self + .tuple_field + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.tuple_field.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_tuple_field(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -if let Some(variable_expression) = found { -tracing::debug!(target: "store", "found duplicate {variable_expression:?}."); -self.variable_expression_free_list.lock().unwrap().push(_index); -variable_expression.clone() -} else { -tracing::debug!(target: "store", "interring {variable_expression:?}."); -self.variable_expression.write().unwrap()[_index] = Some(variable_expression.clone()); -variable_expression -} -} + x.clone() + }); + } + } + }); + // } + + // if self.type_cast.read().unwrap().len() != other.type_cast.read().unwrap().len() { + 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 self + .type_cast + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.type_cast.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_type_cast(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exhume (get) [`VariableExpression`] from the store. -/// -#[inline] -pub fn exhume_variable_expression(&self, id: &usize) -> Option>> { -match self.variable_expression.read().unwrap().get(*id) { -Some(variable_expression) => variable_expression.clone(), -None => None -} -} + x.clone() + }); + } + } + }); + // } + + // if self.unary.read().unwrap().len() != other.unary.read().unwrap().len() { + 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 self + .unary + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.unary.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_unary(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Exorcise (remove) [`VariableExpression`] from the store. -/// -#[inline] -pub fn exorcise_variable_expression(&mut self, id: &usize) -> Option>> { -tracing::debug!(target: "store", "exorcising variable_expression slot: {id}."); -let result = self.variable_expression.write().unwrap()[*id].take(); -self.variable_expression_free_list.lock().unwrap().push(*id); -result -} + x.clone() + }); + } + } + }); + // } + + // if self.unit.read().unwrap().len() != other.unit.read().unwrap().len() { + 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 self + .unit + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.unit.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_unit(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -/// Get an iterator over the internal `HashMap<&Uuid, VariableExpression>`. -/// -#[inline] -pub fn iter_variable_expression(&self) -> impl Iterator>> + '_ { -let len = self.variable_expression.read().unwrap().len(); -(0..len).filter(|i| self.variable_expression.read().unwrap()[*i].is_some()).map(move|i|{self.variable_expression.read().unwrap()[i].as_ref().map(|variable_expression| variable_expression.clone()).unwrap()}) -} + x.clone() + }); + } + } + }); + // } + + // if self.unnamed_field_expression.read().unwrap().len() != other.unnamed_field_expression.read().unwrap().len() { + 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 self + .unnamed_field_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.unnamed_field_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_unnamed_field_expression( + |id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } -// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}} + x.clone() + }, + ); + } + } + }); + // } + + // if self.x_value.read().unwrap().len() != other.x_value.read().unwrap().len() { + 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 self + .x_value + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_value.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_value(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.value_type.read().unwrap().len() != other.value_type.read().unwrap().len() { + 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 self + .value_type + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.value_type.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_value_type(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.variable.read().unwrap().len() != other.variable.read().unwrap().len() { + 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 self + .variable + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.variable.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_variable(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + x.clone() + }); + } + } + }); + // } + + // if self.variable_expression.read().unwrap().len() != other.variable_expression.read().unwrap().len() { + 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 self + .variable_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.variable_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_variable_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + } + pub fn new() -> Self { + let mut store = Self { + argument_free_list: std::sync::Mutex::new(Vec::new()), + argument: Arc::new(RwLock::new(Vec::new())), + a_wait_free_list: std::sync::Mutex::new(Vec::new()), + a_wait: Arc::new(RwLock::new(Vec::new())), + binary_free_list: std::sync::Mutex::new(Vec::new()), + binary: Arc::new(RwLock::new(Vec::new())), + block_free_list: std::sync::Mutex::new(Vec::new()), + block: Arc::new(RwLock::new(Vec::new())), + body_free_list: std::sync::Mutex::new(Vec::new()), + body: Arc::new(RwLock::new(Vec::new())), + boolean_literal_free_list: std::sync::Mutex::new(Vec::new()), + boolean_literal: Arc::new(RwLock::new(Vec::new())), + boolean_operator_free_list: std::sync::Mutex::new(Vec::new()), + boolean_operator: Arc::new(RwLock::new(Vec::new())), + call_free_list: std::sync::Mutex::new(Vec::new()), + call: Arc::new(RwLock::new(Vec::new())), + char_literal_free_list: std::sync::Mutex::new(Vec::new()), + char_literal: Arc::new(RwLock::new(Vec::new())), + comparison_free_list: std::sync::Mutex::new(Vec::new()), + comparison: Arc::new(RwLock::new(Vec::new())), + data_structure_free_list: std::sync::Mutex::new(Vec::new()), + data_structure: Arc::new(RwLock::new(Vec::new())), + dwarf_source_file_free_list: std::sync::Mutex::new(Vec::new()), + dwarf_source_file: Arc::new(RwLock::new(Vec::new())), + enum_field_free_list: std::sync::Mutex::new(Vec::new()), + enum_field: Arc::new(RwLock::new(Vec::new())), + enum_generic_free_list: std::sync::Mutex::new(Vec::new()), + enum_generic: Arc::new(RwLock::new(Vec::new())), + enum_generic_type_free_list: std::sync::Mutex::new(Vec::new()), + enum_generic_type: Arc::new(RwLock::new(Vec::new())), + enumeration_free_list: std::sync::Mutex::new(Vec::new()), + enumeration: Arc::new(RwLock::new(Vec::new())), + enumeration_id_by_name: Arc::new(RwLock::new(HashMap::default())), + expression_free_list: std::sync::Mutex::new(Vec::new()), + expression: Arc::new(RwLock::new(Vec::new())), + expression_bit_free_list: std::sync::Mutex::new(Vec::new()), + expression_bit: Arc::new(RwLock::new(Vec::new())), + expression_statement_free_list: std::sync::Mutex::new(Vec::new()), + expression_statement: Arc::new(RwLock::new(Vec::new())), + external_implementation_free_list: std::sync::Mutex::new(Vec::new()), + external_implementation: Arc::new(RwLock::new(Vec::new())), + field_free_list: std::sync::Mutex::new(Vec::new()), + field: Arc::new(RwLock::new(Vec::new())), + field_id_by_name: Arc::new(RwLock::new(HashMap::default())), + field_access_free_list: std::sync::Mutex::new(Vec::new()), + field_access: Arc::new(RwLock::new(Vec::new())), + field_access_target_free_list: std::sync::Mutex::new(Vec::new()), + field_access_target: Arc::new(RwLock::new(Vec::new())), + field_expression_free_list: std::sync::Mutex::new(Vec::new()), + field_expression: Arc::new(RwLock::new(Vec::new())), + float_literal_free_list: std::sync::Mutex::new(Vec::new()), + float_literal: Arc::new(RwLock::new(Vec::new())), + for_loop_free_list: std::sync::Mutex::new(Vec::new()), + for_loop: Arc::new(RwLock::new(Vec::new())), + format_bit_free_list: std::sync::Mutex::new(Vec::new()), + format_bit: Arc::new(RwLock::new(Vec::new())), + format_string_free_list: std::sync::Mutex::new(Vec::new()), + format_string: Arc::new(RwLock::new(Vec::new())), + func_generic_free_list: std::sync::Mutex::new(Vec::new()), + func_generic: Arc::new(RwLock::new(Vec::new())), + function_free_list: std::sync::Mutex::new(Vec::new()), + function: Arc::new(RwLock::new(Vec::new())), + function_id_by_name: Arc::new(RwLock::new(HashMap::default())), + function_call_free_list: std::sync::Mutex::new(Vec::new()), + function_call: Arc::new(RwLock::new(Vec::new())), + x_future_free_list: std::sync::Mutex::new(Vec::new()), + x_future: Arc::new(RwLock::new(Vec::new())), + grouped_free_list: std::sync::Mutex::new(Vec::new()), + grouped: Arc::new(RwLock::new(Vec::new())), + halt_and_catch_fire_free_list: std::sync::Mutex::new(Vec::new()), + halt_and_catch_fire: Arc::new(RwLock::new(Vec::new())), + x_if_free_list: std::sync::Mutex::new(Vec::new()), + x_if: Arc::new(RwLock::new(Vec::new())), + implementation_block_free_list: std::sync::Mutex::new(Vec::new()), + implementation_block: Arc::new(RwLock::new(Vec::new())), + import_free_list: std::sync::Mutex::new(Vec::new()), + import: Arc::new(RwLock::new(Vec::new())), + index_free_list: std::sync::Mutex::new(Vec::new()), + index: Arc::new(RwLock::new(Vec::new())), + integer_literal_free_list: std::sync::Mutex::new(Vec::new()), + integer_literal: Arc::new(RwLock::new(Vec::new())), + item_free_list: std::sync::Mutex::new(Vec::new()), + item: Arc::new(RwLock::new(Vec::new())), + lambda_free_list: std::sync::Mutex::new(Vec::new()), + lambda: Arc::new(RwLock::new(Vec::new())), + lambda_parameter_free_list: std::sync::Mutex::new(Vec::new()), + lambda_parameter: Arc::new(RwLock::new(Vec::new())), + let_statement_free_list: std::sync::Mutex::new(Vec::new()), + let_statement: Arc::new(RwLock::new(Vec::new())), + list_free_list: std::sync::Mutex::new(Vec::new()), + list: Arc::new(RwLock::new(Vec::new())), + list_element_free_list: std::sync::Mutex::new(Vec::new()), + list_element: Arc::new(RwLock::new(Vec::new())), + list_expression_free_list: std::sync::Mutex::new(Vec::new()), + list_expression: Arc::new(RwLock::new(Vec::new())), + literal_free_list: std::sync::Mutex::new(Vec::new()), + literal: Arc::new(RwLock::new(Vec::new())), + local_variable_free_list: std::sync::Mutex::new(Vec::new()), + local_variable: Arc::new(RwLock::new(Vec::new())), + x_macro_free_list: std::sync::Mutex::new(Vec::new()), + x_macro: Arc::new(RwLock::new(Vec::new())), + map_free_list: std::sync::Mutex::new(Vec::new()), + map: Arc::new(RwLock::new(Vec::new())), + map_element_free_list: std::sync::Mutex::new(Vec::new()), + map_element: Arc::new(RwLock::new(Vec::new())), + map_expression_free_list: std::sync::Mutex::new(Vec::new()), + map_expression: Arc::new(RwLock::new(Vec::new())), + x_match_free_list: std::sync::Mutex::new(Vec::new()), + x_match: Arc::new(RwLock::new(Vec::new())), + method_call_free_list: std::sync::Mutex::new(Vec::new()), + method_call: Arc::new(RwLock::new(Vec::new())), + named_field_expression_free_list: std::sync::Mutex::new(Vec::new()), + named_field_expression: Arc::new(RwLock::new(Vec::new())), + z_object_store_free_list: std::sync::Mutex::new(Vec::new()), + z_object_store: Arc::new(RwLock::new(Vec::new())), + z_object_store_id_by_name: Arc::new(RwLock::new(HashMap::default())), + object_wrapper_free_list: std::sync::Mutex::new(Vec::new()), + object_wrapper: Arc::new(RwLock::new(Vec::new())), + operator_free_list: std::sync::Mutex::new(Vec::new()), + operator: Arc::new(RwLock::new(Vec::new())), + parameter_free_list: std::sync::Mutex::new(Vec::new()), + parameter: Arc::new(RwLock::new(Vec::new())), + x_path_free_list: std::sync::Mutex::new(Vec::new()), + x_path: Arc::new(RwLock::new(Vec::new())), + path_element_free_list: std::sync::Mutex::new(Vec::new()), + path_element: Arc::new(RwLock::new(Vec::new())), + pattern_free_list: std::sync::Mutex::new(Vec::new()), + pattern: Arc::new(RwLock::new(Vec::new())), + x_plugin_free_list: std::sync::Mutex::new(Vec::new()), + x_plugin: Arc::new(RwLock::new(Vec::new())), + x_plugin_id_by_name: Arc::new(RwLock::new(HashMap::default())), + x_print_free_list: std::sync::Mutex::new(Vec::new()), + x_print: Arc::new(RwLock::new(Vec::new())), + range_expression_free_list: std::sync::Mutex::new(Vec::new()), + range_expression: Arc::new(RwLock::new(Vec::new())), + result_statement_free_list: std::sync::Mutex::new(Vec::new()), + result_statement: Arc::new(RwLock::new(Vec::new())), + x_return_free_list: std::sync::Mutex::new(Vec::new()), + x_return: Arc::new(RwLock::new(Vec::new())), + span_free_list: std::sync::Mutex::new(Vec::new()), + span: Arc::new(RwLock::new(Vec::new())), + statement_free_list: std::sync::Mutex::new(Vec::new()), + statement: Arc::new(RwLock::new(Vec::new())), + static_method_call_free_list: std::sync::Mutex::new(Vec::new()), + static_method_call: Arc::new(RwLock::new(Vec::new())), + string_bit_free_list: std::sync::Mutex::new(Vec::new()), + string_bit: Arc::new(RwLock::new(Vec::new())), + string_literal_free_list: std::sync::Mutex::new(Vec::new()), + string_literal: Arc::new(RwLock::new(Vec::new())), + woog_struct_free_list: std::sync::Mutex::new(Vec::new()), + woog_struct: Arc::new(RwLock::new(Vec::new())), + woog_struct_id_by_name: Arc::new(RwLock::new(HashMap::default())), + struct_expression_free_list: std::sync::Mutex::new(Vec::new()), + struct_expression: Arc::new(RwLock::new(Vec::new())), + struct_field_free_list: std::sync::Mutex::new(Vec::new()), + struct_field: Arc::new(RwLock::new(Vec::new())), + struct_generic_free_list: std::sync::Mutex::new(Vec::new()), + struct_generic: Arc::new(RwLock::new(Vec::new())), + tuple_field_free_list: std::sync::Mutex::new(Vec::new()), + tuple_field: Arc::new(RwLock::new(Vec::new())), + type_cast_free_list: std::sync::Mutex::new(Vec::new()), + type_cast: Arc::new(RwLock::new(Vec::new())), + unary_free_list: std::sync::Mutex::new(Vec::new()), + unary: Arc::new(RwLock::new(Vec::new())), + unit_free_list: std::sync::Mutex::new(Vec::new()), + unit: Arc::new(RwLock::new(Vec::new())), + unnamed_field_expression_free_list: std::sync::Mutex::new(Vec::new()), + unnamed_field_expression: Arc::new(RwLock::new(Vec::new())), + x_value_free_list: std::sync::Mutex::new(Vec::new()), + x_value: Arc::new(RwLock::new(Vec::new())), + value_type_free_list: std::sync::Mutex::new(Vec::new()), + value_type: Arc::new(RwLock::new(Vec::new())), + variable_free_list: std::sync::Mutex::new(Vec::new()), + variable: Arc::new(RwLock::new(Vec::new())), + variable_expression_free_list: std::sync::Mutex::new(Vec::new()), + variable_expression: Arc::new(RwLock::new(Vec::new())), + }; + + // Initialize Singleton Subtypes + // 💥 Look at how beautiful this generated code is for super/sub-type graphs! + // I remember having a bit of a struggle making it work. It's recursive, with + // a lot of special cases, and I think it calls other recursive functions...💥 + + store + } + + // {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"v2::lu_dog_ndrwlock_vec-object-store-methods"}}} + /// Inter (insert) [`Argument`] into the store. + /// + #[inline] + pub fn inter_argument(&mut self, argument: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.argument_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.argument.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.argument.write().unwrap().push(None); + _index + }; + + let argument = argument(_index); + + let found = if let Some(argument) = self.argument.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *argument.read().unwrap() + } else { + false + } + }) { + argument.clone() + } else { + None + }; + + if let Some(argument) = found { + tracing::debug!(target: "store", "found duplicate {argument:?}."); + self.argument_free_list.lock().unwrap().push(_index); + argument.clone() + } else { + tracing::debug!(target: "store", "interring {argument:?}."); + self.argument.write().unwrap()[_index] = Some(argument.clone()); + argument + } + } + + /// Exhume (get) [`Argument`] from the store. + /// + #[inline] + pub fn exhume_argument(&self, id: &usize) -> Option>> { + match self.argument.read().unwrap().get(*id) { + Some(argument) => argument.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Argument`] from the store. + /// + #[inline] + pub fn exorcise_argument(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising argument slot: {id}."); + let result = self.argument.write().unwrap()[*id].take(); + self.argument_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Argument>`. + /// + #[inline] + pub fn iter_argument(&self) -> impl Iterator>> + '_ { + let len = self.argument.read().unwrap().len(); + (0..len) + .filter(|i| self.argument.read().unwrap()[*i].is_some()) + .map(move |i| { + self.argument.read().unwrap()[i] + .as_ref() + .map(|argument| argument.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`AWait`] into the store. + /// + #[inline] + pub fn inter_a_wait(&mut self, a_wait: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.a_wait_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.a_wait.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.a_wait.write().unwrap().push(None); + _index + }; + + let a_wait = a_wait(_index); + + let found = if let Some(a_wait) = self.a_wait.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *a_wait.read().unwrap() + } else { + false + } + }) { + a_wait.clone() + } else { + None + }; + + if let Some(a_wait) = found { + tracing::debug!(target: "store", "found duplicate {a_wait:?}."); + self.a_wait_free_list.lock().unwrap().push(_index); + a_wait.clone() + } else { + tracing::debug!(target: "store", "interring {a_wait:?}."); + self.a_wait.write().unwrap()[_index] = Some(a_wait.clone()); + a_wait + } + } + + /// Exhume (get) [`AWait`] from the store. + /// + #[inline] + pub fn exhume_a_wait(&self, id: &usize) -> Option>> { + match self.a_wait.read().unwrap().get(*id) { + Some(a_wait) => a_wait.clone(), + None => None, + } + } + + /// Exorcise (remove) [`AWait`] from the store. + /// + #[inline] + pub fn exorcise_a_wait(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising a_wait slot: {id}."); + let result = self.a_wait.write().unwrap()[*id].take(); + self.a_wait_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, AWait>`. + /// + #[inline] + pub fn iter_a_wait(&self) -> impl Iterator>> + '_ { + let len = self.a_wait.read().unwrap().len(); + (0..len) + .filter(|i| self.a_wait.read().unwrap()[*i].is_some()) + .map(move |i| { + self.a_wait.read().unwrap()[i] + .as_ref() + .map(|a_wait| a_wait.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Binary`] into the store. + /// + #[inline] + pub fn inter_binary(&mut self, binary: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.binary_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.binary.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.binary.write().unwrap().push(None); + _index + }; + + let binary = binary(_index); + + let found = if let Some(binary) = self.binary.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *binary.read().unwrap() + } else { + false + } + }) { + binary.clone() + } else { + None + }; + + if let Some(binary) = found { + tracing::debug!(target: "store", "found duplicate {binary:?}."); + self.binary_free_list.lock().unwrap().push(_index); + binary.clone() + } else { + tracing::debug!(target: "store", "interring {binary:?}."); + self.binary.write().unwrap()[_index] = Some(binary.clone()); + binary + } + } + + /// Exhume (get) [`Binary`] from the store. + /// + #[inline] + pub fn exhume_binary(&self, id: &usize) -> Option>> { + match self.binary.read().unwrap().get(*id) { + Some(binary) => binary.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Binary`] from the store. + /// + #[inline] + pub fn exorcise_binary(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising binary slot: {id}."); + let result = self.binary.write().unwrap()[*id].take(); + self.binary_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Binary>`. + /// + #[inline] + pub fn iter_binary(&self) -> impl Iterator>> + '_ { + let len = self.binary.read().unwrap().len(); + (0..len) + .filter(|i| self.binary.read().unwrap()[*i].is_some()) + .map(move |i| { + self.binary.read().unwrap()[i] + .as_ref() + .map(|binary| binary.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Block`] into the store. + /// + #[inline] + pub fn inter_block(&mut self, block: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.block_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.block.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.block.write().unwrap().push(None); + _index + }; + + let block = block(_index); + + let found = if let Some(block) = self.block.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *block.read().unwrap() + } else { + false + } + }) { + block.clone() + } else { + None + }; + + if let Some(block) = found { + tracing::debug!(target: "store", "found duplicate {block:?}."); + self.block_free_list.lock().unwrap().push(_index); + block.clone() + } else { + tracing::debug!(target: "store", "interring {block:?}."); + self.block.write().unwrap()[_index] = Some(block.clone()); + block + } + } + + /// Exhume (get) [`Block`] from the store. + /// + #[inline] + pub fn exhume_block(&self, id: &usize) -> Option>> { + match self.block.read().unwrap().get(*id) { + Some(block) => block.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Block`] from the store. + /// + #[inline] + pub fn exorcise_block(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising block slot: {id}."); + let result = self.block.write().unwrap()[*id].take(); + self.block_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Block>`. + /// + #[inline] + pub fn iter_block(&self) -> impl Iterator>> + '_ { + let len = self.block.read().unwrap().len(); + (0..len) + .filter(|i| self.block.read().unwrap()[*i].is_some()) + .map(move |i| { + self.block.read().unwrap()[i] + .as_ref() + .map(|block| block.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Body`] into the store. + /// + #[inline] + pub fn inter_body(&mut self, body: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.body_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.body.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.body.write().unwrap().push(None); + _index + }; + + let body = body(_index); + + let found = if let Some(body) = self.body.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *body.read().unwrap() + } else { + false + } + }) { + body.clone() + } else { + None + }; + + if let Some(body) = found { + tracing::debug!(target: "store", "found duplicate {body:?}."); + self.body_free_list.lock().unwrap().push(_index); + body.clone() + } else { + tracing::debug!(target: "store", "interring {body:?}."); + self.body.write().unwrap()[_index] = Some(body.clone()); + body + } + } + + /// Exhume (get) [`Body`] from the store. + /// + #[inline] + pub fn exhume_body(&self, id: &usize) -> Option>> { + match self.body.read().unwrap().get(*id) { + Some(body) => body.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Body`] from the store. + /// + #[inline] + pub fn exorcise_body(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising body slot: {id}."); + let result = self.body.write().unwrap()[*id].take(); + self.body_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Body>`. + /// + #[inline] + pub fn iter_body(&self) -> impl Iterator>> + '_ { + let len = self.body.read().unwrap().len(); + (0..len) + .filter(|i| self.body.read().unwrap()[*i].is_some()) + .map(move |i| { + self.body.read().unwrap()[i] + .as_ref() + .map(|body| body.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`BooleanLiteral`] into the store. + /// + #[inline] + pub fn inter_boolean_literal(&mut self, boolean_literal: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.boolean_literal_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.boolean_literal.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.boolean_literal.write().unwrap().push(None); + _index + }; + + let boolean_literal = boolean_literal(_index); + + let found = if let Some(boolean_literal) = + self.boolean_literal.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *boolean_literal.read().unwrap() + } else { + false + } + }) { + boolean_literal.clone() + } else { + None + }; + + if let Some(boolean_literal) = found { + tracing::debug!(target: "store", "found duplicate {boolean_literal:?}."); + self.boolean_literal_free_list.lock().unwrap().push(_index); + boolean_literal.clone() + } else { + tracing::debug!(target: "store", "interring {boolean_literal:?}."); + self.boolean_literal.write().unwrap()[_index] = Some(boolean_literal.clone()); + boolean_literal + } + } + + /// Exhume (get) [`BooleanLiteral`] from the store. + /// + #[inline] + pub fn exhume_boolean_literal(&self, id: &usize) -> Option>> { + match self.boolean_literal.read().unwrap().get(*id) { + Some(boolean_literal) => boolean_literal.clone(), + None => None, + } + } + + /// Exorcise (remove) [`BooleanLiteral`] from the store. + /// + #[inline] + pub fn exorcise_boolean_literal(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising boolean_literal slot: {id}."); + let result = self.boolean_literal.write().unwrap()[*id].take(); + self.boolean_literal_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, BooleanLiteral>`. + /// + #[inline] + pub fn iter_boolean_literal(&self) -> impl Iterator>> + '_ { + let len = self.boolean_literal.read().unwrap().len(); + (0..len) + .filter(|i| self.boolean_literal.read().unwrap()[*i].is_some()) + .map(move |i| { + self.boolean_literal.read().unwrap()[i] + .as_ref() + .map(|boolean_literal| boolean_literal.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`BooleanOperator`] into the store. + /// + #[inline] + pub fn inter_boolean_operator(&mut self, boolean_operator: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.boolean_operator_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.boolean_operator.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.boolean_operator.write().unwrap().push(None); + _index + }; + + let boolean_operator = boolean_operator(_index); + + let found = if let Some(boolean_operator) = + self.boolean_operator.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *boolean_operator.read().unwrap() + } else { + false + } + }) { + boolean_operator.clone() + } else { + None + }; + + if let Some(boolean_operator) = found { + tracing::debug!(target: "store", "found duplicate {boolean_operator:?}."); + self.boolean_operator_free_list.lock().unwrap().push(_index); + boolean_operator.clone() + } else { + tracing::debug!(target: "store", "interring {boolean_operator:?}."); + self.boolean_operator.write().unwrap()[_index] = Some(boolean_operator.clone()); + boolean_operator + } + } + + /// Exhume (get) [`BooleanOperator`] from the store. + /// + #[inline] + pub fn exhume_boolean_operator(&self, id: &usize) -> Option>> { + match self.boolean_operator.read().unwrap().get(*id) { + Some(boolean_operator) => boolean_operator.clone(), + None => None, + } + } + + /// Exorcise (remove) [`BooleanOperator`] from the store. + /// + #[inline] + pub fn exorcise_boolean_operator( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising boolean_operator slot: {id}."); + let result = self.boolean_operator.write().unwrap()[*id].take(); + self.boolean_operator_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, BooleanOperator>`. + /// + #[inline] + pub fn iter_boolean_operator(&self) -> impl Iterator>> + '_ { + let len = self.boolean_operator.read().unwrap().len(); + (0..len) + .filter(|i| self.boolean_operator.read().unwrap()[*i].is_some()) + .map(move |i| { + self.boolean_operator.read().unwrap()[i] + .as_ref() + .map(|boolean_operator| boolean_operator.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Call`] into the store. + /// + #[inline] + pub fn inter_call(&mut self, call: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.call_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.call.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.call.write().unwrap().push(None); + _index + }; + + let call = call(_index); + + let found = if let Some(call) = self.call.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *call.read().unwrap() + } else { + false + } + }) { + call.clone() + } else { + None + }; + + if let Some(call) = found { + tracing::debug!(target: "store", "found duplicate {call:?}."); + self.call_free_list.lock().unwrap().push(_index); + call.clone() + } else { + tracing::debug!(target: "store", "interring {call:?}."); + self.call.write().unwrap()[_index] = Some(call.clone()); + call + } + } + + /// Exhume (get) [`Call`] from the store. + /// + #[inline] + pub fn exhume_call(&self, id: &usize) -> Option>> { + match self.call.read().unwrap().get(*id) { + Some(call) => call.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Call`] from the store. + /// + #[inline] + pub fn exorcise_call(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising call slot: {id}."); + let result = self.call.write().unwrap()[*id].take(); + self.call_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Call>`. + /// + #[inline] + pub fn iter_call(&self) -> impl Iterator>> + '_ { + let len = self.call.read().unwrap().len(); + (0..len) + .filter(|i| self.call.read().unwrap()[*i].is_some()) + .map(move |i| { + self.call.read().unwrap()[i] + .as_ref() + .map(|call| call.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`CharLiteral`] into the store. + /// + #[inline] + pub fn inter_char_literal(&mut self, char_literal: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.char_literal_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.char_literal.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.char_literal.write().unwrap().push(None); + _index + }; + + let char_literal = char_literal(_index); + + let found = if let Some(char_literal) = + self.char_literal.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *char_literal.read().unwrap() + } else { + false + } + }) { + char_literal.clone() + } else { + None + }; + + if let Some(char_literal) = found { + tracing::debug!(target: "store", "found duplicate {char_literal:?}."); + self.char_literal_free_list.lock().unwrap().push(_index); + char_literal.clone() + } else { + tracing::debug!(target: "store", "interring {char_literal:?}."); + self.char_literal.write().unwrap()[_index] = Some(char_literal.clone()); + char_literal + } + } + + /// Exhume (get) [`CharLiteral`] from the store. + /// + #[inline] + pub fn exhume_char_literal(&self, id: &usize) -> Option>> { + match self.char_literal.read().unwrap().get(*id) { + Some(char_literal) => char_literal.clone(), + None => None, + } + } + + /// Exorcise (remove) [`CharLiteral`] from the store. + /// + #[inline] + pub fn exorcise_char_literal(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising char_literal slot: {id}."); + let result = self.char_literal.write().unwrap()[*id].take(); + self.char_literal_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, CharLiteral>`. + /// + #[inline] + pub fn iter_char_literal(&self) -> impl Iterator>> + '_ { + let len = self.char_literal.read().unwrap().len(); + (0..len) + .filter(|i| self.char_literal.read().unwrap()[*i].is_some()) + .map(move |i| { + self.char_literal.read().unwrap()[i] + .as_ref() + .map(|char_literal| char_literal.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Comparison`] into the store. + /// + #[inline] + pub fn inter_comparison(&mut self, comparison: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.comparison_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.comparison.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.comparison.write().unwrap().push(None); + _index + }; + + let comparison = comparison(_index); + + let found = if let Some(comparison) = + self.comparison.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *comparison.read().unwrap() + } else { + false + } + }) { + comparison.clone() + } else { + None + }; + + if let Some(comparison) = found { + tracing::debug!(target: "store", "found duplicate {comparison:?}."); + self.comparison_free_list.lock().unwrap().push(_index); + comparison.clone() + } else { + tracing::debug!(target: "store", "interring {comparison:?}."); + self.comparison.write().unwrap()[_index] = Some(comparison.clone()); + comparison + } + } + + /// Exhume (get) [`Comparison`] from the store. + /// + #[inline] + pub fn exhume_comparison(&self, id: &usize) -> Option>> { + match self.comparison.read().unwrap().get(*id) { + Some(comparison) => comparison.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Comparison`] from the store. + /// + #[inline] + pub fn exorcise_comparison(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising comparison slot: {id}."); + let result = self.comparison.write().unwrap()[*id].take(); + self.comparison_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Comparison>`. + /// + #[inline] + pub fn iter_comparison(&self) -> impl Iterator>> + '_ { + let len = self.comparison.read().unwrap().len(); + (0..len) + .filter(|i| self.comparison.read().unwrap()[*i].is_some()) + .map(move |i| { + self.comparison.read().unwrap()[i] + .as_ref() + .map(|comparison| comparison.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`DataStructure`] into the store. + /// + #[inline] + pub fn inter_data_structure(&mut self, data_structure: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.data_structure_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.data_structure.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.data_structure.write().unwrap().push(None); + _index + }; + + let data_structure = data_structure(_index); + + let found = if let Some(data_structure) = + self.data_structure.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *data_structure.read().unwrap() + } else { + false + } + }) { + data_structure.clone() + } else { + None + }; + + if let Some(data_structure) = found { + tracing::debug!(target: "store", "found duplicate {data_structure:?}."); + self.data_structure_free_list.lock().unwrap().push(_index); + data_structure.clone() + } else { + tracing::debug!(target: "store", "interring {data_structure:?}."); + self.data_structure.write().unwrap()[_index] = Some(data_structure.clone()); + data_structure + } + } + + /// Exhume (get) [`DataStructure`] from the store. + /// + #[inline] + pub fn exhume_data_structure(&self, id: &usize) -> Option>> { + match self.data_structure.read().unwrap().get(*id) { + Some(data_structure) => data_structure.clone(), + None => None, + } + } + + /// Exorcise (remove) [`DataStructure`] from the store. + /// + #[inline] + pub fn exorcise_data_structure(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising data_structure slot: {id}."); + let result = self.data_structure.write().unwrap()[*id].take(); + self.data_structure_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, DataStructure>`. + /// + #[inline] + pub fn iter_data_structure(&self) -> impl Iterator>> + '_ { + let len = self.data_structure.read().unwrap().len(); + (0..len) + .filter(|i| self.data_structure.read().unwrap()[*i].is_some()) + .map(move |i| { + self.data_structure.read().unwrap()[i] + .as_ref() + .map(|data_structure| data_structure.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`DwarfSourceFile`] into the store. + /// + #[inline] + pub fn inter_dwarf_source_file( + &mut self, + dwarf_source_file: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.dwarf_source_file_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.dwarf_source_file.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.dwarf_source_file.write().unwrap().push(None); + _index + }; + + let dwarf_source_file = dwarf_source_file(_index); + + let found = if let Some(dwarf_source_file) = self + .dwarf_source_file + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *dwarf_source_file.read().unwrap() + } else { + false + } + }) { + dwarf_source_file.clone() + } else { + None + }; + + if let Some(dwarf_source_file) = found { + tracing::debug!(target: "store", "found duplicate {dwarf_source_file:?}."); + self.dwarf_source_file_free_list + .lock() + .unwrap() + .push(_index); + dwarf_source_file.clone() + } else { + tracing::debug!(target: "store", "interring {dwarf_source_file:?}."); + self.dwarf_source_file.write().unwrap()[_index] = Some(dwarf_source_file.clone()); + dwarf_source_file + } + } + + /// Exhume (get) [`DwarfSourceFile`] from the store. + /// + #[inline] + pub fn exhume_dwarf_source_file(&self, id: &usize) -> Option>> { + match self.dwarf_source_file.read().unwrap().get(*id) { + Some(dwarf_source_file) => dwarf_source_file.clone(), + None => None, + } + } + + /// Exorcise (remove) [`DwarfSourceFile`] from the store. + /// + #[inline] + pub fn exorcise_dwarf_source_file( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising dwarf_source_file slot: {id}."); + let result = self.dwarf_source_file.write().unwrap()[*id].take(); + self.dwarf_source_file_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, DwarfSourceFile>`. + /// + #[inline] + pub fn iter_dwarf_source_file( + &self, + ) -> impl Iterator>> + '_ { + let len = self.dwarf_source_file.read().unwrap().len(); + (0..len) + .filter(|i| self.dwarf_source_file.read().unwrap()[*i].is_some()) + .map(move |i| { + self.dwarf_source_file.read().unwrap()[i] + .as_ref() + .map(|dwarf_source_file| dwarf_source_file.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`EnumField`] into the store. + /// + #[inline] + pub fn inter_enum_field(&mut self, enum_field: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.enum_field_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.enum_field.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.enum_field.write().unwrap().push(None); + _index + }; + + let enum_field = enum_field(_index); + + let found = if let Some(enum_field) = + self.enum_field.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *enum_field.read().unwrap() + } else { + false + } + }) { + enum_field.clone() + } else { + None + }; + + if let Some(enum_field) = found { + tracing::debug!(target: "store", "found duplicate {enum_field:?}."); + self.enum_field_free_list.lock().unwrap().push(_index); + enum_field.clone() + } else { + tracing::debug!(target: "store", "interring {enum_field:?}."); + self.enum_field.write().unwrap()[_index] = Some(enum_field.clone()); + enum_field + } + } + + /// Exhume (get) [`EnumField`] from the store. + /// + #[inline] + pub fn exhume_enum_field(&self, id: &usize) -> Option>> { + match self.enum_field.read().unwrap().get(*id) { + Some(enum_field) => enum_field.clone(), + None => None, + } + } + + /// Exorcise (remove) [`EnumField`] from the store. + /// + #[inline] + pub fn exorcise_enum_field(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising enum_field slot: {id}."); + let result = self.enum_field.write().unwrap()[*id].take(); + self.enum_field_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, EnumField>`. + /// + #[inline] + pub fn iter_enum_field(&self) -> impl Iterator>> + '_ { + let len = self.enum_field.read().unwrap().len(); + (0..len) + .filter(|i| self.enum_field.read().unwrap()[*i].is_some()) + .map(move |i| { + self.enum_field.read().unwrap()[i] + .as_ref() + .map(|enum_field| enum_field.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`EnumGeneric`] into the store. + /// + #[inline] + pub fn inter_enum_generic(&mut self, enum_generic: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.enum_generic_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.enum_generic.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.enum_generic.write().unwrap().push(None); + _index + }; + + let enum_generic = enum_generic(_index); + + let found = if let Some(enum_generic) = + self.enum_generic.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *enum_generic.read().unwrap() + } else { + false + } + }) { + enum_generic.clone() + } else { + None + }; + + if let Some(enum_generic) = found { + tracing::debug!(target: "store", "found duplicate {enum_generic:?}."); + self.enum_generic_free_list.lock().unwrap().push(_index); + enum_generic.clone() + } else { + tracing::debug!(target: "store", "interring {enum_generic:?}."); + self.enum_generic.write().unwrap()[_index] = Some(enum_generic.clone()); + enum_generic + } + } + + /// Exhume (get) [`EnumGeneric`] from the store. + /// + #[inline] + pub fn exhume_enum_generic(&self, id: &usize) -> Option>> { + match self.enum_generic.read().unwrap().get(*id) { + Some(enum_generic) => enum_generic.clone(), + None => None, + } + } + + /// Exorcise (remove) [`EnumGeneric`] from the store. + /// + #[inline] + pub fn exorcise_enum_generic(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising enum_generic slot: {id}."); + let result = self.enum_generic.write().unwrap()[*id].take(); + self.enum_generic_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, EnumGeneric>`. + /// + #[inline] + pub fn iter_enum_generic(&self) -> impl Iterator>> + '_ { + let len = self.enum_generic.read().unwrap().len(); + (0..len) + .filter(|i| self.enum_generic.read().unwrap()[*i].is_some()) + .map(move |i| { + self.enum_generic.read().unwrap()[i] + .as_ref() + .map(|enum_generic| enum_generic.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`EnumGenericType`] into the store. + /// + #[inline] + pub fn inter_enum_generic_type( + &mut self, + enum_generic_type: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.enum_generic_type_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.enum_generic_type.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.enum_generic_type.write().unwrap().push(None); + _index + }; + + let enum_generic_type = enum_generic_type(_index); + + let found = if let Some(enum_generic_type) = self + .enum_generic_type + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *enum_generic_type.read().unwrap() + } else { + false + } + }) { + enum_generic_type.clone() + } else { + None + }; + + if let Some(enum_generic_type) = found { + tracing::debug!(target: "store", "found duplicate {enum_generic_type:?}."); + self.enum_generic_type_free_list + .lock() + .unwrap() + .push(_index); + enum_generic_type.clone() + } else { + tracing::debug!(target: "store", "interring {enum_generic_type:?}."); + self.enum_generic_type.write().unwrap()[_index] = Some(enum_generic_type.clone()); + enum_generic_type + } + } + + /// Exhume (get) [`EnumGenericType`] from the store. + /// + #[inline] + pub fn exhume_enum_generic_type(&self, id: &usize) -> Option>> { + match self.enum_generic_type.read().unwrap().get(*id) { + Some(enum_generic_type) => enum_generic_type.clone(), + None => None, + } + } + + /// Exorcise (remove) [`EnumGenericType`] from the store. + /// + #[inline] + pub fn exorcise_enum_generic_type( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising enum_generic_type slot: {id}."); + let result = self.enum_generic_type.write().unwrap()[*id].take(); + self.enum_generic_type_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, EnumGenericType>`. + /// + #[inline] + pub fn iter_enum_generic_type( + &self, + ) -> impl Iterator>> + '_ { + let len = self.enum_generic_type.read().unwrap().len(); + (0..len) + .filter(|i| self.enum_generic_type.read().unwrap()[*i].is_some()) + .map(move |i| { + self.enum_generic_type.read().unwrap()[i] + .as_ref() + .map(|enum_generic_type| enum_generic_type.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Enumeration`] into the store. + /// + #[inline] + pub fn inter_enumeration(&mut self, enumeration: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.enumeration_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.enumeration.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.enumeration.write().unwrap().push(None); + _index + }; + + let enumeration = enumeration(_index); + + let found = if let Some(enumeration) = + self.enumeration.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *enumeration.read().unwrap() + } else { + false + } + }) { + enumeration.clone() + } else { + None + }; + + let enumeration = if let Some(enumeration) = found { + tracing::debug!(target: "store", "found duplicate {enumeration:?}."); + self.enumeration_free_list.lock().unwrap().push(_index); + enumeration.clone() + } else { + tracing::debug!(target: "store", "interring {enumeration:?}."); + self.enumeration.write().unwrap()[_index] = Some(enumeration.clone()); + enumeration + }; + self.enumeration_id_by_name.write().unwrap().insert( + enumeration.read().unwrap().name.to_owned(), + enumeration.read().unwrap().id, + ); + enumeration + } + + /// Exhume (get) [`Enumeration`] from the store. + /// + #[inline] + pub fn exhume_enumeration(&self, id: &usize) -> Option>> { + match self.enumeration.read().unwrap().get(*id) { + Some(enumeration) => enumeration.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Enumeration`] from the store. + /// + #[inline] + pub fn exorcise_enumeration(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising enumeration slot: {id}."); + let result = self.enumeration.write().unwrap()[*id].take(); + self.enumeration_free_list.lock().unwrap().push(*id); + result + } + + /// Exorcise [`Enumeration`] id from the store by name. + /// + #[inline] + pub fn exhume_enumeration_id_by_name(&self, name: &str) -> Option { + self.enumeration_id_by_name + .read() + .unwrap() + .get(name) + .map(|enumeration| *enumeration) + } + + /// Get an iterator over the internal `HashMap<&Uuid, Enumeration>`. + /// + #[inline] + pub fn iter_enumeration(&self) -> impl Iterator>> + '_ { + let len = self.enumeration.read().unwrap().len(); + (0..len) + .filter(|i| self.enumeration.read().unwrap()[*i].is_some()) + .map(move |i| { + self.enumeration.read().unwrap()[i] + .as_ref() + .map(|enumeration| enumeration.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Expression`] into the store. + /// + #[inline] + pub fn inter_expression(&mut self, expression: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.expression_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.expression.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.expression.write().unwrap().push(None); + _index + }; + + let expression = expression(_index); + + let found = if let Some(expression) = + self.expression.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *expression.read().unwrap() + } else { + false + } + }) { + expression.clone() + } else { + None + }; + + if let Some(expression) = found { + tracing::debug!(target: "store", "found duplicate {expression:?}."); + self.expression_free_list.lock().unwrap().push(_index); + expression.clone() + } else { + tracing::debug!(target: "store", "interring {expression:?}."); + self.expression.write().unwrap()[_index] = Some(expression.clone()); + expression + } + } + + /// Exhume (get) [`Expression`] from the store. + /// + #[inline] + pub fn exhume_expression(&self, id: &usize) -> Option>> { + match self.expression.read().unwrap().get(*id) { + Some(expression) => expression.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Expression`] from the store. + /// + #[inline] + pub fn exorcise_expression(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising expression slot: {id}."); + let result = self.expression.write().unwrap()[*id].take(); + self.expression_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Expression>`. + /// + #[inline] + pub fn iter_expression(&self) -> impl Iterator>> + '_ { + let len = self.expression.read().unwrap().len(); + (0..len) + .filter(|i| self.expression.read().unwrap()[*i].is_some()) + .map(move |i| { + self.expression.read().unwrap()[i] + .as_ref() + .map(|expression| expression.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`ExpressionBit`] into the store. + /// + #[inline] + pub fn inter_expression_bit(&mut self, expression_bit: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.expression_bit_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.expression_bit.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.expression_bit.write().unwrap().push(None); + _index + }; + + let expression_bit = expression_bit(_index); + + let found = if let Some(expression_bit) = + self.expression_bit.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *expression_bit.read().unwrap() + } else { + false + } + }) { + expression_bit.clone() + } else { + None + }; + + if let Some(expression_bit) = found { + tracing::debug!(target: "store", "found duplicate {expression_bit:?}."); + self.expression_bit_free_list.lock().unwrap().push(_index); + expression_bit.clone() + } else { + tracing::debug!(target: "store", "interring {expression_bit:?}."); + self.expression_bit.write().unwrap()[_index] = Some(expression_bit.clone()); + expression_bit + } + } + + /// Exhume (get) [`ExpressionBit`] from the store. + /// + #[inline] + pub fn exhume_expression_bit(&self, id: &usize) -> Option>> { + match self.expression_bit.read().unwrap().get(*id) { + Some(expression_bit) => expression_bit.clone(), + None => None, + } + } + + /// Exorcise (remove) [`ExpressionBit`] from the store. + /// + #[inline] + pub fn exorcise_expression_bit(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising expression_bit slot: {id}."); + let result = self.expression_bit.write().unwrap()[*id].take(); + self.expression_bit_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, ExpressionBit>`. + /// + #[inline] + pub fn iter_expression_bit(&self) -> impl Iterator>> + '_ { + let len = self.expression_bit.read().unwrap().len(); + (0..len) + .filter(|i| self.expression_bit.read().unwrap()[*i].is_some()) + .map(move |i| { + self.expression_bit.read().unwrap()[i] + .as_ref() + .map(|expression_bit| expression_bit.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`ExpressionStatement`] into the store. + /// + #[inline] + pub fn inter_expression_statement( + &mut self, + expression_statement: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.expression_statement_free_list.lock().unwrap().pop() + { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.expression_statement.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.expression_statement.write().unwrap().push(None); + _index + }; + + let expression_statement = expression_statement(_index); + + let found = if let Some(expression_statement) = self + .expression_statement + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *expression_statement.read().unwrap() + } else { + false + } + }) { + expression_statement.clone() + } else { + None + }; + + if let Some(expression_statement) = found { + tracing::debug!(target: "store", "found duplicate {expression_statement:?}."); + self.expression_statement_free_list + .lock() + .unwrap() + .push(_index); + expression_statement.clone() + } else { + tracing::debug!(target: "store", "interring {expression_statement:?}."); + self.expression_statement.write().unwrap()[_index] = Some(expression_statement.clone()); + expression_statement + } + } + + /// Exhume (get) [`ExpressionStatement`] from the store. + /// + #[inline] + pub fn exhume_expression_statement( + &self, + id: &usize, + ) -> Option>> { + match self.expression_statement.read().unwrap().get(*id) { + Some(expression_statement) => expression_statement.clone(), + None => None, + } + } + + /// Exorcise (remove) [`ExpressionStatement`] from the store. + /// + #[inline] + pub fn exorcise_expression_statement( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising expression_statement slot: {id}."); + let result = self.expression_statement.write().unwrap()[*id].take(); + self.expression_statement_free_list + .lock() + .unwrap() + .push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, ExpressionStatement>`. + /// + #[inline] + pub fn iter_expression_statement( + &self, + ) -> impl Iterator>> + '_ { + let len = self.expression_statement.read().unwrap().len(); + (0..len) + .filter(|i| self.expression_statement.read().unwrap()[*i].is_some()) + .map(move |i| { + self.expression_statement.read().unwrap()[i] + .as_ref() + .map(|expression_statement| expression_statement.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`ExternalImplementation`] into the store. + /// + #[inline] + pub fn inter_external_implementation( + &mut self, + external_implementation: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = + if let Some(_index) = self.external_implementation_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.external_implementation.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.external_implementation.write().unwrap().push(None); + _index + }; + + let external_implementation = external_implementation(_index); + + let found = if let Some(external_implementation) = self + .external_implementation + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *external_implementation.read().unwrap() + } else { + false + } + }) { + external_implementation.clone() + } else { + None + }; + + if let Some(external_implementation) = found { + tracing::debug!(target: "store", "found duplicate {external_implementation:?}."); + self.external_implementation_free_list + .lock() + .unwrap() + .push(_index); + external_implementation.clone() + } else { + tracing::debug!(target: "store", "interring {external_implementation:?}."); + self.external_implementation.write().unwrap()[_index] = + Some(external_implementation.clone()); + external_implementation + } + } + + /// Exhume (get) [`ExternalImplementation`] from the store. + /// + #[inline] + pub fn exhume_external_implementation( + &self, + id: &usize, + ) -> Option>> { + match self.external_implementation.read().unwrap().get(*id) { + Some(external_implementation) => external_implementation.clone(), + None => None, + } + } + + /// Exorcise (remove) [`ExternalImplementation`] from the store. + /// + #[inline] + pub fn exorcise_external_implementation( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising external_implementation slot: {id}."); + let result = self.external_implementation.write().unwrap()[*id].take(); + self.external_implementation_free_list + .lock() + .unwrap() + .push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, ExternalImplementation>`. + /// + #[inline] + pub fn iter_external_implementation( + &self, + ) -> impl Iterator>> + '_ { + let len = self.external_implementation.read().unwrap().len(); + (0..len) + .filter(|i| self.external_implementation.read().unwrap()[*i].is_some()) + .map(move |i| { + self.external_implementation.read().unwrap()[i] + .as_ref() + .map(|external_implementation| external_implementation.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Field`] into the store. + /// + #[inline] + pub fn inter_field(&mut self, field: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.field_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.field.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.field.write().unwrap().push(None); + _index + }; + + let field = field(_index); + + let found = if let Some(field) = self.field.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *field.read().unwrap() + } else { + false + } + }) { + field.clone() + } else { + None + }; + + let field = if let Some(field) = found { + tracing::debug!(target: "store", "found duplicate {field:?}."); + self.field_free_list.lock().unwrap().push(_index); + field.clone() + } else { + tracing::debug!(target: "store", "interring {field:?}."); + self.field.write().unwrap()[_index] = Some(field.clone()); + field + }; + self.field_id_by_name.write().unwrap().insert( + field.read().unwrap().name.to_owned(), + field.read().unwrap().id, + ); + field + } + + /// Exhume (get) [`Field`] from the store. + /// + #[inline] + pub fn exhume_field(&self, id: &usize) -> Option>> { + match self.field.read().unwrap().get(*id) { + Some(field) => field.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Field`] from the store. + /// + #[inline] + pub fn exorcise_field(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising field slot: {id}."); + let result = self.field.write().unwrap()[*id].take(); + self.field_free_list.lock().unwrap().push(*id); + result + } + + /// Exorcise [`Field`] id from the store by name. + /// + #[inline] + pub fn exhume_field_id_by_name(&self, name: &str) -> Option { + self.field_id_by_name + .read() + .unwrap() + .get(name) + .map(|field| *field) + } + + /// Get an iterator over the internal `HashMap<&Uuid, Field>`. + /// + #[inline] + pub fn iter_field(&self) -> impl Iterator>> + '_ { + let len = self.field.read().unwrap().len(); + (0..len) + .filter(|i| self.field.read().unwrap()[*i].is_some()) + .map(move |i| { + self.field.read().unwrap()[i] + .as_ref() + .map(|field| field.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`FieldAccess`] into the store. + /// + #[inline] + pub fn inter_field_access(&mut self, field_access: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.field_access_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.field_access.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.field_access.write().unwrap().push(None); + _index + }; + + let field_access = field_access(_index); + + let found = if let Some(field_access) = + self.field_access.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *field_access.read().unwrap() + } else { + false + } + }) { + field_access.clone() + } else { + None + }; + + if let Some(field_access) = found { + tracing::debug!(target: "store", "found duplicate {field_access:?}."); + self.field_access_free_list.lock().unwrap().push(_index); + field_access.clone() + } else { + tracing::debug!(target: "store", "interring {field_access:?}."); + self.field_access.write().unwrap()[_index] = Some(field_access.clone()); + field_access + } + } + + /// Exhume (get) [`FieldAccess`] from the store. + /// + #[inline] + pub fn exhume_field_access(&self, id: &usize) -> Option>> { + match self.field_access.read().unwrap().get(*id) { + Some(field_access) => field_access.clone(), + None => None, + } + } + + /// Exorcise (remove) [`FieldAccess`] from the store. + /// + #[inline] + pub fn exorcise_field_access(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising field_access slot: {id}."); + let result = self.field_access.write().unwrap()[*id].take(); + self.field_access_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, FieldAccess>`. + /// + #[inline] + pub fn iter_field_access(&self) -> impl Iterator>> + '_ { + let len = self.field_access.read().unwrap().len(); + (0..len) + .filter(|i| self.field_access.read().unwrap()[*i].is_some()) + .map(move |i| { + self.field_access.read().unwrap()[i] + .as_ref() + .map(|field_access| field_access.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`FieldAccessTarget`] into the store. + /// + #[inline] + pub fn inter_field_access_target( + &mut self, + field_access_target: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.field_access_target_free_list.lock().unwrap().pop() + { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.field_access_target.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.field_access_target.write().unwrap().push(None); + _index + }; + + let field_access_target = field_access_target(_index); + + let found = if let Some(field_access_target) = self + .field_access_target + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *field_access_target.read().unwrap() + } else { + false + } + }) { + field_access_target.clone() + } else { + None + }; + + if let Some(field_access_target) = found { + tracing::debug!(target: "store", "found duplicate {field_access_target:?}."); + self.field_access_target_free_list + .lock() + .unwrap() + .push(_index); + field_access_target.clone() + } else { + tracing::debug!(target: "store", "interring {field_access_target:?}."); + self.field_access_target.write().unwrap()[_index] = Some(field_access_target.clone()); + field_access_target + } + } + + /// Exhume (get) [`FieldAccessTarget`] from the store. + /// + #[inline] + pub fn exhume_field_access_target(&self, id: &usize) -> Option>> { + match self.field_access_target.read().unwrap().get(*id) { + Some(field_access_target) => field_access_target.clone(), + None => None, + } + } + + /// Exorcise (remove) [`FieldAccessTarget`] from the store. + /// + #[inline] + pub fn exorcise_field_access_target( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising field_access_target slot: {id}."); + let result = self.field_access_target.write().unwrap()[*id].take(); + self.field_access_target_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, FieldAccessTarget>`. + /// + #[inline] + pub fn iter_field_access_target( + &self, + ) -> impl Iterator>> + '_ { + let len = self.field_access_target.read().unwrap().len(); + (0..len) + .filter(|i| self.field_access_target.read().unwrap()[*i].is_some()) + .map(move |i| { + self.field_access_target.read().unwrap()[i] + .as_ref() + .map(|field_access_target| field_access_target.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`FieldExpression`] into the store. + /// + #[inline] + pub fn inter_field_expression(&mut self, field_expression: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.field_expression_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.field_expression.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.field_expression.write().unwrap().push(None); + _index + }; + + let field_expression = field_expression(_index); + + let found = if let Some(field_expression) = + self.field_expression.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *field_expression.read().unwrap() + } else { + false + } + }) { + field_expression.clone() + } else { + None + }; + + if let Some(field_expression) = found { + tracing::debug!(target: "store", "found duplicate {field_expression:?}."); + self.field_expression_free_list.lock().unwrap().push(_index); + field_expression.clone() + } else { + tracing::debug!(target: "store", "interring {field_expression:?}."); + self.field_expression.write().unwrap()[_index] = Some(field_expression.clone()); + field_expression + } + } + + /// Exhume (get) [`FieldExpression`] from the store. + /// + #[inline] + pub fn exhume_field_expression(&self, id: &usize) -> Option>> { + match self.field_expression.read().unwrap().get(*id) { + Some(field_expression) => field_expression.clone(), + None => None, + } + } + + /// Exorcise (remove) [`FieldExpression`] from the store. + /// + #[inline] + pub fn exorcise_field_expression( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising field_expression slot: {id}."); + let result = self.field_expression.write().unwrap()[*id].take(); + self.field_expression_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, FieldExpression>`. + /// + #[inline] + pub fn iter_field_expression(&self) -> impl Iterator>> + '_ { + let len = self.field_expression.read().unwrap().len(); + (0..len) + .filter(|i| self.field_expression.read().unwrap()[*i].is_some()) + .map(move |i| { + self.field_expression.read().unwrap()[i] + .as_ref() + .map(|field_expression| field_expression.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`FloatLiteral`] into the store. + /// + #[inline] + pub fn inter_float_literal(&mut self, float_literal: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.float_literal_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.float_literal.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.float_literal.write().unwrap().push(None); + _index + }; + + let float_literal = float_literal(_index); + + let found = if let Some(float_literal) = + self.float_literal.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *float_literal.read().unwrap() + } else { + false + } + }) { + float_literal.clone() + } else { + None + }; + + if let Some(float_literal) = found { + tracing::debug!(target: "store", "found duplicate {float_literal:?}."); + self.float_literal_free_list.lock().unwrap().push(_index); + float_literal.clone() + } else { + tracing::debug!(target: "store", "interring {float_literal:?}."); + self.float_literal.write().unwrap()[_index] = Some(float_literal.clone()); + float_literal + } + } + + /// Exhume (get) [`FloatLiteral`] from the store. + /// + #[inline] + pub fn exhume_float_literal(&self, id: &usize) -> Option>> { + match self.float_literal.read().unwrap().get(*id) { + Some(float_literal) => float_literal.clone(), + None => None, + } + } + + /// Exorcise (remove) [`FloatLiteral`] from the store. + /// + #[inline] + pub fn exorcise_float_literal(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising float_literal slot: {id}."); + let result = self.float_literal.write().unwrap()[*id].take(); + self.float_literal_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, FloatLiteral>`. + /// + #[inline] + pub fn iter_float_literal(&self) -> impl Iterator>> + '_ { + let len = self.float_literal.read().unwrap().len(); + (0..len) + .filter(|i| self.float_literal.read().unwrap()[*i].is_some()) + .map(move |i| { + self.float_literal.read().unwrap()[i] + .as_ref() + .map(|float_literal| float_literal.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`ForLoop`] into the store. + /// + #[inline] + pub fn inter_for_loop(&mut self, for_loop: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.for_loop_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.for_loop.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.for_loop.write().unwrap().push(None); + _index + }; + + let for_loop = for_loop(_index); + + let found = if let Some(for_loop) = self.for_loop.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *for_loop.read().unwrap() + } else { + false + } + }) { + for_loop.clone() + } else { + None + }; + + if let Some(for_loop) = found { + tracing::debug!(target: "store", "found duplicate {for_loop:?}."); + self.for_loop_free_list.lock().unwrap().push(_index); + for_loop.clone() + } else { + tracing::debug!(target: "store", "interring {for_loop:?}."); + self.for_loop.write().unwrap()[_index] = Some(for_loop.clone()); + for_loop + } + } + + /// Exhume (get) [`ForLoop`] from the store. + /// + #[inline] + pub fn exhume_for_loop(&self, id: &usize) -> Option>> { + match self.for_loop.read().unwrap().get(*id) { + Some(for_loop) => for_loop.clone(), + None => None, + } + } + + /// Exorcise (remove) [`ForLoop`] from the store. + /// + #[inline] + pub fn exorcise_for_loop(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising for_loop slot: {id}."); + let result = self.for_loop.write().unwrap()[*id].take(); + self.for_loop_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, ForLoop>`. + /// + #[inline] + pub fn iter_for_loop(&self) -> impl Iterator>> + '_ { + let len = self.for_loop.read().unwrap().len(); + (0..len) + .filter(|i| self.for_loop.read().unwrap()[*i].is_some()) + .map(move |i| { + self.for_loop.read().unwrap()[i] + .as_ref() + .map(|for_loop| for_loop.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`FormatBit`] into the store. + /// + #[inline] + pub fn inter_format_bit(&mut self, format_bit: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.format_bit_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.format_bit.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.format_bit.write().unwrap().push(None); + _index + }; + + let format_bit = format_bit(_index); + + let found = if let Some(format_bit) = + self.format_bit.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *format_bit.read().unwrap() + } else { + false + } + }) { + format_bit.clone() + } else { + None + }; + + if let Some(format_bit) = found { + tracing::debug!(target: "store", "found duplicate {format_bit:?}."); + self.format_bit_free_list.lock().unwrap().push(_index); + format_bit.clone() + } else { + tracing::debug!(target: "store", "interring {format_bit:?}."); + self.format_bit.write().unwrap()[_index] = Some(format_bit.clone()); + format_bit + } + } + + /// Exhume (get) [`FormatBit`] from the store. + /// + #[inline] + pub fn exhume_format_bit(&self, id: &usize) -> Option>> { + match self.format_bit.read().unwrap().get(*id) { + Some(format_bit) => format_bit.clone(), + None => None, + } + } + + /// Exorcise (remove) [`FormatBit`] from the store. + /// + #[inline] + pub fn exorcise_format_bit(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising format_bit slot: {id}."); + let result = self.format_bit.write().unwrap()[*id].take(); + self.format_bit_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, FormatBit>`. + /// + #[inline] + pub fn iter_format_bit(&self) -> impl Iterator>> + '_ { + let len = self.format_bit.read().unwrap().len(); + (0..len) + .filter(|i| self.format_bit.read().unwrap()[*i].is_some()) + .map(move |i| { + self.format_bit.read().unwrap()[i] + .as_ref() + .map(|format_bit| format_bit.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`FormatString`] into the store. + /// + #[inline] + pub fn inter_format_string(&mut self, format_string: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.format_string_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.format_string.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.format_string.write().unwrap().push(None); + _index + }; + + let format_string = format_string(_index); + + let found = if let Some(format_string) = + self.format_string.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *format_string.read().unwrap() + } else { + false + } + }) { + format_string.clone() + } else { + None + }; + + if let Some(format_string) = found { + tracing::debug!(target: "store", "found duplicate {format_string:?}."); + self.format_string_free_list.lock().unwrap().push(_index); + format_string.clone() + } else { + tracing::debug!(target: "store", "interring {format_string:?}."); + self.format_string.write().unwrap()[_index] = Some(format_string.clone()); + format_string + } + } + + /// Exhume (get) [`FormatString`] from the store. + /// + #[inline] + pub fn exhume_format_string(&self, id: &usize) -> Option>> { + match self.format_string.read().unwrap().get(*id) { + Some(format_string) => format_string.clone(), + None => None, + } + } + + /// Exorcise (remove) [`FormatString`] from the store. + /// + #[inline] + pub fn exorcise_format_string(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising format_string slot: {id}."); + let result = self.format_string.write().unwrap()[*id].take(); + self.format_string_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, FormatString>`. + /// + #[inline] + pub fn iter_format_string(&self) -> impl Iterator>> + '_ { + let len = self.format_string.read().unwrap().len(); + (0..len) + .filter(|i| self.format_string.read().unwrap()[*i].is_some()) + .map(move |i| { + self.format_string.read().unwrap()[i] + .as_ref() + .map(|format_string| format_string.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`FuncGeneric`] into the store. + /// + #[inline] + pub fn inter_func_generic(&mut self, func_generic: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.func_generic_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.func_generic.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.func_generic.write().unwrap().push(None); + _index + }; + + let func_generic = func_generic(_index); + + let found = if let Some(func_generic) = + self.func_generic.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *func_generic.read().unwrap() + } else { + false + } + }) { + func_generic.clone() + } else { + None + }; + + if let Some(func_generic) = found { + tracing::debug!(target: "store", "found duplicate {func_generic:?}."); + self.func_generic_free_list.lock().unwrap().push(_index); + func_generic.clone() + } else { + tracing::debug!(target: "store", "interring {func_generic:?}."); + self.func_generic.write().unwrap()[_index] = Some(func_generic.clone()); + func_generic + } + } + + /// Exhume (get) [`FuncGeneric`] from the store. + /// + #[inline] + pub fn exhume_func_generic(&self, id: &usize) -> Option>> { + match self.func_generic.read().unwrap().get(*id) { + Some(func_generic) => func_generic.clone(), + None => None, + } + } + + /// Exorcise (remove) [`FuncGeneric`] from the store. + /// + #[inline] + pub fn exorcise_func_generic(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising func_generic slot: {id}."); + let result = self.func_generic.write().unwrap()[*id].take(); + self.func_generic_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, FuncGeneric>`. + /// + #[inline] + pub fn iter_func_generic(&self) -> impl Iterator>> + '_ { + let len = self.func_generic.read().unwrap().len(); + (0..len) + .filter(|i| self.func_generic.read().unwrap()[*i].is_some()) + .map(move |i| { + self.func_generic.read().unwrap()[i] + .as_ref() + .map(|func_generic| func_generic.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Function`] into the store. + /// + #[inline] + pub fn inter_function(&mut self, function: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.function_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.function.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.function.write().unwrap().push(None); + _index + }; + + let function = function(_index); + + let found = if let Some(function) = self.function.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *function.read().unwrap() + } else { + false + } + }) { + function.clone() + } else { + None + }; + + let function = if let Some(function) = found { + tracing::debug!(target: "store", "found duplicate {function:?}."); + self.function_free_list.lock().unwrap().push(_index); + function.clone() + } else { + tracing::debug!(target: "store", "interring {function:?}."); + self.function.write().unwrap()[_index] = Some(function.clone()); + function + }; + self.function_id_by_name.write().unwrap().insert( + function.read().unwrap().name.to_owned(), + function.read().unwrap().id, + ); + function + } + + /// Exhume (get) [`Function`] from the store. + /// + #[inline] + pub fn exhume_function(&self, id: &usize) -> Option>> { + match self.function.read().unwrap().get(*id) { + Some(function) => function.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Function`] from the store. + /// + #[inline] + pub fn exorcise_function(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising function slot: {id}."); + let result = self.function.write().unwrap()[*id].take(); + self.function_free_list.lock().unwrap().push(*id); + result + } + + /// Exorcise [`Function`] id from the store by name. + /// + #[inline] + pub fn exhume_function_id_by_name(&self, name: &str) -> Option { + self.function_id_by_name + .read() + .unwrap() + .get(name) + .map(|function| *function) + } + + /// Get an iterator over the internal `HashMap<&Uuid, Function>`. + /// + #[inline] + pub fn iter_function(&self) -> impl Iterator>> + '_ { + let len = self.function.read().unwrap().len(); + (0..len) + .filter(|i| self.function.read().unwrap()[*i].is_some()) + .map(move |i| { + self.function.read().unwrap()[i] + .as_ref() + .map(|function| function.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`FunctionCall`] into the store. + /// + #[inline] + pub fn inter_function_call(&mut self, function_call: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.function_call_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.function_call.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.function_call.write().unwrap().push(None); + _index + }; + + let function_call = function_call(_index); + + let found = if let Some(function_call) = + self.function_call.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *function_call.read().unwrap() + } else { + false + } + }) { + function_call.clone() + } else { + None + }; + + if let Some(function_call) = found { + tracing::debug!(target: "store", "found duplicate {function_call:?}."); + self.function_call_free_list.lock().unwrap().push(_index); + function_call.clone() + } else { + tracing::debug!(target: "store", "interring {function_call:?}."); + self.function_call.write().unwrap()[_index] = Some(function_call.clone()); + function_call + } + } + + /// Exhume (get) [`FunctionCall`] from the store. + /// + #[inline] + pub fn exhume_function_call(&self, id: &usize) -> Option>> { + match self.function_call.read().unwrap().get(*id) { + Some(function_call) => function_call.clone(), + None => None, + } + } + + /// Exorcise (remove) [`FunctionCall`] from the store. + /// + #[inline] + pub fn exorcise_function_call(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising function_call slot: {id}."); + let result = self.function_call.write().unwrap()[*id].take(); + self.function_call_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, FunctionCall>`. + /// + #[inline] + pub fn iter_function_call(&self) -> impl Iterator>> + '_ { + let len = self.function_call.read().unwrap().len(); + (0..len) + .filter(|i| self.function_call.read().unwrap()[*i].is_some()) + .map(move |i| { + self.function_call.read().unwrap()[i] + .as_ref() + .map(|function_call| function_call.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`XFuture`] into the store. + /// + #[inline] + pub fn inter_x_future(&mut self, x_future: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.x_future_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.x_future.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.x_future.write().unwrap().push(None); + _index + }; + + let x_future = x_future(_index); + + let found = if let Some(x_future) = self.x_future.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *x_future.read().unwrap() + } else { + false + } + }) { + x_future.clone() + } else { + None + }; + + if let Some(x_future) = found { + tracing::debug!(target: "store", "found duplicate {x_future:?}."); + self.x_future_free_list.lock().unwrap().push(_index); + x_future.clone() + } else { + tracing::debug!(target: "store", "interring {x_future:?}."); + self.x_future.write().unwrap()[_index] = Some(x_future.clone()); + x_future + } + } + + /// Exhume (get) [`XFuture`] from the store. + /// + #[inline] + pub fn exhume_x_future(&self, id: &usize) -> Option>> { + match self.x_future.read().unwrap().get(*id) { + Some(x_future) => x_future.clone(), + None => None, + } + } + + /// Exorcise (remove) [`XFuture`] from the store. + /// + #[inline] + pub fn exorcise_x_future(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising x_future slot: {id}."); + let result = self.x_future.write().unwrap()[*id].take(); + self.x_future_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, XFuture>`. + /// + #[inline] + pub fn iter_x_future(&self) -> impl Iterator>> + '_ { + let len = self.x_future.read().unwrap().len(); + (0..len) + .filter(|i| self.x_future.read().unwrap()[*i].is_some()) + .map(move |i| { + self.x_future.read().unwrap()[i] + .as_ref() + .map(|x_future| x_future.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Grouped`] into the store. + /// + #[inline] + pub fn inter_grouped(&mut self, grouped: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.grouped_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.grouped.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.grouped.write().unwrap().push(None); + _index + }; + + let grouped = grouped(_index); + + let found = if let Some(grouped) = self.grouped.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *grouped.read().unwrap() + } else { + false + } + }) { + grouped.clone() + } else { + None + }; + + if let Some(grouped) = found { + tracing::debug!(target: "store", "found duplicate {grouped:?}."); + self.grouped_free_list.lock().unwrap().push(_index); + grouped.clone() + } else { + tracing::debug!(target: "store", "interring {grouped:?}."); + self.grouped.write().unwrap()[_index] = Some(grouped.clone()); + grouped + } + } + + /// Exhume (get) [`Grouped`] from the store. + /// + #[inline] + pub fn exhume_grouped(&self, id: &usize) -> Option>> { + match self.grouped.read().unwrap().get(*id) { + Some(grouped) => grouped.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Grouped`] from the store. + /// + #[inline] + pub fn exorcise_grouped(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising grouped slot: {id}."); + let result = self.grouped.write().unwrap()[*id].take(); + self.grouped_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Grouped>`. + /// + #[inline] + pub fn iter_grouped(&self) -> impl Iterator>> + '_ { + let len = self.grouped.read().unwrap().len(); + (0..len) + .filter(|i| self.grouped.read().unwrap()[*i].is_some()) + .map(move |i| { + self.grouped.read().unwrap()[i] + .as_ref() + .map(|grouped| grouped.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`HaltAndCatchFire`] into the store. + /// + #[inline] + pub fn inter_halt_and_catch_fire( + &mut self, + halt_and_catch_fire: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.halt_and_catch_fire_free_list.lock().unwrap().pop() + { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.halt_and_catch_fire.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.halt_and_catch_fire.write().unwrap().push(None); + _index + }; + + let halt_and_catch_fire = halt_and_catch_fire(_index); + + let found = if let Some(halt_and_catch_fire) = self + .halt_and_catch_fire + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *halt_and_catch_fire.read().unwrap() + } else { + false + } + }) { + halt_and_catch_fire.clone() + } else { + None + }; + + if let Some(halt_and_catch_fire) = found { + tracing::debug!(target: "store", "found duplicate {halt_and_catch_fire:?}."); + self.halt_and_catch_fire_free_list + .lock() + .unwrap() + .push(_index); + halt_and_catch_fire.clone() + } else { + tracing::debug!(target: "store", "interring {halt_and_catch_fire:?}."); + self.halt_and_catch_fire.write().unwrap()[_index] = Some(halt_and_catch_fire.clone()); + halt_and_catch_fire + } + } + + /// Exhume (get) [`HaltAndCatchFire`] from the store. + /// + #[inline] + pub fn exhume_halt_and_catch_fire(&self, id: &usize) -> Option>> { + match self.halt_and_catch_fire.read().unwrap().get(*id) { + Some(halt_and_catch_fire) => halt_and_catch_fire.clone(), + None => None, + } + } + + /// Exorcise (remove) [`HaltAndCatchFire`] from the store. + /// + #[inline] + pub fn exorcise_halt_and_catch_fire( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising halt_and_catch_fire slot: {id}."); + let result = self.halt_and_catch_fire.write().unwrap()[*id].take(); + self.halt_and_catch_fire_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, HaltAndCatchFire>`. + /// + #[inline] + pub fn iter_halt_and_catch_fire( + &self, + ) -> impl Iterator>> + '_ { + let len = self.halt_and_catch_fire.read().unwrap().len(); + (0..len) + .filter(|i| self.halt_and_catch_fire.read().unwrap()[*i].is_some()) + .map(move |i| { + self.halt_and_catch_fire.read().unwrap()[i] + .as_ref() + .map(|halt_and_catch_fire| halt_and_catch_fire.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`XIf`] into the store. + /// + #[inline] + pub fn inter_x_if(&mut self, x_if: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.x_if_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.x_if.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.x_if.write().unwrap().push(None); + _index + }; + + let x_if = x_if(_index); + + let found = if let Some(x_if) = self.x_if.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *x_if.read().unwrap() + } else { + false + } + }) { + x_if.clone() + } else { + None + }; + + if let Some(x_if) = found { + tracing::debug!(target: "store", "found duplicate {x_if:?}."); + self.x_if_free_list.lock().unwrap().push(_index); + x_if.clone() + } else { + tracing::debug!(target: "store", "interring {x_if:?}."); + self.x_if.write().unwrap()[_index] = Some(x_if.clone()); + x_if + } + } + + /// Exhume (get) [`XIf`] from the store. + /// + #[inline] + pub fn exhume_x_if(&self, id: &usize) -> Option>> { + match self.x_if.read().unwrap().get(*id) { + Some(x_if) => x_if.clone(), + None => None, + } + } + + /// Exorcise (remove) [`XIf`] from the store. + /// + #[inline] + pub fn exorcise_x_if(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising x_if slot: {id}."); + let result = self.x_if.write().unwrap()[*id].take(); + self.x_if_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, XIf>`. + /// + #[inline] + pub fn iter_x_if(&self) -> impl Iterator>> + '_ { + let len = self.x_if.read().unwrap().len(); + (0..len) + .filter(|i| self.x_if.read().unwrap()[*i].is_some()) + .map(move |i| { + self.x_if.read().unwrap()[i] + .as_ref() + .map(|x_if| x_if.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`ImplementationBlock`] into the store. + /// + #[inline] + pub fn inter_implementation_block( + &mut self, + implementation_block: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.implementation_block_free_list.lock().unwrap().pop() + { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.implementation_block.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.implementation_block.write().unwrap().push(None); + _index + }; + + let implementation_block = implementation_block(_index); + + let found = if let Some(implementation_block) = self + .implementation_block + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *implementation_block.read().unwrap() + } else { + false + } + }) { + implementation_block.clone() + } else { + None + }; + + if let Some(implementation_block) = found { + tracing::debug!(target: "store", "found duplicate {implementation_block:?}."); + self.implementation_block_free_list + .lock() + .unwrap() + .push(_index); + implementation_block.clone() + } else { + tracing::debug!(target: "store", "interring {implementation_block:?}."); + self.implementation_block.write().unwrap()[_index] = Some(implementation_block.clone()); + implementation_block + } + } + + /// Exhume (get) [`ImplementationBlock`] from the store. + /// + #[inline] + pub fn exhume_implementation_block( + &self, + id: &usize, + ) -> Option>> { + match self.implementation_block.read().unwrap().get(*id) { + Some(implementation_block) => implementation_block.clone(), + None => None, + } + } + + /// Exorcise (remove) [`ImplementationBlock`] from the store. + /// + #[inline] + pub fn exorcise_implementation_block( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising implementation_block slot: {id}."); + let result = self.implementation_block.write().unwrap()[*id].take(); + self.implementation_block_free_list + .lock() + .unwrap() + .push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, ImplementationBlock>`. + /// + #[inline] + pub fn iter_implementation_block( + &self, + ) -> impl Iterator>> + '_ { + let len = self.implementation_block.read().unwrap().len(); + (0..len) + .filter(|i| self.implementation_block.read().unwrap()[*i].is_some()) + .map(move |i| { + self.implementation_block.read().unwrap()[i] + .as_ref() + .map(|implementation_block| implementation_block.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Import`] into the store. + /// + #[inline] + pub fn inter_import(&mut self, import: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.import_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.import.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.import.write().unwrap().push(None); + _index + }; + + let import = import(_index); + + let found = if let Some(import) = self.import.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *import.read().unwrap() + } else { + false + } + }) { + import.clone() + } else { + None + }; + + if let Some(import) = found { + tracing::debug!(target: "store", "found duplicate {import:?}."); + self.import_free_list.lock().unwrap().push(_index); + import.clone() + } else { + tracing::debug!(target: "store", "interring {import:?}."); + self.import.write().unwrap()[_index] = Some(import.clone()); + import + } + } + + /// Exhume (get) [`Import`] from the store. + /// + #[inline] + pub fn exhume_import(&self, id: &usize) -> Option>> { + match self.import.read().unwrap().get(*id) { + Some(import) => import.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Import`] from the store. + /// + #[inline] + pub fn exorcise_import(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising import slot: {id}."); + let result = self.import.write().unwrap()[*id].take(); + self.import_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Import>`. + /// + #[inline] + pub fn iter_import(&self) -> impl Iterator>> + '_ { + let len = self.import.read().unwrap().len(); + (0..len) + .filter(|i| self.import.read().unwrap()[*i].is_some()) + .map(move |i| { + self.import.read().unwrap()[i] + .as_ref() + .map(|import| import.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Index`] into the store. + /// + #[inline] + pub fn inter_index(&mut self, index: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.index_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.index.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.index.write().unwrap().push(None); + _index + }; + + let index = index(_index); + + let found = if let Some(index) = self.index.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *index.read().unwrap() + } else { + false + } + }) { + index.clone() + } else { + None + }; + + if let Some(index) = found { + tracing::debug!(target: "store", "found duplicate {index:?}."); + self.index_free_list.lock().unwrap().push(_index); + index.clone() + } else { + tracing::debug!(target: "store", "interring {index:?}."); + self.index.write().unwrap()[_index] = Some(index.clone()); + index + } + } + + /// Exhume (get) [`Index`] from the store. + /// + #[inline] + pub fn exhume_index(&self, id: &usize) -> Option>> { + match self.index.read().unwrap().get(*id) { + Some(index) => index.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Index`] from the store. + /// + #[inline] + pub fn exorcise_index(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising index slot: {id}."); + let result = self.index.write().unwrap()[*id].take(); + self.index_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Index>`. + /// + #[inline] + pub fn iter_index(&self) -> impl Iterator>> + '_ { + let len = self.index.read().unwrap().len(); + (0..len) + .filter(|i| self.index.read().unwrap()[*i].is_some()) + .map(move |i| { + self.index.read().unwrap()[i] + .as_ref() + .map(|index| index.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`IntegerLiteral`] into the store. + /// + #[inline] + pub fn inter_integer_literal(&mut self, integer_literal: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.integer_literal_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.integer_literal.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.integer_literal.write().unwrap().push(None); + _index + }; + + let integer_literal = integer_literal(_index); + + let found = if let Some(integer_literal) = + self.integer_literal.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *integer_literal.read().unwrap() + } else { + false + } + }) { + integer_literal.clone() + } else { + None + }; + + if let Some(integer_literal) = found { + tracing::debug!(target: "store", "found duplicate {integer_literal:?}."); + self.integer_literal_free_list.lock().unwrap().push(_index); + integer_literal.clone() + } else { + tracing::debug!(target: "store", "interring {integer_literal:?}."); + self.integer_literal.write().unwrap()[_index] = Some(integer_literal.clone()); + integer_literal + } + } + + /// Exhume (get) [`IntegerLiteral`] from the store. + /// + #[inline] + pub fn exhume_integer_literal(&self, id: &usize) -> Option>> { + match self.integer_literal.read().unwrap().get(*id) { + Some(integer_literal) => integer_literal.clone(), + None => None, + } + } + + /// Exorcise (remove) [`IntegerLiteral`] from the store. + /// + #[inline] + pub fn exorcise_integer_literal(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising integer_literal slot: {id}."); + let result = self.integer_literal.write().unwrap()[*id].take(); + self.integer_literal_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, IntegerLiteral>`. + /// + #[inline] + pub fn iter_integer_literal(&self) -> impl Iterator>> + '_ { + let len = self.integer_literal.read().unwrap().len(); + (0..len) + .filter(|i| self.integer_literal.read().unwrap()[*i].is_some()) + .map(move |i| { + self.integer_literal.read().unwrap()[i] + .as_ref() + .map(|integer_literal| integer_literal.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Item`] into the store. + /// + #[inline] + pub fn inter_item(&mut self, item: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.item_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.item.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.item.write().unwrap().push(None); + _index + }; + + let item = item(_index); + + let found = if let Some(item) = self.item.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *item.read().unwrap() + } else { + false + } + }) { + item.clone() + } else { + None + }; + + if let Some(item) = found { + tracing::debug!(target: "store", "found duplicate {item:?}."); + self.item_free_list.lock().unwrap().push(_index); + item.clone() + } else { + tracing::debug!(target: "store", "interring {item:?}."); + self.item.write().unwrap()[_index] = Some(item.clone()); + item + } + } + + /// Exhume (get) [`Item`] from the store. + /// + #[inline] + pub fn exhume_item(&self, id: &usize) -> Option>> { + match self.item.read().unwrap().get(*id) { + Some(item) => item.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Item`] from the store. + /// + #[inline] + pub fn exorcise_item(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising item slot: {id}."); + let result = self.item.write().unwrap()[*id].take(); + self.item_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Item>`. + /// + #[inline] + pub fn iter_item(&self) -> impl Iterator>> + '_ { + let len = self.item.read().unwrap().len(); + (0..len) + .filter(|i| self.item.read().unwrap()[*i].is_some()) + .map(move |i| { + self.item.read().unwrap()[i] + .as_ref() + .map(|item| item.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Lambda`] into the store. + /// + #[inline] + pub fn inter_lambda(&mut self, lambda: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.lambda_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.lambda.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.lambda.write().unwrap().push(None); + _index + }; + + let lambda = lambda(_index); + + let found = if let Some(lambda) = self.lambda.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *lambda.read().unwrap() + } else { + false + } + }) { + lambda.clone() + } else { + None + }; + + if let Some(lambda) = found { + tracing::debug!(target: "store", "found duplicate {lambda:?}."); + self.lambda_free_list.lock().unwrap().push(_index); + lambda.clone() + } else { + tracing::debug!(target: "store", "interring {lambda:?}."); + self.lambda.write().unwrap()[_index] = Some(lambda.clone()); + lambda + } + } + + /// Exhume (get) [`Lambda`] from the store. + /// + #[inline] + pub fn exhume_lambda(&self, id: &usize) -> Option>> { + match self.lambda.read().unwrap().get(*id) { + Some(lambda) => lambda.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Lambda`] from the store. + /// + #[inline] + pub fn exorcise_lambda(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising lambda slot: {id}."); + let result = self.lambda.write().unwrap()[*id].take(); + self.lambda_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Lambda>`. + /// + #[inline] + pub fn iter_lambda(&self) -> impl Iterator>> + '_ { + let len = self.lambda.read().unwrap().len(); + (0..len) + .filter(|i| self.lambda.read().unwrap()[*i].is_some()) + .map(move |i| { + self.lambda.read().unwrap()[i] + .as_ref() + .map(|lambda| lambda.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`LambdaParameter`] into the store. + /// + #[inline] + pub fn inter_lambda_parameter(&mut self, lambda_parameter: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.lambda_parameter_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.lambda_parameter.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.lambda_parameter.write().unwrap().push(None); + _index + }; + + let lambda_parameter = lambda_parameter(_index); + + let found = if let Some(lambda_parameter) = + self.lambda_parameter.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *lambda_parameter.read().unwrap() + } else { + false + } + }) { + lambda_parameter.clone() + } else { + None + }; + + if let Some(lambda_parameter) = found { + tracing::debug!(target: "store", "found duplicate {lambda_parameter:?}."); + self.lambda_parameter_free_list.lock().unwrap().push(_index); + lambda_parameter.clone() + } else { + tracing::debug!(target: "store", "interring {lambda_parameter:?}."); + self.lambda_parameter.write().unwrap()[_index] = Some(lambda_parameter.clone()); + lambda_parameter + } + } + + /// Exhume (get) [`LambdaParameter`] from the store. + /// + #[inline] + pub fn exhume_lambda_parameter(&self, id: &usize) -> Option>> { + match self.lambda_parameter.read().unwrap().get(*id) { + Some(lambda_parameter) => lambda_parameter.clone(), + None => None, + } + } + + /// Exorcise (remove) [`LambdaParameter`] from the store. + /// + #[inline] + pub fn exorcise_lambda_parameter( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising lambda_parameter slot: {id}."); + let result = self.lambda_parameter.write().unwrap()[*id].take(); + self.lambda_parameter_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, LambdaParameter>`. + /// + #[inline] + pub fn iter_lambda_parameter(&self) -> impl Iterator>> + '_ { + let len = self.lambda_parameter.read().unwrap().len(); + (0..len) + .filter(|i| self.lambda_parameter.read().unwrap()[*i].is_some()) + .map(move |i| { + self.lambda_parameter.read().unwrap()[i] + .as_ref() + .map(|lambda_parameter| lambda_parameter.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`LetStatement`] into the store. + /// + #[inline] + pub fn inter_let_statement(&mut self, let_statement: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.let_statement_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.let_statement.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.let_statement.write().unwrap().push(None); + _index + }; + + let let_statement = let_statement(_index); + + let found = if let Some(let_statement) = + self.let_statement.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *let_statement.read().unwrap() + } else { + false + } + }) { + let_statement.clone() + } else { + None + }; + + if let Some(let_statement) = found { + tracing::debug!(target: "store", "found duplicate {let_statement:?}."); + self.let_statement_free_list.lock().unwrap().push(_index); + let_statement.clone() + } else { + tracing::debug!(target: "store", "interring {let_statement:?}."); + self.let_statement.write().unwrap()[_index] = Some(let_statement.clone()); + let_statement + } + } + + /// Exhume (get) [`LetStatement`] from the store. + /// + #[inline] + pub fn exhume_let_statement(&self, id: &usize) -> Option>> { + match self.let_statement.read().unwrap().get(*id) { + Some(let_statement) => let_statement.clone(), + None => None, + } + } + + /// Exorcise (remove) [`LetStatement`] from the store. + /// + #[inline] + pub fn exorcise_let_statement(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising let_statement slot: {id}."); + let result = self.let_statement.write().unwrap()[*id].take(); + self.let_statement_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, LetStatement>`. + /// + #[inline] + pub fn iter_let_statement(&self) -> impl Iterator>> + '_ { + let len = self.let_statement.read().unwrap().len(); + (0..len) + .filter(|i| self.let_statement.read().unwrap()[*i].is_some()) + .map(move |i| { + self.let_statement.read().unwrap()[i] + .as_ref() + .map(|let_statement| let_statement.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`List`] into the store. + /// + #[inline] + pub fn inter_list(&mut self, list: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.list_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.list.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.list.write().unwrap().push(None); + _index + }; + + let list = list(_index); + + let found = if let Some(list) = self.list.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *list.read().unwrap() + } else { + false + } + }) { + list.clone() + } else { + None + }; + + if let Some(list) = found { + tracing::debug!(target: "store", "found duplicate {list:?}."); + self.list_free_list.lock().unwrap().push(_index); + list.clone() + } else { + tracing::debug!(target: "store", "interring {list:?}."); + self.list.write().unwrap()[_index] = Some(list.clone()); + list + } + } + + /// Exhume (get) [`List`] from the store. + /// + #[inline] + pub fn exhume_list(&self, id: &usize) -> Option>> { + match self.list.read().unwrap().get(*id) { + Some(list) => list.clone(), + None => None, + } + } + + /// Exorcise (remove) [`List`] from the store. + /// + #[inline] + pub fn exorcise_list(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising list slot: {id}."); + let result = self.list.write().unwrap()[*id].take(); + self.list_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, List>`. + /// + #[inline] + pub fn iter_list(&self) -> impl Iterator>> + '_ { + let len = self.list.read().unwrap().len(); + (0..len) + .filter(|i| self.list.read().unwrap()[*i].is_some()) + .map(move |i| { + self.list.read().unwrap()[i] + .as_ref() + .map(|list| list.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`ListElement`] into the store. + /// + #[inline] + pub fn inter_list_element(&mut self, list_element: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.list_element_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.list_element.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.list_element.write().unwrap().push(None); + _index + }; + + let list_element = list_element(_index); + + let found = if let Some(list_element) = + self.list_element.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *list_element.read().unwrap() + } else { + false + } + }) { + list_element.clone() + } else { + None + }; + + if let Some(list_element) = found { + tracing::debug!(target: "store", "found duplicate {list_element:?}."); + self.list_element_free_list.lock().unwrap().push(_index); + list_element.clone() + } else { + tracing::debug!(target: "store", "interring {list_element:?}."); + self.list_element.write().unwrap()[_index] = Some(list_element.clone()); + list_element + } + } + + /// Exhume (get) [`ListElement`] from the store. + /// + #[inline] + pub fn exhume_list_element(&self, id: &usize) -> Option>> { + match self.list_element.read().unwrap().get(*id) { + Some(list_element) => list_element.clone(), + None => None, + } + } + + /// Exorcise (remove) [`ListElement`] from the store. + /// + #[inline] + pub fn exorcise_list_element(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising list_element slot: {id}."); + let result = self.list_element.write().unwrap()[*id].take(); + self.list_element_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, ListElement>`. + /// + #[inline] + pub fn iter_list_element(&self) -> impl Iterator>> + '_ { + let len = self.list_element.read().unwrap().len(); + (0..len) + .filter(|i| self.list_element.read().unwrap()[*i].is_some()) + .map(move |i| { + self.list_element.read().unwrap()[i] + .as_ref() + .map(|list_element| list_element.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`ListExpression`] into the store. + /// + #[inline] + pub fn inter_list_expression(&mut self, list_expression: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.list_expression_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.list_expression.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.list_expression.write().unwrap().push(None); + _index + }; + + let list_expression = list_expression(_index); + + let found = if let Some(list_expression) = + self.list_expression.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *list_expression.read().unwrap() + } else { + false + } + }) { + list_expression.clone() + } else { + None + }; + + if let Some(list_expression) = found { + tracing::debug!(target: "store", "found duplicate {list_expression:?}."); + self.list_expression_free_list.lock().unwrap().push(_index); + list_expression.clone() + } else { + tracing::debug!(target: "store", "interring {list_expression:?}."); + self.list_expression.write().unwrap()[_index] = Some(list_expression.clone()); + list_expression + } + } + + /// Exhume (get) [`ListExpression`] from the store. + /// + #[inline] + pub fn exhume_list_expression(&self, id: &usize) -> Option>> { + match self.list_expression.read().unwrap().get(*id) { + Some(list_expression) => list_expression.clone(), + None => None, + } + } + + /// Exorcise (remove) [`ListExpression`] from the store. + /// + #[inline] + pub fn exorcise_list_expression(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising list_expression slot: {id}."); + let result = self.list_expression.write().unwrap()[*id].take(); + self.list_expression_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, ListExpression>`. + /// + #[inline] + pub fn iter_list_expression(&self) -> impl Iterator>> + '_ { + let len = self.list_expression.read().unwrap().len(); + (0..len) + .filter(|i| self.list_expression.read().unwrap()[*i].is_some()) + .map(move |i| { + self.list_expression.read().unwrap()[i] + .as_ref() + .map(|list_expression| list_expression.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Literal`] into the store. + /// + #[inline] + pub fn inter_literal(&mut self, literal: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.literal_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.literal.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.literal.write().unwrap().push(None); + _index + }; + + let literal = literal(_index); + + let found = if let Some(literal) = self.literal.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *literal.read().unwrap() + } else { + false + } + }) { + literal.clone() + } else { + None + }; + + if let Some(literal) = found { + tracing::debug!(target: "store", "found duplicate {literal:?}."); + self.literal_free_list.lock().unwrap().push(_index); + literal.clone() + } else { + tracing::debug!(target: "store", "interring {literal:?}."); + self.literal.write().unwrap()[_index] = Some(literal.clone()); + literal + } + } + + /// Exhume (get) [`Literal`] from the store. + /// + #[inline] + pub fn exhume_literal(&self, id: &usize) -> Option>> { + match self.literal.read().unwrap().get(*id) { + Some(literal) => literal.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Literal`] from the store. + /// + #[inline] + pub fn exorcise_literal(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising literal slot: {id}."); + let result = self.literal.write().unwrap()[*id].take(); + self.literal_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Literal>`. + /// + #[inline] + pub fn iter_literal(&self) -> impl Iterator>> + '_ { + let len = self.literal.read().unwrap().len(); + (0..len) + .filter(|i| self.literal.read().unwrap()[*i].is_some()) + .map(move |i| { + self.literal.read().unwrap()[i] + .as_ref() + .map(|literal| literal.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`LocalVariable`] into the store. + /// + #[inline] + pub fn inter_local_variable(&mut self, local_variable: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.local_variable_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.local_variable.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.local_variable.write().unwrap().push(None); + _index + }; + + let local_variable = local_variable(_index); + + let found = if let Some(local_variable) = + self.local_variable.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *local_variable.read().unwrap() + } else { + false + } + }) { + local_variable.clone() + } else { + None + }; + + if let Some(local_variable) = found { + tracing::debug!(target: "store", "found duplicate {local_variable:?}."); + self.local_variable_free_list.lock().unwrap().push(_index); + local_variable.clone() + } else { + tracing::debug!(target: "store", "interring {local_variable:?}."); + self.local_variable.write().unwrap()[_index] = Some(local_variable.clone()); + local_variable + } + } + + /// Exhume (get) [`LocalVariable`] from the store. + /// + #[inline] + pub fn exhume_local_variable(&self, id: &usize) -> Option>> { + match self.local_variable.read().unwrap().get(*id) { + Some(local_variable) => local_variable.clone(), + None => None, + } + } + + /// Exorcise (remove) [`LocalVariable`] from the store. + /// + #[inline] + pub fn exorcise_local_variable(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising local_variable slot: {id}."); + let result = self.local_variable.write().unwrap()[*id].take(); + self.local_variable_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, LocalVariable>`. + /// + #[inline] + pub fn iter_local_variable(&self) -> impl Iterator>> + '_ { + let len = self.local_variable.read().unwrap().len(); + (0..len) + .filter(|i| self.local_variable.read().unwrap()[*i].is_some()) + .map(move |i| { + self.local_variable.read().unwrap()[i] + .as_ref() + .map(|local_variable| local_variable.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`XMacro`] into the store. + /// + #[inline] + pub fn inter_x_macro(&mut self, x_macro: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.x_macro_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.x_macro.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.x_macro.write().unwrap().push(None); + _index + }; + + let x_macro = x_macro(_index); + + let found = if let Some(x_macro) = self.x_macro.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *x_macro.read().unwrap() + } else { + false + } + }) { + x_macro.clone() + } else { + None + }; + + if let Some(x_macro) = found { + tracing::debug!(target: "store", "found duplicate {x_macro:?}."); + self.x_macro_free_list.lock().unwrap().push(_index); + x_macro.clone() + } else { + tracing::debug!(target: "store", "interring {x_macro:?}."); + self.x_macro.write().unwrap()[_index] = Some(x_macro.clone()); + x_macro + } + } + + /// Exhume (get) [`XMacro`] from the store. + /// + #[inline] + pub fn exhume_x_macro(&self, id: &usize) -> Option>> { + match self.x_macro.read().unwrap().get(*id) { + Some(x_macro) => x_macro.clone(), + None => None, + } + } + + /// Exorcise (remove) [`XMacro`] from the store. + /// + #[inline] + pub fn exorcise_x_macro(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising x_macro slot: {id}."); + let result = self.x_macro.write().unwrap()[*id].take(); + self.x_macro_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, XMacro>`. + /// + #[inline] + pub fn iter_x_macro(&self) -> impl Iterator>> + '_ { + let len = self.x_macro.read().unwrap().len(); + (0..len) + .filter(|i| self.x_macro.read().unwrap()[*i].is_some()) + .map(move |i| { + self.x_macro.read().unwrap()[i] + .as_ref() + .map(|x_macro| x_macro.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Map`] into the store. + /// + #[inline] + pub fn inter_map(&mut self, map: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.map_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.map.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.map.write().unwrap().push(None); + _index + }; + + let map = map(_index); + + let found = if let Some(map) = self.map.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *map.read().unwrap() + } else { + false + } + }) { + map.clone() + } else { + None + }; + + if let Some(map) = found { + tracing::debug!(target: "store", "found duplicate {map:?}."); + self.map_free_list.lock().unwrap().push(_index); + map.clone() + } else { + tracing::debug!(target: "store", "interring {map:?}."); + self.map.write().unwrap()[_index] = Some(map.clone()); + map + } + } + + /// Exhume (get) [`Map`] from the store. + /// + #[inline] + pub fn exhume_map(&self, id: &usize) -> Option>> { + match self.map.read().unwrap().get(*id) { + Some(map) => map.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Map`] from the store. + /// + #[inline] + pub fn exorcise_map(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising map slot: {id}."); + let result = self.map.write().unwrap()[*id].take(); + self.map_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Map>`. + /// + #[inline] + pub fn iter_map(&self) -> impl Iterator>> + '_ { + let len = self.map.read().unwrap().len(); + (0..len) + .filter(|i| self.map.read().unwrap()[*i].is_some()) + .map(move |i| { + self.map.read().unwrap()[i] + .as_ref() + .map(|map| map.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`MapElement`] into the store. + /// + #[inline] + pub fn inter_map_element(&mut self, map_element: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.map_element_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.map_element.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.map_element.write().unwrap().push(None); + _index + }; + + let map_element = map_element(_index); + + let found = if let Some(map_element) = + self.map_element.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *map_element.read().unwrap() + } else { + false + } + }) { + map_element.clone() + } else { + None + }; + + if let Some(map_element) = found { + tracing::debug!(target: "store", "found duplicate {map_element:?}."); + self.map_element_free_list.lock().unwrap().push(_index); + map_element.clone() + } else { + tracing::debug!(target: "store", "interring {map_element:?}."); + self.map_element.write().unwrap()[_index] = Some(map_element.clone()); + map_element + } + } + + /// Exhume (get) [`MapElement`] from the store. + /// + #[inline] + pub fn exhume_map_element(&self, id: &usize) -> Option>> { + match self.map_element.read().unwrap().get(*id) { + Some(map_element) => map_element.clone(), + None => None, + } + } + + /// Exorcise (remove) [`MapElement`] from the store. + /// + #[inline] + pub fn exorcise_map_element(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising map_element slot: {id}."); + let result = self.map_element.write().unwrap()[*id].take(); + self.map_element_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, MapElement>`. + /// + #[inline] + pub fn iter_map_element(&self) -> impl Iterator>> + '_ { + let len = self.map_element.read().unwrap().len(); + (0..len) + .filter(|i| self.map_element.read().unwrap()[*i].is_some()) + .map(move |i| { + self.map_element.read().unwrap()[i] + .as_ref() + .map(|map_element| map_element.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`MapExpression`] into the store. + /// + #[inline] + pub fn inter_map_expression(&mut self, map_expression: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.map_expression_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.map_expression.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.map_expression.write().unwrap().push(None); + _index + }; + + let map_expression = map_expression(_index); + + let found = if let Some(map_expression) = + self.map_expression.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *map_expression.read().unwrap() + } else { + false + } + }) { + map_expression.clone() + } else { + None + }; + + if let Some(map_expression) = found { + tracing::debug!(target: "store", "found duplicate {map_expression:?}."); + self.map_expression_free_list.lock().unwrap().push(_index); + map_expression.clone() + } else { + tracing::debug!(target: "store", "interring {map_expression:?}."); + self.map_expression.write().unwrap()[_index] = Some(map_expression.clone()); + map_expression + } + } + + /// Exhume (get) [`MapExpression`] from the store. + /// + #[inline] + pub fn exhume_map_expression(&self, id: &usize) -> Option>> { + match self.map_expression.read().unwrap().get(*id) { + Some(map_expression) => map_expression.clone(), + None => None, + } + } + + /// Exorcise (remove) [`MapExpression`] from the store. + /// + #[inline] + pub fn exorcise_map_expression(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising map_expression slot: {id}."); + let result = self.map_expression.write().unwrap()[*id].take(); + self.map_expression_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, MapExpression>`. + /// + #[inline] + pub fn iter_map_expression(&self) -> impl Iterator>> + '_ { + let len = self.map_expression.read().unwrap().len(); + (0..len) + .filter(|i| self.map_expression.read().unwrap()[*i].is_some()) + .map(move |i| { + self.map_expression.read().unwrap()[i] + .as_ref() + .map(|map_expression| map_expression.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`XMatch`] into the store. + /// + #[inline] + pub fn inter_x_match(&mut self, x_match: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.x_match_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.x_match.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.x_match.write().unwrap().push(None); + _index + }; + + let x_match = x_match(_index); + + let found = if let Some(x_match) = self.x_match.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *x_match.read().unwrap() + } else { + false + } + }) { + x_match.clone() + } else { + None + }; + + if let Some(x_match) = found { + tracing::debug!(target: "store", "found duplicate {x_match:?}."); + self.x_match_free_list.lock().unwrap().push(_index); + x_match.clone() + } else { + tracing::debug!(target: "store", "interring {x_match:?}."); + self.x_match.write().unwrap()[_index] = Some(x_match.clone()); + x_match + } + } + + /// Exhume (get) [`XMatch`] from the store. + /// + #[inline] + pub fn exhume_x_match(&self, id: &usize) -> Option>> { + match self.x_match.read().unwrap().get(*id) { + Some(x_match) => x_match.clone(), + None => None, + } + } + + /// Exorcise (remove) [`XMatch`] from the store. + /// + #[inline] + pub fn exorcise_x_match(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising x_match slot: {id}."); + let result = self.x_match.write().unwrap()[*id].take(); + self.x_match_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, XMatch>`. + /// + #[inline] + pub fn iter_x_match(&self) -> impl Iterator>> + '_ { + let len = self.x_match.read().unwrap().len(); + (0..len) + .filter(|i| self.x_match.read().unwrap()[*i].is_some()) + .map(move |i| { + self.x_match.read().unwrap()[i] + .as_ref() + .map(|x_match| x_match.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`MethodCall`] into the store. + /// + #[inline] + pub fn inter_method_call(&mut self, method_call: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.method_call_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.method_call.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.method_call.write().unwrap().push(None); + _index + }; + + let method_call = method_call(_index); + + let found = if let Some(method_call) = + self.method_call.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *method_call.read().unwrap() + } else { + false + } + }) { + method_call.clone() + } else { + None + }; + + if let Some(method_call) = found { + tracing::debug!(target: "store", "found duplicate {method_call:?}."); + self.method_call_free_list.lock().unwrap().push(_index); + method_call.clone() + } else { + tracing::debug!(target: "store", "interring {method_call:?}."); + self.method_call.write().unwrap()[_index] = Some(method_call.clone()); + method_call + } + } + + /// Exhume (get) [`MethodCall`] from the store. + /// + #[inline] + pub fn exhume_method_call(&self, id: &usize) -> Option>> { + match self.method_call.read().unwrap().get(*id) { + Some(method_call) => method_call.clone(), + None => None, + } + } + + /// Exorcise (remove) [`MethodCall`] from the store. + /// + #[inline] + pub fn exorcise_method_call(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising method_call slot: {id}."); + let result = self.method_call.write().unwrap()[*id].take(); + self.method_call_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, MethodCall>`. + /// + #[inline] + pub fn iter_method_call(&self) -> impl Iterator>> + '_ { + let len = self.method_call.read().unwrap().len(); + (0..len) + .filter(|i| self.method_call.read().unwrap()[*i].is_some()) + .map(move |i| { + self.method_call.read().unwrap()[i] + .as_ref() + .map(|method_call| method_call.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`NamedFieldExpression`] into the store. + /// + #[inline] + pub fn inter_named_field_expression( + &mut self, + named_field_expression: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = + if let Some(_index) = self.named_field_expression_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.named_field_expression.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.named_field_expression.write().unwrap().push(None); + _index + }; + + let named_field_expression = named_field_expression(_index); + + let found = if let Some(named_field_expression) = self + .named_field_expression + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *named_field_expression.read().unwrap() + } else { + false + } + }) { + named_field_expression.clone() + } else { + None + }; + + if let Some(named_field_expression) = found { + tracing::debug!(target: "store", "found duplicate {named_field_expression:?}."); + self.named_field_expression_free_list + .lock() + .unwrap() + .push(_index); + named_field_expression.clone() + } else { + tracing::debug!(target: "store", "interring {named_field_expression:?}."); + self.named_field_expression.write().unwrap()[_index] = + Some(named_field_expression.clone()); + named_field_expression + } + } + + /// Exhume (get) [`NamedFieldExpression`] from the store. + /// + #[inline] + pub fn exhume_named_field_expression( + &self, + id: &usize, + ) -> Option>> { + match self.named_field_expression.read().unwrap().get(*id) { + Some(named_field_expression) => named_field_expression.clone(), + None => None, + } + } + + /// Exorcise (remove) [`NamedFieldExpression`] from the store. + /// + #[inline] + pub fn exorcise_named_field_expression( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising named_field_expression slot: {id}."); + let result = self.named_field_expression.write().unwrap()[*id].take(); + self.named_field_expression_free_list + .lock() + .unwrap() + .push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, NamedFieldExpression>`. + /// + #[inline] + pub fn iter_named_field_expression( + &self, + ) -> impl Iterator>> + '_ { + let len = self.named_field_expression.read().unwrap().len(); + (0..len) + .filter(|i| self.named_field_expression.read().unwrap()[*i].is_some()) + .map(move |i| { + self.named_field_expression.read().unwrap()[i] + .as_ref() + .map(|named_field_expression| named_field_expression.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`ZObjectStore`] into the store. + /// + #[inline] + pub fn inter_z_object_store(&mut self, z_object_store: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.z_object_store_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.z_object_store.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.z_object_store.write().unwrap().push(None); + _index + }; + + let z_object_store = z_object_store(_index); + + let found = if let Some(z_object_store) = + self.z_object_store.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *z_object_store.read().unwrap() + } else { + false + } + }) { + z_object_store.clone() + } else { + None + }; + + let z_object_store = if let Some(z_object_store) = found { + tracing::debug!(target: "store", "found duplicate {z_object_store:?}."); + self.z_object_store_free_list.lock().unwrap().push(_index); + z_object_store.clone() + } else { + tracing::debug!(target: "store", "interring {z_object_store:?}."); + self.z_object_store.write().unwrap()[_index] = Some(z_object_store.clone()); + z_object_store + }; + self.z_object_store_id_by_name.write().unwrap().insert( + z_object_store.read().unwrap().name.to_owned(), + z_object_store.read().unwrap().id, + ); + z_object_store + } + + /// Exhume (get) [`ZObjectStore`] from the store. + /// + #[inline] + pub fn exhume_z_object_store(&self, id: &usize) -> Option>> { + match self.z_object_store.read().unwrap().get(*id) { + Some(z_object_store) => z_object_store.clone(), + None => None, + } + } + + /// Exorcise (remove) [`ZObjectStore`] from the store. + /// + #[inline] + pub fn exorcise_z_object_store(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising z_object_store slot: {id}."); + let result = self.z_object_store.write().unwrap()[*id].take(); + self.z_object_store_free_list.lock().unwrap().push(*id); + result + } + + /// Exorcise [`ZObjectStore`] id from the store by name. + /// + #[inline] + pub fn exhume_z_object_store_id_by_name(&self, name: &str) -> Option { + self.z_object_store_id_by_name + .read() + .unwrap() + .get(name) + .map(|z_object_store| *z_object_store) + } + + /// Get an iterator over the internal `HashMap<&Uuid, ZObjectStore>`. + /// + #[inline] + pub fn iter_z_object_store(&self) -> impl Iterator>> + '_ { + let len = self.z_object_store.read().unwrap().len(); + (0..len) + .filter(|i| self.z_object_store.read().unwrap()[*i].is_some()) + .map(move |i| { + self.z_object_store.read().unwrap()[i] + .as_ref() + .map(|z_object_store| z_object_store.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`ObjectWrapper`] into the store. + /// + #[inline] + pub fn inter_object_wrapper(&mut self, object_wrapper: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.object_wrapper_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.object_wrapper.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.object_wrapper.write().unwrap().push(None); + _index + }; + + let object_wrapper = object_wrapper(_index); + + let found = if let Some(object_wrapper) = + self.object_wrapper.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *object_wrapper.read().unwrap() + } else { + false + } + }) { + object_wrapper.clone() + } else { + None + }; + + if let Some(object_wrapper) = found { + tracing::debug!(target: "store", "found duplicate {object_wrapper:?}."); + self.object_wrapper_free_list.lock().unwrap().push(_index); + object_wrapper.clone() + } else { + tracing::debug!(target: "store", "interring {object_wrapper:?}."); + self.object_wrapper.write().unwrap()[_index] = Some(object_wrapper.clone()); + object_wrapper + } + } + + /// Exhume (get) [`ObjectWrapper`] from the store. + /// + #[inline] + pub fn exhume_object_wrapper(&self, id: &usize) -> Option>> { + match self.object_wrapper.read().unwrap().get(*id) { + Some(object_wrapper) => object_wrapper.clone(), + None => None, + } + } + + /// Exorcise (remove) [`ObjectWrapper`] from the store. + /// + #[inline] + pub fn exorcise_object_wrapper(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising object_wrapper slot: {id}."); + let result = self.object_wrapper.write().unwrap()[*id].take(); + self.object_wrapper_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, ObjectWrapper>`. + /// + #[inline] + pub fn iter_object_wrapper(&self) -> impl Iterator>> + '_ { + let len = self.object_wrapper.read().unwrap().len(); + (0..len) + .filter(|i| self.object_wrapper.read().unwrap()[*i].is_some()) + .map(move |i| { + self.object_wrapper.read().unwrap()[i] + .as_ref() + .map(|object_wrapper| object_wrapper.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Operator`] into the store. + /// + #[inline] + pub fn inter_operator(&mut self, operator: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.operator_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.operator.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.operator.write().unwrap().push(None); + _index + }; + + let operator = operator(_index); + + let found = if let Some(operator) = self.operator.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *operator.read().unwrap() + } else { + false + } + }) { + operator.clone() + } else { + None + }; + + if let Some(operator) = found { + tracing::debug!(target: "store", "found duplicate {operator:?}."); + self.operator_free_list.lock().unwrap().push(_index); + operator.clone() + } else { + tracing::debug!(target: "store", "interring {operator:?}."); + self.operator.write().unwrap()[_index] = Some(operator.clone()); + operator + } + } + + /// Exhume (get) [`Operator`] from the store. + /// + #[inline] + pub fn exhume_operator(&self, id: &usize) -> Option>> { + match self.operator.read().unwrap().get(*id) { + Some(operator) => operator.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Operator`] from the store. + /// + #[inline] + pub fn exorcise_operator(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising operator slot: {id}."); + let result = self.operator.write().unwrap()[*id].take(); + self.operator_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Operator>`. + /// + #[inline] + pub fn iter_operator(&self) -> impl Iterator>> + '_ { + let len = self.operator.read().unwrap().len(); + (0..len) + .filter(|i| self.operator.read().unwrap()[*i].is_some()) + .map(move |i| { + self.operator.read().unwrap()[i] + .as_ref() + .map(|operator| operator.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Parameter`] into the store. + /// + #[inline] + pub fn inter_parameter(&mut self, parameter: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.parameter_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.parameter.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.parameter.write().unwrap().push(None); + _index + }; + + let parameter = parameter(_index); + + let found = if let Some(parameter) = self.parameter.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *parameter.read().unwrap() + } else { + false + } + }) { + parameter.clone() + } else { + None + }; + + if let Some(parameter) = found { + tracing::debug!(target: "store", "found duplicate {parameter:?}."); + self.parameter_free_list.lock().unwrap().push(_index); + parameter.clone() + } else { + tracing::debug!(target: "store", "interring {parameter:?}."); + self.parameter.write().unwrap()[_index] = Some(parameter.clone()); + parameter + } + } + + /// Exhume (get) [`Parameter`] from the store. + /// + #[inline] + pub fn exhume_parameter(&self, id: &usize) -> Option>> { + match self.parameter.read().unwrap().get(*id) { + Some(parameter) => parameter.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Parameter`] from the store. + /// + #[inline] + pub fn exorcise_parameter(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising parameter slot: {id}."); + let result = self.parameter.write().unwrap()[*id].take(); + self.parameter_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Parameter>`. + /// + #[inline] + pub fn iter_parameter(&self) -> impl Iterator>> + '_ { + let len = self.parameter.read().unwrap().len(); + (0..len) + .filter(|i| self.parameter.read().unwrap()[*i].is_some()) + .map(move |i| { + self.parameter.read().unwrap()[i] + .as_ref() + .map(|parameter| parameter.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`XPath`] into the store. + /// + #[inline] + pub fn inter_x_path(&mut self, x_path: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.x_path_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.x_path.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.x_path.write().unwrap().push(None); + _index + }; + + let x_path = x_path(_index); + + let found = if let Some(x_path) = self.x_path.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *x_path.read().unwrap() + } else { + false + } + }) { + x_path.clone() + } else { + None + }; + + if let Some(x_path) = found { + tracing::debug!(target: "store", "found duplicate {x_path:?}."); + self.x_path_free_list.lock().unwrap().push(_index); + x_path.clone() + } else { + tracing::debug!(target: "store", "interring {x_path:?}."); + self.x_path.write().unwrap()[_index] = Some(x_path.clone()); + x_path + } + } + + /// Exhume (get) [`XPath`] from the store. + /// + #[inline] + pub fn exhume_x_path(&self, id: &usize) -> Option>> { + match self.x_path.read().unwrap().get(*id) { + Some(x_path) => x_path.clone(), + None => None, + } + } + + /// Exorcise (remove) [`XPath`] from the store. + /// + #[inline] + pub fn exorcise_x_path(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising x_path slot: {id}."); + let result = self.x_path.write().unwrap()[*id].take(); + self.x_path_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, XPath>`. + /// + #[inline] + pub fn iter_x_path(&self) -> impl Iterator>> + '_ { + let len = self.x_path.read().unwrap().len(); + (0..len) + .filter(|i| self.x_path.read().unwrap()[*i].is_some()) + .map(move |i| { + self.x_path.read().unwrap()[i] + .as_ref() + .map(|x_path| x_path.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`PathElement`] into the store. + /// + #[inline] + pub fn inter_path_element(&mut self, path_element: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.path_element_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.path_element.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.path_element.write().unwrap().push(None); + _index + }; + + let path_element = path_element(_index); + + let found = if let Some(path_element) = + self.path_element.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *path_element.read().unwrap() + } else { + false + } + }) { + path_element.clone() + } else { + None + }; + + if let Some(path_element) = found { + tracing::debug!(target: "store", "found duplicate {path_element:?}."); + self.path_element_free_list.lock().unwrap().push(_index); + path_element.clone() + } else { + tracing::debug!(target: "store", "interring {path_element:?}."); + self.path_element.write().unwrap()[_index] = Some(path_element.clone()); + path_element + } + } + + /// Exhume (get) [`PathElement`] from the store. + /// + #[inline] + pub fn exhume_path_element(&self, id: &usize) -> Option>> { + match self.path_element.read().unwrap().get(*id) { + Some(path_element) => path_element.clone(), + None => None, + } + } + + /// Exorcise (remove) [`PathElement`] from the store. + /// + #[inline] + pub fn exorcise_path_element(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising path_element slot: {id}."); + let result = self.path_element.write().unwrap()[*id].take(); + self.path_element_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, PathElement>`. + /// + #[inline] + pub fn iter_path_element(&self) -> impl Iterator>> + '_ { + let len = self.path_element.read().unwrap().len(); + (0..len) + .filter(|i| self.path_element.read().unwrap()[*i].is_some()) + .map(move |i| { + self.path_element.read().unwrap()[i] + .as_ref() + .map(|path_element| path_element.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Pattern`] into the store. + /// + #[inline] + pub fn inter_pattern(&mut self, pattern: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.pattern_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.pattern.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.pattern.write().unwrap().push(None); + _index + }; + + let pattern = pattern(_index); + + let found = if let Some(pattern) = self.pattern.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *pattern.read().unwrap() + } else { + false + } + }) { + pattern.clone() + } else { + None + }; + + if let Some(pattern) = found { + tracing::debug!(target: "store", "found duplicate {pattern:?}."); + self.pattern_free_list.lock().unwrap().push(_index); + pattern.clone() + } else { + tracing::debug!(target: "store", "interring {pattern:?}."); + self.pattern.write().unwrap()[_index] = Some(pattern.clone()); + pattern + } + } + + /// Exhume (get) [`Pattern`] from the store. + /// + #[inline] + pub fn exhume_pattern(&self, id: &usize) -> Option>> { + match self.pattern.read().unwrap().get(*id) { + Some(pattern) => pattern.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Pattern`] from the store. + /// + #[inline] + pub fn exorcise_pattern(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising pattern slot: {id}."); + let result = self.pattern.write().unwrap()[*id].take(); + self.pattern_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Pattern>`. + /// + #[inline] + pub fn iter_pattern(&self) -> impl Iterator>> + '_ { + let len = self.pattern.read().unwrap().len(); + (0..len) + .filter(|i| self.pattern.read().unwrap()[*i].is_some()) + .map(move |i| { + self.pattern.read().unwrap()[i] + .as_ref() + .map(|pattern| pattern.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`XPlugin`] into the store. + /// + #[inline] + pub fn inter_x_plugin(&mut self, x_plugin: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.x_plugin_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.x_plugin.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.x_plugin.write().unwrap().push(None); + _index + }; + + let x_plugin = x_plugin(_index); + + let found = if let Some(x_plugin) = self.x_plugin.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *x_plugin.read().unwrap() + } else { + false + } + }) { + x_plugin.clone() + } else { + None + }; + + let x_plugin = if let Some(x_plugin) = found { + tracing::debug!(target: "store", "found duplicate {x_plugin:?}."); + self.x_plugin_free_list.lock().unwrap().push(_index); + x_plugin.clone() + } else { + tracing::debug!(target: "store", "interring {x_plugin:?}."); + self.x_plugin.write().unwrap()[_index] = Some(x_plugin.clone()); + x_plugin + }; + self.x_plugin_id_by_name.write().unwrap().insert( + x_plugin.read().unwrap().name.to_owned(), + x_plugin.read().unwrap().id, + ); + x_plugin + } + + /// Exhume (get) [`XPlugin`] from the store. + /// + #[inline] + pub fn exhume_x_plugin(&self, id: &usize) -> Option>> { + match self.x_plugin.read().unwrap().get(*id) { + Some(x_plugin) => x_plugin.clone(), + None => None, + } + } + + /// Exorcise (remove) [`XPlugin`] from the store. + /// + #[inline] + pub fn exorcise_x_plugin(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising x_plugin slot: {id}."); + let result = self.x_plugin.write().unwrap()[*id].take(); + self.x_plugin_free_list.lock().unwrap().push(*id); + result + } + + /// Exorcise [`XPlugin`] id from the store by name. + /// + #[inline] + pub fn exhume_x_plugin_id_by_name(&self, name: &str) -> Option { + self.x_plugin_id_by_name + .read() + .unwrap() + .get(name) + .map(|x_plugin| *x_plugin) + } + + /// Get an iterator over the internal `HashMap<&Uuid, XPlugin>`. + /// + #[inline] + pub fn iter_x_plugin(&self) -> impl Iterator>> + '_ { + let len = self.x_plugin.read().unwrap().len(); + (0..len) + .filter(|i| self.x_plugin.read().unwrap()[*i].is_some()) + .map(move |i| { + self.x_plugin.read().unwrap()[i] + .as_ref() + .map(|x_plugin| x_plugin.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`XPrint`] into the store. + /// + #[inline] + pub fn inter_x_print(&mut self, x_print: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.x_print_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.x_print.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.x_print.write().unwrap().push(None); + _index + }; + + let x_print = x_print(_index); + + let found = if let Some(x_print) = self.x_print.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *x_print.read().unwrap() + } else { + false + } + }) { + x_print.clone() + } else { + None + }; + + if let Some(x_print) = found { + tracing::debug!(target: "store", "found duplicate {x_print:?}."); + self.x_print_free_list.lock().unwrap().push(_index); + x_print.clone() + } else { + tracing::debug!(target: "store", "interring {x_print:?}."); + self.x_print.write().unwrap()[_index] = Some(x_print.clone()); + x_print + } + } + + /// Exhume (get) [`XPrint`] from the store. + /// + #[inline] + pub fn exhume_x_print(&self, id: &usize) -> Option>> { + match self.x_print.read().unwrap().get(*id) { + Some(x_print) => x_print.clone(), + None => None, + } + } + + /// Exorcise (remove) [`XPrint`] from the store. + /// + #[inline] + pub fn exorcise_x_print(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising x_print slot: {id}."); + let result = self.x_print.write().unwrap()[*id].take(); + self.x_print_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, XPrint>`. + /// + #[inline] + pub fn iter_x_print(&self) -> impl Iterator>> + '_ { + let len = self.x_print.read().unwrap().len(); + (0..len) + .filter(|i| self.x_print.read().unwrap()[*i].is_some()) + .map(move |i| { + self.x_print.read().unwrap()[i] + .as_ref() + .map(|x_print| x_print.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`RangeExpression`] into the store. + /// + #[inline] + pub fn inter_range_expression(&mut self, range_expression: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.range_expression_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.range_expression.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.range_expression.write().unwrap().push(None); + _index + }; + + let range_expression = range_expression(_index); + + let found = if let Some(range_expression) = + self.range_expression.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *range_expression.read().unwrap() + } else { + false + } + }) { + range_expression.clone() + } else { + None + }; + + if let Some(range_expression) = found { + tracing::debug!(target: "store", "found duplicate {range_expression:?}."); + self.range_expression_free_list.lock().unwrap().push(_index); + range_expression.clone() + } else { + tracing::debug!(target: "store", "interring {range_expression:?}."); + self.range_expression.write().unwrap()[_index] = Some(range_expression.clone()); + range_expression + } + } + + /// Exhume (get) [`RangeExpression`] from the store. + /// + #[inline] + pub fn exhume_range_expression(&self, id: &usize) -> Option>> { + match self.range_expression.read().unwrap().get(*id) { + Some(range_expression) => range_expression.clone(), + None => None, + } + } + + /// Exorcise (remove) [`RangeExpression`] from the store. + /// + #[inline] + pub fn exorcise_range_expression( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising range_expression slot: {id}."); + let result = self.range_expression.write().unwrap()[*id].take(); + self.range_expression_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, RangeExpression>`. + /// + #[inline] + pub fn iter_range_expression(&self) -> impl Iterator>> + '_ { + let len = self.range_expression.read().unwrap().len(); + (0..len) + .filter(|i| self.range_expression.read().unwrap()[*i].is_some()) + .map(move |i| { + self.range_expression.read().unwrap()[i] + .as_ref() + .map(|range_expression| range_expression.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`ResultStatement`] into the store. + /// + #[inline] + pub fn inter_result_statement(&mut self, result_statement: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.result_statement_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.result_statement.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.result_statement.write().unwrap().push(None); + _index + }; + + let result_statement = result_statement(_index); + + let found = if let Some(result_statement) = + self.result_statement.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *result_statement.read().unwrap() + } else { + false + } + }) { + result_statement.clone() + } else { + None + }; + + if let Some(result_statement) = found { + tracing::debug!(target: "store", "found duplicate {result_statement:?}."); + self.result_statement_free_list.lock().unwrap().push(_index); + result_statement.clone() + } else { + tracing::debug!(target: "store", "interring {result_statement:?}."); + self.result_statement.write().unwrap()[_index] = Some(result_statement.clone()); + result_statement + } + } + + /// Exhume (get) [`ResultStatement`] from the store. + /// + #[inline] + pub fn exhume_result_statement(&self, id: &usize) -> Option>> { + match self.result_statement.read().unwrap().get(*id) { + Some(result_statement) => result_statement.clone(), + None => None, + } + } + + /// Exorcise (remove) [`ResultStatement`] from the store. + /// + #[inline] + pub fn exorcise_result_statement( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising result_statement slot: {id}."); + let result = self.result_statement.write().unwrap()[*id].take(); + self.result_statement_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, ResultStatement>`. + /// + #[inline] + pub fn iter_result_statement(&self) -> impl Iterator>> + '_ { + let len = self.result_statement.read().unwrap().len(); + (0..len) + .filter(|i| self.result_statement.read().unwrap()[*i].is_some()) + .map(move |i| { + self.result_statement.read().unwrap()[i] + .as_ref() + .map(|result_statement| result_statement.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`XReturn`] into the store. + /// + #[inline] + pub fn inter_x_return(&mut self, x_return: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.x_return_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.x_return.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.x_return.write().unwrap().push(None); + _index + }; + + let x_return = x_return(_index); + + let found = if let Some(x_return) = self.x_return.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *x_return.read().unwrap() + } else { + false + } + }) { + x_return.clone() + } else { + None + }; + + if let Some(x_return) = found { + tracing::debug!(target: "store", "found duplicate {x_return:?}."); + self.x_return_free_list.lock().unwrap().push(_index); + x_return.clone() + } else { + tracing::debug!(target: "store", "interring {x_return:?}."); + self.x_return.write().unwrap()[_index] = Some(x_return.clone()); + x_return + } + } + + /// Exhume (get) [`XReturn`] from the store. + /// + #[inline] + pub fn exhume_x_return(&self, id: &usize) -> Option>> { + match self.x_return.read().unwrap().get(*id) { + Some(x_return) => x_return.clone(), + None => None, + } + } + + /// Exorcise (remove) [`XReturn`] from the store. + /// + #[inline] + pub fn exorcise_x_return(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising x_return slot: {id}."); + let result = self.x_return.write().unwrap()[*id].take(); + self.x_return_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, XReturn>`. + /// + #[inline] + pub fn iter_x_return(&self) -> impl Iterator>> + '_ { + let len = self.x_return.read().unwrap().len(); + (0..len) + .filter(|i| self.x_return.read().unwrap()[*i].is_some()) + .map(move |i| { + self.x_return.read().unwrap()[i] + .as_ref() + .map(|x_return| x_return.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Span`] into the store. + /// + #[inline] + pub fn inter_span(&mut self, span: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.span_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.span.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.span.write().unwrap().push(None); + _index + }; + + let span = span(_index); + + let found = if let Some(span) = self.span.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *span.read().unwrap() + } else { + false + } + }) { + span.clone() + } else { + None + }; + + if let Some(span) = found { + tracing::debug!(target: "store", "found duplicate {span:?}."); + self.span_free_list.lock().unwrap().push(_index); + span.clone() + } else { + tracing::debug!(target: "store", "interring {span:?}."); + self.span.write().unwrap()[_index] = Some(span.clone()); + span + } + } + + /// Exhume (get) [`Span`] from the store. + /// + #[inline] + pub fn exhume_span(&self, id: &usize) -> Option>> { + match self.span.read().unwrap().get(*id) { + Some(span) => span.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Span`] from the store. + /// + #[inline] + pub fn exorcise_span(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising span slot: {id}."); + let result = self.span.write().unwrap()[*id].take(); + self.span_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Span>`. + /// + #[inline] + pub fn iter_span(&self) -> impl Iterator>> + '_ { + let len = self.span.read().unwrap().len(); + (0..len) + .filter(|i| self.span.read().unwrap()[*i].is_some()) + .map(move |i| { + self.span.read().unwrap()[i] + .as_ref() + .map(|span| span.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Statement`] into the store. + /// + #[inline] + pub fn inter_statement(&mut self, statement: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.statement_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.statement.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.statement.write().unwrap().push(None); + _index + }; + + let statement = statement(_index); + + let found = if let Some(statement) = self.statement.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *statement.read().unwrap() + } else { + false + } + }) { + statement.clone() + } else { + None + }; + + if let Some(statement) = found { + tracing::debug!(target: "store", "found duplicate {statement:?}."); + self.statement_free_list.lock().unwrap().push(_index); + statement.clone() + } else { + tracing::debug!(target: "store", "interring {statement:?}."); + self.statement.write().unwrap()[_index] = Some(statement.clone()); + statement + } + } + + /// Exhume (get) [`Statement`] from the store. + /// + #[inline] + pub fn exhume_statement(&self, id: &usize) -> Option>> { + match self.statement.read().unwrap().get(*id) { + Some(statement) => statement.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Statement`] from the store. + /// + #[inline] + pub fn exorcise_statement(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising statement slot: {id}."); + let result = self.statement.write().unwrap()[*id].take(); + self.statement_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Statement>`. + /// + #[inline] + pub fn iter_statement(&self) -> impl Iterator>> + '_ { + let len = self.statement.read().unwrap().len(); + (0..len) + .filter(|i| self.statement.read().unwrap()[*i].is_some()) + .map(move |i| { + self.statement.read().unwrap()[i] + .as_ref() + .map(|statement| statement.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`StaticMethodCall`] into the store. + /// + #[inline] + pub fn inter_static_method_call( + &mut self, + static_method_call: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.static_method_call_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.static_method_call.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.static_method_call.write().unwrap().push(None); + _index + }; + + let static_method_call = static_method_call(_index); + + let found = if let Some(static_method_call) = self + .static_method_call + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *static_method_call.read().unwrap() + } else { + false + } + }) { + static_method_call.clone() + } else { + None + }; + + if let Some(static_method_call) = found { + tracing::debug!(target: "store", "found duplicate {static_method_call:?}."); + self.static_method_call_free_list + .lock() + .unwrap() + .push(_index); + static_method_call.clone() + } else { + tracing::debug!(target: "store", "interring {static_method_call:?}."); + self.static_method_call.write().unwrap()[_index] = Some(static_method_call.clone()); + static_method_call + } + } + + /// Exhume (get) [`StaticMethodCall`] from the store. + /// + #[inline] + pub fn exhume_static_method_call(&self, id: &usize) -> Option>> { + match self.static_method_call.read().unwrap().get(*id) { + Some(static_method_call) => static_method_call.clone(), + None => None, + } + } + + /// Exorcise (remove) [`StaticMethodCall`] from the store. + /// + #[inline] + pub fn exorcise_static_method_call( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising static_method_call slot: {id}."); + let result = self.static_method_call.write().unwrap()[*id].take(); + self.static_method_call_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, StaticMethodCall>`. + /// + #[inline] + pub fn iter_static_method_call( + &self, + ) -> impl Iterator>> + '_ { + let len = self.static_method_call.read().unwrap().len(); + (0..len) + .filter(|i| self.static_method_call.read().unwrap()[*i].is_some()) + .map(move |i| { + self.static_method_call.read().unwrap()[i] + .as_ref() + .map(|static_method_call| static_method_call.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`StringBit`] into the store. + /// + #[inline] + pub fn inter_string_bit(&mut self, string_bit: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.string_bit_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.string_bit.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.string_bit.write().unwrap().push(None); + _index + }; + + let string_bit = string_bit(_index); + + let found = if let Some(string_bit) = + self.string_bit.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *string_bit.read().unwrap() + } else { + false + } + }) { + string_bit.clone() + } else { + None + }; + + if let Some(string_bit) = found { + tracing::debug!(target: "store", "found duplicate {string_bit:?}."); + self.string_bit_free_list.lock().unwrap().push(_index); + string_bit.clone() + } else { + tracing::debug!(target: "store", "interring {string_bit:?}."); + self.string_bit.write().unwrap()[_index] = Some(string_bit.clone()); + string_bit + } + } + + /// Exhume (get) [`StringBit`] from the store. + /// + #[inline] + pub fn exhume_string_bit(&self, id: &usize) -> Option>> { + match self.string_bit.read().unwrap().get(*id) { + Some(string_bit) => string_bit.clone(), + None => None, + } + } + + /// Exorcise (remove) [`StringBit`] from the store. + /// + #[inline] + pub fn exorcise_string_bit(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising string_bit slot: {id}."); + let result = self.string_bit.write().unwrap()[*id].take(); + self.string_bit_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, StringBit>`. + /// + #[inline] + pub fn iter_string_bit(&self) -> impl Iterator>> + '_ { + let len = self.string_bit.read().unwrap().len(); + (0..len) + .filter(|i| self.string_bit.read().unwrap()[*i].is_some()) + .map(move |i| { + self.string_bit.read().unwrap()[i] + .as_ref() + .map(|string_bit| string_bit.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`StringLiteral`] into the store. + /// + #[inline] + pub fn inter_string_literal(&mut self, string_literal: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.string_literal_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.string_literal.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.string_literal.write().unwrap().push(None); + _index + }; + + let string_literal = string_literal(_index); + + let found = if let Some(string_literal) = + self.string_literal.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *string_literal.read().unwrap() + } else { + false + } + }) { + string_literal.clone() + } else { + None + }; + + if let Some(string_literal) = found { + tracing::debug!(target: "store", "found duplicate {string_literal:?}."); + self.string_literal_free_list.lock().unwrap().push(_index); + string_literal.clone() + } else { + tracing::debug!(target: "store", "interring {string_literal:?}."); + self.string_literal.write().unwrap()[_index] = Some(string_literal.clone()); + string_literal + } + } + + /// Exhume (get) [`StringLiteral`] from the store. + /// + #[inline] + pub fn exhume_string_literal(&self, id: &usize) -> Option>> { + match self.string_literal.read().unwrap().get(*id) { + Some(string_literal) => string_literal.clone(), + None => None, + } + } + + /// Exorcise (remove) [`StringLiteral`] from the store. + /// + #[inline] + pub fn exorcise_string_literal(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising string_literal slot: {id}."); + let result = self.string_literal.write().unwrap()[*id].take(); + self.string_literal_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, StringLiteral>`. + /// + #[inline] + pub fn iter_string_literal(&self) -> impl Iterator>> + '_ { + let len = self.string_literal.read().unwrap().len(); + (0..len) + .filter(|i| self.string_literal.read().unwrap()[*i].is_some()) + .map(move |i| { + self.string_literal.read().unwrap()[i] + .as_ref() + .map(|string_literal| string_literal.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`WoogStruct`] into the store. + /// + #[inline] + pub fn inter_woog_struct(&mut self, woog_struct: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.woog_struct_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.woog_struct.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.woog_struct.write().unwrap().push(None); + _index + }; + + let woog_struct = woog_struct(_index); + + let found = if let Some(woog_struct) = + self.woog_struct.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *woog_struct.read().unwrap() + } else { + false + } + }) { + woog_struct.clone() + } else { + None + }; + + let woog_struct = if let Some(woog_struct) = found { + tracing::debug!(target: "store", "found duplicate {woog_struct:?}."); + self.woog_struct_free_list.lock().unwrap().push(_index); + woog_struct.clone() + } else { + tracing::debug!(target: "store", "interring {woog_struct:?}."); + self.woog_struct.write().unwrap()[_index] = Some(woog_struct.clone()); + woog_struct + }; + self.woog_struct_id_by_name.write().unwrap().insert( + woog_struct.read().unwrap().name.to_owned(), + woog_struct.read().unwrap().id, + ); + woog_struct + } + + /// Exhume (get) [`WoogStruct`] from the store. + /// + #[inline] + pub fn exhume_woog_struct(&self, id: &usize) -> Option>> { + match self.woog_struct.read().unwrap().get(*id) { + Some(woog_struct) => woog_struct.clone(), + None => None, + } + } + + /// Exorcise (remove) [`WoogStruct`] from the store. + /// + #[inline] + pub fn exorcise_woog_struct(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising woog_struct slot: {id}."); + let result = self.woog_struct.write().unwrap()[*id].take(); + self.woog_struct_free_list.lock().unwrap().push(*id); + result + } + + /// Exorcise [`WoogStruct`] id from the store by name. + /// + #[inline] + pub fn exhume_woog_struct_id_by_name(&self, name: &str) -> Option { + self.woog_struct_id_by_name + .read() + .unwrap() + .get(name) + .map(|woog_struct| *woog_struct) + } + + /// Get an iterator over the internal `HashMap<&Uuid, WoogStruct>`. + /// + #[inline] + pub fn iter_woog_struct(&self) -> impl Iterator>> + '_ { + let len = self.woog_struct.read().unwrap().len(); + (0..len) + .filter(|i| self.woog_struct.read().unwrap()[*i].is_some()) + .map(move |i| { + self.woog_struct.read().unwrap()[i] + .as_ref() + .map(|woog_struct| woog_struct.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`StructExpression`] into the store. + /// + #[inline] + pub fn inter_struct_expression( + &mut self, + struct_expression: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.struct_expression_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.struct_expression.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.struct_expression.write().unwrap().push(None); + _index + }; + + let struct_expression = struct_expression(_index); + + let found = if let Some(struct_expression) = self + .struct_expression + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *struct_expression.read().unwrap() + } else { + false + } + }) { + struct_expression.clone() + } else { + None + }; + + if let Some(struct_expression) = found { + tracing::debug!(target: "store", "found duplicate {struct_expression:?}."); + self.struct_expression_free_list + .lock() + .unwrap() + .push(_index); + struct_expression.clone() + } else { + tracing::debug!(target: "store", "interring {struct_expression:?}."); + self.struct_expression.write().unwrap()[_index] = Some(struct_expression.clone()); + struct_expression + } + } + + /// Exhume (get) [`StructExpression`] from the store. + /// + #[inline] + pub fn exhume_struct_expression(&self, id: &usize) -> Option>> { + match self.struct_expression.read().unwrap().get(*id) { + Some(struct_expression) => struct_expression.clone(), + None => None, + } + } + + /// Exorcise (remove) [`StructExpression`] from the store. + /// + #[inline] + pub fn exorcise_struct_expression( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising struct_expression slot: {id}."); + let result = self.struct_expression.write().unwrap()[*id].take(); + self.struct_expression_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, StructExpression>`. + /// + #[inline] + pub fn iter_struct_expression( + &self, + ) -> impl Iterator>> + '_ { + let len = self.struct_expression.read().unwrap().len(); + (0..len) + .filter(|i| self.struct_expression.read().unwrap()[*i].is_some()) + .map(move |i| { + self.struct_expression.read().unwrap()[i] + .as_ref() + .map(|struct_expression| struct_expression.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`StructField`] into the store. + /// + #[inline] + pub fn inter_struct_field(&mut self, struct_field: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.struct_field_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.struct_field.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.struct_field.write().unwrap().push(None); + _index + }; + + let struct_field = struct_field(_index); + + let found = if let Some(struct_field) = + self.struct_field.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *struct_field.read().unwrap() + } else { + false + } + }) { + struct_field.clone() + } else { + None + }; + + if let Some(struct_field) = found { + tracing::debug!(target: "store", "found duplicate {struct_field:?}."); + self.struct_field_free_list.lock().unwrap().push(_index); + struct_field.clone() + } else { + tracing::debug!(target: "store", "interring {struct_field:?}."); + self.struct_field.write().unwrap()[_index] = Some(struct_field.clone()); + struct_field + } + } + + /// Exhume (get) [`StructField`] from the store. + /// + #[inline] + pub fn exhume_struct_field(&self, id: &usize) -> Option>> { + match self.struct_field.read().unwrap().get(*id) { + Some(struct_field) => struct_field.clone(), + None => None, + } + } + + /// Exorcise (remove) [`StructField`] from the store. + /// + #[inline] + pub fn exorcise_struct_field(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising struct_field slot: {id}."); + let result = self.struct_field.write().unwrap()[*id].take(); + self.struct_field_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, StructField>`. + /// + #[inline] + pub fn iter_struct_field(&self) -> impl Iterator>> + '_ { + let len = self.struct_field.read().unwrap().len(); + (0..len) + .filter(|i| self.struct_field.read().unwrap()[*i].is_some()) + .map(move |i| { + self.struct_field.read().unwrap()[i] + .as_ref() + .map(|struct_field| struct_field.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`StructGeneric`] into the store. + /// + #[inline] + pub fn inter_struct_generic(&mut self, struct_generic: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.struct_generic_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.struct_generic.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.struct_generic.write().unwrap().push(None); + _index + }; + + let struct_generic = struct_generic(_index); + + let found = if let Some(struct_generic) = + self.struct_generic.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *struct_generic.read().unwrap() + } else { + false + } + }) { + struct_generic.clone() + } else { + None + }; + + if let Some(struct_generic) = found { + tracing::debug!(target: "store", "found duplicate {struct_generic:?}."); + self.struct_generic_free_list.lock().unwrap().push(_index); + struct_generic.clone() + } else { + tracing::debug!(target: "store", "interring {struct_generic:?}."); + self.struct_generic.write().unwrap()[_index] = Some(struct_generic.clone()); + struct_generic + } + } + + /// Exhume (get) [`StructGeneric`] from the store. + /// + #[inline] + pub fn exhume_struct_generic(&self, id: &usize) -> Option>> { + match self.struct_generic.read().unwrap().get(*id) { + Some(struct_generic) => struct_generic.clone(), + None => None, + } + } + + /// Exorcise (remove) [`StructGeneric`] from the store. + /// + #[inline] + pub fn exorcise_struct_generic(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising struct_generic slot: {id}."); + let result = self.struct_generic.write().unwrap()[*id].take(); + self.struct_generic_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, StructGeneric>`. + /// + #[inline] + pub fn iter_struct_generic(&self) -> impl Iterator>> + '_ { + let len = self.struct_generic.read().unwrap().len(); + (0..len) + .filter(|i| self.struct_generic.read().unwrap()[*i].is_some()) + .map(move |i| { + self.struct_generic.read().unwrap()[i] + .as_ref() + .map(|struct_generic| struct_generic.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`TupleField`] into the store. + /// + #[inline] + pub fn inter_tuple_field(&mut self, tuple_field: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.tuple_field_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.tuple_field.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.tuple_field.write().unwrap().push(None); + _index + }; + + let tuple_field = tuple_field(_index); + + let found = if let Some(tuple_field) = + self.tuple_field.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *tuple_field.read().unwrap() + } else { + false + } + }) { + tuple_field.clone() + } else { + None + }; + + if let Some(tuple_field) = found { + tracing::debug!(target: "store", "found duplicate {tuple_field:?}."); + self.tuple_field_free_list.lock().unwrap().push(_index); + tuple_field.clone() + } else { + tracing::debug!(target: "store", "interring {tuple_field:?}."); + self.tuple_field.write().unwrap()[_index] = Some(tuple_field.clone()); + tuple_field + } + } + + /// Exhume (get) [`TupleField`] from the store. + /// + #[inline] + pub fn exhume_tuple_field(&self, id: &usize) -> Option>> { + match self.tuple_field.read().unwrap().get(*id) { + Some(tuple_field) => tuple_field.clone(), + None => None, + } + } + + /// Exorcise (remove) [`TupleField`] from the store. + /// + #[inline] + pub fn exorcise_tuple_field(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising tuple_field slot: {id}."); + let result = self.tuple_field.write().unwrap()[*id].take(); + self.tuple_field_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, TupleField>`. + /// + #[inline] + pub fn iter_tuple_field(&self) -> impl Iterator>> + '_ { + let len = self.tuple_field.read().unwrap().len(); + (0..len) + .filter(|i| self.tuple_field.read().unwrap()[*i].is_some()) + .map(move |i| { + self.tuple_field.read().unwrap()[i] + .as_ref() + .map(|tuple_field| tuple_field.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`TypeCast`] into the store. + /// + #[inline] + pub fn inter_type_cast(&mut self, type_cast: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.type_cast_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.type_cast.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.type_cast.write().unwrap().push(None); + _index + }; + + let type_cast = type_cast(_index); + + let found = if let Some(type_cast) = self.type_cast.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *type_cast.read().unwrap() + } else { + false + } + }) { + type_cast.clone() + } else { + None + }; + + if let Some(type_cast) = found { + tracing::debug!(target: "store", "found duplicate {type_cast:?}."); + self.type_cast_free_list.lock().unwrap().push(_index); + type_cast.clone() + } else { + tracing::debug!(target: "store", "interring {type_cast:?}."); + self.type_cast.write().unwrap()[_index] = Some(type_cast.clone()); + type_cast + } + } + + /// Exhume (get) [`TypeCast`] from the store. + /// + #[inline] + pub fn exhume_type_cast(&self, id: &usize) -> Option>> { + match self.type_cast.read().unwrap().get(*id) { + Some(type_cast) => type_cast.clone(), + None => None, + } + } + + /// Exorcise (remove) [`TypeCast`] from the store. + /// + #[inline] + pub fn exorcise_type_cast(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising type_cast slot: {id}."); + let result = self.type_cast.write().unwrap()[*id].take(); + self.type_cast_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, TypeCast>`. + /// + #[inline] + pub fn iter_type_cast(&self) -> impl Iterator>> + '_ { + let len = self.type_cast.read().unwrap().len(); + (0..len) + .filter(|i| self.type_cast.read().unwrap()[*i].is_some()) + .map(move |i| { + self.type_cast.read().unwrap()[i] + .as_ref() + .map(|type_cast| type_cast.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Unary`] into the store. + /// + #[inline] + pub fn inter_unary(&mut self, unary: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.unary_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.unary.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.unary.write().unwrap().push(None); + _index + }; + + let unary = unary(_index); + + let found = if let Some(unary) = self.unary.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *unary.read().unwrap() + } else { + false + } + }) { + unary.clone() + } else { + None + }; + + if let Some(unary) = found { + tracing::debug!(target: "store", "found duplicate {unary:?}."); + self.unary_free_list.lock().unwrap().push(_index); + unary.clone() + } else { + tracing::debug!(target: "store", "interring {unary:?}."); + self.unary.write().unwrap()[_index] = Some(unary.clone()); + unary + } + } + + /// Exhume (get) [`Unary`] from the store. + /// + #[inline] + pub fn exhume_unary(&self, id: &usize) -> Option>> { + match self.unary.read().unwrap().get(*id) { + Some(unary) => unary.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Unary`] from the store. + /// + #[inline] + pub fn exorcise_unary(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising unary slot: {id}."); + let result = self.unary.write().unwrap()[*id].take(); + self.unary_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Unary>`. + /// + #[inline] + pub fn iter_unary(&self) -> impl Iterator>> + '_ { + let len = self.unary.read().unwrap().len(); + (0..len) + .filter(|i| self.unary.read().unwrap()[*i].is_some()) + .map(move |i| { + self.unary.read().unwrap()[i] + .as_ref() + .map(|unary| unary.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Unit`] into the store. + /// + #[inline] + pub fn inter_unit(&mut self, unit: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.unit_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.unit.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.unit.write().unwrap().push(None); + _index + }; + + let unit = unit(_index); + + let found = if let Some(unit) = self.unit.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *unit.read().unwrap() + } else { + false + } + }) { + unit.clone() + } else { + None + }; + + if let Some(unit) = found { + tracing::debug!(target: "store", "found duplicate {unit:?}."); + self.unit_free_list.lock().unwrap().push(_index); + unit.clone() + } else { + tracing::debug!(target: "store", "interring {unit:?}."); + self.unit.write().unwrap()[_index] = Some(unit.clone()); + unit + } + } + + /// Exhume (get) [`Unit`] from the store. + /// + #[inline] + pub fn exhume_unit(&self, id: &usize) -> Option>> { + match self.unit.read().unwrap().get(*id) { + Some(unit) => unit.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Unit`] from the store. + /// + #[inline] + pub fn exorcise_unit(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising unit slot: {id}."); + let result = self.unit.write().unwrap()[*id].take(); + self.unit_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Unit>`. + /// + #[inline] + pub fn iter_unit(&self) -> impl Iterator>> + '_ { + let len = self.unit.read().unwrap().len(); + (0..len) + .filter(|i| self.unit.read().unwrap()[*i].is_some()) + .map(move |i| { + self.unit.read().unwrap()[i] + .as_ref() + .map(|unit| unit.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`UnnamedFieldExpression`] into the store. + /// + #[inline] + pub fn inter_unnamed_field_expression( + &mut self, + unnamed_field_expression: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self + .unnamed_field_expression_free_list + .lock() + .unwrap() + .pop() + { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.unnamed_field_expression.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.unnamed_field_expression.write().unwrap().push(None); + _index + }; + + let unnamed_field_expression = unnamed_field_expression(_index); + + let found = if let Some(unnamed_field_expression) = self + .unnamed_field_expression + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *unnamed_field_expression.read().unwrap() + } else { + false + } + }) { + unnamed_field_expression.clone() + } else { + None + }; + + if let Some(unnamed_field_expression) = found { + tracing::debug!(target: "store", "found duplicate {unnamed_field_expression:?}."); + self.unnamed_field_expression_free_list + .lock() + .unwrap() + .push(_index); + unnamed_field_expression.clone() + } else { + tracing::debug!(target: "store", "interring {unnamed_field_expression:?}."); + self.unnamed_field_expression.write().unwrap()[_index] = + Some(unnamed_field_expression.clone()); + unnamed_field_expression + } + } + + /// Exhume (get) [`UnnamedFieldExpression`] from the store. + /// + #[inline] + pub fn exhume_unnamed_field_expression( + &self, + id: &usize, + ) -> Option>> { + match self.unnamed_field_expression.read().unwrap().get(*id) { + Some(unnamed_field_expression) => unnamed_field_expression.clone(), + None => None, + } + } + + /// Exorcise (remove) [`UnnamedFieldExpression`] from the store. + /// + #[inline] + pub fn exorcise_unnamed_field_expression( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising unnamed_field_expression slot: {id}."); + let result = self.unnamed_field_expression.write().unwrap()[*id].take(); + self.unnamed_field_expression_free_list + .lock() + .unwrap() + .push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, UnnamedFieldExpression>`. + /// + #[inline] + pub fn iter_unnamed_field_expression( + &self, + ) -> impl Iterator>> + '_ { + let len = self.unnamed_field_expression.read().unwrap().len(); + (0..len) + .filter(|i| self.unnamed_field_expression.read().unwrap()[*i].is_some()) + .map(move |i| { + self.unnamed_field_expression.read().unwrap()[i] + .as_ref() + .map(|unnamed_field_expression| unnamed_field_expression.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`XValue`] into the store. + /// + #[inline] + pub fn inter_x_value(&mut self, x_value: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.x_value_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.x_value.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.x_value.write().unwrap().push(None); + _index + }; + + let x_value = x_value(_index); + + let found = if let Some(x_value) = self.x_value.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *x_value.read().unwrap() + } else { + false + } + }) { + x_value.clone() + } else { + None + }; + + if let Some(x_value) = found { + tracing::debug!(target: "store", "found duplicate {x_value:?}."); + self.x_value_free_list.lock().unwrap().push(_index); + x_value.clone() + } else { + tracing::debug!(target: "store", "interring {x_value:?}."); + self.x_value.write().unwrap()[_index] = Some(x_value.clone()); + x_value + } + } + + /// Exhume (get) [`XValue`] from the store. + /// + #[inline] + pub fn exhume_x_value(&self, id: &usize) -> Option>> { + match self.x_value.read().unwrap().get(*id) { + Some(x_value) => x_value.clone(), + None => None, + } + } + + /// Exorcise (remove) [`XValue`] from the store. + /// + #[inline] + pub fn exorcise_x_value(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising x_value slot: {id}."); + let result = self.x_value.write().unwrap()[*id].take(); + self.x_value_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, XValue>`. + /// + #[inline] + pub fn iter_x_value(&self) -> impl Iterator>> + '_ { + let len = self.x_value.read().unwrap().len(); + (0..len) + .filter(|i| self.x_value.read().unwrap()[*i].is_some()) + .map(move |i| { + self.x_value.read().unwrap()[i] + .as_ref() + .map(|x_value| x_value.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`ValueType`] into the store. + /// + #[inline] + pub fn inter_value_type(&mut self, value_type: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.value_type_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.value_type.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.value_type.write().unwrap().push(None); + _index + }; + + let value_type = value_type(_index); + + let found = if let Some(value_type) = + self.value_type.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *value_type.read().unwrap() + } else { + false + } + }) { + value_type.clone() + } else { + None + }; + + if let Some(value_type) = found { + tracing::debug!(target: "store", "found duplicate {value_type:?}."); + self.value_type_free_list.lock().unwrap().push(_index); + value_type.clone() + } else { + tracing::debug!(target: "store", "interring {value_type:?}."); + self.value_type.write().unwrap()[_index] = Some(value_type.clone()); + value_type + } + } + + /// Exhume (get) [`ValueType`] from the store. + /// + #[inline] + pub fn exhume_value_type(&self, id: &usize) -> Option>> { + match self.value_type.read().unwrap().get(*id) { + Some(value_type) => value_type.clone(), + None => None, + } + } + + /// Exorcise (remove) [`ValueType`] from the store. + /// + #[inline] + pub fn exorcise_value_type(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising value_type slot: {id}."); + let result = self.value_type.write().unwrap()[*id].take(); + self.value_type_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, ValueType>`. + /// + #[inline] + pub fn iter_value_type(&self) -> impl Iterator>> + '_ { + let len = self.value_type.read().unwrap().len(); + (0..len) + .filter(|i| self.value_type.read().unwrap()[*i].is_some()) + .map(move |i| { + self.value_type.read().unwrap()[i] + .as_ref() + .map(|value_type| value_type.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`Variable`] into the store. + /// + #[inline] + pub fn inter_variable(&mut self, variable: F) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.variable_free_list.lock().unwrap().pop() { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.variable.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.variable.write().unwrap().push(None); + _index + }; + + let variable = variable(_index); + + let found = if let Some(variable) = self.variable.read().unwrap().iter().find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *variable.read().unwrap() + } else { + false + } + }) { + variable.clone() + } else { + None + }; + + if let Some(variable) = found { + tracing::debug!(target: "store", "found duplicate {variable:?}."); + self.variable_free_list.lock().unwrap().push(_index); + variable.clone() + } else { + tracing::debug!(target: "store", "interring {variable:?}."); + self.variable.write().unwrap()[_index] = Some(variable.clone()); + variable + } + } + + /// Exhume (get) [`Variable`] from the store. + /// + #[inline] + pub fn exhume_variable(&self, id: &usize) -> Option>> { + match self.variable.read().unwrap().get(*id) { + Some(variable) => variable.clone(), + None => None, + } + } + + /// Exorcise (remove) [`Variable`] from the store. + /// + #[inline] + pub fn exorcise_variable(&mut self, id: &usize) -> Option>> { + tracing::debug!(target: "store", "exorcising variable slot: {id}."); + let result = self.variable.write().unwrap()[*id].take(); + self.variable_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, Variable>`. + /// + #[inline] + pub fn iter_variable(&self) -> impl Iterator>> + '_ { + let len = self.variable.read().unwrap().len(); + (0..len) + .filter(|i| self.variable.read().unwrap()[*i].is_some()) + .map(move |i| { + self.variable.read().unwrap()[i] + .as_ref() + .map(|variable| variable.clone()) + .unwrap() + }) + } + + /// Inter (insert) [`VariableExpression`] into the store. + /// + #[inline] + pub fn inter_variable_expression( + &mut self, + variable_expression: F, + ) -> Arc> + where + F: Fn(usize) -> Arc>, + { + let _index = if let Some(_index) = self.variable_expression_free_list.lock().unwrap().pop() + { + tracing::trace!(target: "store", "recycling block {_index}."); + _index + } else { + let _index = self.variable_expression.read().unwrap().len(); + tracing::trace!(target: "store", "allocating block {_index}."); + self.variable_expression.write().unwrap().push(None); + _index + }; + + let variable_expression = variable_expression(_index); + + let found = if let Some(variable_expression) = self + .variable_expression + .read() + .unwrap() + .iter() + .find(|stored| { + if let Some(stored) = stored { + *stored.read().unwrap() == *variable_expression.read().unwrap() + } else { + false + } + }) { + variable_expression.clone() + } else { + None + }; + + if let Some(variable_expression) = found { + tracing::debug!(target: "store", "found duplicate {variable_expression:?}."); + self.variable_expression_free_list + .lock() + .unwrap() + .push(_index); + variable_expression.clone() + } else { + tracing::debug!(target: "store", "interring {variable_expression:?}."); + self.variable_expression.write().unwrap()[_index] = Some(variable_expression.clone()); + variable_expression + } + } + + /// Exhume (get) [`VariableExpression`] from the store. + /// + #[inline] + pub fn exhume_variable_expression( + &self, + id: &usize, + ) -> Option>> { + match self.variable_expression.read().unwrap().get(*id) { + Some(variable_expression) => variable_expression.clone(), + None => None, + } + } + + /// Exorcise (remove) [`VariableExpression`] from the store. + /// + #[inline] + pub fn exorcise_variable_expression( + &mut self, + id: &usize, + ) -> Option>> { + tracing::debug!(target: "store", "exorcising variable_expression slot: {id}."); + let result = self.variable_expression.write().unwrap()[*id].take(); + self.variable_expression_free_list.lock().unwrap().push(*id); + result + } + + /// Get an iterator over the internal `HashMap<&Uuid, VariableExpression>`. + /// + #[inline] + pub fn iter_variable_expression( + &self, + ) -> impl Iterator>> + '_ { + let len = self.variable_expression.read().unwrap().len(); + (0..len) + .filter(|i| self.variable_expression.read().unwrap()[*i].is_some()) + .map(move |i| { + self.variable_expression.read().unwrap()[i] + .as_ref() + .map(|variable_expression| variable_expression.clone()) + .unwrap() + }) + } + + // {"magic":"","directive":{"End":{"directive":"ignore-orig"}}} } // {"magic":"","directive":{"End":{"directive":"ignore-orig"}}} // {"magic":"","directive":{"End":{"directive":"ignore-orig"}}} diff --git a/src/v2/lu_dog_pl_vec/store.rs b/src/v2/lu_dog_pl_vec/store.rs index 558be798..b1f18e90 100644 --- a/src/v2/lu_dog_pl_vec/store.rs +++ b/src/v2/lu_dog_pl_vec/store.rs @@ -587,2216 +587,2984 @@ impl Clone for ObjectStore { } impl ObjectStore { pub fn merge(&mut self, other: &ObjectStore) { - if self.argument.read().len() != other.argument.read().len() { - let mut argument = self.argument.write(); - other.argument.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = argument.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - argument.push(Some(x.clone())); - } - } - }); - } - - if self.a_wait.read().len() != other.a_wait.read().len() { - let mut a_wait = self.a_wait.write(); - other.a_wait.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = a_wait.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - a_wait.push(Some(x.clone())); - } - } - }); - } - - if self.binary.read().len() != other.binary.read().len() { - let mut binary = self.binary.write(); - other.binary.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = binary.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - binary.push(Some(x.clone())); - } - } - }); - } - - if self.block.read().len() != other.block.read().len() { - let mut block = self.block.write(); - other.block.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = block.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - block.push(Some(x.clone())); - } - } - }); - } - - if self.body.read().len() != other.body.read().len() { - let mut body = self.body.write(); - other.body.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = body.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - body.push(Some(x.clone())); - } - } - }); - } - - if self.boolean_literal.read().len() != other.boolean_literal.read().len() { - let mut boolean_literal = self.boolean_literal.write(); - other.boolean_literal.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = boolean_literal.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - boolean_literal.push(Some(x.clone())); - } - } - }); - } - - if self.boolean_operator.read().len() != other.boolean_operator.read().len() { - let mut boolean_operator = self.boolean_operator.write(); - other.boolean_operator.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = boolean_operator.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - boolean_operator.push(Some(x.clone())); - } - } - }); - } - - if self.call.read().len() != other.call.read().len() { - let mut call = self.call.write(); - other.call.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = call.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - call.push(Some(x.clone())); - } - } - }); - } - - if self.char_literal.read().len() != other.char_literal.read().len() { - let mut char_literal = self.char_literal.write(); - other.char_literal.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = char_literal.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - char_literal.push(Some(x.clone())); - } - } - }); - } - - if self.comparison.read().len() != other.comparison.read().len() { - let mut comparison = self.comparison.write(); - other.comparison.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = comparison.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - comparison.push(Some(x.clone())); - } - } - }); - } - - if self.data_structure.read().len() != other.data_structure.read().len() { - let mut data_structure = self.data_structure.write(); - other.data_structure.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = data_structure.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - data_structure.push(Some(x.clone())); - } - } - }); - } - - if self.dwarf_source_file.read().len() != other.dwarf_source_file.read().len() { - let mut dwarf_source_file = self.dwarf_source_file.write(); - other.dwarf_source_file.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = dwarf_source_file.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - dwarf_source_file.push(Some(x.clone())); - } - } - }); - } - - if self.enum_field.read().len() != other.enum_field.read().len() { - let mut enum_field = self.enum_field.write(); - other.enum_field.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_field.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - enum_field.push(Some(x.clone())); - } - } - }); - } - - if self.enum_generic.read().len() != other.enum_generic.read().len() { - let mut enum_generic = self.enum_generic.write(); - other.enum_generic.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_generic.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - enum_generic.push(Some(x.clone())); - } - } - }); - } - - if self.enum_generic_type.read().len() != other.enum_generic_type.read().len() { - let mut enum_generic_type = self.enum_generic_type.write(); - other.enum_generic_type.read().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. - if enum_generic_type - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_generic_type.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - enum_generic_type.push(Some(x.clone())); - } - } - }); - } - - if self.enumeration.read().len() != other.enumeration.read().len() { - let mut enumeration = self.enumeration.write(); - other.enumeration.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = enumeration.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - enumeration.push(Some(x.clone())); - } - } - }); - } - - if self.expression.read().len() != other.expression.read().len() { - let mut expression = self.expression.write(); - other.expression.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = expression.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - expression.push(Some(x.clone())); - } - } - }); - } - - if self.expression_bit.read().len() != other.expression_bit.read().len() { - let mut expression_bit = self.expression_bit.write(); - other.expression_bit.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = expression_bit.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - expression_bit.push(Some(x.clone())); - } - } - }); - } - - if self.expression_statement.read().len() != other.expression_statement.read().len() { - let mut expression_statement = self.expression_statement.write(); - other.expression_statement.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = expression_statement.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - expression_statement.push(Some(x.clone())); - } - } - }); - } - - if self.external_implementation.read().len() != other.external_implementation.read().len() { - let mut external_implementation = self.external_implementation.write(); - other.external_implementation.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = external_implementation.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - external_implementation.push(Some(x.clone())); - } - } - }); - } - - if self.field.read().len() != other.field.read().len() { - let mut field = self.field.write(); - other.field.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = field.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - field.push(Some(x.clone())); - } - } - }); - } - - if self.field_access.read().len() != other.field_access.read().len() { - let mut field_access = self.field_access.write(); - other.field_access.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = field_access.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - field_access.push(Some(x.clone())); - } - } - }); - } - - if self.field_access_target.read().len() != other.field_access_target.read().len() { - let mut field_access_target = self.field_access_target.write(); - other.field_access_target.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = field_access_target.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - field_access_target.push(Some(x.clone())); - } - } - }); - } - - if self.field_expression.read().len() != other.field_expression.read().len() { - let mut field_expression = self.field_expression.write(); - other.field_expression.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = field_expression.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - field_expression.push(Some(x.clone())); - } - } - }); - } - - if self.float_literal.read().len() != other.float_literal.read().len() { - let mut float_literal = self.float_literal.write(); - other.float_literal.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = float_literal.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - float_literal.push(Some(x.clone())); - } - } - }); - } - - if self.for_loop.read().len() != other.for_loop.read().len() { - let mut for_loop = self.for_loop.write(); - other.for_loop.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = for_loop.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - for_loop.push(Some(x.clone())); - } - } - }); - } - - if self.format_bit.read().len() != other.format_bit.read().len() { - let mut format_bit = self.format_bit.write(); - other.format_bit.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = format_bit.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - format_bit.push(Some(x.clone())); - } - } - }); - } - - if self.format_string.read().len() != other.format_string.read().len() { - let mut format_string = self.format_string.write(); - other.format_string.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = format_string.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - format_string.push(Some(x.clone())); - } - } - }); - } - - if self.func_generic.read().len() != other.func_generic.read().len() { - let mut func_generic = self.func_generic.write(); - other.func_generic.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = func_generic.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - func_generic.push(Some(x.clone())); - } - } - }); - } - - if self.function.read().len() != other.function.read().len() { - let mut function = self.function.write(); - other.function.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = function.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - function.push(Some(x.clone())); - } - } - }); - } - - if self.function_call.read().len() != other.function_call.read().len() { - let mut function_call = self.function_call.write(); - other.function_call.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = function_call.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - function_call.push(Some(x.clone())); - } - } - }); - } - - if self.x_future.read().len() != other.x_future.read().len() { - let mut x_future = self.x_future.write(); - other.x_future.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = x_future.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - x_future.push(Some(x.clone())); - } - } - }); - } - - if self.grouped.read().len() != other.grouped.read().len() { - let mut grouped = self.grouped.write(); - other.grouped.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = grouped.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - grouped.push(Some(x.clone())); - } - } - }); - } - - if self.halt_and_catch_fire.read().len() != other.halt_and_catch_fire.read().len() { - let mut halt_and_catch_fire = self.halt_and_catch_fire.write(); - other.halt_and_catch_fire.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = halt_and_catch_fire.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - halt_and_catch_fire.push(Some(x.clone())); - } - } - }); - } - - if self.x_if.read().len() != other.x_if.read().len() { - let mut x_if = self.x_if.write(); - other.x_if.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = x_if.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - x_if.push(Some(x.clone())); - } - } - }); - } - - if self.implementation_block.read().len() != other.implementation_block.read().len() { - let mut implementation_block = self.implementation_block.write(); - other.implementation_block.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = implementation_block.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - implementation_block.push(Some(x.clone())); - } - } - }); - } - - if self.import.read().len() != other.import.read().len() { - let mut import = self.import.write(); - other.import.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = import.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - import.push(Some(x.clone())); - } - } - }); - } - - if self.index.read().len() != other.index.read().len() { - let mut index = self.index.write(); - other.index.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = index.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - index.push(Some(x.clone())); - } - } - }); - } - - if self.integer_literal.read().len() != other.integer_literal.read().len() { - let mut integer_literal = self.integer_literal.write(); - other.integer_literal.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = integer_literal.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - integer_literal.push(Some(x.clone())); - } - } - }); - } - - if self.item.read().len() != other.item.read().len() { - let mut item = self.item.write(); - other.item.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = item.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - item.push(Some(x.clone())); - } - } - }); - } - - if self.lambda.read().len() != other.lambda.read().len() { - let mut lambda = self.lambda.write(); - other.lambda.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = lambda.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - lambda.push(Some(x.clone())); - } - } - }); - } - - if self.lambda_parameter.read().len() != other.lambda_parameter.read().len() { - let mut lambda_parameter = self.lambda_parameter.write(); - other.lambda_parameter.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = lambda_parameter.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - lambda_parameter.push(Some(x.clone())); - } - } - }); - } - - if self.let_statement.read().len() != other.let_statement.read().len() { - let mut let_statement = self.let_statement.write(); - other.let_statement.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = let_statement.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - let_statement.push(Some(x.clone())); - } - } - }); - } - - if self.list.read().len() != other.list.read().len() { - let mut list = self.list.write(); - other.list.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = list.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - list.push(Some(x.clone())); - } - } - }); - } - - if self.list_element.read().len() != other.list_element.read().len() { - let mut list_element = self.list_element.write(); - other.list_element.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = list_element.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - list_element.push(Some(x.clone())); - } - } - }); - } - - if self.list_expression.read().len() != other.list_expression.read().len() { - let mut list_expression = self.list_expression.write(); - other.list_expression.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = list_expression.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - list_expression.push(Some(x.clone())); - } - } - }); - } - - if self.literal.read().len() != other.literal.read().len() { - let mut literal = self.literal.write(); - other.literal.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = literal.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - literal.push(Some(x.clone())); - } - } - }); - } - - if self.local_variable.read().len() != other.local_variable.read().len() { - let mut local_variable = self.local_variable.write(); - other.local_variable.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = local_variable.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - local_variable.push(Some(x.clone())); - } - } - }); - } - - if self.x_macro.read().len() != other.x_macro.read().len() { - let mut x_macro = self.x_macro.write(); - other.x_macro.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = x_macro.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - x_macro.push(Some(x.clone())); - } - } - }); - } - - if self.map.read().len() != other.map.read().len() { - let mut map = self.map.write(); - other.map.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = map.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - map.push(Some(x.clone())); - } - } - }); - } - - if self.map_element.read().len() != other.map_element.read().len() { - let mut map_element = self.map_element.write(); - other.map_element.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = map_element.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - map_element.push(Some(x.clone())); - } - } - }); - } - - if self.map_expression.read().len() != other.map_expression.read().len() { - let mut map_expression = self.map_expression.write(); - other.map_expression.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = map_expression.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - map_expression.push(Some(x.clone())); - } - } - }); - } - - if self.x_match.read().len() != other.x_match.read().len() { - let mut x_match = self.x_match.write(); - other.x_match.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = x_match.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - x_match.push(Some(x.clone())); - } - } - }); - } - - if self.method_call.read().len() != other.method_call.read().len() { - let mut method_call = self.method_call.write(); - other.method_call.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = method_call.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - method_call.push(Some(x.clone())); - } - } - }); - } - - if self.named_field_expression.read().len() != other.named_field_expression.read().len() { - let mut named_field_expression = self.named_field_expression.write(); - other.named_field_expression.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = named_field_expression.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - named_field_expression.push(Some(x.clone())); - } - } - }); - } - - if self.z_object_store.read().len() != other.z_object_store.read().len() { - let mut z_object_store = self.z_object_store.write(); - other.z_object_store.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = z_object_store.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - z_object_store.push(Some(x.clone())); - } - } - }); - } - - if self.object_wrapper.read().len() != other.object_wrapper.read().len() { - let mut object_wrapper = self.object_wrapper.write(); - other.object_wrapper.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = object_wrapper.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - object_wrapper.push(Some(x.clone())); - } - } - }); - } - - if self.operator.read().len() != other.operator.read().len() { - let mut operator = self.operator.write(); - other.operator.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = operator.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - operator.push(Some(x.clone())); - } - } - }); - } - - if self.parameter.read().len() != other.parameter.read().len() { - let mut parameter = self.parameter.write(); - other.parameter.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = parameter.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - parameter.push(Some(x.clone())); - } - } - }); - } - - if self.x_path.read().len() != other.x_path.read().len() { - let mut x_path = self.x_path.write(); - other.x_path.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = x_path.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - x_path.push(Some(x.clone())); - } - } - }); - } - - if self.path_element.read().len() != other.path_element.read().len() { - let mut path_element = self.path_element.write(); - other.path_element.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = path_element.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - path_element.push(Some(x.clone())); - } - } - }); - } - - if self.pattern.read().len() != other.pattern.read().len() { - let mut pattern = self.pattern.write(); - other.pattern.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = pattern.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - pattern.push(Some(x.clone())); - } - } - }); - } - - if self.x_plugin.read().len() != other.x_plugin.read().len() { - let mut x_plugin = self.x_plugin.write(); - other.x_plugin.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = x_plugin.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - x_plugin.push(Some(x.clone())); - } - } - }); - } - - if self.x_print.read().len() != other.x_print.read().len() { - let mut x_print = self.x_print.write(); - other.x_print.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = x_print.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - x_print.push(Some(x.clone())); - } - } - }); - } - - if self.range_expression.read().len() != other.range_expression.read().len() { - let mut range_expression = self.range_expression.write(); - other.range_expression.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = range_expression.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - range_expression.push(Some(x.clone())); - } - } - }); - } - - if self.result_statement.read().len() != other.result_statement.read().len() { - let mut result_statement = self.result_statement.write(); - other.result_statement.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = result_statement.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - result_statement.push(Some(x.clone())); - } - } - }); - } - - if self.x_return.read().len() != other.x_return.read().len() { - let mut x_return = self.x_return.write(); - other.x_return.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = x_return.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - x_return.push(Some(x.clone())); - } - } - }); - } - - if self.span.read().len() != other.span.read().len() { - let mut span = self.span.write(); - other.span.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = span.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - span.push(Some(x.clone())); - } - } - }); - } - - if self.statement.read().len() != other.statement.read().len() { - let mut statement = self.statement.write(); - other.statement.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = statement.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - statement.push(Some(x.clone())); - } - } - }); - } - - if self.static_method_call.read().len() != other.static_method_call.read().len() { - let mut static_method_call = self.static_method_call.write(); - other.static_method_call.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = static_method_call.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - static_method_call.push(Some(x.clone())); - } - } - }); - } - - if self.string_bit.read().len() != other.string_bit.read().len() { - let mut string_bit = self.string_bit.write(); - other.string_bit.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = string_bit.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - string_bit.push(Some(x.clone())); - } - } - }); - } - - if self.string_literal.read().len() != other.string_literal.read().len() { - let mut string_literal = self.string_literal.write(); - other.string_literal.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = string_literal.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - string_literal.push(Some(x.clone())); - } - } - }); - } - - if self.woog_struct.read().len() != other.woog_struct.read().len() { - let mut woog_struct = self.woog_struct.write(); - other.woog_struct.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = woog_struct.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - woog_struct.push(Some(x.clone())); - } - } - }); - } - - if self.struct_expression.read().len() != other.struct_expression.read().len() { - let mut struct_expression = self.struct_expression.write(); - other.struct_expression.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = struct_expression.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - struct_expression.push(Some(x.clone())); - } - } - }); - } - - if self.struct_field.read().len() != other.struct_field.read().len() { - let mut struct_field = self.struct_field.write(); - other.struct_field.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = struct_field.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - struct_field.push(Some(x.clone())); - } - } - }); - } - - if self.struct_generic.read().len() != other.struct_generic.read().len() { - let mut struct_generic = self.struct_generic.write(); - other.struct_generic.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = struct_generic.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - struct_generic.push(Some(x.clone())); - } - } - }); - } - - if self.tuple_field.read().len() != other.tuple_field.read().len() { - let mut tuple_field = self.tuple_field.write(); - other.tuple_field.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = tuple_field.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - tuple_field.push(Some(x.clone())); - } - } - }); - } - - if self.type_cast.read().len() != other.type_cast.read().len() { - let mut type_cast = self.type_cast.write(); - other.type_cast.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = type_cast.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - type_cast.push(Some(x.clone())); - } - } - }); - } - - if self.unary.read().len() != other.unary.read().len() { - let mut unary = self.unary.write(); - other.unary.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = unary.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - unary.push(Some(x.clone())); - } - } - }); - } - - if self.unit.read().len() != other.unit.read().len() { - let mut unit = self.unit.write(); - other.unit.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = unit.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - unit.push(Some(x.clone())); - } - } - }); - } - - if self.unnamed_field_expression.read().len() != other.unnamed_field_expression.read().len() - { - let mut unnamed_field_expression = self.unnamed_field_expression.write(); - other.unnamed_field_expression.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = unnamed_field_expression.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - unnamed_field_expression.push(Some(x.clone())); - } - } - }); - } - - if self.x_value.read().len() != other.x_value.read().len() { - let mut x_value = self.x_value.write(); - other.x_value.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = x_value.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - x_value.push(Some(x.clone())); - } - } - }); - } - - if self.value_type.read().len() != other.value_type.read().len() { - let mut value_type = self.value_type.write(); - other.value_type.read().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() == *x.read() - } else { - false - } - }) - .is_none() - { - let _index_ = value_type.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - value_type.push(Some(x.clone())); - } - } - }); - } - - if self.variable.read().len() != other.variable.read().len() { - let mut variable = self.variable.write(); - other.variable.read().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() == *x.read() - } else { - false + // if self.argument.read().len() != other.argument.read().len() { + other.argument.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in argument, if it's not there add it to argument. + if self + .argument + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.argument.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_argument(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.a_wait.read().len() != other.a_wait.read().len() { + other.a_wait.read().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 self + .a_wait + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.a_wait.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_a_wait(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.binary.read().len() != other.binary.read().len() { + other.binary.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in binary, if it's not there add it to binary. + if self + .binary + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.binary.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_binary(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.block.read().len() != other.block.read().len() { + other.block.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in block, if it's not there add it to block. + if self + .block + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.block.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_block(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.body.read().len() != other.body.read().len() { + other.body.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in body, if it's not there add it to body. + if self + .body + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.body.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_body(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.boolean_literal.read().len() != other.boolean_literal.read().len() { + other.boolean_literal.read().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 self + .boolean_literal + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.boolean_literal.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_boolean_literal(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.boolean_operator.read().len() != other.boolean_operator.read().len() { + other.boolean_operator.read().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 self + .boolean_operator + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.boolean_operator.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_boolean_operator(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.call.read().len() != other.call.read().len() { + other.call.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in call, if it's not there add it to call. + if self + .call + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.call.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_call(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.char_literal.read().len() != other.char_literal.read().len() { + other.char_literal.read().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 self + .char_literal + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.char_literal.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_char_literal(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.comparison.read().len() != other.comparison.read().len() { + other.comparison.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in comparison, if it's not there add it to comparison. + if self + .comparison + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.comparison.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_comparison(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.data_structure.read().len() != other.data_structure.read().len() { + other.data_structure.read().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 self + .data_structure + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.data_structure.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_data_structure(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.dwarf_source_file.read().len() != other.dwarf_source_file.read().len() { + other.dwarf_source_file.read().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 self + .dwarf_source_file + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.dwarf_source_file.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_dwarf_source_file(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.enum_field.read().len() != other.enum_field.read().len() { + other.enum_field.read().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 self + .enum_field + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.enum_field.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_enum_field(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.enum_generic.read().len() != other.enum_generic.read().len() { + other.enum_generic.read().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 self + .enum_generic + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.enum_generic.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_enum_generic(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.enum_generic_type.read().len() != other.enum_generic_type.read().len() { + other.enum_generic_type.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. + if self + .enum_generic_type + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.enum_generic_type.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_enum_generic_type(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.enumeration.read().len() != other.enumeration.read().len() { + other.enumeration.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enumeration, if it's not there add it to enumeration. + if self + .enumeration + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.enumeration.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_enumeration(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.expression.read().len() != other.expression.read().len() { + other.expression.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression, if it's not there add it to expression. + if self + .expression + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.expression.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_expression(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.expression_bit.read().len() != other.expression_bit.read().len() { + other.expression_bit.read().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 self + .expression_bit + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.expression_bit.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_expression_bit(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.expression_statement.read().len() != other.expression_statement.read().len() { + other.expression_statement.read().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 self + .expression_statement + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.expression_statement.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_expression_statement(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.external_implementation.read().len() != other.external_implementation.read().len() { + other.external_implementation.read().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 self + .external_implementation + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.external_implementation.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_external_implementation( + |id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; } - }) - .is_none() - { - let _index_ = variable.len(); - if x.read().id != _index_ { - x.write().id = _index_; - } - variable.push(Some(x.clone())); - } - } - }); - } - - if self.variable_expression.read().len() != other.variable_expression.read().len() { - let mut variable_expression = self.variable_expression.write(); - other.variable_expression.read().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() == *x.read() - } else { - false + + x.clone() + }, + ); + } + } + }); + // } + + // if self.field.read().len() != other.field.read().len() { + other.field.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field, if it's not there add it to field. + if self + .field + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.field.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_field(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.field_access.read().len() != other.field_access.read().len() { + other.field_access.read().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 self + .field_access + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.field_access.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_field_access(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.field_access_target.read().len() != other.field_access_target.read().len() { + other.field_access_target.read().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 self + .field_access_target + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.field_access_target.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_field_access_target(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.field_expression.read().len() != other.field_expression.read().len() { + other.field_expression.read().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 self + .field_expression + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.field_expression.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_field_expression(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.float_literal.read().len() != other.float_literal.read().len() { + other.float_literal.read().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 self + .float_literal + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.float_literal.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_float_literal(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.for_loop.read().len() != other.for_loop.read().len() { + other.for_loop.read().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 self + .for_loop + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.for_loop.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_for_loop(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.format_bit.read().len() != other.format_bit.read().len() { + other.format_bit.read().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 self + .format_bit + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.format_bit.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_format_bit(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.format_string.read().len() != other.format_string.read().len() { + other.format_string.read().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 self + .format_string + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.format_string.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_format_string(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.func_generic.read().len() != other.func_generic.read().len() { + other.func_generic.read().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 self + .func_generic + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.func_generic.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_func_generic(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.function.read().len() != other.function.read().len() { + other.function.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function, if it's not there add it to function. + if self + .function + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.function.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_function(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.function_call.read().len() != other.function_call.read().len() { + other.function_call.read().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 self + .function_call + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.function_call.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_function_call(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.x_future.read().len() != other.x_future.read().len() { + other.x_future.read().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 self + .x_future + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_future.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_x_future(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.grouped.read().len() != other.grouped.read().len() { + other.grouped.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in grouped, if it's not there add it to grouped. + if self + .grouped + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.grouped.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_grouped(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.halt_and_catch_fire.read().len() != other.halt_and_catch_fire.read().len() { + other.halt_and_catch_fire.read().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 self + .halt_and_catch_fire + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.halt_and_catch_fire.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_halt_and_catch_fire(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.x_if.read().len() != other.x_if.read().len() { + other.x_if.read().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 self + .x_if + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_if.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_x_if(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.implementation_block.read().len() != other.implementation_block.read().len() { + other.implementation_block.read().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 self + .implementation_block + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.implementation_block.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_implementation_block(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.import.read().len() != other.import.read().len() { + other.import.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in import, if it's not there add it to import. + if self + .import + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.import.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_import(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.index.read().len() != other.index.read().len() { + other.index.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in index, if it's not there add it to index. + if self + .index + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.index.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_index(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.integer_literal.read().len() != other.integer_literal.read().len() { + other.integer_literal.read().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 self + .integer_literal + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.integer_literal.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_integer_literal(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.item.read().len() != other.item.read().len() { + other.item.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in item, if it's not there add it to item. + if self + .item + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.item.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_item(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.lambda.read().len() != other.lambda.read().len() { + other.lambda.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda, if it's not there add it to lambda. + if self + .lambda + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.lambda.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_lambda(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.lambda_parameter.read().len() != other.lambda_parameter.read().len() { + other.lambda_parameter.read().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 self + .lambda_parameter + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.lambda_parameter.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_lambda_parameter(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.let_statement.read().len() != other.let_statement.read().len() { + other.let_statement.read().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 self + .let_statement + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.let_statement.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_let_statement(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.list.read().len() != other.list.read().len() { + other.list.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list, if it's not there add it to list. + if self + .list + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.list.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_list(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.list_element.read().len() != other.list_element.read().len() { + other.list_element.read().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 self + .list_element + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.list_element.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_list_element(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.list_expression.read().len() != other.list_expression.read().len() { + other.list_expression.read().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 self + .list_expression + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.list_expression.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_list_expression(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.literal.read().len() != other.literal.read().len() { + other.literal.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in literal, if it's not there add it to literal. + if self + .literal + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.literal.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_literal(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.local_variable.read().len() != other.local_variable.read().len() { + other.local_variable.read().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 self + .local_variable + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.local_variable.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_local_variable(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.x_macro.read().len() != other.x_macro.read().len() { + other.x_macro.read().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 self + .x_macro + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_macro.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_x_macro(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.map.read().len() != other.map.read().len() { + other.map.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map, if it's not there add it to map. + if self + .map + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.map.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_map(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.map_element.read().len() != other.map_element.read().len() { + other.map_element.read().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 self + .map_element + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.map_element.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_map_element(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.map_expression.read().len() != other.map_expression.read().len() { + other.map_expression.read().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 self + .map_expression + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.map_expression.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_map_expression(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.x_match.read().len() != other.x_match.read().len() { + other.x_match.read().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 self + .x_match + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_match.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_x_match(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.method_call.read().len() != other.method_call.read().len() { + other.method_call.read().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 self + .method_call + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.method_call.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_method_call(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.named_field_expression.read().len() != other.named_field_expression.read().len() { + other.named_field_expression.read().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 self + .named_field_expression + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.named_field_expression.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_named_field_expression(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.z_object_store.read().len() != other.z_object_store.read().len() { + other.z_object_store.read().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 self + .z_object_store + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.z_object_store.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_z_object_store(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.object_wrapper.read().len() != other.object_wrapper.read().len() { + other.object_wrapper.read().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 self + .object_wrapper + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.object_wrapper.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_object_wrapper(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.operator.read().len() != other.operator.read().len() { + other.operator.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in operator, if it's not there add it to operator. + if self + .operator + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.operator.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_operator(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.parameter.read().len() != other.parameter.read().len() { + other.parameter.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in parameter, if it's not there add it to parameter. + if self + .parameter + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.parameter.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_parameter(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.x_path.read().len() != other.x_path.read().len() { + other.x_path.read().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 self + .x_path + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_path.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_x_path(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.path_element.read().len() != other.path_element.read().len() { + other.path_element.read().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 self + .path_element + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.path_element.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_path_element(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.pattern.read().len() != other.pattern.read().len() { + other.pattern.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in pattern, if it's not there add it to pattern. + if self + .pattern + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.pattern.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_pattern(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.x_plugin.read().len() != other.x_plugin.read().len() { + other.x_plugin.read().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 self + .x_plugin + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_plugin.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_x_plugin(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.x_print.read().len() != other.x_print.read().len() { + other.x_print.read().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 self + .x_print + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_print.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_x_print(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.range_expression.read().len() != other.range_expression.read().len() { + other.range_expression.read().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 self + .range_expression + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.range_expression.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_range_expression(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.result_statement.read().len() != other.result_statement.read().len() { + other.result_statement.read().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 self + .result_statement + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.result_statement.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_result_statement(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.x_return.read().len() != other.x_return.read().len() { + other.x_return.read().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 self + .x_return + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_return.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_x_return(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.span.read().len() != other.span.read().len() { + other.span.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in span, if it's not there add it to span. + if self + .span + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.span.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_span(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.statement.read().len() != other.statement.read().len() { + other.statement.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in statement, if it's not there add it to statement. + if self + .statement + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.statement.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_statement(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.static_method_call.read().len() != other.static_method_call.read().len() { + other.static_method_call.read().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 self + .static_method_call + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.static_method_call.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_static_method_call(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.string_bit.read().len() != other.string_bit.read().len() { + other.string_bit.read().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 self + .string_bit + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.string_bit.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_string_bit(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.string_literal.read().len() != other.string_literal.read().len() { + other.string_literal.read().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 self + .string_literal + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.string_literal.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_string_literal(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.woog_struct.read().len() != other.woog_struct.read().len() { + other.woog_struct.read().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 self + .woog_struct + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.woog_struct.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_woog_struct(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.struct_expression.read().len() != other.struct_expression.read().len() { + other.struct_expression.read().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 self + .struct_expression + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.struct_expression.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_struct_expression(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.struct_field.read().len() != other.struct_field.read().len() { + other.struct_field.read().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 self + .struct_field + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.struct_field.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_struct_field(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.struct_generic.read().len() != other.struct_generic.read().len() { + other.struct_generic.read().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 self + .struct_generic + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.struct_generic.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_struct_generic(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.tuple_field.read().len() != other.tuple_field.read().len() { + other.tuple_field.read().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 self + .tuple_field + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.tuple_field.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_tuple_field(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.type_cast.read().len() != other.type_cast.read().len() { + other.type_cast.read().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 self + .type_cast + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.type_cast.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_type_cast(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.unary.read().len() != other.unary.read().len() { + other.unary.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unary, if it's not there add it to unary. + if self + .unary + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.unary.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_unary(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.unit.read().len() != other.unit.read().len() { + other.unit.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unit, if it's not there add it to unit. + if self + .unit + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.unit.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_unit(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.unnamed_field_expression.read().len() != other.unnamed_field_expression.read().len() { + other.unnamed_field_expression.read().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 self + .unnamed_field_expression + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.unnamed_field_expression.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_unnamed_field_expression( + |id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; } - }) - .is_none() - { - let _index_ = variable_expression.len(); - if x.read().id != _index_ { - x.write().id = _index_; + + x.clone() + }, + ); + } + } + }); + // } + + // if self.x_value.read().len() != other.x_value.read().len() { + other.x_value.read().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 self + .x_value + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_value.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_x_value(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; } - variable_expression.push(Some(x.clone())); - } + + x.clone() + }); } - }); - } + } + }); + // } + + // if self.value_type.read().len() != other.value_type.read().len() { + other.value_type.read().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 self + .value_type + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.value_type.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_value_type(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.variable.read().len() != other.variable.read().len() { + other.variable.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable, if it's not there add it to variable. + if self + .variable + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.variable.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_variable(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.variable_expression.read().len() != other.variable_expression.read().len() { + other.variable_expression.read().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 self + .variable_expression + .read() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.variable_expression.read().len(); + // if x.read().id != _index_ { + // x.write().id = _index_; + // } + self.inter_variable_expression(|id| -> Arc> { + if x.read().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().id = id; + } + + x.clone() + }); + } + } + }); + // } } pub fn new() -> Self { let mut store = Self { diff --git a/src/v2/lu_dog_rwlock_vec/store.rs b/src/v2/lu_dog_rwlock_vec/store.rs index 3f377f36..d475656b 100644 --- a/src/v2/lu_dog_rwlock_vec/store.rs +++ b/src/v2/lu_dog_rwlock_vec/store.rs @@ -587,12 +587,415 @@ impl Clone for ObjectStore { } impl ObjectStore { pub fn merge(&mut self, other: &ObjectStore) { - if self.argument.read().unwrap().len() != other.argument.read().unwrap().len() { - let mut argument = self.argument.write().unwrap(); - other.argument.read().unwrap().iter().for_each(|x| { + // if self.argument.read().unwrap().len() != other.argument.read().unwrap().len() { + 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 self + .argument + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.argument.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_argument(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.a_wait.read().unwrap().len() != other.a_wait.read().unwrap().len() { + 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 self + .a_wait + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.a_wait.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_a_wait(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.binary.read().unwrap().len() != other.binary.read().unwrap().len() { + 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 self + .binary + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.binary.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_binary(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.block.read().unwrap().len() != other.block.read().unwrap().len() { + 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 self + .block + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.block.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_block(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.body.read().unwrap().len() != other.body.read().unwrap().len() { + 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 self + .body + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.body.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_body(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.boolean_literal.read().unwrap().len() != other.boolean_literal.read().unwrap().len() { + 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 self + .boolean_literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.boolean_literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_boolean_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.boolean_operator.read().unwrap().len() != other.boolean_operator.read().unwrap().len() { + 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 self + .boolean_operator + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.boolean_operator.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_boolean_operator(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.call.read().unwrap().len() != other.call.read().unwrap().len() { + 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 self + .call + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.call.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_call(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.char_literal.read().unwrap().len() != other.char_literal.read().unwrap().len() { + 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 self + .char_literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.char_literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_char_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.comparison.read().unwrap().len() != other.comparison.read().unwrap().len() { + 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 self + .comparison + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.comparison.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_comparison(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.data_structure.read().unwrap().len() != other.data_structure.read().unwrap().len() { + 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 self + .data_structure + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.data_structure.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_data_structure(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.dwarf_source_file.read().unwrap().len() != other.dwarf_source_file.read().unwrap().len() { + other + .dwarf_source_file + .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 + // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. + if self + .dwarf_source_file + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -603,22 +1006,109 @@ impl ObjectStore { }) .is_none() { - let _index_ = argument.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - argument.push(Some(x.clone())); + // let _index_ = self.dwarf_source_file.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_dwarf_source_file(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } } }); - } + // } + + // if self.enum_field.read().unwrap().len() != other.enum_field.read().unwrap().len() { + 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 self + .enum_field + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.enum_field.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_enum_field(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.enum_generic.read().unwrap().len() != other.enum_generic.read().unwrap().len() { + 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 self + .enum_generic + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.enum_generic.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_enum_generic(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } - if self.a_wait.read().unwrap().len() != other.a_wait.read().unwrap().len() { - let mut a_wait = self.a_wait.write().unwrap(); - other.a_wait.read().unwrap().iter().for_each(|x| { + x.clone() + }); + } + } + }); + // } + + // if self.enum_generic_type.read().unwrap().len() != other.enum_generic_type.read().unwrap().len() { + other + .enum_generic_type + .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 + // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. + if self + .enum_generic_type + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -629,22 +1119,145 @@ impl ObjectStore { }) .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 _index_ = self.enum_generic_type.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_enum_generic_type(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } } }); - } + // } + + // if self.enumeration.read().unwrap().len() != other.enumeration.read().unwrap().len() { + 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 self + .enumeration + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.enumeration.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_enumeration(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.expression.read().unwrap().len() != other.expression.read().unwrap().len() { + 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 self + .expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.expression_bit.read().unwrap().len() != other.expression_bit.read().unwrap().len() { + 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 self + .expression_bit + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.expression_bit.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_expression_bit(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } - if self.binary.read().unwrap().len() != other.binary.read().unwrap().len() { - let mut binary = self.binary.write().unwrap(); - other.binary.read().unwrap().iter().for_each(|x| { + // if self.expression_statement.read().unwrap().len() != other.expression_statement.read().unwrap().len() { + other + .expression_statement + .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 + // Look for other in expression_statement, if it's not there add it to expression_statement. + if self + .expression_statement + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -655,22 +1268,37 @@ impl ObjectStore { }) .is_none() { - let _index_ = binary.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - binary.push(Some(x.clone())); + // let _index_ = self.expression_statement.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_expression_statement(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } } }); - } + // } - if self.block.read().unwrap().len() != other.block.read().unwrap().len() { - let mut block = self.block.write().unwrap(); - other.block.read().unwrap().iter().for_each(|x| { + // if self.external_implementation.read().unwrap().len() != other.external_implementation.read().unwrap().len() { + other + .external_implementation + .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 + // Look for other in external_implementation, if it's not there add it to external_implementation. + if self + .external_implementation + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -681,22 +1309,111 @@ impl ObjectStore { }) .is_none() { - let _index_ = block.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - block.push(Some(x.clone())); + // let _index_ = self.external_implementation.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_external_implementation( + |id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }, + ); } } }); - } + // } - if self.body.read().unwrap().len() != other.body.read().unwrap().len() { - let mut body = self.body.write().unwrap(); - other.body.read().unwrap().iter().for_each(|x| { + // if self.field.read().unwrap().len() != other.field.read().unwrap().len() { + 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 self + .field + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.field.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_field(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.field_access.read().unwrap().len() != other.field_access.read().unwrap().len() { + 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 self + .field_access + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.field_access.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_field_access(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.field_access_target.read().unwrap().len() != other.field_access_target.read().unwrap().len() { + other + .field_access_target + .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 + // Look for other in field_access_target, if it's not there add it to field_access_target. + if self + .field_access_target + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -707,23 +1424,397 @@ impl ObjectStore { }) .is_none() { - let _index_ = body.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - body.push(Some(x.clone())); + // let _index_ = self.field_access_target.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_field_access_target(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } } }); - } + // } + + // if self.field_expression.read().unwrap().len() != other.field_expression.read().unwrap().len() { + 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 self + .field_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.field_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_field_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } - if self.boolean_literal.read().unwrap().len() != other.boolean_literal.read().unwrap().len() - { - let mut boolean_literal = self.boolean_literal.write().unwrap(); - other.boolean_literal.read().unwrap().iter().for_each(|x| { + x.clone() + }); + } + } + }); + // } + + // if self.float_literal.read().unwrap().len() != other.float_literal.read().unwrap().len() { + 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 self + .float_literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.float_literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_float_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.for_loop.read().unwrap().len() != other.for_loop.read().unwrap().len() { + 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 self + .for_loop + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.for_loop.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_for_loop(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.format_bit.read().unwrap().len() != other.format_bit.read().unwrap().len() { + 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 self + .format_bit + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.format_bit.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_format_bit(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.format_string.read().unwrap().len() != other.format_string.read().unwrap().len() { + 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 self + .format_string + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.format_string.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_format_string(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.func_generic.read().unwrap().len() != other.func_generic.read().unwrap().len() { + 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 self + .func_generic + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.func_generic.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_func_generic(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.function.read().unwrap().len() != other.function.read().unwrap().len() { + 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 self + .function + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.function.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_function(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.function_call.read().unwrap().len() != other.function_call.read().unwrap().len() { + 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 self + .function_call + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.function_call.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_function_call(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.x_future.read().unwrap().len() != other.x_future.read().unwrap().len() { + 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 self + .x_future + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_future.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_future(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.grouped.read().unwrap().len() != other.grouped.read().unwrap().len() { + 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 self + .grouped + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.grouped.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_grouped(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.halt_and_catch_fire.read().unwrap().len() != other.halt_and_catch_fire.read().unwrap().len() { + other + .halt_and_catch_fire + .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 + // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. + if self + .halt_and_catch_fire + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -734,24 +1825,73 @@ impl ObjectStore { }) .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 _index_ = self.halt_and_catch_fire.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_halt_and_catch_fire(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } } }); - } + // } - if self.boolean_operator.read().unwrap().len() - != other.boolean_operator.read().unwrap().len() - { - let mut boolean_operator = self.boolean_operator.write().unwrap(); - other.boolean_operator.read().unwrap().iter().for_each(|x| { + // if self.x_if.read().unwrap().len() != other.x_if.read().unwrap().len() { + 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 self + .x_if + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_if.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_if(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); + } + } + }); + // } + + // if self.implementation_block.read().unwrap().len() != other.implementation_block.read().unwrap().len() { + other + .implementation_block + .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 + // Look for other in implementation_block, if it's not there add it to implementation_block. + if self + .implementation_block + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -762,1273 +1902,685 @@ impl ObjectStore { }) .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 _index_ = self.implementation_block.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_implementation_block(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } } }); - } + // } - if self.call.read().unwrap().len() != other.call.read().unwrap().len() { - 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_; + // if self.import.read().unwrap().len() != other.import.read().unwrap().len() { + 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 self + .import + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - call.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.import.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_import(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.char_literal.read().unwrap().len() != other.char_literal.read().unwrap().len() { - 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_; + // if self.index.read().unwrap().len() != other.index.read().unwrap().len() { + 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 self + .index + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - char_literal.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.index.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_index(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.comparison.read().unwrap().len() != other.comparison.read().unwrap().len() { - 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_; + // if self.integer_literal.read().unwrap().len() != other.integer_literal.read().unwrap().len() { + 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 self + .integer_literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - comparison.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.integer_literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_integer_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.data_structure.read().unwrap().len() != other.data_structure.read().unwrap().len() { - 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_; + // if self.item.read().unwrap().len() != other.item.read().unwrap().len() { + 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 self + .item + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - data_structure.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.item.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_item(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.dwarf_source_file.read().unwrap().len() - != other.dwarf_source_file.read().unwrap().len() - { - 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())); + // if self.lambda.read().unwrap().len() != other.lambda.read().unwrap().len() { + 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 self + .lambda + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.lambda.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_lambda(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; } - } - }); - } - if self.enum_field.read().unwrap().len() != other.enum_field.read().unwrap().len() { - 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_; + x.clone() + }); + } + } + }); + // } + + // if self.lambda_parameter.read().unwrap().len() != other.lambda_parameter.read().unwrap().len() { + 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 self + .lambda_parameter + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - enum_field.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.lambda_parameter.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_lambda_parameter(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.enum_generic.read().unwrap().len() != other.enum_generic.read().unwrap().len() { - 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_; + // if self.let_statement.read().unwrap().len() != other.let_statement.read().unwrap().len() { + 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 self + .let_statement + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - enum_generic.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.let_statement.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_let_statement(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.enum_generic_type.read().unwrap().len() - != other.enum_generic_type.read().unwrap().len() - { - let mut enum_generic_type = self.enum_generic_type.write().unwrap(); - other - .enum_generic_type - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. - if enum_generic_type - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_generic_type.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - enum_generic_type.push(Some(x.clone())); + // if self.list.read().unwrap().len() != other.list.read().unwrap().len() { + 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 self + .list + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.list.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_list(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; } - } - }); - } - if self.enumeration.read().unwrap().len() != other.enumeration.read().unwrap().len() { - 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_; + x.clone() + }); + } + } + }); + // } + + // if self.list_element.read().unwrap().len() != other.list_element.read().unwrap().len() { + 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 self + .list_element + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - enumeration.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.list_element.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_list_element(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.expression.read().unwrap().len() != other.expression.read().unwrap().len() { - 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_; + // if self.list_expression.read().unwrap().len() != other.list_expression.read().unwrap().len() { + 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 self + .list_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - expression.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.list_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_list_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.expression_bit.read().unwrap().len() != other.expression_bit.read().unwrap().len() { - 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_; + // if self.literal.read().unwrap().len() != other.literal.read().unwrap().len() { + 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 self + .literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - expression_bit.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.expression_statement.read().unwrap().len() - != other.expression_statement.read().unwrap().len() - { - 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())); + // if self.local_variable.read().unwrap().len() != other.local_variable.read().unwrap().len() { + 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 self + .local_variable + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.local_variable.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_local_variable(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; } - } - }); - } - if self.external_implementation.read().unwrap().len() - != other.external_implementation.read().unwrap().len() - { - 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())); + x.clone() + }); + } + } + }); + // } + + // if self.x_macro.read().unwrap().len() != other.x_macro.read().unwrap().len() { + 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 self + .x_macro + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_macro.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_macro(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; } - } - }); - } - if self.field.read().unwrap().len() != other.field.read().unwrap().len() { - 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_; + x.clone() + }); + } + } + }); + // } + + // if self.map.read().unwrap().len() != other.map.read().unwrap().len() { + 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 self + .map + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - field.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.map.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_map(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.field_access.read().unwrap().len() != other.field_access.read().unwrap().len() { - 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_; + // if self.map_element.read().unwrap().len() != other.map_element.read().unwrap().len() { + 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 self + .map_element + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - field_access.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.map_element.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_map_element(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.field_access_target.read().unwrap().len() - != other.field_access_target.read().unwrap().len() - { - 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())); + // if self.map_expression.read().unwrap().len() != other.map_expression.read().unwrap().len() { + 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 self + .map_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.map_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_map_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; } - } - }); - } - if self.field_expression.read().unwrap().len() - != other.field_expression.read().unwrap().len() - { - 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())); - } - } - }); - } - - if self.float_literal.read().unwrap().len() != other.float_literal.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.for_loop.read().unwrap().len() != other.for_loop.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.format_bit.read().unwrap().len() != other.format_bit.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.format_string.read().unwrap().len() != other.format_string.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.func_generic.read().unwrap().len() != other.func_generic.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.function.read().unwrap().len() != other.function.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.function_call.read().unwrap().len() != other.function_call.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.x_future.read().unwrap().len() != other.x_future.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.grouped.read().unwrap().len() != other.grouped.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.halt_and_catch_fire.read().unwrap().len() - != other.halt_and_catch_fire.read().unwrap().len() - { - 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())); - } - } - }); - } - - if self.x_if.read().unwrap().len() != other.x_if.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.implementation_block.read().unwrap().len() - != other.implementation_block.read().unwrap().len() - { - 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())); - } - } - }); - } - - if self.import.read().unwrap().len() != other.import.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.index.read().unwrap().len() != other.index.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.integer_literal.read().unwrap().len() != other.integer_literal.read().unwrap().len() - { - 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())); - } - } - }); - } - - if self.item.read().unwrap().len() != other.item.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.lambda.read().unwrap().len() != other.lambda.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.lambda_parameter.read().unwrap().len() - != other.lambda_parameter.read().unwrap().len() - { - 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())); - } - } - }); - } - - if self.let_statement.read().unwrap().len() != other.let_statement.read().unwrap().len() { - 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())); - } + x.clone() + }); } - }); - } - - if self.list.read().unwrap().len() != other.list.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.list_element.read().unwrap().len() != other.list_element.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.list_expression.read().unwrap().len() != other.list_expression.read().unwrap().len() - { - 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())); - } - } - }); - } - - if self.literal.read().unwrap().len() != other.literal.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.local_variable.read().unwrap().len() != other.local_variable.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.x_macro.read().unwrap().len() != other.x_macro.read().unwrap().len() { - 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())); - } - } - }); - } - - if self.map.read().unwrap().len() != other.map.read().unwrap().len() { - 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())); - } - } - }); - } + } + }); + // } - if self.map_element.read().unwrap().len() != other.map_element.read().unwrap().len() { - 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_; + // if self.x_match.read().unwrap().len() != other.x_match.read().unwrap().len() { + 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 self + .x_match + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - map_element.push(Some(x.clone())); - } - } - }); - } - - if self.map_expression.read().unwrap().len() != other.map_expression.read().unwrap().len() { - 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_; + }) + .is_none() + { + // let _index_ = self.x_match.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_match(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; } - map_expression.push(Some(x.clone())); - } + + x.clone() + }); } - }); - } + } + }); + // } - if self.x_match.read().unwrap().len() != other.x_match.read().unwrap().len() { - 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_; + // if self.method_call.read().unwrap().len() != other.method_call.read().unwrap().len() { + 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 self + .method_call + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - x_match.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.method_call.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_method_call(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.method_call.read().unwrap().len() != other.method_call.read().unwrap().len() { - let mut method_call = self.method_call.write().unwrap(); - other.method_call.read().unwrap().iter().for_each(|x| { + // if self.named_field_expression.read().unwrap().len() != other.named_field_expression.read().unwrap().len() { + other + .named_field_expression + .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 + // Look for other in named_field_expression, if it's not there add it to named_field_expression. + if self + .named_field_expression + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -2039,397 +2591,543 @@ impl ObjectStore { }) .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 _index_ = self.named_field_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_named_field_expression( + |id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }, + ); } } }); - } - - if self.named_field_expression.read().unwrap().len() - != other.named_field_expression.read().unwrap().len() - { - 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())); + // } + + // if self.z_object_store.read().unwrap().len() != other.z_object_store.read().unwrap().len() { + 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 self + .z_object_store + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.z_object_store.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_z_object_store(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; } - } - }); - } - if self.z_object_store.read().unwrap().len() != other.z_object_store.read().unwrap().len() { - 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_; + x.clone() + }); + } + } + }); + // } + + // if self.object_wrapper.read().unwrap().len() != other.object_wrapper.read().unwrap().len() { + 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 self + .object_wrapper + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - z_object_store.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.object_wrapper.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_object_wrapper(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.object_wrapper.read().unwrap().len() != other.object_wrapper.read().unwrap().len() { - 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_; + // if self.operator.read().unwrap().len() != other.operator.read().unwrap().len() { + 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 self + .operator + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - object_wrapper.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.operator.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_operator(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.operator.read().unwrap().len() != other.operator.read().unwrap().len() { - 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_; + // if self.parameter.read().unwrap().len() != other.parameter.read().unwrap().len() { + 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 self + .parameter + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - operator.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.parameter.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_parameter(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.parameter.read().unwrap().len() != other.parameter.read().unwrap().len() { - 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_; + // if self.x_path.read().unwrap().len() != other.x_path.read().unwrap().len() { + 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 self + .x_path + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - parameter.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.x_path.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_path(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.x_path.read().unwrap().len() != other.x_path.read().unwrap().len() { - 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_; + // if self.path_element.read().unwrap().len() != other.path_element.read().unwrap().len() { + 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 self + .path_element + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - x_path.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.path_element.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_path_element(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.path_element.read().unwrap().len() != other.path_element.read().unwrap().len() { - 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_; + // if self.pattern.read().unwrap().len() != other.pattern.read().unwrap().len() { + 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 self + .pattern + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - path_element.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.pattern.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_pattern(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.pattern.read().unwrap().len() != other.pattern.read().unwrap().len() { - 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_; + // if self.x_plugin.read().unwrap().len() != other.x_plugin.read().unwrap().len() { + 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 self + .x_plugin + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - pattern.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.x_plugin.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_plugin(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.x_plugin.read().unwrap().len() != other.x_plugin.read().unwrap().len() { - 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_; + // if self.x_print.read().unwrap().len() != other.x_print.read().unwrap().len() { + 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 self + .x_print + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - x_plugin.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.x_print.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_print(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.x_print.read().unwrap().len() != other.x_print.read().unwrap().len() { - 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_; + // if self.range_expression.read().unwrap().len() != other.range_expression.read().unwrap().len() { + 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 self + .range_expression + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - x_print.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.range_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_range_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.range_expression.read().unwrap().len() - != other.range_expression.read().unwrap().len() - { - 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_; + // if self.result_statement.read().unwrap().len() != other.result_statement.read().unwrap().len() { + 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 self + .result_statement + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - range_expression.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.result_statement.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_result_statement(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.result_statement.read().unwrap().len() - != other.result_statement.read().unwrap().len() - { - 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_; + // if self.x_return.read().unwrap().len() != other.x_return.read().unwrap().len() { + 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 self + .x_return + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - result_statement.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.x_return.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_return(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.x_return.read().unwrap().len() != other.x_return.read().unwrap().len() { - 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_; + // if self.span.read().unwrap().len() != other.span.read().unwrap().len() { + 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 self + .span + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - x_return.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.span.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_span(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.span.read().unwrap().len() != other.span.read().unwrap().len() { - 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_; + // if self.statement.read().unwrap().len() != other.statement.read().unwrap().len() { + 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 self + .statement + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - span.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.statement.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_statement(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.statement.read().unwrap().len() != other.statement.read().unwrap().len() { - let mut statement = self.statement.write().unwrap(); - other.statement.read().unwrap().iter().for_each(|x| { + // if self.static_method_call.read().unwrap().len() != other.static_method_call.read().unwrap().len() { + other + .static_method_call + .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 + // Look for other in static_method_call, if it's not there add it to static_method_call. + if self + .static_method_call + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -2440,107 +3138,145 @@ impl ObjectStore { }) .is_none() { - let _index_ = statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - statement.push(Some(x.clone())); + // let _index_ = self.static_method_call.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_static_method_call(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } } }); - } + // } - if self.static_method_call.read().unwrap().len() - != other.static_method_call.read().unwrap().len() - { - 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())); + // if self.string_bit.read().unwrap().len() != other.string_bit.read().unwrap().len() { + 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 self + .string_bit + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.string_bit.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_string_bit(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; } - } - }); - } - if self.string_bit.read().unwrap().len() != other.string_bit.read().unwrap().len() { - 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_; + x.clone() + }); + } + } + }); + // } + + // if self.string_literal.read().unwrap().len() != other.string_literal.read().unwrap().len() { + 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 self + .string_literal + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - string_bit.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.string_literal.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_string_literal(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.string_literal.read().unwrap().len() != other.string_literal.read().unwrap().len() { - 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_; + // if self.woog_struct.read().unwrap().len() != other.woog_struct.read().unwrap().len() { + 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 self + .woog_struct + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - string_literal.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.woog_struct.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_woog_struct(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.woog_struct.read().unwrap().len() != other.woog_struct.read().unwrap().len() { - let mut woog_struct = self.woog_struct.write().unwrap(); - other.woog_struct.read().unwrap().iter().for_each(|x| { + // if self.struct_expression.read().unwrap().len() != other.struct_expression.read().unwrap().len() { + other + .struct_expression + .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 + // Look for other in struct_expression, if it's not there add it to struct_expression. + if self + .struct_expression + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -2551,185 +3287,253 @@ impl ObjectStore { }) .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 _index_ = self.struct_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_struct_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } } }); - } + // } - if self.struct_expression.read().unwrap().len() - != other.struct_expression.read().unwrap().len() - { - 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())); + // if self.struct_field.read().unwrap().len() != other.struct_field.read().unwrap().len() { + 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 self + .struct_field + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.struct_field.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_struct_field(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; } - } - }); - } - if self.struct_field.read().unwrap().len() != other.struct_field.read().unwrap().len() { - 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_; + x.clone() + }); + } + } + }); + // } + + // if self.struct_generic.read().unwrap().len() != other.struct_generic.read().unwrap().len() { + 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 self + .struct_generic + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - struct_field.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.struct_generic.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_struct_generic(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.struct_generic.read().unwrap().len() != other.struct_generic.read().unwrap().len() { - 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_; + // if self.tuple_field.read().unwrap().len() != other.tuple_field.read().unwrap().len() { + 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 self + .tuple_field + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - struct_generic.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.tuple_field.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_tuple_field(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.tuple_field.read().unwrap().len() != other.tuple_field.read().unwrap().len() { - 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_; + // if self.type_cast.read().unwrap().len() != other.type_cast.read().unwrap().len() { + 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 self + .type_cast + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - tuple_field.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.type_cast.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_type_cast(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.type_cast.read().unwrap().len() != other.type_cast.read().unwrap().len() { - 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_; + // if self.unary.read().unwrap().len() != other.unary.read().unwrap().len() { + 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 self + .unary + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - type_cast.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.unary.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_unary(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.unary.read().unwrap().len() != other.unary.read().unwrap().len() { - 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_; + // if self.unit.read().unwrap().len() != other.unit.read().unwrap().len() { + 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 self + .unit + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - unary.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.unit.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_unit(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.unit.read().unwrap().len() != other.unit.read().unwrap().len() { - let mut unit = self.unit.write().unwrap(); - other.unit.read().unwrap().iter().for_each(|x| { + // if self.unnamed_field_expression.read().unwrap().len() != other.unnamed_field_expression.read().unwrap().len() { + other + .unnamed_field_expression + .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 + // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. + if self + .unnamed_field_expression + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -2740,107 +3544,147 @@ impl ObjectStore { }) .is_none() { - let _index_ = unit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - unit.push(Some(x.clone())); + // let _index_ = self.unnamed_field_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_unnamed_field_expression( + |id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }, + ); } } }); - } + // } - if self.unnamed_field_expression.read().unwrap().len() - != other.unnamed_field_expression.read().unwrap().len() - { - 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())); + // if self.x_value.read().unwrap().len() != other.x_value.read().unwrap().len() { + 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 self + .x_value + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + // let _index_ = self.x_value.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_x_value(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; } - } - }); - } - if self.x_value.read().unwrap().len() != other.x_value.read().unwrap().len() { - 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.clone() + }); + } + } + }); + // } + + // if self.value_type.read().unwrap().len() != other.value_type.read().unwrap().len() { + 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 self + .value_type + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - x_value.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.value_type.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_value_type(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.value_type.read().unwrap().len() != other.value_type.read().unwrap().len() { - 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_; + // if self.variable.read().unwrap().len() != other.variable.read().unwrap().len() { + 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 self + .variable + .read() + .unwrap() + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false } - value_type.push(Some(x.clone())); - } + }) + .is_none() + { + // let _index_ = self.variable.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_variable(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } - }); - } + } + }); + // } - if self.variable.read().unwrap().len() != other.variable.read().unwrap().len() { - let mut variable = self.variable.write().unwrap(); - other.variable.read().unwrap().iter().for_each(|x| { + // if self.variable_expression.read().unwrap().len() != other.variable_expression.read().unwrap().len() { + other + .variable_expression + .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 + // Look for other in variable_expression, if it's not there add it to variable_expression. + if self + .variable_expression + .read() + .unwrap() .iter() .find(|&y| { if let Some(y) = y { @@ -2851,48 +3695,23 @@ impl ObjectStore { }) .is_none() { - let _index_ = variable.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - variable.push(Some(x.clone())); + // let _index_ = self.variable_expression.read().unwrap().len(); + // if x.read().unwrap().id != _index_ { + // x.write().unwrap().id = _index_; + // } + self.inter_variable_expression(|id| -> Arc> { + if x.read().unwrap().id != id { + dbg!(x, id); + // panic!("id mismatch"); + x.write().unwrap().id = id; + } + + x.clone() + }); } } }); - } - - if self.variable_expression.read().unwrap().len() - != other.variable_expression.read().unwrap().len() - { - 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 { diff --git a/src/v2/lu_dog_vec/store.rs b/src/v2/lu_dog_vec/store.rs index 1433e587..f6ebd435 100644 --- a/src/v2/lu_dog_vec/store.rs +++ b/src/v2/lu_dog_vec/store.rs @@ -489,1705 +489,2304 @@ impl Clone for ObjectStore { } impl ObjectStore { pub fn merge(&mut self, other: &ObjectStore) { - if self.argument.len() != other.argument.len() { - let mut argument = &mut self.argument; - other.argument.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 == *x } else { false }) - .is_none() - { - let _index_ = argument.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; - } - argument.push(Some(x.clone())); - } - } - }); - } - - if self.a_wait.len() != other.a_wait.len() { - let mut a_wait = &mut self.a_wait; - other.a_wait.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 == *x } else { false }) - .is_none() - { - let _index_ = a_wait.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; - } - a_wait.push(Some(x.clone())); - } - } - }); - } - - if self.binary.len() != other.binary.len() { - let mut binary = &mut self.binary; - other.binary.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 == *x } else { false }) - .is_none() - { - let _index_ = binary.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + // if self.argument.len() != other.argument.len() { + other.argument.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in argument, if it's not there add it to argument. + if self + .argument + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.argument.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_argument(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - binary.push(Some(x.clone())); - } - } - }); - } - - if self.block.len() != other.block.len() { - let mut block = &mut self.block; - other.block.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 == *x } else { false }) - .is_none() - { - let _index_ = block.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.a_wait.len() != other.a_wait.len() { + other.a_wait.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 self + .a_wait + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.a_wait.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_a_wait(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - block.push(Some(x.clone())); - } - } - }); - } - - if self.body.len() != other.body.len() { - let mut body = &mut self.body; - other.body.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 == *x } else { false }) - .is_none() - { - let _index_ = body.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.binary.len() != other.binary.len() { + other.binary.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in binary, if it's not there add it to binary. + if self + .binary + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.binary.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_binary(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - body.push(Some(x.clone())); - } - } - }); - } - - if self.boolean_literal.len() != other.boolean_literal.len() { - let mut boolean_literal = &mut self.boolean_literal; - other.boolean_literal.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 == *x } else { false }) - .is_none() - { - let _index_ = boolean_literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.block.len() != other.block.len() { + other.block.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in block, if it's not there add it to block. + if self + .block + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.block.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_block(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - boolean_literal.push(Some(x.clone())); - } - } - }); - } - - if self.boolean_operator.len() != other.boolean_operator.len() { - let mut boolean_operator = &mut self.boolean_operator; - other.boolean_operator.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 == *x } else { false }) - .is_none() - { - let _index_ = boolean_operator.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.body.len() != other.body.len() { + other.body.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in body, if it's not there add it to body. + if self + .body + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.body.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_body(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - boolean_operator.push(Some(x.clone())); - } - } - }); - } - - if self.call.len() != other.call.len() { - let mut call = &mut self.call; - other.call.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 == *x } else { false }) - .is_none() - { - let _index_ = call.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.boolean_literal.len() != other.boolean_literal.len() { + other.boolean_literal.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 self + .boolean_literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.boolean_literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_boolean_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - call.push(Some(x.clone())); - } - } - }); - } - - if self.char_literal.len() != other.char_literal.len() { - let mut char_literal = &mut self.char_literal; - other.char_literal.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 == *x } else { false }) - .is_none() - { - let _index_ = char_literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.boolean_operator.len() != other.boolean_operator.len() { + other.boolean_operator.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 self + .boolean_operator + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.boolean_operator.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_boolean_operator(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - char_literal.push(Some(x.clone())); - } - } - }); - } - - if self.comparison.len() != other.comparison.len() { - let mut comparison = &mut self.comparison; - other.comparison.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 == *x } else { false }) - .is_none() - { - let _index_ = comparison.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.call.len() != other.call.len() { + other.call.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in call, if it's not there add it to call. + if self + .call + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.call.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_call(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - comparison.push(Some(x.clone())); - } - } - }); - } - - if self.data_structure.len() != other.data_structure.len() { - let mut data_structure = &mut self.data_structure; - other.data_structure.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 == *x } else { false }) - .is_none() - { - let _index_ = data_structure.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.char_literal.len() != other.char_literal.len() { + other.char_literal.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 self + .char_literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.char_literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_char_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - data_structure.push(Some(x.clone())); - } - } - }); - } - - if self.dwarf_source_file.len() != other.dwarf_source_file.len() { - let mut dwarf_source_file = &mut self.dwarf_source_file; - other.dwarf_source_file.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 == *x } else { false }) - .is_none() - { - let _index_ = dwarf_source_file.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.comparison.len() != other.comparison.len() { + other.comparison.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in comparison, if it's not there add it to comparison. + if self + .comparison + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.comparison.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_comparison(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - dwarf_source_file.push(Some(x.clone())); - } - } - }); - } - - if self.enum_field.len() != other.enum_field.len() { - let mut enum_field = &mut self.enum_field; - other.enum_field.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 == *x } else { false }) - .is_none() - { - let _index_ = enum_field.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.data_structure.len() != other.data_structure.len() { + other.data_structure.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 self + .data_structure + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.data_structure.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_data_structure(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - enum_field.push(Some(x.clone())); - } - } - }); - } - - if self.enum_generic.len() != other.enum_generic.len() { - let mut enum_generic = &mut self.enum_generic; - other.enum_generic.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 == *x } else { false }) - .is_none() - { - let _index_ = enum_generic.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.dwarf_source_file.len() != other.dwarf_source_file.len() { + other.dwarf_source_file.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 self + .dwarf_source_file + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.dwarf_source_file.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_dwarf_source_file(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - enum_generic.push(Some(x.clone())); - } - } - }); - } - - if self.enum_generic_type.len() != other.enum_generic_type.len() { - let mut enum_generic_type = &mut self.enum_generic_type; - other.enum_generic_type.iter().for_each(|x| { - if let Some(x) = x { - // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. - if enum_generic_type - .iter() - .find(|&y| if let Some(y) = y { *y == *x } else { false }) - .is_none() - { - let _index_ = enum_generic_type.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.enum_field.len() != other.enum_field.len() { + other.enum_field.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 self + .enum_field + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.enum_field.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_enum_field(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - enum_generic_type.push(Some(x.clone())); - } - } - }); - } - - if self.enumeration.len() != other.enumeration.len() { - let mut enumeration = &mut self.enumeration; - other.enumeration.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 == *x } else { false }) - .is_none() - { - let _index_ = enumeration.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.enum_generic.len() != other.enum_generic.len() { + other.enum_generic.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 self + .enum_generic + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.enum_generic.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_enum_generic(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - enumeration.push(Some(x.clone())); - } - } - }); - } - - if self.expression.len() != other.expression.len() { - let mut expression = &mut self.expression; - other.expression.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 == *x } else { false }) - .is_none() - { - let _index_ = expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.enum_generic_type.len() != other.enum_generic_type.len() { + other.enum_generic_type.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. + if self + .enum_generic_type + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.enum_generic_type.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_enum_generic_type(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - expression.push(Some(x.clone())); - } - } - }); - } - - if self.expression_bit.len() != other.expression_bit.len() { - let mut expression_bit = &mut self.expression_bit; - other.expression_bit.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 == *x } else { false }) - .is_none() - { - let _index_ = expression_bit.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.enumeration.len() != other.enumeration.len() { + other.enumeration.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enumeration, if it's not there add it to enumeration. + if self + .enumeration + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.enumeration.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_enumeration(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - expression_bit.push(Some(x.clone())); - } - } - }); - } - - if self.expression_statement.len() != other.expression_statement.len() { - let mut expression_statement = &mut self.expression_statement; - other.expression_statement.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 == *x } else { false }) - .is_none() - { - let _index_ = expression_statement.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.expression.len() != other.expression.len() { + other.expression.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression, if it's not there add it to expression. + if self + .expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - expression_statement.push(Some(x.clone())); - } - } - }); - } - - if self.external_implementation.len() != other.external_implementation.len() { - let mut external_implementation = &mut self.external_implementation; - other.external_implementation.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 == *x } else { false }) - .is_none() - { - let _index_ = external_implementation.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.expression_bit.len() != other.expression_bit.len() { + other.expression_bit.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 self + .expression_bit + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.expression_bit.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_expression_bit(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - external_implementation.push(Some(x.clone())); - } - } - }); - } - - if self.field.len() != other.field.len() { - let mut field = &mut self.field; - other.field.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 == *x } else { false }) - .is_none() - { - let _index_ = field.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.expression_statement.len() != other.expression_statement.len() { + other.expression_statement.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 self + .expression_statement + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.expression_statement.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_expression_statement(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - field.push(Some(x.clone())); - } - } - }); - } - - if self.field_access.len() != other.field_access.len() { - let mut field_access = &mut self.field_access; - other.field_access.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 == *x } else { false }) - .is_none() - { - let _index_ = field_access.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.external_implementation.len() != other.external_implementation.len() { + other.external_implementation.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 self + .external_implementation + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.external_implementation.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_external_implementation( + |id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); + } + + x.clone() + }, + ); + } + } + }); + // } + + // if self.field.len() != other.field.len() { + other.field.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field, if it's not there add it to field. + if self + .field + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.field.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_field(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - field_access.push(Some(x.clone())); - } - } - }); - } - - if self.field_access_target.len() != other.field_access_target.len() { - let mut field_access_target = &mut self.field_access_target; - other.field_access_target.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 == *x } else { false }) - .is_none() - { - let _index_ = field_access_target.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.field_access.len() != other.field_access.len() { + other.field_access.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 self + .field_access + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.field_access.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_field_access(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - field_access_target.push(Some(x.clone())); - } - } - }); - } - - if self.field_expression.len() != other.field_expression.len() { - let mut field_expression = &mut self.field_expression; - other.field_expression.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 == *x } else { false }) - .is_none() - { - let _index_ = field_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.field_access_target.len() != other.field_access_target.len() { + other.field_access_target.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 self + .field_access_target + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.field_access_target.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_field_access_target(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - field_expression.push(Some(x.clone())); - } - } - }); - } - - if self.float_literal.len() != other.float_literal.len() { - let mut float_literal = &mut self.float_literal; - other.float_literal.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 == *x } else { false }) - .is_none() - { - let _index_ = float_literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.field_expression.len() != other.field_expression.len() { + other.field_expression.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 self + .field_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.field_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_field_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - float_literal.push(Some(x.clone())); - } - } - }); - } - - if self.for_loop.len() != other.for_loop.len() { - let mut for_loop = &mut self.for_loop; - other.for_loop.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 == *x } else { false }) - .is_none() - { - let _index_ = for_loop.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.float_literal.len() != other.float_literal.len() { + other.float_literal.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 self + .float_literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.float_literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_float_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - for_loop.push(Some(x.clone())); - } - } - }); - } - - if self.format_bit.len() != other.format_bit.len() { - let mut format_bit = &mut self.format_bit; - other.format_bit.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 == *x } else { false }) - .is_none() - { - let _index_ = format_bit.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.for_loop.len() != other.for_loop.len() { + other.for_loop.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 self + .for_loop + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.for_loop.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_for_loop(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - format_bit.push(Some(x.clone())); - } - } - }); - } - - if self.format_string.len() != other.format_string.len() { - let mut format_string = &mut self.format_string; - other.format_string.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 == *x } else { false }) - .is_none() - { - let _index_ = format_string.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.format_bit.len() != other.format_bit.len() { + other.format_bit.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 self + .format_bit + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.format_bit.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_format_bit(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - format_string.push(Some(x.clone())); - } - } - }); - } - - if self.func_generic.len() != other.func_generic.len() { - let mut func_generic = &mut self.func_generic; - other.func_generic.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 == *x } else { false }) - .is_none() - { - let _index_ = func_generic.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.format_string.len() != other.format_string.len() { + other.format_string.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 self + .format_string + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.format_string.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_format_string(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - func_generic.push(Some(x.clone())); - } - } - }); - } - - if self.function.len() != other.function.len() { - let mut function = &mut self.function; - other.function.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 == *x } else { false }) - .is_none() - { - let _index_ = function.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.func_generic.len() != other.func_generic.len() { + other.func_generic.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 self + .func_generic + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.func_generic.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_func_generic(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - function.push(Some(x.clone())); - } - } - }); - } - - if self.function_call.len() != other.function_call.len() { - let mut function_call = &mut self.function_call; - other.function_call.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 == *x } else { false }) - .is_none() - { - let _index_ = function_call.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.function.len() != other.function.len() { + other.function.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function, if it's not there add it to function. + if self + .function + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.function.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_function(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - function_call.push(Some(x.clone())); - } - } - }); - } - - if self.x_future.len() != other.x_future.len() { - let mut x_future = &mut self.x_future; - other.x_future.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 == *x } else { false }) - .is_none() - { - let _index_ = x_future.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.function_call.len() != other.function_call.len() { + other.function_call.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 self + .function_call + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.function_call.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_function_call(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_future.push(Some(x.clone())); - } - } - }); - } - - if self.grouped.len() != other.grouped.len() { - let mut grouped = &mut self.grouped; - other.grouped.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 == *x } else { false }) - .is_none() - { - let _index_ = grouped.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_future.len() != other.x_future.len() { + other.x_future.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 self + .x_future + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_future.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_future(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - grouped.push(Some(x.clone())); - } - } - }); - } - - if self.halt_and_catch_fire.len() != other.halt_and_catch_fire.len() { - let mut halt_and_catch_fire = &mut self.halt_and_catch_fire; - other.halt_and_catch_fire.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 == *x } else { false }) - .is_none() - { - let _index_ = halt_and_catch_fire.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.grouped.len() != other.grouped.len() { + other.grouped.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in grouped, if it's not there add it to grouped. + if self + .grouped + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.grouped.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_grouped(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - halt_and_catch_fire.push(Some(x.clone())); - } - } - }); - } - - if self.x_if.len() != other.x_if.len() { - let mut x_if = &mut self.x_if; - other.x_if.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 == *x } else { false }) - .is_none() - { - let _index_ = x_if.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.halt_and_catch_fire.len() != other.halt_and_catch_fire.len() { + other.halt_and_catch_fire.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 self + .halt_and_catch_fire + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.halt_and_catch_fire.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_halt_and_catch_fire(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_if.push(Some(x.clone())); - } - } - }); - } - - if self.implementation_block.len() != other.implementation_block.len() { - let mut implementation_block = &mut self.implementation_block; - other.implementation_block.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 == *x } else { false }) - .is_none() - { - let _index_ = implementation_block.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_if.len() != other.x_if.len() { + other.x_if.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 self + .x_if + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_if.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_if(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - implementation_block.push(Some(x.clone())); - } - } - }); - } - - if self.import.len() != other.import.len() { - let mut import = &mut self.import; - other.import.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 == *x } else { false }) - .is_none() - { - let _index_ = import.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.implementation_block.len() != other.implementation_block.len() { + other.implementation_block.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 self + .implementation_block + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.implementation_block.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_implementation_block(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - import.push(Some(x.clone())); - } - } - }); - } - - if self.index.len() != other.index.len() { - let mut index = &mut self.index; - other.index.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 == *x } else { false }) - .is_none() - { - let _index_ = index.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.import.len() != other.import.len() { + other.import.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in import, if it's not there add it to import. + if self + .import + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.import.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_import(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - index.push(Some(x.clone())); - } - } - }); - } - - if self.integer_literal.len() != other.integer_literal.len() { - let mut integer_literal = &mut self.integer_literal; - other.integer_literal.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 == *x } else { false }) - .is_none() - { - let _index_ = integer_literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.index.len() != other.index.len() { + other.index.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in index, if it's not there add it to index. + if self + .index + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.index.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_index(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - integer_literal.push(Some(x.clone())); - } - } - }); - } - - if self.item.len() != other.item.len() { - let mut item = &mut self.item; - other.item.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 == *x } else { false }) - .is_none() - { - let _index_ = item.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.integer_literal.len() != other.integer_literal.len() { + other.integer_literal.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 self + .integer_literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.integer_literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_integer_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - item.push(Some(x.clone())); - } - } - }); - } - - if self.lambda.len() != other.lambda.len() { - let mut lambda = &mut self.lambda; - other.lambda.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 == *x } else { false }) - .is_none() - { - let _index_ = lambda.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.item.len() != other.item.len() { + other.item.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in item, if it's not there add it to item. + if self + .item + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.item.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_item(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - lambda.push(Some(x.clone())); - } - } - }); - } - - if self.lambda_parameter.len() != other.lambda_parameter.len() { - let mut lambda_parameter = &mut self.lambda_parameter; - other.lambda_parameter.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 == *x } else { false }) - .is_none() - { - let _index_ = lambda_parameter.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.lambda.len() != other.lambda.len() { + other.lambda.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda, if it's not there add it to lambda. + if self + .lambda + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.lambda.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_lambda(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - lambda_parameter.push(Some(x.clone())); - } - } - }); - } - - if self.let_statement.len() != other.let_statement.len() { - let mut let_statement = &mut self.let_statement; - other.let_statement.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 == *x } else { false }) - .is_none() - { - let _index_ = let_statement.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.lambda_parameter.len() != other.lambda_parameter.len() { + other.lambda_parameter.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 self + .lambda_parameter + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.lambda_parameter.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_lambda_parameter(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - let_statement.push(Some(x.clone())); - } - } - }); - } - - if self.list.len() != other.list.len() { - let mut list = &mut self.list; - other.list.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 == *x } else { false }) - .is_none() - { - let _index_ = list.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.let_statement.len() != other.let_statement.len() { + other.let_statement.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 self + .let_statement + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.let_statement.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_let_statement(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - list.push(Some(x.clone())); - } - } - }); - } - - if self.list_element.len() != other.list_element.len() { - let mut list_element = &mut self.list_element; - other.list_element.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 == *x } else { false }) - .is_none() - { - let _index_ = list_element.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.list.len() != other.list.len() { + other.list.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list, if it's not there add it to list. + if self + .list + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.list.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_list(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - list_element.push(Some(x.clone())); - } - } - }); - } - - if self.list_expression.len() != other.list_expression.len() { - let mut list_expression = &mut self.list_expression; - other.list_expression.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 == *x } else { false }) - .is_none() - { - let _index_ = list_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.list_element.len() != other.list_element.len() { + other.list_element.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 self + .list_element + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.list_element.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_list_element(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - list_expression.push(Some(x.clone())); - } - } - }); - } - - if self.literal.len() != other.literal.len() { - let mut literal = &mut self.literal; - other.literal.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 == *x } else { false }) - .is_none() - { - let _index_ = literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.list_expression.len() != other.list_expression.len() { + other.list_expression.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 self + .list_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.list_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_list_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - literal.push(Some(x.clone())); - } - } - }); - } - - if self.local_variable.len() != other.local_variable.len() { - let mut local_variable = &mut self.local_variable; - other.local_variable.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 == *x } else { false }) - .is_none() - { - let _index_ = local_variable.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.literal.len() != other.literal.len() { + other.literal.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in literal, if it's not there add it to literal. + if self + .literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - local_variable.push(Some(x.clone())); - } - } - }); - } - - if self.x_macro.len() != other.x_macro.len() { - let mut x_macro = &mut self.x_macro; - other.x_macro.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 == *x } else { false }) - .is_none() - { - let _index_ = x_macro.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.local_variable.len() != other.local_variable.len() { + other.local_variable.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 self + .local_variable + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.local_variable.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_local_variable(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_macro.push(Some(x.clone())); - } - } - }); - } - - if self.map.len() != other.map.len() { - let mut map = &mut self.map; - other.map.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 == *x } else { false }) - .is_none() - { - let _index_ = map.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_macro.len() != other.x_macro.len() { + other.x_macro.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 self + .x_macro + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_macro.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_macro(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - map.push(Some(x.clone())); - } - } - }); - } - - if self.map_element.len() != other.map_element.len() { - let mut map_element = &mut self.map_element; - other.map_element.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 == *x } else { false }) - .is_none() - { - let _index_ = map_element.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.map.len() != other.map.len() { + other.map.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map, if it's not there add it to map. + if self + .map + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.map.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_map(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - map_element.push(Some(x.clone())); - } - } - }); - } - - if self.map_expression.len() != other.map_expression.len() { - let mut map_expression = &mut self.map_expression; - other.map_expression.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 == *x } else { false }) - .is_none() - { - let _index_ = map_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.map_element.len() != other.map_element.len() { + other.map_element.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 self + .map_element + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.map_element.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_map_element(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - map_expression.push(Some(x.clone())); - } - } - }); - } - - if self.x_match.len() != other.x_match.len() { - let mut x_match = &mut self.x_match; - other.x_match.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 == *x } else { false }) - .is_none() - { - let _index_ = x_match.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.map_expression.len() != other.map_expression.len() { + other.map_expression.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 self + .map_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.map_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_map_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_match.push(Some(x.clone())); - } - } - }); - } - - if self.method_call.len() != other.method_call.len() { - let mut method_call = &mut self.method_call; - other.method_call.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 == *x } else { false }) - .is_none() - { - let _index_ = method_call.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_match.len() != other.x_match.len() { + other.x_match.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 self + .x_match + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_match.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_match(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - method_call.push(Some(x.clone())); - } - } - }); - } - - if self.named_field_expression.len() != other.named_field_expression.len() { - let mut named_field_expression = &mut self.named_field_expression; - other.named_field_expression.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 == *x } else { false }) - .is_none() - { - let _index_ = named_field_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.method_call.len() != other.method_call.len() { + other.method_call.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 self + .method_call + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.method_call.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_method_call(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - named_field_expression.push(Some(x.clone())); - } - } - }); - } - - if self.z_object_store.len() != other.z_object_store.len() { - let mut z_object_store = &mut self.z_object_store; - other.z_object_store.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 == *x } else { false }) - .is_none() - { - let _index_ = z_object_store.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.named_field_expression.len() != other.named_field_expression.len() { + other.named_field_expression.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 self + .named_field_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.named_field_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_named_field_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - z_object_store.push(Some(x.clone())); - } - } - }); - } - - if self.object_wrapper.len() != other.object_wrapper.len() { - let mut object_wrapper = &mut self.object_wrapper; - other.object_wrapper.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 == *x } else { false }) - .is_none() - { - let _index_ = object_wrapper.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.z_object_store.len() != other.z_object_store.len() { + other.z_object_store.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 self + .z_object_store + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.z_object_store.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_z_object_store(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - object_wrapper.push(Some(x.clone())); - } - } - }); - } - - if self.operator.len() != other.operator.len() { - let mut operator = &mut self.operator; - other.operator.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 == *x } else { false }) - .is_none() - { - let _index_ = operator.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.object_wrapper.len() != other.object_wrapper.len() { + other.object_wrapper.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 self + .object_wrapper + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.object_wrapper.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_object_wrapper(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - operator.push(Some(x.clone())); - } - } - }); - } - - if self.parameter.len() != other.parameter.len() { - let mut parameter = &mut self.parameter; - other.parameter.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 == *x } else { false }) - .is_none() - { - let _index_ = parameter.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.operator.len() != other.operator.len() { + other.operator.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in operator, if it's not there add it to operator. + if self + .operator + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.operator.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_operator(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - parameter.push(Some(x.clone())); - } - } - }); - } - - if self.x_path.len() != other.x_path.len() { - let mut x_path = &mut self.x_path; - other.x_path.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 == *x } else { false }) - .is_none() - { - let _index_ = x_path.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.parameter.len() != other.parameter.len() { + other.parameter.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in parameter, if it's not there add it to parameter. + if self + .parameter + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.parameter.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_parameter(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_path.push(Some(x.clone())); - } - } - }); - } - - if self.path_element.len() != other.path_element.len() { - let mut path_element = &mut self.path_element; - other.path_element.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 == *x } else { false }) - .is_none() - { - let _index_ = path_element.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_path.len() != other.x_path.len() { + other.x_path.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 self + .x_path + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_path.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_path(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - path_element.push(Some(x.clone())); - } - } - }); - } - - if self.pattern.len() != other.pattern.len() { - let mut pattern = &mut self.pattern; - other.pattern.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 == *x } else { false }) - .is_none() - { - let _index_ = pattern.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.path_element.len() != other.path_element.len() { + other.path_element.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 self + .path_element + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.path_element.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_path_element(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - pattern.push(Some(x.clone())); - } - } - }); - } - - if self.x_plugin.len() != other.x_plugin.len() { - let mut x_plugin = &mut self.x_plugin; - other.x_plugin.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 == *x } else { false }) - .is_none() - { - let _index_ = x_plugin.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.pattern.len() != other.pattern.len() { + other.pattern.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in pattern, if it's not there add it to pattern. + if self + .pattern + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.pattern.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_pattern(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_plugin.push(Some(x.clone())); - } - } - }); - } - - if self.x_print.len() != other.x_print.len() { - let mut x_print = &mut self.x_print; - other.x_print.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 == *x } else { false }) - .is_none() - { - let _index_ = x_print.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_plugin.len() != other.x_plugin.len() { + other.x_plugin.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 self + .x_plugin + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_plugin.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_plugin(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_print.push(Some(x.clone())); - } - } - }); - } - - if self.range_expression.len() != other.range_expression.len() { - let mut range_expression = &mut self.range_expression; - other.range_expression.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 == *x } else { false }) - .is_none() - { - let _index_ = range_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_print.len() != other.x_print.len() { + other.x_print.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 self + .x_print + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_print.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_print(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - range_expression.push(Some(x.clone())); - } - } - }); - } - - if self.result_statement.len() != other.result_statement.len() { - let mut result_statement = &mut self.result_statement; - other.result_statement.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 == *x } else { false }) - .is_none() - { - let _index_ = result_statement.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.range_expression.len() != other.range_expression.len() { + other.range_expression.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 self + .range_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.range_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_range_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - result_statement.push(Some(x.clone())); - } - } - }); - } - - if self.x_return.len() != other.x_return.len() { - let mut x_return = &mut self.x_return; - other.x_return.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 == *x } else { false }) - .is_none() - { - let _index_ = x_return.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.result_statement.len() != other.result_statement.len() { + other.result_statement.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 self + .result_statement + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.result_statement.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_result_statement(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_return.push(Some(x.clone())); - } - } - }); - } - - if self.span.len() != other.span.len() { - let mut span = &mut self.span; - other.span.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 == *x } else { false }) - .is_none() - { - let _index_ = span.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_return.len() != other.x_return.len() { + other.x_return.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 self + .x_return + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_return.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_return(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - span.push(Some(x.clone())); - } - } - }); - } - - if self.statement.len() != other.statement.len() { - let mut statement = &mut self.statement; - other.statement.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 == *x } else { false }) - .is_none() - { - let _index_ = statement.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.span.len() != other.span.len() { + other.span.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in span, if it's not there add it to span. + if self + .span + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.span.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_span(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - statement.push(Some(x.clone())); - } - } - }); - } - - if self.static_method_call.len() != other.static_method_call.len() { - let mut static_method_call = &mut self.static_method_call; - other.static_method_call.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 == *x } else { false }) - .is_none() - { - let _index_ = static_method_call.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.statement.len() != other.statement.len() { + other.statement.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in statement, if it's not there add it to statement. + if self + .statement + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.statement.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_statement(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - static_method_call.push(Some(x.clone())); - } - } - }); - } - - if self.string_bit.len() != other.string_bit.len() { - let mut string_bit = &mut self.string_bit; - other.string_bit.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 == *x } else { false }) - .is_none() - { - let _index_ = string_bit.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.static_method_call.len() != other.static_method_call.len() { + other.static_method_call.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 self + .static_method_call + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.static_method_call.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_static_method_call(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - string_bit.push(Some(x.clone())); - } - } - }); - } - - if self.string_literal.len() != other.string_literal.len() { - let mut string_literal = &mut self.string_literal; - other.string_literal.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 == *x } else { false }) - .is_none() - { - let _index_ = string_literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.string_bit.len() != other.string_bit.len() { + other.string_bit.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 self + .string_bit + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.string_bit.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_string_bit(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - string_literal.push(Some(x.clone())); - } - } - }); - } - - if self.woog_struct.len() != other.woog_struct.len() { - let mut woog_struct = &mut self.woog_struct; - other.woog_struct.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 == *x } else { false }) - .is_none() - { - let _index_ = woog_struct.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.string_literal.len() != other.string_literal.len() { + other.string_literal.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 self + .string_literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.string_literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_string_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - woog_struct.push(Some(x.clone())); - } - } - }); - } - - if self.struct_expression.len() != other.struct_expression.len() { - let mut struct_expression = &mut self.struct_expression; - other.struct_expression.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 == *x } else { false }) - .is_none() - { - let _index_ = struct_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.woog_struct.len() != other.woog_struct.len() { + other.woog_struct.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 self + .woog_struct + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.woog_struct.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_woog_struct(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - struct_expression.push(Some(x.clone())); - } - } - }); - } - - if self.struct_field.len() != other.struct_field.len() { - let mut struct_field = &mut self.struct_field; - other.struct_field.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 == *x } else { false }) - .is_none() - { - let _index_ = struct_field.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.struct_expression.len() != other.struct_expression.len() { + other.struct_expression.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 self + .struct_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.struct_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_struct_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - struct_field.push(Some(x.clone())); - } - } - }); - } - - if self.struct_generic.len() != other.struct_generic.len() { - let mut struct_generic = &mut self.struct_generic; - other.struct_generic.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 == *x } else { false }) - .is_none() - { - let _index_ = struct_generic.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.struct_field.len() != other.struct_field.len() { + other.struct_field.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 self + .struct_field + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.struct_field.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_struct_field(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - struct_generic.push(Some(x.clone())); - } - } - }); - } - - if self.tuple_field.len() != other.tuple_field.len() { - let mut tuple_field = &mut self.tuple_field; - other.tuple_field.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 == *x } else { false }) - .is_none() - { - let _index_ = tuple_field.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.struct_generic.len() != other.struct_generic.len() { + other.struct_generic.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 self + .struct_generic + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.struct_generic.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_struct_generic(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - tuple_field.push(Some(x.clone())); - } - } - }); - } - - if self.type_cast.len() != other.type_cast.len() { - let mut type_cast = &mut self.type_cast; - other.type_cast.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 == *x } else { false }) - .is_none() - { - let _index_ = type_cast.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.tuple_field.len() != other.tuple_field.len() { + other.tuple_field.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 self + .tuple_field + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.tuple_field.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_tuple_field(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - type_cast.push(Some(x.clone())); - } - } - }); - } - - if self.unary.len() != other.unary.len() { - let mut unary = &mut self.unary; - other.unary.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 == *x } else { false }) - .is_none() - { - let _index_ = unary.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.type_cast.len() != other.type_cast.len() { + other.type_cast.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 self + .type_cast + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.type_cast.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_type_cast(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - unary.push(Some(x.clone())); - } - } - }); - } - - if self.unit.len() != other.unit.len() { - let mut unit = &mut self.unit; - other.unit.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 == *x } else { false }) - .is_none() - { - let _index_ = unit.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.unary.len() != other.unary.len() { + other.unary.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unary, if it's not there add it to unary. + if self + .unary + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.unary.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_unary(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - unit.push(Some(x.clone())); - } - } - }); - } - - if self.unnamed_field_expression.len() != other.unnamed_field_expression.len() { - let mut unnamed_field_expression = &mut self.unnamed_field_expression; - other.unnamed_field_expression.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 == *x } else { false }) - .is_none() - { - let _index_ = unnamed_field_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.unit.len() != other.unit.len() { + other.unit.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unit, if it's not there add it to unit. + if self + .unit + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.unit.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_unit(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - unnamed_field_expression.push(Some(x.clone())); - } - } - }); - } - - if self.x_value.len() != other.x_value.len() { - let mut x_value = &mut self.x_value; - other.x_value.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 == *x } else { false }) - .is_none() - { - let _index_ = x_value.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.unnamed_field_expression.len() != other.unnamed_field_expression.len() { + other.unnamed_field_expression.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 self + .unnamed_field_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.unnamed_field_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_unnamed_field_expression( + |id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); + } + + x.clone() + }, + ); + } + } + }); + // } + + // if self.x_value.len() != other.x_value.len() { + other.x_value.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 self + .x_value + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_value.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_value(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_value.push(Some(x.clone())); - } - } - }); - } - - if self.value_type.len() != other.value_type.len() { - let mut value_type = &mut self.value_type; - other.value_type.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 == *x } else { false }) - .is_none() - { - let _index_ = value_type.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.value_type.len() != other.value_type.len() { + other.value_type.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 self + .value_type + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.value_type.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_value_type(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - value_type.push(Some(x.clone())); - } - } - }); - } - - if self.variable.len() != other.variable.len() { - let mut variable = &mut self.variable; - other.variable.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 == *x } else { false }) - .is_none() - { - let _index_ = variable.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.variable.len() != other.variable.len() { + other.variable.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable, if it's not there add it to variable. + if self + .variable + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.variable.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_variable(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - variable.push(Some(x.clone())); - } - } - }); - } - - if self.variable_expression.len() != other.variable_expression.len() { - let mut variable_expression = &mut self.variable_expression; - other.variable_expression.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 == *x } else { false }) - .is_none() - { - let _index_ = variable_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.variable_expression.len() != other.variable_expression.len() { + other.variable_expression.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 self + .variable_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.variable_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_variable_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - variable_expression.push(Some(x.clone())); - } + + x.clone() + }); } - }); - } + } + }); + // } } pub fn new() -> Self { let mut store = Self { diff --git a/src/v2/lu_dog_vec_tracy/store.rs b/src/v2/lu_dog_vec_tracy/store.rs index d279b3d4..78499a1f 100644 --- a/src/v2/lu_dog_vec_tracy/store.rs +++ b/src/v2/lu_dog_vec_tracy/store.rs @@ -489,2224 +489,2304 @@ impl Clone for ObjectStore { } impl ObjectStore { pub fn merge(&mut self, other: &ObjectStore) { - if self.argument.borrow().len() != other.argument.borrow().len() { - let mut argument = self.argument.borrow_mut(); - other.argument.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = argument.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; - } - argument.push(Some(x.clone())); - } - } - }); - } - - if self.a_wait.borrow().len() != other.a_wait.borrow().len() { - let mut a_wait = self.a_wait.borrow_mut(); - other.a_wait.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = a_wait.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; - } - a_wait.push(Some(x.clone())); - } - } - }); - } - - if self.binary.borrow().len() != other.binary.borrow().len() { - let mut binary = self.binary.borrow_mut(); - other.binary.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = binary.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + // if self.argument.len() != other.argument.len() { + other.argument.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in argument, if it's not there add it to argument. + if self + .argument + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.argument.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_argument(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - binary.push(Some(x.clone())); - } - } - }); - } - - if self.block.borrow().len() != other.block.borrow().len() { - let mut block = self.block.borrow_mut(); - other.block.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = block.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.a_wait.len() != other.a_wait.len() { + other.a_wait.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 self + .a_wait + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.a_wait.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_a_wait(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - block.push(Some(x.clone())); - } - } - }); - } - - if self.body.borrow().len() != other.body.borrow().len() { - let mut body = self.body.borrow_mut(); - other.body.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = body.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.binary.len() != other.binary.len() { + other.binary.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in binary, if it's not there add it to binary. + if self + .binary + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.binary.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_binary(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - body.push(Some(x.clone())); - } - } - }); - } - - if self.boolean_literal.borrow().len() != other.boolean_literal.borrow().len() { - let mut boolean_literal = self.boolean_literal.borrow_mut(); - other.boolean_literal.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = boolean_literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.block.len() != other.block.len() { + other.block.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in block, if it's not there add it to block. + if self + .block + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.block.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_block(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - boolean_literal.push(Some(x.clone())); - } - } - }); - } - - if self.boolean_operator.borrow().len() != other.boolean_operator.borrow().len() { - let mut boolean_operator = self.boolean_operator.borrow_mut(); - other.boolean_operator.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = boolean_operator.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.body.len() != other.body.len() { + other.body.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in body, if it's not there add it to body. + if self + .body + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.body.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_body(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - boolean_operator.push(Some(x.clone())); - } - } - }); - } - - if self.call.borrow().len() != other.call.borrow().len() { - let mut call = self.call.borrow_mut(); - other.call.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = call.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.boolean_literal.len() != other.boolean_literal.len() { + other.boolean_literal.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 self + .boolean_literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.boolean_literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_boolean_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - call.push(Some(x.clone())); - } - } - }); - } - - if self.char_literal.borrow().len() != other.char_literal.borrow().len() { - let mut char_literal = self.char_literal.borrow_mut(); - other.char_literal.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = char_literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.boolean_operator.len() != other.boolean_operator.len() { + other.boolean_operator.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 self + .boolean_operator + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.boolean_operator.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_boolean_operator(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - char_literal.push(Some(x.clone())); - } - } - }); - } - - if self.comparison.borrow().len() != other.comparison.borrow().len() { - let mut comparison = self.comparison.borrow_mut(); - other.comparison.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = comparison.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.call.len() != other.call.len() { + other.call.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in call, if it's not there add it to call. + if self + .call + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.call.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_call(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - comparison.push(Some(x.clone())); - } - } - }); - } - - if self.data_structure.borrow().len() != other.data_structure.borrow().len() { - let mut data_structure = self.data_structure.borrow_mut(); - other.data_structure.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = data_structure.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.char_literal.len() != other.char_literal.len() { + other.char_literal.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 self + .char_literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.char_literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_char_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - data_structure.push(Some(x.clone())); - } - } - }); - } - - if self.dwarf_source_file.borrow().len() != other.dwarf_source_file.borrow().len() { - let mut dwarf_source_file = self.dwarf_source_file.borrow_mut(); - other.dwarf_source_file.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = dwarf_source_file.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.comparison.len() != other.comparison.len() { + other.comparison.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in comparison, if it's not there add it to comparison. + if self + .comparison + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.comparison.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_comparison(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - dwarf_source_file.push(Some(x.clone())); - } - } - }); - } - - if self.enum_field.borrow().len() != other.enum_field.borrow().len() { - let mut enum_field = self.enum_field.borrow_mut(); - other.enum_field.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_field.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.data_structure.len() != other.data_structure.len() { + other.data_structure.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 self + .data_structure + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.data_structure.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_data_structure(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - enum_field.push(Some(x.clone())); - } - } - }); - } - - if self.enum_generic.borrow().len() != other.enum_generic.borrow().len() { - let mut enum_generic = self.enum_generic.borrow_mut(); - other.enum_generic.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_generic.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.dwarf_source_file.len() != other.dwarf_source_file.len() { + other.dwarf_source_file.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 self + .dwarf_source_file + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.dwarf_source_file.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_dwarf_source_file(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - enum_generic.push(Some(x.clone())); - } - } - }); - } - - if self.enum_generic_type.borrow().len() != other.enum_generic_type.borrow().len() { - let mut enum_generic_type = self.enum_generic_type.borrow_mut(); - other.enum_generic_type.borrow().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. - if enum_generic_type - .iter() - .find(|&y| { - if let Some(y) = y { - *y.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_generic_type.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.enum_field.len() != other.enum_field.len() { + other.enum_field.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 self + .enum_field + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.enum_field.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_enum_field(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - enum_generic_type.push(Some(x.clone())); - } - } - }); - } - - if self.enumeration.borrow().len() != other.enumeration.borrow().len() { - let mut enumeration = self.enumeration.borrow_mut(); - other.enumeration.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = enumeration.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.enum_generic.len() != other.enum_generic.len() { + other.enum_generic.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 self + .enum_generic + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.enum_generic.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_enum_generic(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - enumeration.push(Some(x.clone())); - } - } - }); - } - - if self.expression.borrow().len() != other.expression.borrow().len() { - let mut expression = self.expression.borrow_mut(); - other.expression.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.enum_generic_type.len() != other.enum_generic_type.len() { + other.enum_generic_type.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. + if self + .enum_generic_type + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.enum_generic_type.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_enum_generic_type(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - expression.push(Some(x.clone())); - } - } - }); - } - - if self.expression_bit.borrow().len() != other.expression_bit.borrow().len() { - let mut expression_bit = self.expression_bit.borrow_mut(); - other.expression_bit.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = expression_bit.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.enumeration.len() != other.enumeration.len() { + other.enumeration.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enumeration, if it's not there add it to enumeration. + if self + .enumeration + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.enumeration.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_enumeration(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - expression_bit.push(Some(x.clone())); - } - } - }); - } - - if self.expression_statement.borrow().len() != other.expression_statement.borrow().len() { - let mut expression_statement = self.expression_statement.borrow_mut(); - other.expression_statement.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = expression_statement.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.expression.len() != other.expression.len() { + other.expression.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression, if it's not there add it to expression. + if self + .expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - expression_statement.push(Some(x.clone())); - } - } - }); - } - - if self.external_implementation.borrow().len() - != other.external_implementation.borrow().len() - { - let mut external_implementation = self.external_implementation.borrow_mut(); - other.external_implementation.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = external_implementation.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.expression_bit.len() != other.expression_bit.len() { + other.expression_bit.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 self + .expression_bit + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.expression_bit.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_expression_bit(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - external_implementation.push(Some(x.clone())); - } - } - }); - } - - if self.field.borrow().len() != other.field.borrow().len() { - let mut field = self.field.borrow_mut(); - other.field.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = field.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.expression_statement.len() != other.expression_statement.len() { + other.expression_statement.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 self + .expression_statement + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.expression_statement.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_expression_statement(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - field.push(Some(x.clone())); - } - } - }); - } - - if self.field_access.borrow().len() != other.field_access.borrow().len() { - let mut field_access = self.field_access.borrow_mut(); - other.field_access.borrow().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.borrow() == *x.borrow() - } else { - false + + x.clone() + }); + } + } + }); + // } + + // if self.external_implementation.len() != other.external_implementation.len() { + other.external_implementation.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 self + .external_implementation + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.external_implementation.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_external_implementation( + |id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - }) - .is_none() - { - let _index_ = field_access.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }, + ); + } + } + }); + // } + + // if self.field.len() != other.field.len() { + other.field.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field, if it's not there add it to field. + if self + .field + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.field.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_field(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - field_access.push(Some(x.clone())); - } - } - }); - } - - if self.field_access_target.borrow().len() != other.field_access_target.borrow().len() { - let mut field_access_target = self.field_access_target.borrow_mut(); - other.field_access_target.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = field_access_target.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.field_access.len() != other.field_access.len() { + other.field_access.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 self + .field_access + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.field_access.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_field_access(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - field_access_target.push(Some(x.clone())); - } - } - }); - } - - if self.field_expression.borrow().len() != other.field_expression.borrow().len() { - let mut field_expression = self.field_expression.borrow_mut(); - other.field_expression.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = field_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.field_access_target.len() != other.field_access_target.len() { + other.field_access_target.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 self + .field_access_target + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.field_access_target.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_field_access_target(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - field_expression.push(Some(x.clone())); - } - } - }); - } - - if self.float_literal.borrow().len() != other.float_literal.borrow().len() { - let mut float_literal = self.float_literal.borrow_mut(); - other.float_literal.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = float_literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.field_expression.len() != other.field_expression.len() { + other.field_expression.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 self + .field_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.field_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_field_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - float_literal.push(Some(x.clone())); - } - } - }); - } - - if self.for_loop.borrow().len() != other.for_loop.borrow().len() { - let mut for_loop = self.for_loop.borrow_mut(); - other.for_loop.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = for_loop.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.float_literal.len() != other.float_literal.len() { + other.float_literal.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 self + .float_literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.float_literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_float_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - for_loop.push(Some(x.clone())); - } - } - }); - } - - if self.format_bit.borrow().len() != other.format_bit.borrow().len() { - let mut format_bit = self.format_bit.borrow_mut(); - other.format_bit.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = format_bit.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.for_loop.len() != other.for_loop.len() { + other.for_loop.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 self + .for_loop + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.for_loop.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_for_loop(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - format_bit.push(Some(x.clone())); - } - } - }); - } - - if self.format_string.borrow().len() != other.format_string.borrow().len() { - let mut format_string = self.format_string.borrow_mut(); - other.format_string.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = format_string.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.format_bit.len() != other.format_bit.len() { + other.format_bit.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 self + .format_bit + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.format_bit.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_format_bit(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - format_string.push(Some(x.clone())); - } - } - }); - } - - if self.func_generic.borrow().len() != other.func_generic.borrow().len() { - let mut func_generic = self.func_generic.borrow_mut(); - other.func_generic.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = func_generic.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.format_string.len() != other.format_string.len() { + other.format_string.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 self + .format_string + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.format_string.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_format_string(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - func_generic.push(Some(x.clone())); - } - } - }); - } - - if self.function.borrow().len() != other.function.borrow().len() { - let mut function = self.function.borrow_mut(); - other.function.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = function.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.func_generic.len() != other.func_generic.len() { + other.func_generic.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 self + .func_generic + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.func_generic.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_func_generic(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - function.push(Some(x.clone())); - } - } - }); - } - - if self.function_call.borrow().len() != other.function_call.borrow().len() { - let mut function_call = self.function_call.borrow_mut(); - other.function_call.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = function_call.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.function.len() != other.function.len() { + other.function.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function, if it's not there add it to function. + if self + .function + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.function.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_function(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - function_call.push(Some(x.clone())); - } - } - }); - } - - if self.x_future.borrow().len() != other.x_future.borrow().len() { - let mut x_future = self.x_future.borrow_mut(); - other.x_future.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = x_future.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.function_call.len() != other.function_call.len() { + other.function_call.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 self + .function_call + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.function_call.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_function_call(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_future.push(Some(x.clone())); - } - } - }); - } - - if self.grouped.borrow().len() != other.grouped.borrow().len() { - let mut grouped = self.grouped.borrow_mut(); - other.grouped.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = grouped.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_future.len() != other.x_future.len() { + other.x_future.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 self + .x_future + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_future.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_future(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - grouped.push(Some(x.clone())); - } - } - }); - } - - if self.halt_and_catch_fire.borrow().len() != other.halt_and_catch_fire.borrow().len() { - let mut halt_and_catch_fire = self.halt_and_catch_fire.borrow_mut(); - other.halt_and_catch_fire.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = halt_and_catch_fire.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.grouped.len() != other.grouped.len() { + other.grouped.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in grouped, if it's not there add it to grouped. + if self + .grouped + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.grouped.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_grouped(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - halt_and_catch_fire.push(Some(x.clone())); - } - } - }); - } - - if self.x_if.borrow().len() != other.x_if.borrow().len() { - let mut x_if = self.x_if.borrow_mut(); - other.x_if.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = x_if.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.halt_and_catch_fire.len() != other.halt_and_catch_fire.len() { + other.halt_and_catch_fire.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 self + .halt_and_catch_fire + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.halt_and_catch_fire.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_halt_and_catch_fire(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_if.push(Some(x.clone())); - } - } - }); - } - - if self.implementation_block.borrow().len() != other.implementation_block.borrow().len() { - let mut implementation_block = self.implementation_block.borrow_mut(); - other.implementation_block.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = implementation_block.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_if.len() != other.x_if.len() { + other.x_if.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 self + .x_if + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_if.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_if(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - implementation_block.push(Some(x.clone())); - } - } - }); - } - - if self.import.borrow().len() != other.import.borrow().len() { - let mut import = self.import.borrow_mut(); - other.import.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = import.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.implementation_block.len() != other.implementation_block.len() { + other.implementation_block.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 self + .implementation_block + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.implementation_block.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_implementation_block(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - import.push(Some(x.clone())); - } - } - }); - } - - if self.index.borrow().len() != other.index.borrow().len() { - let mut index = self.index.borrow_mut(); - other.index.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = index.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.import.len() != other.import.len() { + other.import.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in import, if it's not there add it to import. + if self + .import + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.import.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_import(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - index.push(Some(x.clone())); - } - } - }); - } - - if self.integer_literal.borrow().len() != other.integer_literal.borrow().len() { - let mut integer_literal = self.integer_literal.borrow_mut(); - other.integer_literal.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = integer_literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.index.len() != other.index.len() { + other.index.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in index, if it's not there add it to index. + if self + .index + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.index.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_index(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - integer_literal.push(Some(x.clone())); - } - } - }); - } - - if self.item.borrow().len() != other.item.borrow().len() { - let mut item = self.item.borrow_mut(); - other.item.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = item.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.integer_literal.len() != other.integer_literal.len() { + other.integer_literal.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 self + .integer_literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.integer_literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_integer_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - item.push(Some(x.clone())); - } - } - }); - } - - if self.lambda.borrow().len() != other.lambda.borrow().len() { - let mut lambda = self.lambda.borrow_mut(); - other.lambda.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = lambda.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.item.len() != other.item.len() { + other.item.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in item, if it's not there add it to item. + if self + .item + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.item.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_item(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - lambda.push(Some(x.clone())); - } - } - }); - } - - if self.lambda_parameter.borrow().len() != other.lambda_parameter.borrow().len() { - let mut lambda_parameter = self.lambda_parameter.borrow_mut(); - other.lambda_parameter.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = lambda_parameter.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.lambda.len() != other.lambda.len() { + other.lambda.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda, if it's not there add it to lambda. + if self + .lambda + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.lambda.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_lambda(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - lambda_parameter.push(Some(x.clone())); - } - } - }); - } - - if self.let_statement.borrow().len() != other.let_statement.borrow().len() { - let mut let_statement = self.let_statement.borrow_mut(); - other.let_statement.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = let_statement.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.lambda_parameter.len() != other.lambda_parameter.len() { + other.lambda_parameter.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 self + .lambda_parameter + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.lambda_parameter.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_lambda_parameter(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - let_statement.push(Some(x.clone())); - } - } - }); - } - - if self.list.borrow().len() != other.list.borrow().len() { - let mut list = self.list.borrow_mut(); - other.list.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = list.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.let_statement.len() != other.let_statement.len() { + other.let_statement.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 self + .let_statement + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.let_statement.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_let_statement(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - list.push(Some(x.clone())); - } - } - }); - } - - if self.list_element.borrow().len() != other.list_element.borrow().len() { - let mut list_element = self.list_element.borrow_mut(); - other.list_element.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = list_element.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.list.len() != other.list.len() { + other.list.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list, if it's not there add it to list. + if self + .list + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.list.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_list(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - list_element.push(Some(x.clone())); - } - } - }); - } - - if self.list_expression.borrow().len() != other.list_expression.borrow().len() { - let mut list_expression = self.list_expression.borrow_mut(); - other.list_expression.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = list_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.list_element.len() != other.list_element.len() { + other.list_element.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 self + .list_element + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.list_element.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_list_element(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - list_expression.push(Some(x.clone())); - } - } - }); - } - - if self.literal.borrow().len() != other.literal.borrow().len() { - let mut literal = self.literal.borrow_mut(); - other.literal.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.list_expression.len() != other.list_expression.len() { + other.list_expression.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 self + .list_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.list_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_list_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - literal.push(Some(x.clone())); - } - } - }); - } - - if self.local_variable.borrow().len() != other.local_variable.borrow().len() { - let mut local_variable = self.local_variable.borrow_mut(); - other.local_variable.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = local_variable.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.literal.len() != other.literal.len() { + other.literal.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in literal, if it's not there add it to literal. + if self + .literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - local_variable.push(Some(x.clone())); - } - } - }); - } - - if self.x_macro.borrow().len() != other.x_macro.borrow().len() { - let mut x_macro = self.x_macro.borrow_mut(); - other.x_macro.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = x_macro.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.local_variable.len() != other.local_variable.len() { + other.local_variable.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 self + .local_variable + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.local_variable.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_local_variable(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_macro.push(Some(x.clone())); - } - } - }); - } - - if self.map.borrow().len() != other.map.borrow().len() { - let mut map = self.map.borrow_mut(); - other.map.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = map.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_macro.len() != other.x_macro.len() { + other.x_macro.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 self + .x_macro + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_macro.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_macro(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - map.push(Some(x.clone())); - } - } - }); - } - - if self.map_element.borrow().len() != other.map_element.borrow().len() { - let mut map_element = self.map_element.borrow_mut(); - other.map_element.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = map_element.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.map.len() != other.map.len() { + other.map.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map, if it's not there add it to map. + if self + .map + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.map.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_map(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - map_element.push(Some(x.clone())); - } - } - }); - } - - if self.map_expression.borrow().len() != other.map_expression.borrow().len() { - let mut map_expression = self.map_expression.borrow_mut(); - other.map_expression.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = map_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.map_element.len() != other.map_element.len() { + other.map_element.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 self + .map_element + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.map_element.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_map_element(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - map_expression.push(Some(x.clone())); - } - } - }); - } - - if self.x_match.borrow().len() != other.x_match.borrow().len() { - let mut x_match = self.x_match.borrow_mut(); - other.x_match.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = x_match.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.map_expression.len() != other.map_expression.len() { + other.map_expression.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 self + .map_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.map_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_map_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_match.push(Some(x.clone())); - } - } - }); - } - - if self.method_call.borrow().len() != other.method_call.borrow().len() { - let mut method_call = self.method_call.borrow_mut(); - other.method_call.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = method_call.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_match.len() != other.x_match.len() { + other.x_match.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 self + .x_match + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_match.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_match(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - method_call.push(Some(x.clone())); - } + + x.clone() + }); } - }); - } + } + }); + // } - if self.named_field_expression.borrow().len() != other.named_field_expression.borrow().len() - { - let mut named_field_expression = self.named_field_expression.borrow_mut(); - other.named_field_expression.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = named_field_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + // if self.method_call.len() != other.method_call.len() { + other.method_call.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 self + .method_call + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.method_call.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_method_call(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - named_field_expression.push(Some(x.clone())); - } - } - }); - } - - if self.z_object_store.borrow().len() != other.z_object_store.borrow().len() { - let mut z_object_store = self.z_object_store.borrow_mut(); - other.z_object_store.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = z_object_store.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.named_field_expression.len() != other.named_field_expression.len() { + other.named_field_expression.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 self + .named_field_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.named_field_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_named_field_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - z_object_store.push(Some(x.clone())); - } - } - }); - } - - if self.object_wrapper.borrow().len() != other.object_wrapper.borrow().len() { - let mut object_wrapper = self.object_wrapper.borrow_mut(); - other.object_wrapper.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = object_wrapper.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.z_object_store.len() != other.z_object_store.len() { + other.z_object_store.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 self + .z_object_store + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.z_object_store.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_z_object_store(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - object_wrapper.push(Some(x.clone())); - } - } - }); - } - - if self.operator.borrow().len() != other.operator.borrow().len() { - let mut operator = self.operator.borrow_mut(); - other.operator.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = operator.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.object_wrapper.len() != other.object_wrapper.len() { + other.object_wrapper.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 self + .object_wrapper + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.object_wrapper.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_object_wrapper(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - operator.push(Some(x.clone())); - } - } - }); - } - - if self.parameter.borrow().len() != other.parameter.borrow().len() { - let mut parameter = self.parameter.borrow_mut(); - other.parameter.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = parameter.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.operator.len() != other.operator.len() { + other.operator.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in operator, if it's not there add it to operator. + if self + .operator + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.operator.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_operator(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - parameter.push(Some(x.clone())); - } - } - }); - } - - if self.x_path.borrow().len() != other.x_path.borrow().len() { - let mut x_path = self.x_path.borrow_mut(); - other.x_path.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = x_path.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.parameter.len() != other.parameter.len() { + other.parameter.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in parameter, if it's not there add it to parameter. + if self + .parameter + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.parameter.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_parameter(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_path.push(Some(x.clone())); - } - } - }); - } - - if self.path_element.borrow().len() != other.path_element.borrow().len() { - let mut path_element = self.path_element.borrow_mut(); - other.path_element.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = path_element.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_path.len() != other.x_path.len() { + other.x_path.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 self + .x_path + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_path.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_path(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - path_element.push(Some(x.clone())); - } - } - }); - } - - if self.pattern.borrow().len() != other.pattern.borrow().len() { - let mut pattern = self.pattern.borrow_mut(); - other.pattern.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = pattern.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.path_element.len() != other.path_element.len() { + other.path_element.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 self + .path_element + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.path_element.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_path_element(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - pattern.push(Some(x.clone())); - } - } - }); - } - - if self.x_plugin.borrow().len() != other.x_plugin.borrow().len() { - let mut x_plugin = self.x_plugin.borrow_mut(); - other.x_plugin.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = x_plugin.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.pattern.len() != other.pattern.len() { + other.pattern.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in pattern, if it's not there add it to pattern. + if self + .pattern + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.pattern.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_pattern(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_plugin.push(Some(x.clone())); - } - } - }); - } - - if self.x_print.borrow().len() != other.x_print.borrow().len() { - let mut x_print = self.x_print.borrow_mut(); - other.x_print.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = x_print.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_plugin.len() != other.x_plugin.len() { + other.x_plugin.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 self + .x_plugin + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_plugin.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_plugin(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_print.push(Some(x.clone())); - } - } - }); - } - - if self.range_expression.borrow().len() != other.range_expression.borrow().len() { - let mut range_expression = self.range_expression.borrow_mut(); - other.range_expression.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = range_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_print.len() != other.x_print.len() { + other.x_print.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 self + .x_print + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_print.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_print(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - range_expression.push(Some(x.clone())); - } - } - }); - } - - if self.result_statement.borrow().len() != other.result_statement.borrow().len() { - let mut result_statement = self.result_statement.borrow_mut(); - other.result_statement.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = result_statement.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.range_expression.len() != other.range_expression.len() { + other.range_expression.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 self + .range_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.range_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_range_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - result_statement.push(Some(x.clone())); - } - } - }); - } - - if self.x_return.borrow().len() != other.x_return.borrow().len() { - let mut x_return = self.x_return.borrow_mut(); - other.x_return.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = x_return.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.result_statement.len() != other.result_statement.len() { + other.result_statement.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 self + .result_statement + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.result_statement.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_result_statement(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_return.push(Some(x.clone())); - } - } - }); - } - - if self.span.borrow().len() != other.span.borrow().len() { - let mut span = self.span.borrow_mut(); - other.span.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = span.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.x_return.len() != other.x_return.len() { + other.x_return.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 self + .x_return + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_return.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_return(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - span.push(Some(x.clone())); - } - } - }); - } - - if self.statement.borrow().len() != other.statement.borrow().len() { - let mut statement = self.statement.borrow_mut(); - other.statement.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = statement.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.span.len() != other.span.len() { + other.span.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in span, if it's not there add it to span. + if self + .span + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.span.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_span(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - statement.push(Some(x.clone())); - } - } - }); - } - - if self.static_method_call.borrow().len() != other.static_method_call.borrow().len() { - let mut static_method_call = self.static_method_call.borrow_mut(); - other.static_method_call.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = static_method_call.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.statement.len() != other.statement.len() { + other.statement.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in statement, if it's not there add it to statement. + if self + .statement + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.statement.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_statement(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - static_method_call.push(Some(x.clone())); - } - } - }); - } - - if self.string_bit.borrow().len() != other.string_bit.borrow().len() { - let mut string_bit = self.string_bit.borrow_mut(); - other.string_bit.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = string_bit.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.static_method_call.len() != other.static_method_call.len() { + other.static_method_call.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 self + .static_method_call + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.static_method_call.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_static_method_call(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - string_bit.push(Some(x.clone())); - } - } - }); - } - - if self.string_literal.borrow().len() != other.string_literal.borrow().len() { - let mut string_literal = self.string_literal.borrow_mut(); - other.string_literal.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = string_literal.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.string_bit.len() != other.string_bit.len() { + other.string_bit.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 self + .string_bit + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.string_bit.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_string_bit(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - string_literal.push(Some(x.clone())); - } - } - }); - } - - if self.woog_struct.borrow().len() != other.woog_struct.borrow().len() { - let mut woog_struct = self.woog_struct.borrow_mut(); - other.woog_struct.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = woog_struct.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.string_literal.len() != other.string_literal.len() { + other.string_literal.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 self + .string_literal + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.string_literal.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_string_literal(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - woog_struct.push(Some(x.clone())); - } - } - }); - } - - if self.struct_expression.borrow().len() != other.struct_expression.borrow().len() { - let mut struct_expression = self.struct_expression.borrow_mut(); - other.struct_expression.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = struct_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.woog_struct.len() != other.woog_struct.len() { + other.woog_struct.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 self + .woog_struct + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.woog_struct.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_woog_struct(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - struct_expression.push(Some(x.clone())); - } - } - }); - } - - if self.struct_field.borrow().len() != other.struct_field.borrow().len() { - let mut struct_field = self.struct_field.borrow_mut(); - other.struct_field.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = struct_field.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.struct_expression.len() != other.struct_expression.len() { + other.struct_expression.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 self + .struct_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.struct_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_struct_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - struct_field.push(Some(x.clone())); - } - } - }); - } - - if self.struct_generic.borrow().len() != other.struct_generic.borrow().len() { - let mut struct_generic = self.struct_generic.borrow_mut(); - other.struct_generic.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = struct_generic.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.struct_field.len() != other.struct_field.len() { + other.struct_field.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 self + .struct_field + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.struct_field.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_struct_field(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - struct_generic.push(Some(x.clone())); - } - } - }); - } - - if self.tuple_field.borrow().len() != other.tuple_field.borrow().len() { - let mut tuple_field = self.tuple_field.borrow_mut(); - other.tuple_field.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = tuple_field.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.struct_generic.len() != other.struct_generic.len() { + other.struct_generic.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 self + .struct_generic + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.struct_generic.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_struct_generic(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - tuple_field.push(Some(x.clone())); - } - } - }); - } - - if self.type_cast.borrow().len() != other.type_cast.borrow().len() { - let mut type_cast = self.type_cast.borrow_mut(); - other.type_cast.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = type_cast.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.tuple_field.len() != other.tuple_field.len() { + other.tuple_field.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 self + .tuple_field + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.tuple_field.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_tuple_field(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - type_cast.push(Some(x.clone())); - } - } - }); - } - - if self.unary.borrow().len() != other.unary.borrow().len() { - let mut unary = self.unary.borrow_mut(); - other.unary.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = unary.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.type_cast.len() != other.type_cast.len() { + other.type_cast.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 self + .type_cast + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.type_cast.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_type_cast(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - unary.push(Some(x.clone())); - } - } - }); - } - - if self.unit.borrow().len() != other.unit.borrow().len() { - let mut unit = self.unit.borrow_mut(); - other.unit.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = unit.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.unary.len() != other.unary.len() { + other.unary.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unary, if it's not there add it to unary. + if self + .unary + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.unary.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_unary(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - unit.push(Some(x.clone())); - } - } - }); - } - - if self.unnamed_field_expression.borrow().len() - != other.unnamed_field_expression.borrow().len() - { - let mut unnamed_field_expression = self.unnamed_field_expression.borrow_mut(); - other - .unnamed_field_expression - .borrow() - .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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = unnamed_field_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; - } - unnamed_field_expression.push(Some(x.clone())); + + x.clone() + }); + } + } + }); + // } + + // if self.unit.len() != other.unit.len() { + other.unit.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unit, if it's not there add it to unit. + if self + .unit + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.unit.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_unit(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - } - }); - } - - if self.x_value.borrow().len() != other.x_value.borrow().len() { - let mut x_value = self.x_value.borrow_mut(); - other.x_value.borrow().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.borrow() == *x.borrow() - } else { - false + + x.clone() + }); + } + } + }); + // } + + // if self.unnamed_field_expression.len() != other.unnamed_field_expression.len() { + other.unnamed_field_expression.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 self + .unnamed_field_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.unnamed_field_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_unnamed_field_expression( + |id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - }) - .is_none() - { - let _index_ = x_value.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }, + ); + } + } + }); + // } + + // if self.x_value.len() != other.x_value.len() { + other.x_value.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 self + .x_value + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.x_value.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_x_value(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - x_value.push(Some(x.clone())); - } - } - }); - } - - if self.value_type.borrow().len() != other.value_type.borrow().len() { - let mut value_type = self.value_type.borrow_mut(); - other.value_type.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = value_type.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.value_type.len() != other.value_type.len() { + other.value_type.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 self + .value_type + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.value_type.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_value_type(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - value_type.push(Some(x.clone())); - } - } - }); - } - - if self.variable.borrow().len() != other.variable.borrow().len() { - let mut variable = self.variable.borrow_mut(); - other.variable.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = variable.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.variable.len() != other.variable.len() { + other.variable.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable, if it's not there add it to variable. + if self + .variable + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.variable.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_variable(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - variable.push(Some(x.clone())); - } - } - }); - } - - if self.variable_expression.borrow().len() != other.variable_expression.borrow().len() { - let mut variable_expression = self.variable_expression.borrow_mut(); - other.variable_expression.borrow().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.borrow() == *x.borrow() - } else { - false - } - }) - .is_none() - { - let _index_ = variable_expression.len(); - if x.borrow().id != _index_ { - x.borrow_mut().id = _index_; + + x.clone() + }); + } + } + }); + // } + + // if self.variable_expression.len() != other.variable_expression.len() { + other.variable_expression.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 self + .variable_expression + .borrow() + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + // let _index_ = self.variable_expression.borrow().len(); + // if x.borrow().id != _index_ { + // x.borrow_mut().id = _index_; + // } + self.inter_variable_expression(|id| -> Rc> { + if x.borrow().id != id { + panic!("id mismatch"); } - variable_expression.push(Some(x.clone())); - } + + x.clone() + }); } - }); - } + } + }); + // } } pub fn new() -> Self { let mut store = Self {