MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxEchoPropertyHost

Function fxEchoPropertyHost

xs/sources/xsDebug.c:1995–2063  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1993}
1994
1995void fxEchoPropertyHost(txMachine* the, txInspectorNameList* theList, txSlot* theInstance, txSlot* theHost)
1996{
1997 txSlot* instanceInspector = fxToInstanceInspector(the, theInstance);
1998 if (instanceInspector) {
1999 txSlot* hostInspectors = &mxHostInspectors;
2000 txSlot* hostInspector;
2001 txSlot* cache;
2002 txSlot* cacheProperty;
2003 hostInspector = hostInspectors->value.list.first;
2004 while (hostInspector) {
2005 if (hostInspector->value.hostInspector.instance == theInstance) {
2006 break;
2007 }
2008 hostInspector = hostInspector->next;
2009 }
2010 if (!hostInspector) {
2011 txSlot* aParent;
2012 cache = fxNewInstance(the);
2013 hostInspector = fxNewSlot(the);
2014 hostInspector->kind = XS_HOST_INSPECTOR_KIND;
2015 hostInspector->value.hostInspector.cache = cache;
2016 hostInspector->value.hostInspector.instance = theInstance;
2017 if (hostInspectors->value.list.first)
2018 hostInspectors->value.list.last->next = hostInspector;
2019 else
2020 hostInspectors->value.list.first = hostInspector;
2021 hostInspectors->value.list.last = hostInspector;
2022 mxPop();
2023
2024 aParent = theInstance;
2025 while (aParent && (aParent->next->kind == XS_HOST_KIND)) {
2026 txSlot* aParentProperty = aParent->next;
2027 while (aParentProperty) {
2028 if ((aParentProperty->kind == XS_ACCESSOR_KIND) && (aParentProperty->value.accessor.getter)) {
2029 cacheProperty = mxBehaviorGetProperty(the, cache, aParentProperty->ID, 0, XS_ANY);
2030 if (!cacheProperty) {
2031 txSlot* aFunction = aParentProperty->value.accessor.getter;
2032 if (mxIsFunction(aFunction)) {
2033 fxBeginHost(the);
2034 the->frame->flag &= ~(XS_STEP_INTO_FLAG | XS_STEP_OVER_FLAG);
2035 /* THIS */
2036 mxPushReference(theInstance);
2037 /* FUNCTION */
2038 mxPushReference(aFunction);
2039 mxCall();
2040 mxRunCount(0);
2041 cacheProperty = mxBehaviorSetProperty(the, cache, aParentProperty->ID, 0, XS_ANY);
2042 cacheProperty->flag |= XS_INSPECTOR_FLAG;
2043 cacheProperty->kind = the->stack->kind;
2044 cacheProperty->value = the->stack->value;
2045 mxPop();
2046 fxEndHost(the);
2047 }
2048 }
2049 }
2050 aParentProperty = aParentProperty->next;
2051 }
2052 aParent = fxGetPrototype(the, aParent);

Callers 1

fxEchoInstanceFunction · 0.85

Calls 7

fxToInstanceInspectorFunction · 0.85
fxNewInstanceFunction · 0.85
fxNewSlotFunction · 0.85
fxBeginHostFunction · 0.85
fxEndHostFunction · 0.85
fxGetPrototypeFunction · 0.85
fxEchoPropertyFunction · 0.85

Tested by

no test coverage detected