P. 1
ECMA-262 JavaScript 5

ECMA-262 JavaScript 5

|Views: 218|Likes:
Publicado porGregoryDonaghy

More info:

Published by: GregoryDonaghy on Mar 12, 2010
Direitos Autorais:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

08/16/2013

pdf

text

original

When the abstract operation ToPropertyDescriptor is called with object Desc, the following steps are taken:

1. If Type(Obj) is not Object throw a TypeError exception.
2. Let desc be the result of creating a new Property Descriptor that initially has no fields.
3. If the result of calling the [[HasProperty]] internal method of Obj with argument "enumerable" is true,

then

a. Let enum be the result of calling the [[Get]] internal method of Obj with "enumerable".
b. Set the [[Enumerable]] field of desc to ToBoolean(enum).
4. If the result of calling the [[HasProperty]] internal method of Obj with argument "configurable" is true,

then

a. Let conf be the result of calling the [[Get]] internal method of Obj with argument
"configurable".
b. Set the [[Configurable]] field of desc to ToBoolean(conf).
5. If the result of calling the [[HasProperty]] internal method of Obj with argument "value" is true, then
a. Let value be the result of calling the [[Get]] internal method of Obj with argument “value”.
b. Set the [[Value]] field of desc to value.
6. If the result of calling the [[HasProperty]] internal method of Obj with argument "writable" is true, then
a. Let writable be the result of calling the [[Get]] internal method of Obj with argument "writable".
b. Set the [[Writable]] field of desc to ToBoolean(writable).
7. If the result of calling the [[HasProperty]] internal method of Obj with argument "get" is true, then
a. Let getter be the result of calling the [[Get]] internal method of Obj with argument "get".
b. If IsCallable(getter) is false and getter is not undefined, then throw a TypeError exception.
c. Set the [[Get]] field of desc to getter.
8. If the result of calling the [[HasProperty]] internal method of Obj with argument "set" is true, then
a. Let setter be the result of calling the [[Get]] internal method of Obj with argument "set".
b. If IsCallable(setter) is false and setter is not undefined, then throw a TypeError exception.
c. Set the [[Set]] field of desc to setter.
9. If either desc.[[Get]] or desc.[[Set]] are present, then
a. If either desc.[[Value]] or desc.[[Writable]] are present, then throw a TypeError exception.

10. Return desc.

38

© Ecma International 2009

You're Reading a Free Preview

Descarregar
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->