@@ -39,14 +39,26 @@ void DefineProperties(const CallbackInfo& info) {
39
39
PropertyDescriptor::Function (" function" , TestFunction),
40
40
});
41
41
} else if (nameType.Utf8Value () == " string" ) {
42
+ // VS2013 has lifetime issues when passing temporary objects into the constructor of another
43
+ // object. It generates code to destruct the object as soon as the constructor call returns.
44
+ // Since this isn't a common case for using std::string objects, I'm refactoring the test to
45
+ // work around the issue.
46
+ std::string str1 (" readonlyAccessor" );
47
+ std::string str2 (" readwriteAccessor" );
48
+ std::string str3 (" readonlyValue" );
49
+ std::string str4 (" readwriteValue" );
50
+ std::string str5 (" enumerableValue" );
51
+ std::string str6 (" configurableValue" );
52
+ std::string str7 (" function" );
53
+
42
54
obj.DefineProperties ({
43
- PropertyDescriptor::Accessor (std::string ( " readonlyAccessor " ) , TestGetter),
44
- PropertyDescriptor::Accessor (std::string ( " readwriteAccessor " ) , TestGetter, TestSetter),
45
- PropertyDescriptor::Value (std::string ( " readonlyValue " ) , trueValue),
46
- PropertyDescriptor::Value (std::string ( " readwriteValue " ) , trueValue, napi_writable),
47
- PropertyDescriptor::Value (std::string ( " enumerableValue " ) , trueValue, napi_enumerable),
48
- PropertyDescriptor::Value (std::string ( " configurableValue " ) , trueValue, napi_configurable),
49
- PropertyDescriptor::Function (std::string ( " function " ) , TestFunction),
55
+ PropertyDescriptor::Accessor (str1 , TestGetter),
56
+ PropertyDescriptor::Accessor (str2 , TestGetter, TestSetter),
57
+ PropertyDescriptor::Value (str3 , trueValue),
58
+ PropertyDescriptor::Value (str4 , trueValue, napi_writable),
59
+ PropertyDescriptor::Value (str5 , trueValue, napi_enumerable),
60
+ PropertyDescriptor::Value (str6 , trueValue, napi_configurable),
61
+ PropertyDescriptor::Function (str7 , TestFunction),
50
62
});
51
63
} else if (nameType.Utf8Value () == " value" ) {
52
64
obj.DefineProperties ({
0 commit comments