refactor: add gin_helper::Dictionary::CreateEmpty() helper (#39547)
This commit is contained in:
parent
9937a2bbe8
commit
09190085c0
29 changed files with 66 additions and 64 deletions
|
@ -126,7 +126,7 @@ v8::Local<v8::Value> CreateFunctionFromTranslater(v8::Isolate* isolate,
|
|||
v8::Local<v8::FunctionTemplate>::New(isolate, g_call_translater);
|
||||
auto* holder = new TranslaterHolder(isolate);
|
||||
holder->translater = translater;
|
||||
gin::Dictionary state = gin::Dictionary::CreateEmpty(isolate);
|
||||
auto state = gin::Dictionary::CreateEmpty(isolate);
|
||||
if (one_time)
|
||||
state.Set("oneTime", true);
|
||||
auto context = isolate->GetCurrentContext();
|
||||
|
|
|
@ -31,6 +31,10 @@ class Dictionary : public gin::Dictionary {
|
|||
Dictionary(const gin::Dictionary& dict) // NOLINT(runtime/explicit)
|
||||
: gin::Dictionary(dict) {}
|
||||
|
||||
static Dictionary CreateEmpty(v8::Isolate* isolate) {
|
||||
return gin::Dictionary::CreateEmpty(isolate);
|
||||
}
|
||||
|
||||
// Differences from the Get method in gin::Dictionary:
|
||||
// 1. This is a const method;
|
||||
// 2. It checks whether the key exists before reading;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue