@@ -170,17 +170,15 @@ bool BindingData::FastCanParse(Local<Value> receiver,
170
170
return ada::can_parse (std::string_view (input.data , input.length ));
171
171
}
172
172
173
- CFunction BindingData::fast_can_parse_ (CFunction::Make(FastCanParse));
174
-
175
173
bool BindingData::FastCanParseWithBase (Local<Value> receiver,
176
174
const FastOneByteString& input,
177
175
const FastOneByteString& base) {
178
176
auto base_view = std::string_view (base.data , base.length );
179
177
return ada::can_parse (std::string_view (input.data , input.length ), &base_view);
180
178
}
181
179
182
- CFunction BindingData::fast_can_parse_with_base_ (
183
- CFunction::Make (FastCanParseWithBase)) ;
180
+ CFunction BindingData::fast_can_parse_methods_[] = {
181
+ CFunction::Make (FastCanParse), CFunction::Make ( FastCanParseWithBase)} ;
184
182
185
183
void BindingData::Format (const FunctionCallbackInfo<Value>& args) {
186
184
CHECK_GT (args.Length (), 4 );
@@ -361,12 +359,7 @@ void BindingData::CreatePerIsolateProperties(IsolateData* isolate_data,
361
359
SetMethod (isolate, target, " parse" , Parse);
362
360
SetMethod (isolate, target, " update" , Update);
363
361
SetFastMethodNoSideEffect (
364
- isolate, target, " canParse" , CanParse, &fast_can_parse_);
365
- SetFastMethodNoSideEffect (isolate,
366
- target,
367
- " canParseWithBase" ,
368
- CanParse,
369
- &fast_can_parse_with_base_);
362
+ isolate, target, " canParse" , CanParse, {fast_can_parse_methods_, 2 });
370
363
}
371
364
372
365
void BindingData::CreatePerContextProperties (Local<Object> target,
@@ -387,9 +380,11 @@ void BindingData::RegisterExternalReferences(
387
380
registry->Register (Update);
388
381
registry->Register (CanParse);
389
382
registry->Register (FastCanParse);
390
- registry->Register (fast_can_parse_.GetTypeInfo ());
391
383
registry->Register (FastCanParseWithBase);
392
- registry->Register (fast_can_parse_with_base_.GetTypeInfo ());
384
+
385
+ for (const CFunction& method : fast_can_parse_methods_) {
386
+ registry->Register (method.GetTypeInfo ());
387
+ }
393
388
}
394
389
395
390
std::string FromFilePath (const std::string_view file_path) {
0 commit comments