| |
| |
| |
|
|
| #ifndef INCLUDE_V8_FUNCTION_H_ |
| #define INCLUDE_V8_FUNCTION_H_ |
|
|
| #include <stddef.h> |
| #include <stdint.h> |
|
|
| #include "v8-function-callback.h" |
| #include "v8-local-handle.h" |
| #include "v8-message.h" |
| #include "v8-object.h" |
| #include "v8-template.h" |
| #include "v8config.h" |
|
|
| namespace v8 { |
|
|
| class Context; |
| class UnboundScript; |
|
|
| |
| |
| |
| class V8_EXPORT Function : public Object { |
| public: |
| |
| |
| |
| |
| 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, int argc, Local<Value> argv[]) const; |
|
|
| V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance( |
| Local<Context> context) const { |
| return NewInstance(context, 0, nullptr); |
| } |
|
|
| |
| |
| |
| |
| |
| V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstanceWithSideEffectType( |
| Local<Context> context, int argc, Local<Value> argv[], |
| SideEffectType side_effect_type = SideEffectType::kHasSideEffect) const; |
|
|
| V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(Local<Context> context, |
| Local<Value> recv, int argc, |
| Local<Value> argv[]); |
|
|
| void SetName(Local<String> name); |
| Local<Value> GetName() const; |
|
|
| V8_DEPRECATED("No direct replacement") |
| MaybeLocal<UnboundScript> GetUnboundScript() const; |
|
|
| |
| |
| |
| |
| |
| |
| Local<Value> GetInferredName() const; |
|
|
| |
| |
| |
| |
| Local<Value> GetDebugName() const; |
|
|
| |
| |
| |
| |
| int GetScriptLineNumber() const; |
| |
| |
| |
| |
| int GetScriptColumnNumber() const; |
|
|
| |
| |
| |
| int ScriptId() const; |
|
|
| |
| |
| |
| |
| Local<Value> GetBoundFunction() const; |
|
|
| |
| |
| |
| |
| |
| |
| V8_WARN_UNUSED_RESULT MaybeLocal<String> FunctionProtoToString( |
| Local<Context> context); |
|
|
| |
| |
| |
| |
| |
| |
| V8_WARN_UNUSED_RESULT bool Experimental_IsNopFunction() const; |
|
|
| ScriptOrigin GetScriptOrigin() const; |
| V8_INLINE static Function* Cast(Value* value) { |
| #ifdef V8_ENABLE_CHECKS |
| CheckCast(value); |
| #endif |
| return static_cast<Function*>(value); |
| } |
|
|
| static const int kLineOffsetNotFound; |
|
|
| private: |
| Function(); |
| static void CheckCast(Value* obj); |
| }; |
| } |
|
|
| #endif |
|
|