MCPcopy Create free account
hub / github.com/Snapchat/Valdi / withPrototypeProperty

Function withPrototypeProperty

tsn/src/tsn/tsn.cpp:2234–2245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2232
2233template<typename F>
2234static inline tsn_result withPrototypeProperty(tsn_vm* ctx, tsn_value cls, F&& cb) {
2235 auto prototype = JS_GetProperty(ctx, cls, JS_GetPrototypeAtom_tsn(ctx));
2236 if (tsn_is_exception(ctx, prototype)) {
2237 return false;
2238 }
2239
2240 auto result = cb(prototype);
2241
2242 tsn_release(ctx, prototype);
2243
2244 return result;
2245}
2246
2247tsn_result tsn_set_class_method(tsn_vm* ctx, tsn_value cls, tsn_atom name, tsn_value method) {
2248 return withPrototypeProperty(

Callers 3

tsn_set_class_methodFunction · 0.85

Calls 4

JS_GetPropertyFunction · 0.85
tsn_is_exceptionFunction · 0.85
tsn_releaseFunction · 0.85
cbFunction · 0.50

Tested by

no test coverage detected