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<Context> context,
57 Local<Value> recv, int argc,
58 Local<Value> argv[]);
60 Local<Value> recv, int argc,
61 Local<Value> argv[]);
62
65
73
79
90
96
100 int ScriptId() const;
101
107
115 Local<Context> context);
116
124
126 V8_INLINE static Function* Cast(Value* value) {
127#ifdef V8_ENABLE_CHECKS
128 CheckCast(value);
129#endif
130 return static_cast<Function*>(value);
131 }
132
133 static const int kLineOffsetNotFound;
134
135 private:
136 Function();
137 static void CheckCast(Value* obj);
138};
139} // namespace v8
140
141#endif // INCLUDE_V8_FUNCTION_H_
Definition: v8-function.h:26
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:41
ScriptOrigin GetScriptOrigin() const
int GetScriptColumnNumber() const
static Function * Cast(Value *value)
Definition: v8-function.h:126
void SetName(Local< String > name)
static const int kLineOffsetNotFound
Definition: v8-function.h:133
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:212
Definition: v8-local-handle.h:266
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:793
#define V8_INLINE
Definition: v8config.h:499
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:660