Skip to content

Commit 083082c

Browse files
author
s.vanriessen
committed
chore: rename binding name function
1 parent 8371570 commit 083082c

File tree

1 file changed

+14
-6
lines changed
  • crates/spidermonkey-embedding-splicer/src

1 file changed

+14
-6
lines changed

crates/spidermonkey-embedding-splicer/src/bindgen.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub fn componentize_bindgen(
174174
let mut import_bindings = Vec::new();
175175
for (specifier, item) in bindgen.imports.iter() {
176176
// this import binding order matters
177-
import_bindings.push(binding_name_import(
177+
import_bindings.push(generate_binding_name_import(
178178
&item.resource.func_name(&item.name),
179179
&item.iface_name,
180180
specifier,
@@ -205,8 +205,11 @@ pub fn componentize_bindgen(
205205
let item = items.first().unwrap();
206206
if let Some(resource) = resource {
207207
let export_name = resource.to_upper_camel_case();
208-
let binding_name =
209-
binding_name_import(&export_name, &item.iface_name, &item.binding_name);
208+
let binding_name = generate_binding_name_import(
209+
&export_name,
210+
&item.iface_name,
211+
&item.binding_name,
212+
);
210213
if item.iface {
211214
specifier_list.push(format!("{export_name}: import_{binding_name}"));
212215
} else {
@@ -655,11 +658,12 @@ impl JsBindgen<'_> {
655658
let fn_name = func.item_name();
656659
let fn_camel_name = fn_name.to_lower_camel_case();
657660

658-
use binding_name_import as binding_name_fn;
661+
use generate_binding_name_import as binding_name_fn;
659662

660663
let (binding_name, resource) = match &func.kind {
661664
FunctionKind::Freestanding => {
662-
let binding_name = binding_name_import(&fn_camel_name, &iface_name, &import_name);
665+
let binding_name =
666+
generate_binding_name_import(&fn_camel_name, &iface_name, &import_name);
663667

664668
uwrite!(self.src, "\nfunction import_{binding_name}");
665669

@@ -1314,7 +1318,11 @@ fn binding_name(func_name: &str, iface_name: &Option<String>) -> String {
13141318
/// * `iface_name` - an interface name, if present (e.g. `greeter`)
13151319
/// * `import_name` - qualified import specifier (e.g. `local:hello`)
13161320
///
1317-
fn binding_name_import(func_name: &str, iface_name: &Option<String>, import_name: &str) -> String {
1321+
fn generate_binding_name_import(
1322+
func_name: &str,
1323+
iface_name: &Option<String>,
1324+
import_name: &str,
1325+
) -> String {
13181326
// import_name is only valid when FunctionKind is Freestanding
13191327
if import_name != "<<INVALID>>" {
13201328
let valid_import = import_name

0 commit comments

Comments
 (0)