Chromium Code Reviews

Side by Side Diff: include/v8.h

Issue 2365403003: [api] Add documentation for various HasProperty functions. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« 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...)
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...)
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.
jochen (gone - plz use gerrit) 2016/09/26 15:16:12 you could add that usually, you should just use an
3168 *
3169 * See also v8::Object::Has().
3170 */
3141 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context, 3171 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context,
3142 Local<Name> key); 3172 Local<Name> key);
3143 V8_DEPRECATE_SOON("Use maybe version", 3173 V8_DEPRECATE_SOON("Use maybe version",
3144 bool HasRealIndexedProperty(uint32_t index)); 3174 bool HasRealIndexedProperty(uint32_t index));
3145 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealIndexedProperty( 3175 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealIndexedProperty(
3146 Local<Context> context, uint32_t index); 3176 Local<Context> context, uint32_t index);
3147 V8_DEPRECATE_SOON("Use maybe version", 3177 V8_DEPRECATE_SOON("Use maybe version",
3148 bool HasRealNamedCallbackProperty(Local<String> key)); 3178 bool HasRealNamedCallbackProperty(Local<String> key));
3149 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedCallbackProperty( 3179 V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedCallbackProperty(
3150 Local<Context> context, Local<Name> key); 3180 Local<Context> context, Local<Name> key);
(...skipping 6422 matching lines...)
9573 */ 9603 */
9574 9604
9575 9605
9576 } // namespace v8 9606 } // namespace v8
9577 9607
9578 9608
9579 #undef TYPE_CHECK 9609 #undef TYPE_CHECK
9580 9610
9581 9611
9582 #endif // INCLUDE_V8_H_ 9612 #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