OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
6 * | 6 * |
7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
8 * | 8 * |
9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 class Maybe; | 88 class Maybe; |
89 class Name; | 89 class Name; |
90 class Number; | 90 class Number; |
91 class NumberObject; | 91 class NumberObject; |
92 class Object; | 92 class Object; |
93 class ObjectOperationDescriptor; | 93 class ObjectOperationDescriptor; |
94 class ObjectTemplate; | 94 class ObjectTemplate; |
95 class Platform; | 95 class Platform; |
96 class Primitive; | 96 class Primitive; |
97 class Promise; | 97 class Promise; |
98 class PropertyDescriptor; | |
98 class Proxy; | 99 class Proxy; |
99 class RawOperationDescriptor; | 100 class RawOperationDescriptor; |
100 class Script; | 101 class Script; |
101 class SharedArrayBuffer; | 102 class SharedArrayBuffer; |
102 class Signature; | 103 class Signature; |
103 class StartupData; | 104 class StartupData; |
104 class StackFrame; | 105 class StackFrame; |
105 class StackTrace; | 106 class StackTrace; |
106 class String; | 107 class String; |
107 class StringObject; | 108 class StringObject; |
(...skipping 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2688 // Implements DefineOwnProperty. | 2689 // Implements DefineOwnProperty. |
2689 // | 2690 // |
2690 // In general, CreateDataProperty will be faster, however, does not allow | 2691 // In general, CreateDataProperty will be faster, however, does not allow |
2691 // for specifying attributes. | 2692 // for specifying attributes. |
2692 // | 2693 // |
2693 // Returns true on success. | 2694 // Returns true on success. |
2694 V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty( | 2695 V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty( |
2695 Local<Context> context, Local<Name> key, Local<Value> value, | 2696 Local<Context> context, Local<Name> key, Local<Value> value, |
2696 PropertyAttribute attributes = None); | 2697 PropertyAttribute attributes = None); |
2697 | 2698 |
2699 // Implements Object.DefineProperty(O, P, Attributes), see Ecma-262 19.1.2.4. | |
2700 // | |
2701 // The defineProperty function is used to add an own property or | |
2702 // update the attributes of an existing own property of an object. | |
2703 // | |
2704 // Both data and accessor descriptors can be used. | |
2705 // | |
2706 // In general, CreateDataProperty is faster, however, does not allow | |
2707 // for specifying attributes or an accessor descriptor. | |
2708 // | |
2709 // Returns true on success. | |
2710 V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty( | |
2711 Local<Context> context, Local<Name> key, | |
2712 const PropertyDescriptor& descriptor); | |
2713 | |
2698 // Sets an own property on this object bypassing interceptors and | 2714 // Sets an own property on this object bypassing interceptors and |
2699 // overriding accessors or read-only properties. | 2715 // overriding accessors or read-only properties. |
2700 // | 2716 // |
2701 // Note that if the object has an interceptor the property will be set | 2717 // Note that if the object has an interceptor the property will be set |
2702 // locally, but since the interceptor takes precedence the local property | 2718 // locally, but since the interceptor takes precedence the local property |
2703 // will only be returned if the interceptor doesn't return a value. | 2719 // will only be returned if the interceptor doesn't return a value. |
2704 // | 2720 // |
2705 // Note also that this only works for named properties. | 2721 // Note also that this only works for named properties. |
2706 V8_DEPRECATED("Use CreateDataProperty / DefineOwnProperty", | 2722 V8_DEPRECATED("Use CreateDataProperty / DefineOwnProperty", |
2707 bool ForceSet(Local<Value> key, Local<Value> value, | 2723 bool ForceSet(Local<Value> key, Local<Value> value, |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3426 */ | 3442 */ |
3427 bool HasHandler(); | 3443 bool HasHandler(); |
3428 | 3444 |
3429 V8_INLINE static Promise* Cast(Value* obj); | 3445 V8_INLINE static Promise* Cast(Value* obj); |
3430 | 3446 |
3431 private: | 3447 private: |
3432 Promise(); | 3448 Promise(); |
3433 static void CheckCast(Value* obj); | 3449 static void CheckCast(Value* obj); |
3434 }; | 3450 }; |
3435 | 3451 |
3452 /** | |
3453 * An instance of a Property Descriptor, see Ecma-262 6.2.4. | |
3454 * | |
3455 * This property descriptor is immutable except for its properties enumerable | |
3456 * and configurable. An invalid descriptor that is both | |
3457 * a data and accessor descriptor can not be generated. To determine if | |
3458 * a descriptor is an accessor, data, or generic descriptor, use the | |
3459 * `has_x()` functions for appropriate x. | |
3460 * | |
3461 * Empty handles for `get` or `set` are interpreted as undefined. | |
Jakob Kummerow
2016/08/26 13:28:30
Is there a particular reason for this, which cause
| |
3462 * | |
3463 * The difference between `hax_x() = false` and setting x to undefined or empty | |
3464 * handle is important when re-defining a property. When re-defining, | |
3465 * `has_x() = false` | |
3466 * does not cause a type error if x is already defined differently. | |
3467 * \code | |
3468 * PropertyDescriptor(Local<Function>()), true) // var desc = {get: undefined} | |
3469 * PropertyDescriptor() // var desc = {} | |
3470 * \endcode | |
3471 */ | |
3472 class V8_EXPORT PropertyDescriptor { | |
3473 public: | |
3474 // GenericDescriptor | |
3475 PropertyDescriptor() {} | |
3476 | |
3477 // DataDescriptor | |
3478 PropertyDescriptor(Local<Value> value, bool has_value, bool writable, | |
3479 bool has_writable) | |
3480 : value_(value), | |
3481 has_value_(has_value), | |
3482 writable_(writable), | |
3483 has_writable_(has_writable) {} | |
3484 | |
3485 // AccessorDescriptor | |
3486 PropertyDescriptor(Local<Function> get, bool has_get, Local<Function> set, | |
3487 bool has_set) | |
3488 : get_(get), has_get_(has_get), set_(set), has_set_(has_set) {} | |
3489 | |
3490 Local<Value> value() const { return value_; } | |
3491 bool has_value() const { return has_value_; } | |
3492 | |
3493 Local<Function> get() const { return get_; } | |
3494 bool has_get() const { return has_get_; } | |
3495 Local<Function> set() const { return set_; } | |
3496 bool has_set() const { return has_set_; } | |
3497 | |
3498 void set_enumerable(bool enumeralbe) { | |
Jakob Kummerow
2016/08/26 13:28:30
nit: typo
Franzi
2016/08/31 09:44:13
Done.
| |
3499 enumerable_ = enumeralbe; | |
3500 has_enumerable_ = true; | |
3501 } | |
3502 bool enumerable() const { return enumerable_; } | |
3503 bool has_enumerable() const { return has_enumerable_; } | |
3504 | |
3505 void set_configurable(bool configurable) { | |
3506 configurable_ = configurable; | |
3507 has_configurable_ = true; | |
3508 } | |
3509 bool configurable() const { return configurable_; } | |
3510 bool has_configurable() const { return has_configurable_; } | |
3511 | |
3512 bool writable() const { return writable_; } | |
3513 bool has_writable() const { return has_writable_; } | |
3514 | |
3515 PropertyDescriptor(const PropertyDescriptor&) = delete; | |
3516 void operator=(const PropertyDescriptor&) = delete; | |
3517 | |
3518 private: | |
3519 Local<Value> value_; | |
3520 bool has_value_ = false; | |
3521 | |
3522 Local<Function> get_; | |
3523 bool has_get_ = false; | |
3524 Local<Function> set_; | |
3525 bool has_set_ = false; | |
3526 | |
3527 bool enumerable_ = false; | |
3528 bool has_enumerable_ = false; | |
3529 bool configurable_ = false; | |
3530 bool has_configurable_ = false; | |
3531 bool writable_ = false; | |
3532 bool has_writable_ = false; | |
3533 }; | |
3436 | 3534 |
3437 /** | 3535 /** |
3438 * An instance of the built-in Proxy constructor (ECMA-262, 6th Edition, | 3536 * An instance of the built-in Proxy constructor (ECMA-262, 6th Edition, |
3439 * 26.2.1). | 3537 * 26.2.1). |
3440 */ | 3538 */ |
3441 class V8_EXPORT Proxy : public Object { | 3539 class V8_EXPORT Proxy : public Object { |
3442 public: | 3540 public: |
3443 Local<Object> GetTarget(); | 3541 Local<Object> GetTarget(); |
3444 Local<Value> GetHandler(); | 3542 Local<Value> GetHandler(); |
3445 bool IsRevoked(); | 3543 bool IsRevoked(); |
(...skipping 5562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9008 */ | 9106 */ |
9009 | 9107 |
9010 | 9108 |
9011 } // namespace v8 | 9109 } // namespace v8 |
9012 | 9110 |
9013 | 9111 |
9014 #undef TYPE_CHECK | 9112 #undef TYPE_CHECK |
9015 | 9113 |
9016 | 9114 |
9017 #endif // INCLUDE_V8_H_ | 9115 #endif // INCLUDE_V8_H_ |
OLD | NEW |