Status: New
Owner: ----

New issue 389 by ofsevensins: SetIndexedPropertyHandler not working
http://code.google.com/p/v8/issues/detail?id=389

I can not get SetIndexedPropertyHandler working. in the v8_shell_sample I
put this in the runMain function

  v8::Handle<v8::FunctionTemplate> point_templ =
v8::FunctionTemplate::New();
   point_templ->SetClassName(v8::String::New("IntArray"));
   v8::Handle<v8::ObjectTemplate> point_inst = point_templ-
> InstanceTemplate();
   point_inst->SetIndexedPropertyHandler(GetPointX,SetPointX);
   global->Set(v8::String::New("IntArray"),point_templ);
   global->Set(v8::String::New("IntArray"),
v8::FunctionTemplate::New(double_array));

   // Create a new execution environment containing the built-in
   // functions
   v8::Handle<v8::Context> context = v8::Context::New(NULL, global);

the get and set functions are

v8::Handle<v8::Value> GetPointX(uint32_t index, const v8::AccessorInfo
&info) {
        v8::Local<v8::Object> self = info.Holder();
        return  v8::Number::New(10);
   }
v8::Handle<v8::Value> SetPointX(uint32_t index, v8::Local<v8::Value> value,
                  const v8::AccessorInfo& info) {
     v8::Local<v8::Object> self = info.Holder();
        return v8::Undefined();
}

when running compiled exe i can go
var a = new IntArray();
a[0];//return nothing
a[0]=2;
a[0];//returns 2 and I would expect it to return 10



--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to