| 157 | } |
| 158 | |
| 159 | void SetMethod(Local <v8::Context> context, |
| 160 | Local <v8::Object> that, |
| 161 | const char *name, |
| 162 | v8::FunctionCallback callback, |
| 163 | Local <v8::Value> data) { |
| 164 | Isolate *isolate = context->GetIsolate(); |
| 165 | Local<v8::Function> function = |
| 166 | NewFunctionTemplate(isolate, |
| 167 | callback, |
| 168 | data, |
| 169 | Local<v8::Signature>(), |
| 170 | v8::ConstructorBehavior::kThrow, |
| 171 | v8::SideEffectType::kHasSideEffect) |
| 172 | ->GetFunction(context) |
| 173 | .ToLocalChecked(); |
| 174 | // kInternalized strings are created in the old space. |
| 175 | const v8::NewStringType type = v8::NewStringType::kInternalized; |
| 176 | Local<v8::String> name_string = |
| 177 | v8::String::NewFromUtf8(isolate, name, type).ToLocalChecked(); |
| 178 | that->Set(context, name_string, function).Check(); |
| 179 | function->SetName(name_string); // NODE_SET_METHOD() compatibility. |
| 180 | } |
| 181 | |
| 182 | void SetMethod(v8::Isolate *isolate, |
| 183 | v8::Local<v8::Template> that, |
no test coverage detected