v8 12.4.254 (node 22.4.1)
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
62 V8_DEPRECATED("No direct replacement")
63 MaybeLocal<UnboundScript> GetUnboundScript() const;
64
71 Local<Value> GetInferredName() const;
72
77 Local<Value> GetDebugName() const;
78
83 int GetScriptLineNumber() const;
88 int GetScriptColumnNumber() const;
89
94 int GetScriptStartPosition() const;
95
99 int ScriptId() const;
100
105 Local<Value> GetBoundFunction() const;
106
114 Local<Context> context);
115
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<Function*>(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_
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)
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewInstance(Local< Context > context) const
Definition v8-function.h:41
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
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[])
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
SideEffectType
Definition v8-object.h:199
ConstructorBehavior
#define V8_EXPORT
Definition v8config.h:753
#define V8_INLINE
Definition v8config.h:477
#define V8_DEPRECATED(message)
Definition v8config.h:563
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:628