| 14 | using namespace tns; |
| 15 | |
| 16 | void ArgConverter::Init(Local<Context> context) { |
| 17 | Isolate* isolate = context->GetIsolate(); |
| 18 | auto cache = GetTypeLongCache(isolate); |
| 19 | |
| 20 | auto ft = FunctionTemplate::New(isolate, ArgConverter::NativeScriptLongFunctionCallback); |
| 21 | ft->SetClassName(V8StringConstants::GetLongNumber(isolate)); |
| 22 | ft->InstanceTemplate()->Set(V8StringConstants::GetValueOf(isolate), FunctionTemplate::New(isolate, ArgConverter::NativeScriptLongValueOfFunctionCallback)); |
| 23 | ft->InstanceTemplate()->Set(V8StringConstants::GetToString(isolate), FunctionTemplate::New(isolate, ArgConverter::NativeScriptLongToStringFunctionCallback)); |
| 24 | cache->LongNumberCtorFunc = new Persistent<Function>(isolate, ft->GetFunction(context).ToLocalChecked()); |
| 25 | |
| 26 | auto nanObject = Number::New(isolate, numeric_limits<double>::quiet_NaN()).As<NumberObject>(); |
| 27 | cache->NanNumberObject = new Persistent<NumberObject>(isolate, nanObject); |
| 28 | } |
| 29 | |
| 30 | void ArgConverter::NativeScriptLongValueOfFunctionCallback(const v8::FunctionCallbackInfo<Value>& args) { |
| 31 | try { |
nothing calls this directly
no test coverage detected