OLD | NEW |
---|---|
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
608 flag |= DONT_DELETE; | 608 flag |= DONT_DELETE; |
609 | 609 |
610 if (IsDataDescriptor(desc) || IsGenericDescriptor(desc)) { | 610 if (IsDataDescriptor(desc) || IsGenericDescriptor(desc)) { |
611 if (desc.hasWritable()) { | 611 if (desc.hasWritable()) { |
612 flag |= desc.isWritable() ? 0 : READ_ONLY; | 612 flag |= desc.isWritable() ? 0 : READ_ONLY; |
613 } else if (!IS_UNDEFINED(current)) { | 613 } else if (!IS_UNDEFINED(current)) { |
614 flag |= current.isWritable() ? 0 : READ_ONLY; | 614 flag |= current.isWritable() ? 0 : READ_ONLY; |
615 } else { | 615 } else { |
616 flag |= READ_ONLY; | 616 flag |= READ_ONLY; |
617 } | 617 } |
618 %DefineOrRedefineDataProperty(obj, p, desc.getValue(), flag); | 618 var value = |
Rico
2010/12/10 10:42:35
Maybe add a comment that states that this actually
Kevin Millikin (Chromium)
2010/12/10 11:08:23
I would actually suggest writing it just like the
Lasse Reichstein
2010/12/10 11:21:45
Changed to:
var value; // Default value is undef
Kevin Millikin (Chromium)
2010/12/10 11:28:20
I still think that's too cute. This is a long fun
Lasse Reichstein
2010/12/10 11:37:51
True, good point.
I'll make a new CL and make it
| |
619 desc.hasValue() ? desc.getValue() : (current && current.getValue()); | |
620 %DefineOrRedefineDataProperty(obj, p, value, flag); | |
619 } else { | 621 } else { |
620 if (desc.hasGetter() && IS_FUNCTION(desc.getGet())) { | 622 if (desc.hasGetter() && IS_FUNCTION(desc.getGet())) { |
621 %DefineOrRedefineAccessorProperty(obj, p, GETTER, desc.getGet(), flag); | 623 %DefineOrRedefineAccessorProperty(obj, p, GETTER, desc.getGet(), flag); |
622 } | 624 } |
623 if (desc.hasSetter() && IS_FUNCTION(desc.getSet())) { | 625 if (desc.hasSetter() && IS_FUNCTION(desc.getSet())) { |
624 %DefineOrRedefineAccessorProperty(obj, p, SETTER, desc.getSet(), flag); | 626 %DefineOrRedefineAccessorProperty(obj, p, SETTER, desc.getSet(), flag); |
625 } | 627 } |
626 } | 628 } |
627 return true; | 629 return true; |
628 } | 630 } |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1187 // ---------------------------------------------------------------------------- | 1189 // ---------------------------------------------------------------------------- |
1188 | 1190 |
1189 function SetupFunction() { | 1191 function SetupFunction() { |
1190 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1192 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1191 "bind", FunctionBind, | 1193 "bind", FunctionBind, |
1192 "toString", FunctionToString | 1194 "toString", FunctionToString |
1193 )); | 1195 )); |
1194 } | 1196 } |
1195 | 1197 |
1196 SetupFunction(); | 1198 SetupFunction(); |
OLD | NEW |