Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: include/v8.h

Issue 2365403003: [api] Add documentation for various HasProperty functions. (Closed)
Patch Set: Also link to indexed callbacks from flags. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2950 matching lines...) Expand 10 before | Expand all | Expand 10 after
2961 2961
2962 /** 2962 /**
2963 * Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3. 2963 * Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3.
2964 */ 2964 */
2965 V8_DEPRECATED("Use maybe version", 2965 V8_DEPRECATED("Use maybe version",
2966 Local<Value> GetOwnPropertyDescriptor(Local<String> key)); 2966 Local<Value> GetOwnPropertyDescriptor(Local<String> key));
2967 V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetOwnPropertyDescriptor( 2967 V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetOwnPropertyDescriptor(
2968 Local<Context> context, Local<String> key); 2968 Local<Context> context, Local<String> key);
2969 2969
2970 V8_DEPRECATE_SOON("Use maybe version", bool Has(Local<Value> key)); 2970 V8_DEPRECATE_SOON("Use maybe version", bool Has(Local<Value> key));
2971 /**
2972 * Object::Has() calls the abstract operation HasProperty(O, P) described
2973 * in ECMA-262, 7.3.10. Has() returns
2974 * true, if the object has the property, either own or on the prototype chain.
2975 * Interceptors, i.e., PropertyQueryCallbacks, are called if present.
2976 *
2977 * Has() has the same side effects as JavaScript's `variable in object`.
2978 * For example, calling Has() on a revoked proxy will throw an exception.
2979 *
2980 * \note Has() converts the key to a name, which possibly calls back into
2981 * JavaScript.
2982 *
2983 * See also v8::Object::HasOwnProperty() and
2984 * v8::Object::HasRealNamedProperty().
2985 */
2971 V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context, 2986 V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context,
2972 Local<Value> key); 2987 Local<Value> key);
2973 2988
2974 V8_DEPRECATE_SOON("Use maybe version", bool Delete(Local<Value> key)); 2989 V8_DEPRECATE_SOON("Use maybe version", bool Delete(Local<Value> key));
2975 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT 2990 // TODO(dcarney): mark V8_WARN_UNUSED_RESULT
2976 Maybe<bool> Delete(Local<Context> context, Local<Value> key); 2991 Maybe<bool> Delete(Local<Context> context, Local<Value> key);
2977 2992
2978 V8_DEPRECATED("Use maybe version", bool Has(uint32_t index)); 2993 V8_DEPRECATED("Use maybe version", bool Has(uint32_t index));
2979 V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context, uint32_t index); 2994 V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context, uint32_t index);
2980 2995
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3125 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such 3140 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such
3126 * a field, GetAlignedPointerFromInternalField must be used, everything else 3141 * a field, GetAlignedPointerFromInternalField must be used, everything else
3127 * leads to undefined behavior. 3142 * leads to undefined behavior.
3128 */ 3143 */
3129 void SetAlignedPointerInInternalField(int index, void* value); 3144 void SetAlignedPointerInInternalField(int index, void* value);
3130 void SetAlignedPointerInInternalFields(int argc, int indices[], 3145 void SetAlignedPointerInInternalFields(int argc, int indices[],
3131 void* values[]); 3146 void* values[]);
3132 3147
3133 // Testers for local properties. 3148 // Testers for local properties.
3134 V8_DEPRECATED("Use maybe version", bool HasOwnProperty(Local<String> key)); 3149 V8_DEPRECATED("Use maybe version", bool HasOwnProperty(Local<String> key));
3150
3151 /**
3152 * HasOwnProperty() is like JavaScript's Object.prototype.hasOwnProperty().
3153 *
3154 * See also v8::Object::Has() and v8::Object::HasRealNamedProperty().
3155 */
3135 V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context, 3156 V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context,
3136 Local<Name> key); 3157 Local<Name> key);
3137 V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context, 3158 V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context,
3138 uint32_t index); 3159 uint32_t index);
3139 V8_DEPRECATE_SOON("Use maybe version", 3160 V8_DEPRECATE_SOON("Use maybe version",
3140 bool HasRealNamedProperty(Local<String> key)); 3161 bool HasRealNamedProperty(Local<String> key));
3162 /**
3163 * Use HasRealNamedProperty() if you want to check if an object has an own
3164 * property without causing side effects, i.e., without calling interceptors.
3165 *
3166 * This function is similar to v8::Object::HasOwnProperty(), but it does not
3167 * call interceptors.
3168 *
3169 * \note Consider using non-masking interceptors, i.e., the interceptors are
3170 * not called if the receiver has the real named property. See
3171 * `v8::PropertyHandlerFlags::kNonMasking`.
3172 *
3173 * See also v8::Object::Has().
3174 */
3141 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context, 3175 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context,
3142 Local<Name> key); 3176 Local<Name> key);
3143 V8_DEPRECATE_SOON("Use maybe version", 3177 V8_DEPRECATE_SOON("Use maybe version",
3144 bool HasRealIndexedProperty(uint32_t index)); 3178 bool HasRealIndexedProperty(uint32_t index));
3145 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealIndexedProperty( 3179 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealIndexedProperty(
3146 Local<Context> context, uint32_t index); 3180 Local<Context> context, uint32_t index);
3147 V8_DEPRECATE_SOON("Use maybe version", 3181 V8_DEPRECATE_SOON("Use maybe version",
3148 bool HasRealNamedCallbackProperty(Local<String> key)); 3182 bool HasRealNamedCallbackProperty(Local<String> key));
3149 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedCallbackProperty( 3183 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedCallbackProperty(
3150 Local<Context> context, Local<Name> key); 3184 Local<Context> context, Local<Name> key);
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
5119 * template. 5153 * template.
5120 */ 5154 */
5121 bool HasInstance(Local<Value> object); 5155 bool HasInstance(Local<Value> object);
5122 5156
5123 private: 5157 private:
5124 FunctionTemplate(); 5158 FunctionTemplate();
5125 friend class Context; 5159 friend class Context;
5126 friend class ObjectTemplate; 5160 friend class ObjectTemplate;
5127 }; 5161 };
5128 5162
5163 /**
5164 * Configuration flags for v8::NamedPropertyHandlerConfiguration or
5165 * v8::IndexedPropertyHandlerConfiguration.
5166 */
5129 enum class PropertyHandlerFlags { 5167 enum class PropertyHandlerFlags {
5168 /**
5169 * None.
5170 */
5130 kNone = 0, 5171 kNone = 0,
5131 // See ALL_CAN_READ above. 5172
5173 /**
5174 * See ALL_CAN_READ above.
5175 */
5132 kAllCanRead = 1, 5176 kAllCanRead = 1,
5133 // Will not call into interceptor for properties on the receiver or prototype 5177
5134 // chain, i.e., only call into interceptor for properties that do not exist. 5178 /** Will not call into interceptor for properties on the receiver or prototype
5135 // Currently only valid for named interceptors. 5179 * chain, i.e., only call into interceptor for properties that do not exist.
5180 * Currently only valid for named interceptors.
5181 */
5136 kNonMasking = 1 << 1, 5182 kNonMasking = 1 << 1,
5137 // Will not call into interceptor for symbol lookup. Only meaningful for 5183
5138 // named interceptors. 5184 /**
5185 * Will not call into interceptor for symbol lookup. Only meaningful for
5186 * named interceptors.
5187 */
5139 kOnlyInterceptStrings = 1 << 2, 5188 kOnlyInterceptStrings = 1 << 2,
5140 }; 5189 };
5141 5190
5142 struct NamedPropertyHandlerConfiguration { 5191 struct NamedPropertyHandlerConfiguration {
5143 NamedPropertyHandlerConfiguration( 5192 NamedPropertyHandlerConfiguration(
5144 /** Note: getter is required */ 5193 /** Note: getter is required */
5145 GenericNamedPropertyGetterCallback getter = 0, 5194 GenericNamedPropertyGetterCallback getter = 0,
5146 GenericNamedPropertySetterCallback setter = 0, 5195 GenericNamedPropertySetterCallback setter = 0,
5147 GenericNamedPropertyQueryCallback query = 0, 5196 GenericNamedPropertyQueryCallback query = 0,
5148 GenericNamedPropertyDeleterCallback deleter = 0, 5197 GenericNamedPropertyDeleterCallback deleter = 0,
(...skipping 4424 matching lines...) Expand 10 before | Expand all | Expand 10 after
9573 */ 9622 */
9574 9623
9575 9624
9576 } // namespace v8 9625 } // namespace v8
9577 9626
9578 9627
9579 #undef TYPE_CHECK 9628 #undef TYPE_CHECK
9580 9629
9581 9630
9582 #endif // INCLUDE_V8_H_ 9631 #endif // INCLUDE_V8_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698