MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / call_property

Method call_property

compiler/src/modules/vm/builtins/identity.rs:10–20  ·  view source on GitHub ↗

`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)

Source from the content-addressed store, hash-verified

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> {

Callers 1

dispatch_nativeMethod · 0.80

Calls 4

cold_typeFunction · 0.85
pop_nMethod · 0.80
pushMethod · 0.80
allocMethod · 0.45

Tested by

no test coverage detected