@@ -170,17 +170,15 @@ bool BindingData::FastCanParse(Local<Value> receiver,
170170 return ada::can_parse (std::string_view (input.data , input.length ));
171171}
172172
173- CFunction BindingData::fast_can_parse_ (CFunction::Make(FastCanParse));
174-
175173bool BindingData::FastCanParseWithBase (Local<Value> receiver,
176174 const FastOneByteString& input,
177175 const FastOneByteString& base) {
178176 auto base_view = std::string_view (base.data , base.length );
179177 return ada::can_parse (std::string_view (input.data , input.length ), &base_view);
180178}
181179
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)} ;
184182
185183void BindingData::Format (const FunctionCallbackInfo<Value>& args) {
186184 CHECK_GT (args.Length (), 4 );
@@ -361,12 +359,7 @@ void BindingData::CreatePerIsolateProperties(IsolateData* isolate_data,
361359 SetMethod (isolate, target, " parse" , Parse);
362360 SetMethod (isolate, target, " update" , Update);
363361 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 });
370363}
371364
372365void BindingData::CreatePerContextProperties (Local<Object> target,
@@ -387,9 +380,11 @@ void BindingData::RegisterExternalReferences(
387380 registry->Register (Update);
388381 registry->Register (CanParse);
389382 registry->Register (FastCanParse);
390- registry->Register (fast_can_parse_.GetTypeInfo ());
391383 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+ }
393388}
394389
395390std::string FromFilePath (const std::string_view file_path) {
0 commit comments