Conversation
|
/cc @jasongin @boingoing |
|
I'm still investigating test failures that I'm seeing in Travis with node-chakracore, but all other legs complete successfully. |
| #define NAPI_HAS_CONSTEXPR 1 | ||
| #endif | ||
|
|
||
| // VS2015 RTM has bugs with constexpr, so require min of VS2015 Update 3 (known good version) |
There was a problem hiding this comment.
Change this comment to reference the char16_t literal issue.
| Function func = info[0].As<Function>(); | ||
| Value receiver = info[1]; | ||
| return func.Call(receiver, { info[2], info[3], info[4] }); | ||
| return func.Call(receiver, { static_cast<napi_value>(info[2]), static_cast<napi_value>(info[3]), static_cast<napi_value>(info[4]) }); |
There was a problem hiding this comment.
nit: Wrap lines at 100 cols.
(There is no linter set up yet...)
There was a problem hiding this comment.
Are there specific guidelines for how to wrap lines? I looked through the existing code and didn't see enough forced wraps to draw solid conclusions.
| if (value != nullptr) { | ||
| napi_status status = napi_create_reference(_env, value, 1, &_ref); | ||
|
|
||
| // TODO - What's the right way to handle errors in the constructor without |
There was a problem hiding this comment.
napi_fatal_error()... but it doesn't exist yet. :)
| HandleScope scope(_env); | ||
|
|
||
| napi_value value = other.Value(); | ||
| if (value != nullptr) { |
There was a problem hiding this comment.
This is always creating a strong reference, even if other was a weak reference. I guess it's OK since this should only ever be called by the Error class which is always strong. At least add a comment explaining that is the purpose of this constructor.
jasongin
left a comment
There was a problem hiding this comment.
LGTM, assuming tests pass on all targeted compilers/platforms.
|
@jasongin The CI is clean now, but I'm running into a test failure with VS2013 (now that the tests actually run). I'll pick this up again tomorrow and figure out why the test is failing. EDIT: It turns out that VS2013 has some behavioral differences from the other compilers with regard to temporary objects created in constructor calls. In this case we take the string, extract the |
|
@jasongin @boingoing I have resolved all build and test issues, is there anything else I should be testing with? |
VS2013 issues
* No constexpr support
- Conditionally use constexpr if the compiler supports it
- Updated tests to use a macro for this purpose
* Requires copy constructor support for base classes of thrown objects
- Added a protected copy constructor to ObjectReference and
Reference<T>
* Incorrect overload resolution for std::initializer_list
- Used explicit types to invoke the correct overload
* No literal support for char16_t
- Added macro to convert the text properly
* Lambdas are unable to capture function non-pointers
- Updated the typedef to create a function pointer
* Short lifetime for temporary objects passed to constructors
- Updated the tests to create the objects and pass them to the
constructor. This is closer to how they would be used anyway
General improvements
* Added console.log output to the test runner to make it more clear
when and where tests are failing
|
Everything is passing now locally building in VS2013 and VS2015 and the CI is green for all legs. |
| PropertyDescriptor::Value(std::string("enumerableValue"), trueValue, napi_enumerable), | ||
| PropertyDescriptor::Value(std::string("configurableValue"), trueValue, napi_configurable), | ||
| PropertyDescriptor::Function(std::string("function"), TestFunction), | ||
| PropertyDescriptor::Accessor(str1, TestGetter), |
There was a problem hiding this comment.
This is unfortunate, and seems likely to confuse many people (if they are using VS 2013). The way I wanted this to work for the most common case is you should be able to just pass in a string literal:
PropertyDescriptor::Accessor("readonlyAccessor", TestGetter),
Did you try that? I'd assume the behavior is the same as the explicit call to std::string(), but I'm not sure.
If that doesn't work, then I think it would be best to add overloads of each of those methods that accept a const char* instead.
There was a problem hiding this comment.
@jasongin there is already an overload for const char *, that's what the other leg of the conditional tests. It just gets chained to for the std::string constructor. Does that resolve your concerns?
There was a problem hiding this comment.
Oh, sorry I didn't look at the broader context in this file! Yes, that resolves my concerns then.
jasongin
left a comment
There was a problem hiding this comment.
I think we need to do something better for the temporary std::string issue.
|
|
||
| inline void AsyncWorker::OnOK() { | ||
| _callback.MakeCallback(_receiver.Value(), {}); | ||
| _callback.MakeCallback(_receiver.Value(), {{}}); |
There was a problem hiding this comment.
This double-curly syntax is weird. Can you add a comment?
There was a problem hiding this comment.
This should have been changed in the latest revision. This actually had side-effects that I encountered during testing.
|
@jasongin As far as I'm concerned this is ready to land, feel free to land it at your convenience. |
VS2013 issues
Reference
constructor. This is closer to how they would be used anyway
General improvements
when and where tests are failing