summaryrefslogtreecommitdiff
path: root/src/hir/from_ast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hir/from_ast.cpp')
-rw-r--r--src/hir/from_ast.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp
index b9a98f58..1f1bc4e3 100644
--- a/src/hir/from_ast.cpp
+++ b/src/hir/from_ast.cpp
@@ -1172,7 +1172,28 @@ void _add_mod_val_item(::HIR::Module& mod, ::std::string name, bool is_pub, ::H
{
TODO(sp, "Expand ExternBlock");
}
- // TODO: Insert a record of the `link` attribute
+ // Insert a record of the `link` attribute
+ for(const auto& a : item.data.attrs.m_items)
+ {
+ if( a.name() != "link" ) continue ;
+
+ ::std::string name;
+ for(const auto& i : a.items())
+ {
+ if( i.name() == "name" ) {
+ name = i.string();
+ }
+ else {
+ }
+ }
+ if( name != "" )
+ {
+ g_crate_ptr->m_ext_libs.push_back( ::HIR::ExternLibrary { name } );
+ }
+ else {
+ ERROR(sp, E0000, "#[link] needs `name`");
+ }
+ }
),
(Impl,
//TODO(sp, "Expand Item::Impl");