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

Method mro_of

compiler/src/modules/vm/handlers/methods.rs:32–37  ·  view source on GitHub ↗

The cached C3 linearization of `cls`, or `[cls]` when uncached (native classes, or an inconsistent hierarchy that `c3_merge` declined to cache).

(&self, c: Val)

Source from the content-addressed store, hash-verified

30impl<'a> VM<'a> {
31 // The cached C3 linearization of `cls`, or `[cls]` when uncached (native classes, or an inconsistent hierarchy that `c3_merge` declined to cache).
32 fn mro_of(&self, c: Val) -> alloc::vec::Vec<Val> {
33 match self.mro_cache.get(&c.0) {
34 Some(r) => (**r).clone(),
35 None => alloc::vec![c],
36 }
37 }
38
39 /* C3 merge of the bases' linearizations plus the bases list itself, the tail of `L[cls] = cls :: merge(...)`. `cls` is prepended by the caller (it isn't allocated yet at validation time). Errs on an inconsistent hierarchy, matching CPython's `TypeError` at class creation. */
40 pub(crate) fn c3_merge(&self, bases: &[Val]) -> Result<alloc::vec::Vec<Val>, VmErr> {

Callers 1

c3_mergeMethod · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected