v8 10.2.154 (node 18.16.0)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
v8-function.h
Go to the documentation of this file.
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 <stddef.h>
9#include <stdint.h>
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
18namespace v8 {
19
20class Context;
21class UnboundScript;
22
26class V8_EXPORT Function : public Object {
27 public:
33 Local<Context> context, FunctionCallback callback,
34 Local<Value> data = Local<Value>(), int length = 0,
35 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
36 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
37
39 Local<Context> context, int argc, Local<Value> argv[]) const;
40
42 Local<Context> context) const {
43 return NewInstance(context, 0, nullptr);
44 }
45
52 Local<Context> context, int argc, Local<Value> argv[],
53 SideEffectType side_effect_type = SideEffectType::kHasSideEffect) const;
54
56 Local<Value> recv, int argc,
57 Local<Value> argv[]);
58
61
63
71
77
88
92 int ScriptId() const;
93
99
107 Local<Context> context);
108
110 V8_INLINE static Function* Cast(Value* value) {
111#ifdef V8_ENABLE_CHECKS
112 CheckCast(value);
113#endif
114 return static_cast<Function*>(value);
115 }
116
117 static const int kLineOffsetNotFound;
118
119 private:
120 Function();
121 static void CheckCast(Value* obj);
122};
123} // namespace v8
124
125#endif // INCLUDE_V8_FUNCTION_H_
Local< Value > GetDebugName() const
MaybeLocal< UnboundScript > GetUnboundScript() const
static MaybeLocal< Function > New(Local< Context > context, FunctionCallback callback, Local< Value > data=Local< Value >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect)
Local< Value > GetInferredName() const
static V8_INLINE Function * Cast(Value *value)
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewInstance(Local< Context > context) const
Definition v8-function.h:41
V8_WARN_UNUSED_RESULT MaybeLocal< String > FunctionProtoToString(Local< Context > context)
static const int kLineOffsetNotFound
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewInstanceWithSideEffectType(Local< Context > context, int argc, Local< Value > argv[], SideEffectType side_effect_type=SideEffectType::kHasSideEffect) const
void SetName(Local< String > name)
Local< Value > GetName() const
ScriptOrigin GetScriptOrigin() const
int GetScriptColumnNumber() const
int ScriptId() const
Local< Value > GetBoundFunction() const
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewInstance(Local< Context > context, int argc, Local< Value > argv[]) const
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Call(Local< Context > context, Local< Value > recv, int argc, Local< Value > argv[])
int GetScriptLineNumber() const
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
SideEffectType
Definition v8-object.h:203
ConstructorBehavior
#define V8_EXPORT
Definition v8config.h:578
#define V8_INLINE
Definition v8config.h:425
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:499