diff options
-rw-r--r-- | src/ast/ast.cpp | 23 | ||||
-rw-r--r-- | src/ast/ast.hpp | 27 | ||||
-rw-r--r-- | src/expand/mod.cpp | 204 | ||||
-rw-r--r-- | src/hir/from_ast.cpp | 12 | ||||
-rw-r--r-- | src/resolve/absolute.cpp | 229 | ||||
-rw-r--r-- | src/resolve/index.cpp | 8 | ||||
-rw-r--r-- | src/resolve/use.cpp | 9 |
7 files changed, 336 insertions, 176 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp index 35407cc4..354c620d 100644 --- a/src/ast/ast.cpp +++ b/src/ast/ast.cpp @@ -248,6 +248,16 @@ UseStmt UseStmt::clone() const return UseStmt(sp, path);
}
+void ExternBlock::add_fcn(Named<Item> named_item)
+{
+ ASSERT_BUG(named_item.data.span, named_item.data.is_Function() || named_item.data.is_Static(), "Incorrect item type for ExternBlock");
+ m_items.push_back( mv$(named_item) );
+}
+ExternBlock ExternBlock::clone() const
+{
+ TODO(Span(), "Clone an extern block");
+}
+
::std::unique_ptr<AST::Module> Module::add_anon() {
auto rv = box$( Module(m_my_path + FMT("#" << m_anon_modules.size())) );
@@ -300,13 +310,22 @@ Item Item::clone() const return AST::Item(e);
),
(MacroInv,
- TODO(Span(), "Clone on Item::MacroInv");
+ TODO(this->span, "Clone on Item::MacroInv");
),
(Use,
return AST::Item(e.clone());
),
+ (ExternBlock,
+ TODO(this->span, "Clone on Item::" << this->tag_str());
+ ),
+ (Impl,
+ TODO(this->span, "Clone on Item::Impl");
+ ),
+ (NegImpl,
+ TODO(this->span, "Clone on Item::NegImpl");
+ ),
(Module,
- TODO(Span(), "Clone on Item::Module");
+ TODO(this->span, "Clone on Item::Module");
),
(Crate,
return AST::Item(e);
diff --git a/src/ast/ast.hpp b/src/ast/ast.hpp index 1b5a04d0..3f43e32a 100644 --- a/src/ast/ast.hpp +++ b/src/ast/ast.hpp @@ -452,6 +452,26 @@ struct UseStmt friend ::std::ostream& operator<<(::std::ostream& os, const UseStmt& x);
};
+class ExternBlock
+{
+ ::std::string m_abi;
+ ::std::vector< Named<Item>> m_items;
+public:
+ ExternBlock(::std::string abi):
+ m_abi( mv$(abi) )
+ {}
+
+ const ::std::string& abi() const { return m_abi; }
+
+ void add_fcn(Named<Item> named_item);
+
+ // NOTE: Only Function and Static are valid.
+ ::std::vector<Named<Item>>& items() { return m_items; }
+ const ::std::vector<Named<Item>>& items() const { return m_items; }
+
+ ExternBlock clone() const;
+};
+
/// Representation of a parsed (and being converted) function
class Module
{
@@ -564,12 +584,17 @@ private: void resolve_macro_import(const Crate& crate, const ::std::string& modname, const ::std::string& macro_name);
};
-
TAGGED_UNION_EX(Item, (), None,
(
(None, struct {} ),
(MacroInv, MacroInvocation),
(Use, UseStmt),
+
+ // Nameless items
+ (ExternBlock, ExternBlock),
+ (Impl, Impl),
+ (NegImpl, ImplDef),
+
(Module, Module),
(Crate, struct {
::std::string name;
diff --git a/src/expand/mod.cpp b/src/expand/mod.cpp index 791d0206..57330540 100644 --- a/src/expand/mod.cpp +++ b/src/expand/mod.cpp @@ -564,6 +564,101 @@ void Expand_Expr(bool is_early, ::AST::Crate& crate, LList<const AST::Module*> m } } +void Expand_Impl(bool is_early, ::AST::Crate& crate, LList<const AST::Module*> modstack, ::AST::Path modpath, ::AST::Module& mod, ::AST::Impl& impl) +{ + Expand_Attrs(impl.def().attrs(), stage_pre(is_early), crate, mod, impl.def()); + if( impl.def().type().is_wildcard() ) { + DEBUG("Deleted"); + return ; + } + + Expand_Type(is_early, crate, modstack, mod, impl.def().type()); + //Expand_Type(is_early, crate, modstack, mod, impl.def().trait()); + + // - Macro invocation + for(unsigned int i = 0; i < impl.m_macro_invocations.size(); i ++ ) + { + auto& mi = impl.m_macro_invocations[i]; + DEBUG("> Macro invoke '"<<mi.name()<<"'"); + if( mi.name() != "" ) + { + // Move out of the module to avoid invalidation if a new macro invocation is added + auto mi_owned = mv$(mi); + + auto ttl = Expand_Macro(is_early, crate, modstack, mod, mi_owned); + + if( ! ttl.get() ) + { + // - Return ownership to the list + mod.macro_invs()[i] = mv$(mi_owned); + } + else + { + // Re-parse tt + assert(ttl.get()); + while( ttl->lookahead(0) != TOK_EOF ) + { + Parse_Impl_Item(*ttl, impl); + } + // - Any new macro invocations ends up at the end of the list and handled + } + } + } + + DEBUG("> Items"); + for( auto& i : impl.items() ) + { + DEBUG(" - " << i.name << " :: " << i.data->attrs); + + // TODO: Make a path from the impl definition? Requires having the impl def resolved to be correct + // - Does it? the namespace is essentially the same. There may be issues with wherever the path is used though + //::AST::Path path = modpath + i.name; + + auto attrs = mv$(i.data->attrs); + Expand_Attrs(attrs, stage_pre(is_early), crate, AST::Path(), mod, *i.data); + + TU_MATCH_DEF(AST::Item, (*i.data), (e), + ( + throw ::std::runtime_error("BUG: Unknown item type in impl block"); + ), + (None, ), + (Function, + for(auto& arg : e.args()) { + Expand_Pattern(is_early, crate, modstack, mod, arg.first); + Expand_Type(is_early, crate, modstack, mod, arg.second); + } + Expand_Type(is_early, crate, modstack, mod, e.rettype()); + Expand_Expr(is_early, crate, modstack, e.code()); + ), + (Static, + Expand_Expr(is_early, crate, modstack, e.value()); + ), + (Type, + Expand_Type(is_early, crate, modstack, mod, e.type()); + ) + ) + + Expand_Attrs(attrs, stage_post(is_early), crate, AST::Path(), mod, *i.data); + if( i.data->attrs.m_items.size() == 0 ) + i.data->attrs = mv$(attrs); + } + + Expand_Attrs(impl.def().attrs(), stage_post(is_early), crate, mod, impl.def()); +} +void Expand_ImplDef(bool is_early, ::AST::Crate& crate, LList<const AST::Module*> modstack, ::AST::Path modpath, ::AST::Module& mod, ::AST::ImplDef& impl_def) +{ + Expand_Attrs(impl_def.attrs(), stage_pre(is_early), crate, mod, impl_def); + if( impl_def.type().is_wildcard() ) { + DEBUG("Deleted"); + return ; + } + + Expand_Type(is_early, crate, modstack, mod, impl_def.type()); + //Expand_Type(is_early, crate, modstack, mod, impl_def.trait()); + + Expand_Attrs(impl_def.attrs(), stage_post(is_early), crate, mod, impl_def); +} + void Expand_Mod(bool is_early, ::AST::Crate& crate, LList<const AST::Module*> modstack, ::AST::Path modpath, ::AST::Module& mod) { TRACE_FUNCTION_F("is_early = " << is_early << ", modpath = " << modpath); @@ -660,6 +755,15 @@ void Expand_Mod(bool is_early, ::AST::Crate& crate, LList<const AST::Module*> mo (Use, // No inner expand. ), + (ExternBlock, + // TODO: Run expand on inner items? + ), + (Impl, + Expand_Impl(is_early, crate, modstack, modpath, mod, e); + ), + (NegImpl, + Expand_ImplDef(is_early, crate, modstack, modpath, mod, e); + ), (Module, LList<const AST::Module*> sub_modstack(&modstack, &e); Expand_Mod(is_early, crate, sub_modstack, path, e); @@ -787,94 +891,30 @@ void Expand_Mod(bool is_early, ::AST::Crate& crate, LList<const AST::Module*> mo // IGNORE m_anon_modules, handled as part of expressions DEBUG("Impls"); - for( auto& impl : mod.impls() ) + for( auto it = mod.impls().begin(); it != mod.impls().end(); ) { - DEBUG("- " << impl); - - Expand_Attrs(impl.def().attrs(), stage_pre(is_early), crate, mod, impl.def()); - if( impl.def().type().is_wildcard() ) { - DEBUG("Deleted"); - continue ; - } - - Expand_Type(is_early, crate, modstack, mod, impl.def().type()); - //Expand_Type(is_early, crate, modstack, mod, impl.def().trait()); + DEBUG("- " << *it); + Expand_Impl(is_early, crate, modstack, modpath, mod, *it); - // - Macro invocation - for(unsigned int i = 0; i < impl.m_macro_invocations.size(); i ++ ) - { - auto& mi = impl.m_macro_invocations[i]; - DEBUG("> Macro invoke '"<<mi.name()<<"'"); - if( mi.name() != "" ) - { - // Move out of the module to avoid invalidation if a new macro invocation is added - auto mi_owned = mv$(mi); - - auto ttl = Expand_Macro(is_early, crate, modstack, mod, mi_owned); - - if( ! ttl.get() ) - { - // - Return ownership to the list - mod.macro_invs()[i] = mv$(mi_owned); - } - else - { - // Re-parse tt - assert(ttl.get()); - while( ttl->lookahead(0) != TOK_EOF ) - { - Parse_Impl_Item(*ttl, impl); - } - // - Any new macro invocations ends up at the end of the list and handled - } - } - } - - DEBUG("> Items"); - for( auto& i : impl.items() ) - { - DEBUG(" - " << i.name << " :: " << i.data->attrs); - - // TODO: Make a path from the impl definition? Requires having the impl def resolved to be correct - // - Does it? the namespace is essentially the same. There may be issues with wherever the path is used though - //::AST::Path path = modpath + i.name; - - auto attrs = mv$(i.data->attrs); - Expand_Attrs(attrs, stage_pre(is_early), crate, AST::Path(), mod, *i.data); - - TU_MATCH_DEF(AST::Item, (*i.data), (e), - ( - throw ::std::runtime_error("BUG: Unknown item type in impl block"); - ), - (None, ), - (Function, - for(auto& arg : e.args()) { - Expand_Pattern(is_early, crate, modstack, mod, arg.first); - Expand_Type(is_early, crate, modstack, mod, arg.second); - } - Expand_Type(is_early, crate, modstack, mod, e.rettype()); - Expand_Expr(is_early, crate, modstack, e.code()); - ), - (Static, - Expand_Expr(is_early, crate, modstack, e.value()); - ), - (Type, - Expand_Type(is_early, crate, modstack, mod, e.type()); - ) - ) - - Expand_Attrs(attrs, stage_post(is_early), crate, AST::Path(), mod, *i.data); - if( i.data->attrs.m_items.size() == 0 ) - i.data->attrs = mv$(attrs); + if( it->def().type().is_wildcard() ) { + DEBUG("- Deleted"); + it = mod.impls().erase( it ); } - - Expand_Attrs(impl.def().attrs(), stage_post(is_early), crate, mod, impl.def()); + else + ++ it; } - for( auto it = mod.impls().begin(); it != mod.impls().end(); ) + DEBUG("Negative Impls"); + for( auto it = mod.neg_impls().begin(); it != mod.neg_impls().end(); ) { - if( it->def().type().is_wildcard() ) - it = mod.impls().erase( it ); + DEBUG("- " << *it); + + Expand_ImplDef(is_early, crate, modstack, modpath, mod, *it); + + if( it->type().is_wildcard() ) { + DEBUG("- Deleted"); + it = mod.neg_impls().erase( it ); + } else ++ it; } diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp index 46e9afa1..9667aa70 100644 --- a/src/hir/from_ast.cpp +++ b/src/hir/from_ast.cpp @@ -1029,12 +1029,22 @@ void _add_mod_val_item(::HIR::Module& mod, ::std::string name, bool is_pub, ::H for( const auto& item : ast_mod.items() ) { + const auto& sp = item.data.span; auto item_path = ::HIR::ItemPath(path, item.name.c_str()); TU_MATCH(::AST::Item, (item.data), (e), (None, ), (MacroInv, - BUG(Span(), "Stray macro invocation in " << path); + BUG(sp, "Stray macro invocation in " << path); + ), + (ExternBlock, + TODO(sp, "Expand ExternBlock"); + ), + (Impl, + TODO(sp, "Expand Item::Impl"); + ), + (NegImpl, + TODO(sp, "Expand Item::NegImpl"); ), (Use, // Ignore - The index is used to add `Import`s diff --git a/src/resolve/absolute.cpp b/src/resolve/absolute.cpp index 9e8856bc..118eca7f 100644 --- a/src/resolve/absolute.cpp +++ b/src/resolve/absolute.cpp @@ -517,6 +517,7 @@ void Resolve_Absolute_Pattern(Context& context, bool allow_refutable, ::AST::Pat void Resolve_Absolute_Mod(const ::AST::Crate& crate, ::AST::Module& mod); void Resolve_Absolute_Mod( Context item_context, ::AST::Module& mod ); +void Resolve_Absolute_Function(Context& item_context, ::AST::Function& fcn); void Resolve_Absolute_PathParams(/*const*/ Context& context, const Span& sp, ::AST::PathParams& args) { @@ -1677,6 +1678,7 @@ void Resolve_Absolute_Pattern(Context& context, bool allow_refutable, ::AST::Pa ) } +// - For traits void Resolve_Absolute_ImplItems(Context& item_context, ::AST::NamedList< ::AST::Item >& items) { TRACE_FUNCTION_F(""); @@ -1684,8 +1686,11 @@ void Resolve_Absolute_ImplItems(Context& item_context, ::AST::NamedList< ::AST: { TU_MATCH(AST::Item, (i.data), (e), (None, ), - (MacroInv, BUG(i.data.span, "Resolve_Absolute_ImplItems - MacroInv");), - (Use, BUG(i.data.span, "Resolve_Absolute_ImplItems - Use");), + (MacroInv, BUG(i.data.span, "Resolve_Absolute_ImplItems - MacroInv");), + (ExternBlock, BUG(i.data.span, "Resolve_Absolute_ImplItems - " << i.data.tag_str());), + (Impl, BUG(i.data.span, "Resolve_Absolute_ImplItems - " << i.data.tag_str());), + (NegImpl, BUG(i.data.span, "Resolve_Absolute_ImplItems - " << i.data.tag_str());), + (Use, BUG(i.data.span, "Resolve_Absolute_ImplItems - Use");), (Module, BUG(i.data.span, "Resolve_Absolute_ImplItems - Module");), (Crate , BUG(i.data.span, "Resolve_Absolute_ImplItems - Crate");), (Enum , BUG(i.data.span, "Resolve_Absolute_ImplItems - Enum");), @@ -1733,6 +1738,48 @@ void Resolve_Absolute_ImplItems(Context& item_context, ::AST::NamedList< ::AST: } } +// - For impl blocks +void Resolve_Absolute_ImplItems(Context& item_context, ::std::vector< ::AST::Impl::ImplItem >& items) +{ + TRACE_FUNCTION_F(""); + for(auto& i : items) + { + TU_MATCH(AST::Item, (*i.data), (e), + (None, ), + (MacroInv, BUG(i.data->span, "Resolve_Absolute_ImplItems - MacroInv");), + + (Impl , BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), + (NegImpl, BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), + (ExternBlock, BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), + (Use , BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), + (Module, BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), + (Crate , BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), + (Enum , BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), + (Trait , BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), + (Struct, BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), + (Type, + DEBUG("Type - " << i.name); + assert( e.params().ty_params().size() == 0 ); + assert( e.params().lft_params().size() == 0 ); + item_context.push( e.params(), GenericSlot::Level::Method, true ); + Resolve_Absolute_Generic(item_context, e.params()); + + Resolve_Absolute_Type( item_context, e.type() ); + + item_context.pop( e.params(), true ); + ), + (Function, + DEBUG("Function - " << i.name); + Resolve_Absolute_Function(item_context, e); + ), + (Static, + DEBUG("Static - " << i.name); + TODO(i.data->span, "Resolve_Absolute_ImplItems - Static"); + ) + ) + } +} + void Resolve_Absolute_Function(Context& item_context, ::AST::Function& fcn) { TRACE_FUNCTION_F(""); @@ -1757,42 +1804,78 @@ void Resolve_Absolute_Function(Context& item_context, ::AST::Function& fcn) item_context.pop( fcn.params() ); } +void Resolve_Absolute_Static(Context& item_context, ::AST::Static& e) +{ + Resolve_Absolute_Type( item_context, e.type() ); + auto _h = item_context.enter_rootblock(); + Resolve_Absolute_Expr( item_context, e.value() ); +} -void Resolve_Absolute_ImplItems(Context& item_context, ::std::vector< ::AST::Impl::ImplItem >& items) +void Resolve_Absolute_Struct(Context& item_context, ::AST::Struct& e) { - TRACE_FUNCTION_F(""); - for(auto& i : items) + item_context.push( e.params(), GenericSlot::Level::Top ); + Resolve_Absolute_Generic(item_context, e.params()); + + TU_MATCH(::AST::StructData, (e.m_data), (s), + (Tuple, + for(auto& field : s.ents) { + Resolve_Absolute_Type(item_context, field.m_type); + } + ), + (Struct, + for(auto& field : s.ents) { + Resolve_Absolute_Type(item_context, field.m_type); + } + ) + ) + + item_context.pop( e.params() ); +} +void Resolve_Absolute_Trait(Context& item_context, ::AST::Trait& e) +{ + item_context.push( e.params(), GenericSlot::Level::Top, true ); + Resolve_Absolute_Generic(item_context, e.params()); + + for(auto& st : e.supertraits()) { + if( !st.ent.is_valid() ) { + DEBUG("- ST 'static"); + } + else { + DEBUG("- ST " << st.ent); + Resolve_Absolute_Path(item_context, st.sp, Context::LookupMode::Type, st.ent); + } + } + + Resolve_Absolute_ImplItems(item_context, e.items()); + + item_context.pop( e.params(), true ); +} +void Resolve_Absolute_Enum(Context& item_context, ::AST::Enum& e) +{ + item_context.push( e.params(), GenericSlot::Level::Top ); + Resolve_Absolute_Generic(item_context, e.params()); + + for(auto& variant : e.variants()) { - TU_MATCH(AST::Item, (*i.data), (e), - (None, ), - (MacroInv, BUG(i.data->span, "Resolve_Absolute_ImplItems - MacroInv");), - (Use , BUG(i.data->span, "Resolve_Absolute_ImplItems - Use");), - (Module, BUG(i.data->span, "Resolve_Absolute_ImplItems - Module");), - (Crate , BUG(i.data->span, "Resolve_Absolute_ImplItems - Crate");), - (Enum , BUG(i.data->span, "Resolve_Absolute_ImplItems - Enum");), - (Trait , BUG(i.data->span, "Resolve_Absolute_ImplItems - Trait");), - (Struct, BUG(i.data->span, "Resolve_Absolute_ImplItems - Struct");), - (Type, - DEBUG("Type - " << i.name); - assert( e.params().ty_params().size() == 0 ); - assert( e.params().lft_params().size() == 0 ); - item_context.push( e.params(), GenericSlot::Level::Method, true ); - Resolve_Absolute_Generic(item_context, e.params()); - - Resolve_Absolute_Type( item_context, e.type() ); - - item_context.pop( e.params(), true ); + TU_MATCH(::AST::EnumVariantData, (variant.m_data), (s), + (Value, + auto _h = item_context.enter_rootblock(); + Resolve_Absolute_Expr(item_context, s.m_value); ), - (Function, - DEBUG("Function - " << i.name); - Resolve_Absolute_Function(item_context, e); + (Tuple, + for(auto& field : s.m_sub_types) { + Resolve_Absolute_Type(item_context, field); + } ), - (Static, - DEBUG("Static - " << i.name); - TODO(i.data->span, "Resolve_Absolute_ImplItems - Static"); + (Struct, + for(auto& field : s.m_fields) { + Resolve_Absolute_Type(item_context, field.m_type); + } ) ) } + + item_context.pop( e.params() ); } void Resolve_Absolute_Mod(const ::AST::Crate& crate, ::AST::Module& mod) { @@ -1811,6 +1894,28 @@ void Resolve_Absolute_Mod( Context item_context, ::AST::Module& mod ) ), (Use, ), + (ExternBlock, + for(auto& i2 : e.items()) + { + TU_MATCH_DEF(AST::Item, (i2.data), (e2), + ( + BUG(i2.data.span, "Unexpected item in ExternBlock - " << i2.data.tag_str()); + ), + (Function, + Resolve_Absolute_Function(item_context, e2); + ), + (Static, + Resolve_Absolute_Static(item_context, e2); + ) + ) + } + ), + (Impl, + TODO(i.data.span, "Impl"); + ), + (NegImpl, + TODO(i.data.span, "NegImpl"); + ), (Module, DEBUG("Module - " << i.name); Resolve_Absolute_Mod(item_context.m_crate, e); @@ -1820,49 +1925,11 @@ void Resolve_Absolute_Mod( Context item_context, ::AST::Module& mod ) ), (Enum, DEBUG("Enum - " << i.name); - item_context.push( e.params(), GenericSlot::Level::Top ); - Resolve_Absolute_Generic(item_context, e.params()); - - for(auto& variant : e.variants()) - { - TU_MATCH(::AST::EnumVariantData, (variant.m_data), (s), - (Value, - auto _h = item_context.enter_rootblock(); - Resolve_Absolute_Expr(item_context, s.m_value); - ), - (Tuple, - for(auto& field : s.m_sub_types) { - Resolve_Absolute_Type(item_context, field); - } - ), - (Struct, - for(auto& field : s.m_fields) { - Resolve_Absolute_Type(item_context, field.m_type); - } - ) - ) - } - - item_context.pop( e.params() ); + Resolve_Absolute_Enum(item_context, e); ), (Trait, DEBUG("Trait - " << i.name); - item_context.push( e.params(), GenericSlot::Level::Top, true ); - Resolve_Absolute_Generic(item_context, e.params()); - - for(auto& st : e.supertraits()) { - if( !st.ent.is_valid() ) { - DEBUG("- ST 'static"); - } - else { - DEBUG("- ST " << st.ent); - Resolve_Absolute_Path(item_context, st.sp, Context::LookupMode::Type, st.ent); - } - } - - Resolve_Absolute_ImplItems(item_context, e.items()); - - item_context.pop( e.params(), true ); + Resolve_Absolute_Trait(item_context, e); ), (Type, DEBUG("Type - " << i.name); @@ -1875,23 +1942,7 @@ void Resolve_Absolute_Mod( Context item_context, ::AST::Module& mod ) ), (Struct, DEBUG("Struct - " << i.name); - item_context.push( e.params(), GenericSlot::Level::Top ); - Resolve_Absolute_Generic(item_context, e.params()); - - TU_MATCH(::AST::StructData, (e.m_data), (s), - (Tuple, - for(auto& field : s.ents) { - Resolve_Absolute_Type(item_context, field.m_type); - } - ), - (Struct, - for(auto& field : s.ents) { - Resolve_Absolute_Type(item_context, field.m_type); - } - ) - ) - - item_context.pop( e.params() ); + Resolve_Absolute_Struct(item_context, e); ), (Function, DEBUG("Function - " << i.name); @@ -1899,9 +1950,7 @@ void Resolve_Absolute_Mod( Context item_context, ::AST::Module& mod ) ), (Static, DEBUG("Static - " << i.name); - Resolve_Absolute_Type( item_context, e.type() ); - auto _h = item_context.enter_rootblock(); - Resolve_Absolute_Expr( item_context, e.value() ); + Resolve_Absolute_Static(item_context, e); ) ) } diff --git a/src/resolve/index.cpp b/src/resolve/index.cpp index 4d66dd14..754b6eea 100644 --- a/src/resolve/index.cpp +++ b/src/resolve/index.cpp @@ -96,6 +96,14 @@ void Resolve_Index_Module_Base(const AST::Crate& crate, AST::Module& mod) ), (MacroInv, ), + // Unnamed + (ExternBlock, + ), + (Impl, + ), + (NegImpl, + ), + (Use, // Skip for now ), diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp index 3377d2aa..44d50516 100644 --- a/src/resolve/use.cpp +++ b/src/resolve/use.cpp @@ -276,6 +276,15 @@ void Resolve_Use_Mod(const ::AST::Crate& crate, ::AST::Module& mod, ::AST::Path (Use, continue; // Skip for now ), + (Impl, + BUG(span, "Hit Impl in use resolution"); + ), + (NegImpl, + BUG(span, "Hit NegImpl in use resolution"); + ), + (ExternBlock, + BUG(span, "Hit Extern in use resolution"); + ), (Crate, if( allow != Lookup::Value ) return ::AST::PathBinding::make_Crate({ &crate.m_extern_crates.at(e.name) }); |