intrinsic arrays
This commit is contained in:
@@ -283,8 +283,30 @@ int uncaught_exception(JSContext *js, JSValue v)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JSValue exp = JS_GetException(js);
|
JSValue exp = JS_GetException(js);
|
||||||
|
|
||||||
|
JSValue message = JS_GetPropertyStr(js, exp, "message");
|
||||||
|
const char *msg_str = JS_ToCString(js, message);
|
||||||
|
if (msg_str) {
|
||||||
|
printf("Exception: %s\n", msg_str);
|
||||||
|
JS_FreeCString(js, msg_str);
|
||||||
|
}
|
||||||
|
JS_FreeValue(js, message);
|
||||||
|
|
||||||
|
JSValue stack = JS_GetPropertyStr(js, exp, "stack");
|
||||||
|
const char *stack_str = JS_ToCString(js, stack);
|
||||||
|
if (stack_str) {
|
||||||
|
printf("Stack:\n%s\n", stack_str);
|
||||||
|
JS_FreeCString(js, stack_str);
|
||||||
|
}
|
||||||
|
JS_FreeValue(js, stack);
|
||||||
|
|
||||||
|
JS_FreeValue(js, exp);
|
||||||
|
JS_FreeValue(js, v);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
exp = JS_GetException(js);
|
||||||
if (JS_IsNull(rt->on_exception)) {
|
if (JS_IsNull(rt->on_exception)) {
|
||||||
const char *str = JS_ToCString(js, exp);
|
const char *str = JS_ToCString(js, exp);
|
||||||
if (str) {
|
if (str) {
|
||||||
|
|||||||
1597
source/quickjs.c
1597
source/quickjs.c
File diff suppressed because it is too large
Load Diff
@@ -74,11 +74,12 @@ typedef uint32_t JSAtom;
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
/* all tags with a reference count are negative */
|
/* all tags with a reference count are negative */
|
||||||
JS_TAG_FIRST = -9, /* first negative tag */
|
JS_TAG_FIRST = -10, /* first negative tag */
|
||||||
JS_TAG_BIG_INT = -9,
|
JS_TAG_BIG_INT = -10,
|
||||||
JS_TAG_SYMBOL = -8,
|
JS_TAG_SYMBOL = -9,
|
||||||
JS_TAG_STRING = -7,
|
JS_TAG_STRING = -8,
|
||||||
JS_TAG_STRING_ROPE = -6,
|
JS_TAG_STRING_ROPE = -7,
|
||||||
|
JS_TAG_ARRAY = -6, /* intrinsic array type */
|
||||||
JS_TAG_MODULE = -3, /* used internally */
|
JS_TAG_MODULE = -3, /* used internally */
|
||||||
JS_TAG_FUNCTION_BYTECODE = -2, /* used internally */
|
JS_TAG_FUNCTION_BYTECODE = -2, /* used internally */
|
||||||
JS_TAG_OBJECT = -1,
|
JS_TAG_OBJECT = -1,
|
||||||
@@ -449,22 +450,6 @@ typedef struct JSPropertyDescriptor {
|
|||||||
JSValue setter;
|
JSValue setter;
|
||||||
} JSPropertyDescriptor;
|
} JSPropertyDescriptor;
|
||||||
|
|
||||||
typedef struct JSClassExoticMethods {
|
|
||||||
/* Return -1 if exception (can only happen in case of Proxy object),
|
|
||||||
FALSE if the property does not exists, TRUE if it exists. If 1 is
|
|
||||||
returned, the property descriptor 'desc' is filled if != NULL. */
|
|
||||||
int (*get_own_property)(JSContext *ctx, JSPropertyDescriptor *desc,
|
|
||||||
JSValueConst obj, JSAtom prop);
|
|
||||||
|
|
||||||
/* return < 0 if exception, or TRUE/FALSE */
|
|
||||||
int (*delete_property)(JSContext *ctx, JSValueConst obj, JSAtom prop);
|
|
||||||
/* return < 0 if exception or TRUE/FALSE */
|
|
||||||
int (*define_own_property)(JSContext *ctx, JSValueConst this_obj,
|
|
||||||
JSAtom prop, JSValueConst val,
|
|
||||||
JSValueConst getter, JSValueConst setter,
|
|
||||||
int flags);
|
|
||||||
} JSClassExoticMethods;
|
|
||||||
|
|
||||||
typedef void JSClassFinalizer(JSRuntime *rt, JSValue val);
|
typedef void JSClassFinalizer(JSRuntime *rt, JSValue val);
|
||||||
typedef void JSClassGCMark(JSRuntime *rt, JSValueConst val,
|
typedef void JSClassGCMark(JSRuntime *rt, JSValueConst val,
|
||||||
JS_MarkFunc *mark_func);
|
JS_MarkFunc *mark_func);
|
||||||
@@ -478,9 +463,6 @@ typedef struct JSClassDef {
|
|||||||
JSClassGCMark *gc_mark;
|
JSClassGCMark *gc_mark;
|
||||||
/* if call != NULL, the object is a function */
|
/* if call != NULL, the object is a function */
|
||||||
JSClassCall *call;
|
JSClassCall *call;
|
||||||
/* XXX: suppress this indirection ? It is here only to save memory
|
|
||||||
because only a few classes need these methods */
|
|
||||||
JSClassExoticMethods *exotic;
|
|
||||||
} JSClassDef;
|
} JSClassDef;
|
||||||
|
|
||||||
#define JS_INVALID_CLASS_ID 0
|
#define JS_INVALID_CLASS_ID 0
|
||||||
|
|||||||
Reference in New Issue
Block a user