`property(fget)` / `property(fget, fset)`, captures the descriptor pair the class chain hands to `LoadAttr` / `StoreAttr`. The `@x.setter` decorator builds the second form via `PropertySetter`. */
(&mut self, argc: u16)
| 8 | |
| 9 | /* `property(fget)` / `property(fget, fset)`, captures the descriptor pair the class chain hands to `LoadAttr` / `StoreAttr`. The `@x.setter` decorator builds the second form via `PropertySetter`. */ |
| 10 | pub fn call_property(&mut self, argc: u16) -> Result<(), VmErr> { |
| 11 | let args = self.pop_n(argc as usize)?; |
| 12 | let (getter, setter) = match args.as_slice() { |
| 13 | [g] => (*g, Val::none()), |
| 14 | [g, s] => (*g, *s), |
| 15 | _ => return Err(cold_type("property() takes 1 or 2 arguments")), |
| 16 | }; |
| 17 | let prop = self.heap.alloc(HeapObj::Property(getter, setter))?; |
| 18 | self.push(prop); |
| 19 | Ok(()) |
| 20 | } |
| 21 | |
| 22 | // `staticmethod(func)`: wraps a function so the class chain returns it unbound, with no `self`. |
| 23 | pub fn call_staticmethod(&mut self, argc: u16) -> Result<(), VmErr> { |
no test coverage detected