Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/node/v8-function.h
$ cat -n /usr/include/node/v8-function.h 1 // Copyright 2021 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef INCLUDE_V8_FUNCTION_H_ 6 #define INCLUDE_V8_FUNCTION_H_ 7 8 #include
9 #include
10 11 #include "v8-function-callback.h" // NOLINT(build/include_directory) 12 #include "v8-local-handle.h" // NOLINT(build/include_directory) 13 #include "v8-message.h" // NOLINT(build/include_directory) 14 #include "v8-object.h" // NOLINT(build/include_directory) 15 #include "v8-template.h" // NOLINT(build/include_directory) 16 #include "v8config.h" // NOLINT(build/include_directory) 17 18 namespace v8 { 19 20 class Context; 21 class UnboundScript; 22 23 /** 24 * A JavaScript function object (ECMA-262, 15.3). 25 */ 26 class V8_EXPORT Function : public Object { 27 public: 28 /** 29 * Create a function in the current execution context 30 * for a given FunctionCallback. 31 */ 32 static MaybeLocal
New( 33 Local
context, FunctionCallback callback, 34 Local
data = Local
(), int length = 0, 35 ConstructorBehavior behavior = ConstructorBehavior::kAllow, 36 SideEffectType side_effect_type = SideEffectType::kHasSideEffect); 37 38 V8_WARN_UNUSED_RESULT MaybeLocal
NewInstance( 39 Local
context, int argc, Local
argv[]) const; 40 41 V8_WARN_UNUSED_RESULT MaybeLocal
NewInstance( 42 Local
context) const { 43 return NewInstance(context, 0, nullptr); 44 } 45 46 /** 47 * When side effect checks are enabled, passing kHasNoSideEffect allows the 48 * constructor to be invoked without throwing. Calls made within the 49 * constructor are still checked. 50 */ 51 V8_WARN_UNUSED_RESULT MaybeLocal
NewInstanceWithSideEffectType( 52 Local
context, int argc, Local
argv[], 53 SideEffectType side_effect_type = SideEffectType::kHasSideEffect) const; 54 55 V8_WARN_UNUSED_RESULT MaybeLocal
Call(Local
context, 56 Local
recv, int argc, 57 Local
argv[]); 58 59 void SetName(Local
name); 60 Local
GetName() const; 61 62 V8_DEPRECATED("No direct replacement") 63 MaybeLocal
GetUnboundScript() const; 64 65 /** 66 * Name inferred from variable or property assignment of this function. 67 * Used to facilitate debugging and profiling of JavaScript code written 68 * in an OO style, where many functions are anonymous but are assigned 69 * to object properties. 70 */ 71 Local
GetInferredName() const; 72 73 /** 74 * displayName if it is set, otherwise name if it is configured, otherwise 75 * function name, otherwise inferred name. 76 */ 77 Local
GetDebugName() const; 78 79 /** 80 * Returns zero based line number of function body and 81 * kLineOffsetNotFound if no information available. 82 */ 83 int GetScriptLineNumber() const; 84 /** 85 * Returns zero based column number of function body and 86 * kLineOffsetNotFound if no information available. 87 */ 88 int GetScriptColumnNumber() const; 89 90 /** 91 * Returns zero based start position (character offset) of function body and 92 * kLineOffsetNotFound if no information available. 93 */ 94 int GetScriptStartPosition() const; 95 96 /** 97 * Returns scriptId. 98 */ 99 int ScriptId() const; 100 101 /** 102 * Returns the original function if this function is bound, else returns 103 * v8::Undefined. 104 */ 105 Local
GetBoundFunction() const; 106 107 /** 108 * Calls builtin Function.prototype.toString on this function. 109 * This is different from Value::ToString() that may call a user-defined 110 * toString() function, and different than Object::ObjectProtoToString() which 111 * always serializes "[object Function]". 112 */ 113 V8_WARN_UNUSED_RESULT MaybeLocal
FunctionProtoToString( 114 Local
context); 115 116 /** 117 * Returns true if the function does nothing. 118 * The function returns false on error. 119 * Note that this function is experimental. Embedders should not rely on 120 * this existing. We may remove this function in the future. 121 */ 122 V8_WARN_UNUSED_RESULT bool Experimental_IsNopFunction() const; 123 124 ScriptOrigin GetScriptOrigin() const; 125 V8_INLINE static Function* Cast(Value* value) { 126 #ifdef V8_ENABLE_CHECKS 127 CheckCast(value); 128 #endif 129 return static_cast
(value); 130 } 131 132 static const int kLineOffsetNotFound; 133 134 private: 135 Function(); 136 static void CheckCast(Value* obj); 137 }; 138 } // namespace v8 139 140 #endif // INCLUDE_V8_FUNCTION_H_
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™