Skip to content

Commit e45cedd

Browse files
committed
testing host_bindgen changes
Signed-off-by: Shailesh Vashishth <shavashishth@gmail.com>
1 parent b9546ac commit e45cedd

File tree

4 files changed

+14
-31
lines changed

4 files changed

+14
-31
lines changed

src/hyperlight_component_macro/src/lib.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,13 @@ impl Parse for BindgenInputParams {
146146
path = Some(std::path::PathBuf::from(value.value()));
147147
}
148148
_ => {
149-
return Err(syn::Error::new(key.span(), format!("unknown parameter '{}'; expected 'path' or 'world_name'", key)));
149+
return Err(syn::Error::new(
150+
key.span(),
151+
format!(
152+
"unknown parameter '{}'; expected 'path' or 'world_name'",
153+
key
154+
),
155+
));
150156
}
151157
}
152158
// Parse optional comma
@@ -163,8 +169,8 @@ impl Parse for BindgenInputParams {
163169
if world_name.is_some() && path.is_none() {
164170
return Err(syn::Error::new(
165171
proc_macro2::Span::call_site(),
166-
"If `world_name` is provided in the brace syntax, `path` must also be provided."
167-
));
172+
"If `world_name` is provided in the brace syntax, `path` must also be provided.",
173+
));
168174
}
169175
Ok(Self { world_name, path })
170176
}

src/hyperlight_component_util/src/component.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,10 @@ pub fn read_component_single_exported_type<'a>(
118118
// picks the world index if world_name is passed in the proc_macro
119119
// else picks the index of last type, exported by core module
120120
if let Some(world) = world_name.as_ref() {
121-
122121
let name = ce.name.0;
123122
if name.eq_ignore_ascii_case(&world) {
124123
selected_type_idx = Some(ctx.types.len() - 1);
125-
}
126-
127-
// match ce.name {
128-
// wasmparser::ComponentExportName(name) => {
129-
// if name.eq_ignore_ascii_case(&world) {
130-
// selected_type_idx =
131-
// Some(ctx.types.len() - 1);
132-
// }
133-
// }
134-
// }
124+
}
135125
} else {
136126
selected_type_idx = Some(ctx.types.len() - 1);
137127
}
@@ -176,9 +166,9 @@ pub fn read_component_single_exported_type<'a>(
176166
Some(Defined::Component(c)) => c,
177167
_ => panic!("final export is not component"),
178168
},
179-
None => match &world_name{
169+
None => match &world_name {
180170
Some(name) => panic!("world '{}' not found in component", name),
181-
None => panic!("no exported type")
182-
}
171+
None => panic!("no exported type"),
172+
},
183173
}
184174
}

src/hyperlight_component_util/src/util.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,7 @@ pub fn read_wit_type_from_file<R, F: FnMut(String, &etypes::Component) -> R>(
5454

5555
/// Deal with `$HYPERLIGHT_COMPONENT_MACRO_DEBUG`: if it is present,
5656
/// save the given token stream (representing the result of
57-
/// macroexpansion) to the debug file and include that file instead of
58-
/// directly returning the given token stream.
59-
///
60-
/// Why do so?
61-
/// we can return the token stream as well.
62-
/// it would be better wouldn't it?
63-
/// Additionally this is causing a race condition.
57+
/// macroexpansion) to the debug file and then return the token stream
6458
pub fn emit_decls(decls: proc_macro2::TokenStream) -> proc_macro2::TokenStream {
6559
if let Ok(dbg_out) = std::env::var("HYPERLIGHT_COMPONENT_MACRO_DEBUG") {
6660
if let Ok(file) = syn::parse2(decls.clone()) {

src/hyperlight_host/tests/wit_test.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,4 @@ mod pick_world_binding_test {
449449
assert_eq!(first_import.r#key, "dummyKey");
450450
assert_eq!(first_import.r#value, "dummyValue");
451451
}
452-
453-
#[should_panic]
454-
#[test]
455-
fn test_second_world_import_panic() {
456-
let second_export = SecondworldResources::new();
457-
assert!(second_export)
458-
}
459452
}

0 commit comments

Comments
 (0)