-
Notifications
You must be signed in to change notification settings - Fork 238
JS_GetClass function #1215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS_GetClass function #1215
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3609,6 +3609,15 @@ bool JS_IsRegisteredClass(JSRuntime *rt, JSClassID class_id) | |||||||||||||||||||||||||||||||||||||
| return (class_id < rt->class_count && | ||||||||||||||||||||||||||||||||||||||
| rt->class_array[class_id].class_id != 0); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| JSAtom JS_GetClassName(JSRuntime *rt, JSClassID id) | ||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||
| if(!JS_IsRegisteredClass(rt, id)) { | ||||||||||||||||||||||||||||||||||||||
| return JS_ATOM_NULL; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| JSAtom ret = rt->class_array[id].class_name; | ||||||||||||||||||||||||||||||||||||||
| JS_DupAtomRT(rt, ret); | ||||||||||||||||||||||||||||||||||||||
| return ret; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
| JSAtom JS_GetClassName(JSRuntime *rt, JSClassID id) | |
| { | |
| if(!JS_IsRegisteredClass(rt, id)) { | |
| return JS_ATOM_NULL; | |
| } | |
| JSAtom ret = rt->class_array[id].class_name; | |
| JS_DupAtomRT(rt, ret); | |
| return ret; | |
| } | |
| JSAtom JS_GetClassName(JSRuntime *rt, JSClassID class_id) | |
| { | |
| if (JS_IsRegisteredClass(rt, class_id)) { | |
| return JS_DupAtomRT(rt, rt->class_array[class_id].class_name); | |
| } else { | |
| return JS_ATOM_NULL; | |
| } | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github wouldn't let me directly commit the suggestions for whatever reason. I think I got 'em all?
Once again thanks for your patience with this. As a blind person especially whitespace-related inconsistencies are very difficult to even notice without proofreading letter-by-letter and even then they're easy to miss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still some left but I'll fix them manually when I merge your PR.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -634,6 +634,8 @@ JS_EXTERN JSClassID JS_NewClassID(JSRuntime *rt, JSClassID *pclass_id); | |||||
| JS_EXTERN JSClassID JS_GetClassID(JSValueConst v); | ||||||
| JS_EXTERN int JS_NewClass(JSRuntime *rt, JSClassID class_id, const JSClassDef *class_def); | ||||||
| JS_EXTERN bool JS_IsRegisteredClass(JSRuntime *rt, JSClassID class_id); | ||||||
| /* Returns the class name or JS_ATOM_NULL if `id` is not a registered class. Must be freed with JS_FreeAtom. */ | ||||||
| JS_EXTERN JSAtom JS_GetClassName(JSRuntime *rt, JSClassID id); | ||||||
|
||||||
| JS_EXTERN JSAtom JS_GetClassName(JSRuntime *rt, JSClassID id); | |
| JS_EXTERN JSAtom JS_GetClassName(JSRuntime *rt, JSClassID class_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style, spacing