Although this is something I'm doing for Node, there's really nothing Node specific about the following (other than the steps I use to produce it)
The example JS could would be something like class TestAccessor { #a = 123; get f() { return this.#a } // throws exception in debugger because this isn't a 'TestAccessor' } the above JS version of this shows [image: example0-a.png] Thich clicking on the (...) is an error of course... (not so fatal of an error as the DebugBreak() that node generates which pops up with a debugger dialog on systems with a development environment installed) [image: example0.png] So, when defining a FunctionTemplate... void ComObject::Init( Local<Object> exports ) { Isolate* isolate = Isolate::GetCurrent(); Local<Context> context = isolate->GetCurrentContext(); Local<FunctionTemplate> comTemplate; comTemplate = FunctionTemplate::New( isolate, New ); comTemplate->SetClassName( String::NewFromUtf8Literal( isolate, "sack.ComPort" ) ); comTemplate->InstanceTemplate()->SetInternalFieldCount( 1 ); // 1 required for wrap comTemplate->PrototypeTemplate()->SetAccessorProperty( String::NewFromUtf8Literal( isolate, "rts" ) , FunctionTemplate::New( isolate, ComObject::getRTS ) , FunctionTemplate::New( isolate, ComObject::setRTS ) ); } where ComObject::getRTS and setRTS are void ComObject::getRTS( const FunctionCallbackInfo<Value>& args ) {} When debugging the Node process, if I mouse over the object containing the function with the above accessor, the getter is called, but it's not passed a valid object, so an breakpoint is generated when (node term; unwrapping) the object. [image: example.png] I tried to change to SetNativeDataProperty instead... comTemplate->PrototypeTemplate()->SetNativeDataProperty( String::NewFromUtf8Literal( isolate, "rts" ) , ComObject::getRTS2 , nullptr //Local<Function>() , Local<Value>() , PropertyAttribute::None , SideEffectType::kHasNoSideEffect , SideEffectType::kHasSideEffect ); Which then gives me (...) option call the getter.... [image: example2.png] Which gives me (...) instead the above just shows the value directly without the getter expanded value... doesn't immediately cause a debugbreak, but will if I click on the (...) which IMO shouldn't be called ever, since it cannot be given a valid object as 'this'. I was just testing this, and thought it was something I was doing with my direct V8 Interface, but my JS test was initially missing 'f' after 'get' as in 'get f()', which does end up showing similar behavior... that the prototype getter shouldn't be called. I can make this a cr-bug if noone else wants to ? -- -- v8-users mailing list v8-users@googlegroups.com 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 v8-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/18c47b91-35d9-4be3-8a1c-1c9f25725a9en%40googlegroups.com.