(ctx: Context)
| 5 | use crate::{BuiltinMethod, Value, VmError, float_arg, vm::Context}; |
| 6 | |
| 7 | pub(crate) fn define_array_methods(ctx: Context) -> HashMap<InternedString, BuiltinMethod> { |
| 8 | [ |
| 9 | // Basic operations |
| 10 | ("append", BuiltinMethod(append)), |
| 11 | ("extend", BuiltinMethod(extend)), |
| 12 | ("insert", BuiltinMethod(insert)), |
| 13 | ("remove", BuiltinMethod(remove)), |
| 14 | ("pop", BuiltinMethod(pop)), |
| 15 | ("clear", BuiltinMethod(clear)), |
| 16 | // Search operations |
| 17 | ("index", BuiltinMethod(index)), |
| 18 | ("count", BuiltinMethod(count)), |
| 19 | // Ordering operations |
| 20 | ("sort", BuiltinMethod(sort)), |
| 21 | ("reverse", BuiltinMethod(reverse)), |
| 22 | // Subarray operations |
| 23 | ("slice", BuiltinMethod(slice)), |
| 24 | ] |
| 25 | .into_iter() |
| 26 | .map(|(name, f)| (ctx.intern_static(name), f)) |
| 27 | .collect() |
| 28 | } |
| 29 | |
| 30 | // Add an item to the end of the list |
| 31 | fn append<'gc>( |
no test coverage detected