@@ -655,51 +655,6 @@ impl ReflectReference {
655655 ReflectReference :: into_script_ref ( reference, world)
656656 }
657657
658- /// Inserts the value into the reference at the specified index, if the reference is an appropriate container type.
659- ///
660- /// Arguments:
661- /// * `ctxt`: The function call context.
662- /// * `reference`: The reference to insert the value into.
663- /// * `key`: The index to insert the value at.
664- /// * `value`: The value to insert.
665- /// Returns:
666- /// * `result`: Nothing if the value was inserted successfully.
667- fn insert (
668- ctxt : FunctionCallContext ,
669- reference : ReflectReference ,
670- key : ScriptValue ,
671- value : ScriptValue ,
672- ) -> Result < ( ) , InteropError > {
673- profiling:: function_scope!( "insert" ) ;
674- let world = ctxt. world ( ) ?;
675- let key_type_id = reference. key_type_id ( world. clone ( ) ) ?. ok_or_else ( || {
676- InteropError :: unsupported_operation (
677- reference. tail_type_id ( world. clone ( ) ) . unwrap_or_default ( ) ,
678- Some ( Box :: new ( key. clone ( ) ) ) ,
679- "Could not get key type id. Are you trying to insert elements into a type that's not a map?" . to_owned ( ) ,
680- )
681- } ) ?;
682-
683- let mut key = <Box < dyn PartialReflect > >:: from_script_ref ( key_type_id, key, world. clone ( ) ) ?;
684-
685- if ctxt. convert_to_0_indexed ( ) {
686- key. convert_to_0_indexed_key ( ) ;
687- }
688-
689- let value_type_id = reference. element_type_id ( world. clone ( ) ) ?. ok_or_else ( || {
690- InteropError :: unsupported_operation (
691- reference. tail_type_id ( world. clone ( ) ) . unwrap_or_default ( ) ,
692- Some ( Box :: new ( value. clone ( ) ) ) ,
693- "Could not get element type id. Are you trying to insert elements into a type that's not a map?" . to_owned ( ) ,
694- )
695- } ) ?;
696-
697- let value =
698- <Box < dyn PartialReflect > >:: from_script_ref ( value_type_id, value, world. clone ( ) ) ?;
699-
700- reference. with_reflect_mut ( world, |s| s. try_insert_boxed ( key, value) ) ?
701- }
702-
703658 /// Clears the container, if the reference is an appropriate container type.
704659 /// Arguments:
705660 /// * `ctxt`: The function call context.
0 commit comments