-
Notifications
You must be signed in to change notification settings - Fork 683
Implement JSON object #168
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
Conversation
Finally the pull request is here :) I am proud of the parse test I added. Since Jerry knows more, perhaps we should improve test coverage / test quality. Lately we stumbled several issues which could be revealed before by better test cases. |
@@ -54,6 +54,9 @@ ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_TYPE_ERROR_UL, "TypeError") | |||
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_URI_ERROR_UL, "URIError") | |||
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_MATH_UL, "Math") | |||
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_JSON_U, "JSON") | |||
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_STRINGIFY, "stringify") | |||
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_PARSE, "parse") | |||
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_TO_JSON, "toJSON") |
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.
Please see this comment (https://github.com/galpeter/jerryscript/blob/assert_builtin/jerry-core/ecma/base/ecma-magic-strings.inc.h#L17) on how the magic strings should be named.
/* Create 4 digits hex value. */ | ||
MEM_DEFINE_LOCAL_ARRAY (hex_buff, 5, ecma_char_t); | ||
|
||
for (uint32_t i = 0; i < 4; i++) |
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.
Maybe we should introduce helper function for this?
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.
Not a bad idea, moved these into a helper function.
I've got no other comments, lgtm |
* Returned value must be freed with ecma_deref_ecma_string. | ||
*/ | ||
ecma_string_t * | ||
ecma_builtin_helper_json_create_separated_properties (list_ctx_t *partial_p, |
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.
Missing comments
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.
Fixed.
Folks, I'd really like to merge this PR in the beginning of the week. Let's make the final review at monday. |
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected] JerryScript-DCO-1.0-Signed-off-by: Roland Takacs [email protected]
#include "ecma-helpers.h" | ||
#include "ecma-builtin-helpers.h" | ||
|
||
#define LIST_BLOCK_SIZE 256UL |
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.
Why the block size is 256UL?
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.
This is a copy from the regexp engine. Maybe a bit big. :)
Since the project went on public, this is not updated automatically anymore. |
New PR created: #307 |
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected]
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs [email protected]