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 Location;
22class UnboundScript;
23
27class V8_EXPORT Function : public Object {
28 public:
34 Local<Context> context, FunctionCallback callback,
35 Local<Value> data = Local<Value>(), int length = 0,
36 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
37 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
38
40 Local<Context> context, int argc, Local<Value> argv[]) const;
41
43 Local<Context> context) const {
44 return NewInstance(context, 0, nullptr);
45 }
46
53 Local<Context> context, int argc, Local<Value> argv[],
54 SideEffectType side_effect_type = SideEffectType::kHasSideEffect) const;
55
57 Local<Context> context,
58 Local<Value> recv, int argc,
59 Local<Value> argv[]);
61 Local<Value> recv, int argc,
62 Local<Value> argv[]);
63
66
74
80
91
97
103
107 int ScriptId() const;
108
114
122 Local<Context> context);
123
131
133 V8_INLINE static Function* Cast(Value* value) {
134#ifdef V8_ENABLE_CHECKS
135 CheckCast(value);
136#endif
137 return static_cast<Function*>(value);
138 }
139
140 static const int kLineOffsetNotFound;
141
142 private:
143 Function();
144 static void CheckCast(Value* obj);
145};
146} // namespace v8
147
148#endif // INCLUDE_V8_FUNCTION_H_
Definition: v8-function.h:27
MaybeLocal< Value > Call(Local< Context > context, Local< Value > recv, int argc, Local< Value > argv[])
Local< Value > GetName() const
bool Experimental_IsNopFunction() const
MaybeLocal< Value > Call(v8::Isolate *isolate, Local< Context > context, Local< Value > recv, int argc, Local< Value > argv[])
Local< Value > GetInferredName() const
int ScriptId() const
MaybeLocal< String > FunctionProtoToString(Local< Context > context)
int GetScriptLineNumber() const
MaybeLocal< Object > NewInstance(Local< Context > context) const
Definition: v8-function.h:42
ScriptOrigin GetScriptOrigin() const
int GetScriptColumnNumber() const
static Function * Cast(Value *value)
Definition: v8-function.h:133
void SetName(Local< String > name)
Location GetScriptLocation() const
static const int kLineOffsetNotFound
Definition: v8-function.h:140
MaybeLocal< Object > NewInstance(Local< Context > context, int argc, Local< Value > argv[]) 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 > GetBoundFunction() const
Local< Value > GetDebugName() const
int GetScriptStartPosition() const
MaybeLocal< Object > NewInstanceWithSideEffectType(Local< Context > context, int argc, Local< Value > argv[], SideEffectType side_effect_type=SideEffectType::kHasSideEffect) const
Definition: v8-isolate.h:273
Definition: v8-local-handle.h:266
Definition: v8-script.h:112
Definition: v8-local-handle.h:632
Definition: v8-object.h:233
Definition: v8-message.h:62
Definition: v8-value.h:32
Definition: libplatform.h:15
SideEffectType
Definition: v8-object.h:198
ConstructorBehavior
Definition: v8-template.h:460
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
Definition: v8-function-callback.h:333
#define V8_EXPORT
Definition: v8config.h:803
#define V8_INLINE
Definition: v8config.h:499
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:670