Skip to content

Implement Date constructor. #322

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

Merged

Conversation

LaszloLango
Copy link
Contributor

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com

@LaszloLango LaszloLango added ecma builtins Related to ECMA built-in routines development Feature implementation labels Jul 7, 2015
@LaszloLango LaszloLango added this to the ECMA builtins milestone Jul 7, 2015
@LaszloLango
Copy link
Contributor Author

Depends on #305

}
else
{
prim_value_num_p= ecma_alloc_number ();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space before =

@LaszloLango LaszloLango force-pushed the date_construct_dev branch from c2e2472 to 225d533 Compare July 7, 2015 10:29
ret_value);

prim_value_num_p = ecma_alloc_number ();
*prim_value_num_p = *ecma_get_number_from_completion_value (parse_res_value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be ecma_get_number_from_value ? As the parse_res_value is not a completion value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is parse_res_value not a completion value?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that. I'll fix it

@LaszloLango LaszloLango force-pushed the date_construct_dev branch from 225d533 to 63a8efe Compare July 7, 2015 14:14

ret_value = ecma_make_normal_completion_value (ecma_make_object_value (obj_p));
}
else if (ecma_is_completion_value_throw (ret_value))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JERRY_ASSERT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruben-ayrapetyan, sorry, I don't get it. What do you mean exactly? What would you like to test with the assert?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LaszloLango, I mean that ret_value can be either empty or contain throw value just before the if block. Here we handle empty case in if and throw in else if. As there should be no other cases, we could just assert this, replacing else if with else and adding JERRY_ASSERT with contents of current else if condition to the else block.

Like the following:

if (ecma_is_completion_value_empty (ret_value))
{
 ...
}
else
{
  JERRY_ASSERT (ecma_is_completion_value_throw (ret_value));

  ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruben-ayrapetyan, I see. Thanks for explain. I'll do it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LaszloLango, thank you.

@LaszloLango LaszloLango force-pushed the date_construct_dev branch from 63a8efe to 3d49ab7 Compare July 7, 2015 15:01
@egavrin egavrin assigned ruben-ayrapetyan and unassigned egavrin Jul 7, 2015
}
catch (e)
{
assert (e.toString() == "Error: foo");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually test it this way:

assert (e instanceof Error);
assert (e.message === "foo");

but this is also ok imho.

@LaszloLango LaszloLango force-pushed the date_construct_dev branch from 3d49ab7 to 475a7f9 Compare July 7, 2015 15:26
@LaszloLango
Copy link
Contributor Author

@galpeter, @ruben-ayrapetyan, I've updated the PR.

ecma_property_t *prim_value_prop_p = ecma_create_internal_property (obj_p,
ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE);
ECMA_SET_POINTER (prim_value_prop_p->u.internal_property.value, prim_value_num_p);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use ECMA_SET_NON_NULL_POINTER in the case, as prim_value_num_p is not NULL.

@ruben-ayrapetyan
Copy link
Contributor

Looks good to me

@egavrin
Copy link
Contributor

egavrin commented Jul 7, 2015

make push

@egavrin egavrin assigned LaszloLango and unassigned egavrin Jul 7, 2015
@galpeter
Copy link
Contributor

galpeter commented Jul 8, 2015

lgtm

@LaszloLango LaszloLango force-pushed the date_construct_dev branch from 475a7f9 to 0af000c Compare July 8, 2015 08:55
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
@LaszloLango LaszloLango force-pushed the date_construct_dev branch from 0af000c to c12914c Compare July 8, 2015 09:09
@LaszloLango LaszloLango merged commit c12914c into jerryscript-project:master Jul 8, 2015
@galpeter galpeter mentioned this pull request Jul 8, 2015
50 tasks
@LaszloLango LaszloLango deleted the date_construct_dev branch December 14, 2015 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Feature implementation ecma builtins Related to ECMA built-in routines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants