diff --git a/misses-compiler/src/codegen.rs b/misses-compiler/src/codegen.rs index 4e176ed..758d219 100644 --- a/misses-compiler/src/codegen.rs +++ b/misses-compiler/src/codegen.rs @@ -89,7 +89,7 @@ fn codegen_pattern_parse(pattern: &Pattern) -> String { let b = &bindings[0]; let ty = binding_kind_to_type(&b.kind); return format!( - " let {name}: {ty} = syn::parse2(input.clone()).unwrap(); // TODO: proper error\n", + " let {name}: {ty} = match syn::parse2(input.clone()) {{ Ok(v) => v, Err(e) => return e.into_compile_error().into() }};\n", name = b.name, ty = ty ); @@ -149,7 +149,7 @@ fn codegen_structural_pattern(pattern: &Pattern, bindings: &[BindingInfo]) -> St }; out.push_str(&format!(" {}\n", ret_expr)); out.push_str(" };\n"); - out.push_str(" __parser.parse2(input.clone()).unwrap() // TODO: proper error\n"); + out.push_str(" match __parser.parse2(input.clone()) { Ok(v) => v, Err(e) => return e.into_compile_error().into() }\n"); out.push_str(" };\n"); out