diff --git a/nac3core/src/primitives.rs b/nac3core/src/primitives.rs index e777749192..ced24da392 100644 --- a/nac3core/src/primitives.rs +++ b/nac3core/src/primitives.rs @@ -17,8 +17,11 @@ fn impl_math(def: &mut TypeDef, ty: &Type) { result: result.clone(), }; def.methods.insert("__add__", fun.clone()); + def.methods.insert("__iadd__", fun.clone()); def.methods.insert("__sub__", fun.clone()); + def.methods.insert("__isub__", fun.clone()); def.methods.insert("__mul__", fun.clone()); + def.methods.insert("__imul__", fun.clone()); def.methods.insert( "__neg__", FnDef { @@ -33,9 +36,21 @@ fn impl_math(def: &mut TypeDef, ty: &Type) { result: Some(PrimitiveType(FLOAT_TYPE).into()), }, ); + if ty.as_ref() == &PrimitiveType(FLOAT_TYPE) { + def.methods.insert( + "__itruediv__", + FnDef { + args: vec![ty.clone()], + result: Some(PrimitiveType(FLOAT_TYPE).into()), + }, + ); + } def.methods.insert("__floordiv__", fun.clone()); + def.methods.insert("__ifloordiv__", fun.clone()); def.methods.insert("__mod__", fun.clone()); - def.methods.insert("__pow__", fun); + def.methods.insert("__imod__", fun.clone()); + def.methods.insert("__pow__", fun.clone()); + def.methods.insert("__ipow__", fun); } fn impl_bits(def: &mut TypeDef, ty: &Type) {