void _ejs_throw_nativeerror_utf8 (EJSNativeErrorType error_type, const char *message) { ejsval exc = _ejs_nativeerror_new_utf8 (error_type, message); _ejs_log ("throwing exception with message %s\n", message); _ejs_throw (exc); EJS_NOT_REACHED(); }
// ECMA262 25.4.5.25.0 Thrower Functions static ejsval thrower(ejsval env, ejsval _this, uint32_t argc, ejsval *args) { ejsval x = _ejs_undefined; if (argc > 0) x = args[0]; _ejs_throw(x); EJS_NOT_REACHED(); }
void _ejs_throw_nativeerror (EJSNativeErrorType error_type, ejsval message) { ejsval exc = _ejs_nativeerror_new (error_type, message); char *message_utf8 = ucs2_to_utf8(EJSVAL_TO_FLAT_STRING(message)); _ejs_log ("throwing exception with message %s\n", message_utf8); free (message_utf8); _ejs_throw (exc); EJS_NOT_REACHED(); }
ejsval _ejs_generator_yield (ejsval generator, ejsval arg) { EJSGenerator* gen = (EJSGenerator*)EJSVAL_TO_OBJECT(generator); gen->yielded_value = _ejs_create_iter_result(arg, _ejs_false); gen->sent_value = _ejs_undefined; _ejs_gc_pop_generator(); swapcontext(&gen->generator_context, &gen->caller_context); _ejs_gc_push_generator(gen); if (gen->throwing) { gen->throwing = EJS_FALSE; _ejs_throw (gen->sent_value); } return gen->sent_value; }