Hi

Do you know how I get for *K* the keys *a* & *b ?  *

*const K = {a: *"foo"*, b: *"bar"*}.*

I see here - https://v8.dev/blog/fast-properties 
that it's on Elements data structure but I can't restore them.

*snippet code : *
const char * text= ("const K = {a: "foo", b: "bar"};);
Local<v8::String> source = v8::String::NewFromUtf8(m_Isolate, text);


Local<Script> compiled_script;
if (!Script::Compile(m_Context, source).ToLocal(&compiled_script))
...
        showprop("*K*")


void  showprop(const char * name)
{
v8::Local<v8::Name> val = v8::String::NewFromUtf8(m_Isolate, name);

Local<Object> obj = val->ToObject(m_Context).ToLocalChecked();
Local<Array>  arr = obj->GetPropertyNames(m_Context).ToLocalChecked();

int len = arr->Length();
for (uint32_t i = 0; i < len; ++i)
{
Local<Value> key = arr->Get(i);
Local<Value> val = obj->Get(m_Context, key).ToLocalChecked();

// i got val as string *K  !!!  * and not get *a* or *b* keys 
}
}


Any help appreciated 
Oren 

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/4a3873d3-f574-4ced-b5b6-e566b9ff5126o%40googlegroups.com.

Reply via email to