Refactor.

This commit is contained in:
Stephen Chung
2020-06-29 23:55:28 +08:00
parent 063851a6ad
commit d6a08be223
37 changed files with 386 additions and 172 deletions

View File

@@ -42,12 +42,10 @@ fn pad<T: Variant + Clone>(engine: &Engine, args: &mut [&mut Dynamic]) -> FuncRe
}
if len >= 0 {
let item = args[2].downcast_ref::<T>().unwrap().clone();
let item = args[2].clone();
let list = args[0].downcast_mut::<Array>().unwrap();
while list.len() < len as usize {
push(list, item.clone())?;
}
list.resize(len as usize, item);
}
Ok(())
}