| 2232 | |
| 2233 | template<typename F> |
| 2234 | static 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 | |
| 2247 | tsn_result tsn_set_class_method(tsn_vm* ctx, tsn_value cls, tsn_atom name, tsn_value method) { |
| 2248 | return withPrototypeProperty( |
no test coverage detected