Skip to content

Commit efe3201

Browse files
committed
fix: address copilot review
1 parent 68d27f3 commit efe3201

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/hyperlight_component_macro/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,13 @@ impl Parse for BindgenInputParams {
190190
let key: Ident = input.parse()?;
191191
input.parse::<Token![:]>()?;
192192
let value: LitStr = input.parse()?;
193-
source = Some(source_from_key(&key, value)?);
193+
match key.to_string().as_str() {
194+
"world" | "world_name" => world_name = Some(value.value()),
195+
"path" | "wit" | "wasm" | "inline" => {
196+
source = Some(source_from_key(&key, value)?);
197+
}
198+
_ => return Err(unknown_key_error(&key)),
199+
}
194200
} else {
195201
let option_path_litstr = input.parse::<Option<syn::LitStr>>()?;
196202
if let Some(concrete_path) = option_path_litstr {

src/hyperlight_component_util/tests/wasmtime_guest_codegen.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ limitations under the License.
1515
*/
1616

1717
use std::path::{Path, PathBuf};
18+
use std::sync::atomic::{AtomicU64, Ordering};
1819

1920
use hyperlight_component_util::etypes::{
2021
Defined, ExternDesc, Handleable, ImportExport, TypeBound, Tyvar, Value,
2122
};
2223
use hyperlight_component_util::{emit, guest, rtypes, util};
2324

25+
static TEMP_WASM_COUNTER: AtomicU64 = AtomicU64::new(0);
26+
2427
fn fixture_path(path: &str) -> PathBuf {
2528
Path::new(env!("CARGO_MANIFEST_DIR")).join(path)
2629
}
@@ -32,8 +35,9 @@ fn encode_wit_fixture_to_wasm(path: &Path) -> PathBuf {
3235
.expect("WIT fixture should parse successfully");
3336
let wasm = wit_component::encode(&resolve, package).expect("WIT fixture should encode");
3437
let wasm_path = std::env::temp_dir().join(format!(
35-
"hyperlight-component-util-{}-wit-fixture.wasm",
36-
std::process::id()
38+
"hyperlight-component-util-{}-{}-wit-fixture.wasm",
39+
std::process::id(),
40+
TEMP_WASM_COUNTER.fetch_add(1, Ordering::Relaxed)
3741
));
3842
std::fs::write(&wasm_path, wasm).expect("temporary wasm fixture should be written");
3943
wasm_path

0 commit comments

Comments
 (0)