Use the custom defineProperty trap when it exists.

This commit is contained in:
Bruno de Oliveira Abinader 2014-12-23 13:39:42 +01:00 committed by Ms2ger
parent c82eb3b1a4
commit ade0b7be8e
3 changed files with 5 additions and 19 deletions

View file

@ -2086,11 +2086,14 @@ class CGDefineProxyHandler(CGAbstractMethod):
return CGAbstractMethod.define(self)
def definition_body(self):
customDefineProperty = 'defineProperty_'
if self.descriptor.operations['IndexedSetter'] or self.descriptor.operations['NamedSetter']:
customDefineProperty = 'defineProperty'
body = """\
let traps = ProxyTraps {
getPropertyDescriptor: Some(getPropertyDescriptor),
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor),
defineProperty: Some(defineProperty_),
defineProperty: Some(%s),
getOwnPropertyNames: ptr::null(),
delete_: Some(delete_),
enumerate: ptr::null(),
@ -2120,7 +2123,7 @@ let traps = ProxyTraps {
};
CreateProxyHandler(&traps, &Class as *const _ as *const _)
""" % (FINALIZE_HOOK_NAME,
""" % (customDefineProperty, FINALIZE_HOOK_NAME,
TRACE_HOOK_NAME)
return CGGeneric(body)