MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / addExternPropertyForType

Function addExternPropertyForType

include/daScript/ast/ast_interop.h:263–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261 template <typename ArgType, int ArgConst, typename RetType, typename FuncT, FuncT fn, template <typename FuncTT, FuncTT fnt> class SimNodeT = SimNode_ExtFuncCall>
262#endif
263 inline auto addExternPropertyForType ( Module & mod, const ModuleLibrary & lib, const char * name, const char * cppName = nullptr,
264 bool explicitConst=false, SideEffects sideEffects = SideEffects::none) {
265#if DAS_SLOW_CALL_INTEROP
266 using SimNodeType = SimNodeT<FuncT>;
267 auto fnX = new ExternalFn<FuncT, fn, SimNodeType, FuncT>(name, cppName);
268#else
269 using SimNodeType = SimNodeT<FuncT, fn>;
270 auto fnX = new ExternalFn<FuncT, fn, SimNodeType, FuncT>(name, cppName);
271#endif
272 vector<TypeDeclPtr> types(2);
273 types[0] = makeType<RetType>(lib);
274 types[1] = makeType<ArgType>(lib);
275 types[1]->constant = ArgConst;
276 fnX->constructExternal(types);
277 defaultTempFn tempFn;
278 tempFn(fnX);
279 fnX->arguments[0]->type->explicitConst = explicitConst;
280 fnX->setSideEffects(sideEffects);
281 fnX->propertyFunction = true;
282 DAS_ASSERTF(!fnX->result->isSmartPointer(), "property function can't return smart pointer %s::%s", mod.name.c_str(), name);
283#if VERIFY_JIT_ARGUMENTS
284 VerifyFn<FuncT, fn>::verify(fnX);
285#endif
286 mod.addFunction(fnX,true); // yes, this one can fail. same C++ bound property can be in multiple classes before or after refactor
287 return fnX;
288 }
289
290#if DAS_SLOW_CALL_INTEROP
291 template <typename FuncT, FuncT fn, template <typename FuncTT> class SimNodeT = SimNode_ExtFuncCall, typename QQ = defaultTempFn>

Callers

nothing calls this directly

Calls 6

verifyFunction · 0.85
constructExternalMethod · 0.80
setSideEffectsMethod · 0.80
isSmartPointerMethod · 0.80
c_strMethod · 0.45
addFunctionMethod · 0.45

Tested by

no test coverage detected