Skip to content

Commit

Permalink
fix(masm): bypass library path validation for component model identif…
Browse files Browse the repository at this point in the history
…iers
  • Loading branch information
bitwalker committed May 14, 2024
1 parent cde7763 commit 239b711
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion codegen/masm/src/masm/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,23 @@ impl Function {
kind: ast::InvokeKind,
target: FunctionIdent,
) {
let path = LibraryPath::new(target.module.as_str()).expect("invalid procedure path");
let module_name_span = miden_assembly::SourceSpan::new(
target.module.span.start_index().0..target.module.span.end_index().0,
);
let module_id = ast::Ident::new_unchecked(miden_assembly::Span::new(
module_name_span,
Arc::from(target.module.as_str().to_string().into_boxed_str()),
));
let name_span = miden_assembly::SourceSpan::new(
target.function.span.start_index().0..target.function.span.end_index().0,
);
let id = ast::Ident::new_unchecked(miden_assembly::Span::new(
name_span,
Arc::from(target.function.as_str().to_string().into_boxed_str()),
));
let path = LibraryPath::new(target.module.as_str()).unwrap_or_else(|_| {
LibraryPath::new_from_components(LibraryNamespace::Anon, [module_id])
});
let name = ast::ProcedureName::new_unchecked(id);
self.register_invoked(kind, ast::InvocationTarget::AbsoluteProcedurePath { name, path });
}
Expand Down

0 comments on commit 239b711

Please sign in to comment.