| 1381 | |
| 1382 | |
| 1383 | Dynamic 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 | |
| 1424 | bool CppiaClassInfo::hasStaticValue(const String &inName) |
no test coverage detected