MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / getStaticValue

Method getStaticValue

src/hx/cppia/CppiaClasses.cpp:1383–1421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1381
1382
1383Dynamic CppiaClassInfo::getStaticValue(const String &inName,hx::PropertyAccess inCallProp)
1384{
1385 if (inCallProp==paccDynamic)
1386 inCallProp = isNativeProperty(inName) ? paccAlways : paccNever;
1387 if (inCallProp)
1388 {
1389 ScriptCallable *getter = findStaticGetter(inName);
1390 if (getter)
1391 {
1392 Array<Dynamic> empty;
1393 return runFunExprDynamic(CppiaCtx::getCurrent(),getter,0, empty);
1394 }
1395 }
1396
1397 CppiaExpr *closure = findFunction(true,inName);
1398 if (closure)
1399 return createMemberClosure(0,(ScriptCallable*)closure);
1400
1401 // Look for dynamic function (variable)
1402 for(int i=0;i<staticDynamicFunctions.size();i++)
1403 {
1404 if (cppia.strings[ staticDynamicFunctions[i]->nameId ]==inName)
1405 {
1406 CppiaVar *d = staticDynamicFunctions[i];
1407
1408 return d->getStaticValue();
1409 }
1410 }
1411
1412 for(int i=0;i<staticVars.size();i++)
1413 {
1414 CppiaVar &var = *staticVars[i];
1415 if (var.name==inName)
1416 return var.getStaticValue();
1417 }
1418
1419 printf("Get static field not found (%s) %s\n", name.c_str(),inName.out_str());
1420 return null();
1421}
1422
1423
1424bool CppiaClassInfo::hasStaticValue(const String &inName)

Callers 1

__FieldMethod · 0.45

Calls 5

runFunExprDynamicFunction · 0.85
createMemberClosureFunction · 0.85
c_strMethod · 0.80
nullClass · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected