Hey Ben, I was able to get around my problem today, but I am not convinced that it was a good solution. The problem I was having was that I was trying to add an Array that represented an reflected C++ enumeration. For some reason, arrays do not get classified as a generic data type. I was able to get around this by switching it to an object template using named parameters, but it really seems like there should be some way to add an array in the object template.
On Wednesday, September 7, 2016 at 9:41:49 PM UTC-5, Ben Noordhuis wrote: > > On Wed, Sep 7, 2016 at 8:56 PM, Pieter <[email protected] > <javascript:>> wrote: > > I am starting to look at upgrading our V8 integration library to build > > against a more recent version of v8. After fixing some compiler errors I > am > > getting a runtime failure on the following line. > > > https://github.com/EventStore/EventStore/blob/release-v4.0.0/src/EventStore.Projections.v8Integration/PreludeScript.cpp#L88 > > > > > result = v8::ObjectTemplate::New(); > > v8::Handle<v8::Array> global_property_names = > > prelude_result_object->GetPropertyNames(); > > > > for (unsigned int i = 0; i < global_property_names->Length(); i++) > > { > > //TODO: handle invalid keys in template object (non-string) > > v8::Handle<v8::String> global_property_name = > > global_property_names->Get(i).As<v8::String>(); > > v8::Handle<v8::Value> global_property_value = > > prelude_result_object->Get(global_property_name); > > > > result->Set(global_property_name, global_property_value); > > } > > > > return S_OK; > > > > It would appear that v8::ObjectTemplate has changed behaviour, > > v8::ObjectTemplate previously used to be able to take the function name > and > > the function as a v8::Value. > > Is there any guidance on how best to migrate/move this bit of code over > so > > that it functions as it previously did? > > > > For reference. The version of v8 this integration library was written > > against is 3.24.10. > > > > Thank you in advance for your help! > > v8::ObjectTemplate only accepts primitive values (numbers, strings, > etc.) and other templates. If you used to add v8::Functions before, > you should use v8::FunctionTemplates now. > > The rationale goes something like this: JS objects and functions are > tied to the context they were created in, templates are not; they are > per-isolate and can be reused across contexts. > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
