-
Notifications
You must be signed in to change notification settings - Fork 676
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
Implement AnnexB RegExp.prototype.compile() #579
Conversation
cf0788c
to
c1f72df
Compare
{ | ||
flags_value = args[1]; | ||
} | ||
} |
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.
Do we need variable arguments here? Can't we simply have two arguments?
Quite a good patch, just a few things |
void | ||
re_initialize_props (ecma_object_t *re_obj_p, | ||
ecma_string_t *source_p, | ||
uint8_t flags) |
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.
c1f72df
to
6b02c71
Compare
@zherczeg, @ruben-ayrapetyan I've updated the patch based on your comments. |
re_bytecode_t *new_bc_p = NULL; | ||
ecma_completion_value_t bc_comp = re_compile_bytecode (&new_bc_p, pattern_string_p, flags); | ||
/* Should always succeed, since we're compiling from a source that has been compiled previously. */ | ||
JERRY_ASSERT (ecma_is_completion_value_normal (bc_comp)); |
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.
ecma_is_completion_value_empty
? In the case, completion value doesn't need to be freed.
After fixing #579 (comment) and #579 (comment) the changes would look good to me. |
6b02c71
to
b74e9cd
Compare
assert (re2.ignoreCase === re1.ignoreCase); | ||
assert (re2.multiline === re1.multiline); | ||
assert (re2.source === re1.source); | ||
assert (re2.lastIndex === 0); |
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.
Just one question: can we rewrite non-configurable properties? E.g. re2.compile(re1); what is happening, if re2.global is non configurable? It would worth adding a test to show that it works.
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.
We can, because we use the internal API to do it. Also, all flag properties are already non-configurable, so the currently added test cases should cover testing this.
LGTM in general, but please check whether we can overwrite non-configurable properties. |
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai [email protected]
b74e9cd
to
13941df
Compare
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai [email protected]