src: deprecate V8 date conversion helpers#23179
Closed
addaleax wants to merge 1 commit intonodejs:masterfrom
Closed
src: deprecate V8 date conversion helpers#23179addaleax wants to merge 1 commit intonodejs:masterfrom
addaleax wants to merge 1 commit intonodejs:masterfrom
Conversation
These helpers provide no benefit over the existing V8 API, and at least one of them fetches the current `Isolate` through `Isolate::GetCurrent()` (which should be avoided).
joyeecheung
approved these changes
Sep 30, 2018
refack
reviewed
Sep 30, 2018
| 1000 * static_cast<double>(t)) | ||
| #define NODE_V8_UNIXTIME(v) (static_cast<double>((v)->NumberValue())/1000.0); | ||
| NODE_DEPRECATED("Use v8::Date::New() directly", | ||
| inline v8::Local<v8::Value> NODE_UNIXTIME_V8(double time) { |
Contributor
There was a problem hiding this comment.
This is not equivalent.
In this case I could imagine a user define time related struct, with no implicit cast to double, e.g.
struct Timestamp {
double _val;
explicit operator double() { return _val; };
};
Member
Author
There was a problem hiding this comment.
While that’s true, I think it’s highly unlikely that such code which uses this method exists.
| inline v8::Local<v8::Value> NODE_UNIXTIME_V8(double time) { | ||
| return v8::Date::New(v8::Isolate::GetCurrent(), 1000 * time); | ||
| }) | ||
| #define NODE_UNIXTIME_V8 node::NODE_UNIXTIME_V8 |
Contributor
There was a problem hiding this comment.
Can you explain why this is needed?
Member
Author
There was a problem hiding this comment.
Because NODE_UNIXTIME_V8 was previously as a macro, it wasn’t in any particular namespace; the inline function here is in the node namespace, though, and can’t be used without some kind of namespace access.
bnoordhuis
approved these changes
Oct 1, 2018
jasnell
approved these changes
Oct 1, 2018
Member
Author
Contributor
|
Landed in ac54469. |
danbev
pushed a commit
that referenced
this pull request
Oct 4, 2018
These helpers provide no benefit over the existing V8 API, and at least one of them fetches the current `Isolate` through `Isolate::GetCurrent()` (which should be avoided). PR-URL: #23179 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Oct 4, 2018
These helpers provide no benefit over the existing V8 API, and at least one of them fetches the current `Isolate` through `Isolate::GetCurrent()` (which should be avoided). PR-URL: #23179 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
This was referenced Oct 10, 2018
jasnell
pushed a commit
that referenced
this pull request
Oct 17, 2018
These helpers provide no benefit over the existing V8 API, and at least one of them fetches the current `Isolate` through `Isolate::GetCurrent()` (which should be avoided). PR-URL: #23179 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These helpers provide no benefit over the existing V8 API,
and at least one of them fetches the current
IsolatethroughIsolate::GetCurrent()(which should be avoided).Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes