diff --git a/ext/node/lib.rs b/ext/node/lib.rs index ed6713eed8..f2c1576cf5 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -633,115 +633,116 @@ deno_core::extension!(deno_node, global_template_middleware = global_template_middleware, global_object_middleware = global_object_middleware, customizer = |ext: &mut deno_core::Extension| { - let mut external_references = Vec::with_capacity(14); + let external_references = [ + vm::QUERY_MAP_FN.with(|query| { + ExternalReference { + named_query: *query, + } + }), + vm::GETTER_MAP_FN.with(|getter| { + ExternalReference { + named_getter: *getter, + } + }), + vm::SETTER_MAP_FN.with(|setter| { + ExternalReference { + named_setter: *setter, + } + }), + vm::DESCRIPTOR_MAP_FN.with(|descriptor| { + ExternalReference { + named_getter: *descriptor, + } + }), + vm::DELETER_MAP_FN.with(|deleter| { + ExternalReference { + named_deleter: *deleter, + } + }), + vm::ENUMERATOR_MAP_FN.with(|enumerator| { + ExternalReference { + enumerator: *enumerator, + } + }), + vm::DEFINER_MAP_FN.with(|definer| { + ExternalReference { + named_definer: *definer, + } + }), - vm::QUERY_MAP_FN.with(|query| { - external_references.push(ExternalReference { - named_query: *query, - }); - }); - vm::GETTER_MAP_FN.with(|getter| { - external_references.push(ExternalReference { - named_getter: *getter, - }); - }); - vm::SETTER_MAP_FN.with(|setter| { - external_references.push(ExternalReference { - named_setter: *setter, - }); - }); - vm::DESCRIPTOR_MAP_FN.with(|descriptor| { - external_references.push(ExternalReference { - named_getter: *descriptor, - }); - }); - vm::DELETER_MAP_FN.with(|deleter| { - external_references.push(ExternalReference { - named_deleter: *deleter, - }); - }); - vm::ENUMERATOR_MAP_FN.with(|enumerator| { - external_references.push(ExternalReference { - enumerator: *enumerator, - }); - }); - vm::DEFINER_MAP_FN.with(|definer| { - external_references.push(ExternalReference { - named_definer: *definer, - }); - }); + vm::INDEXED_QUERY_MAP_FN.with(|query| { + ExternalReference { + indexed_query: *query, + } + }), + vm::INDEXED_GETTER_MAP_FN.with(|getter| { + ExternalReference { + indexed_getter: *getter, + } + }), + vm::INDEXED_SETTER_MAP_FN.with(|setter| { + ExternalReference { + indexed_setter: *setter, + } + }), + vm::INDEXED_DESCRIPTOR_MAP_FN.with(|descriptor| { + ExternalReference { + indexed_getter: *descriptor, + } + }), + vm::INDEXED_DELETER_MAP_FN.with(|deleter| { + ExternalReference { + indexed_deleter: *deleter, + } + }), + vm::INDEXED_DEFINER_MAP_FN.with(|definer| { + ExternalReference { + indexed_definer: *definer, + } + }), + vm::INDEXED_ENUMERATOR_MAP_FN.with(|enumerator| { + ExternalReference { + enumerator: *enumerator, + } + }), - vm::INDEXED_QUERY_MAP_FN.with(|query| { - external_references.push(ExternalReference { - indexed_query: *query, - }); - }); - vm::INDEXED_GETTER_MAP_FN.with(|getter| { - external_references.push(ExternalReference { - indexed_getter: *getter, - }); - }); - vm::INDEXED_SETTER_MAP_FN.with(|setter| { - external_references.push(ExternalReference { - indexed_setter: *setter, - }); - }); - vm::INDEXED_DESCRIPTOR_MAP_FN.with(|descriptor| { - external_references.push(ExternalReference { - indexed_getter: *descriptor, - }); - }); - vm::INDEXED_DELETER_MAP_FN.with(|deleter| { - external_references.push(ExternalReference { - indexed_deleter: *deleter, - }); - }); - vm::INDEXED_DEFINER_MAP_FN.with(|definer| { - external_references.push(ExternalReference { - indexed_definer: *definer, - }); - }); - vm::INDEXED_ENUMERATOR_MAP_FN.with(|enumerator| { - external_references.push(ExternalReference { - enumerator: *enumerator, - }); - }); + global::GETTER_MAP_FN.with(|getter| { + ExternalReference { + named_getter: *getter, + } + }), + global::SETTER_MAP_FN.with(|setter| { + ExternalReference { + named_setter: *setter, + } + }), + global::QUERY_MAP_FN.with(|query| { + ExternalReference { + named_query: *query, + } + }), + global::DELETER_MAP_FN.with(|deleter| { + ExternalReference { + named_deleter: *deleter, + } + }), + global::ENUMERATOR_MAP_FN.with(|enumerator| { + ExternalReference { + enumerator: *enumerator, + } + }), + global::DEFINER_MAP_FN.with(|definer| { + ExternalReference { + named_definer: *definer, + } + }), + global::DESCRIPTOR_MAP_FN.with(|descriptor| { + ExternalReference { + named_getter: *descriptor, + } + }), + ]; - global::GETTER_MAP_FN.with(|getter| { - external_references.push(ExternalReference { - named_getter: *getter, - }); - }); - global::SETTER_MAP_FN.with(|setter| { - external_references.push(ExternalReference { - named_setter: *setter, - }); - }); - global::QUERY_MAP_FN.with(|query| { - external_references.push(ExternalReference { - named_query: *query, - }); - }); - global::DELETER_MAP_FN.with(|deleter| { - external_references.push(ExternalReference { - named_deleter: *deleter, - }); - }); - global::ENUMERATOR_MAP_FN.with(|enumerator| { - external_references.push(ExternalReference { - enumerator: *enumerator, - }); - }); - global::DEFINER_MAP_FN.with(|definer| { - external_references.push(ExternalReference { - named_definer: *definer, - }); - }); - global::DESCRIPTOR_MAP_FN.with(|descriptor| { - external_references.push(ExternalReference { - named_getter: *descriptor, - }); - }); ext.external_references.to_mut().extend(external_references); }, );