summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ast/ast.cpp6
-rw-r--r--src/convert/resolve.cpp4
-rw-r--r--src/expand/mod.cpp6
-rw-r--r--src/parse/root.cpp4
4 files changed, 9 insertions, 11 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp
index 787a6a40..33741397 100644
--- a/src/ast/ast.cpp
+++ b/src/ast/ast.cpp
@@ -244,7 +244,9 @@ void Module::add_function(bool is_public, ::std::string name, Function item, Met
this->add_item( is_public, name, Item::make_Function({mv$(item)}), mv$(attrs) );
}
void Module::add_submod(bool is_public, Module mod, MetaItems attrs) {
- this->add_item( is_public, mod.m_name, Item::make_Module({mv$(mod)}), mv$(attrs) );
+ auto name = mod.m_name;
+ DEBUG("mod.m_name = " << name);
+ this->add_item( is_public, mv$(name), Item::make_Module({mv$(mod)}), mv$(attrs) );
}
void Module::prescan()
@@ -343,7 +345,7 @@ template<typename T>
typename ::std::vector<Named<T> >::const_iterator find_named(const ::std::vector<Named<T> >& vec, const ::std::string& name)
{
return ::std::find_if(vec.begin(), vec.end(), [&name](const Named<T>& x) {
- //DEBUG("find_named - x.name = " << x.name);
+ DEBUG("find_named - x.name = " << x.name);
return x.name == name;
});
}
diff --git a/src/convert/resolve.cpp b/src/convert/resolve.cpp
index cd72d27b..6640193a 100644
--- a/src/convert/resolve.cpp
+++ b/src/convert/resolve.cpp
@@ -403,7 +403,7 @@ void resolve_path(const Span& span, const AST::Crate& root_crate, AST::Path& pat
// HACK: Not actually a normal TU, but it fits the same pattern
TU_MATCH(AST::Module::ItemRef, (item), (i),
(None,
- throw ParseError::Generic( FMT("Unable to find component '" << node.name() << "' of import " << path) );
+ ERROR(span, E0000, "Unable to find component '" << node.name() << "' of import " << path);
),
(Module,
mod = &i;
@@ -1727,7 +1727,7 @@ void absolutise_path(const Span& span, const AST::Crate& crate, const AST::Modul
void ResolvePaths_HandleModule_Use(const AST::Crate& crate, const AST::Path& modpath, AST::Module& mod)
{
- TRACE_FUNCTION_F("modpath = " << modpath);
+ TRACE_FUNCTION_F("modpath = " << modpath << ", mod = {name:" << mod.name() << "}");
::std::vector<AST::Path> new_imports;
for( auto& imp : mod.imports() )
{
diff --git a/src/expand/mod.cpp b/src/expand/mod.cpp
index 6598af4e..ee6fcfe5 100644
--- a/src/expand/mod.cpp
+++ b/src/expand/mod.cpp
@@ -9,17 +9,13 @@
::std::map< ::std::string, ::std::unique_ptr<ExpandDecorator> > g_decorators;
::std::map< ::std::string, ::std::unique_ptr<ExpandProcMacro> > g_macros;
-void init() __attribute__((constructor(101)));
-void init()
-{
-}
-
void Register_Synext_Decorator(::std::string name, ::std::unique_ptr<ExpandDecorator> handler) {
g_decorators[name] = mv$(handler);
}
void Expand_Decorators_Mod(::AST::Crate& crate, bool is_before_macros, ::AST::Path modpath, ::AST::Module& mod)
{
+ TRACE_FUNCTION_F("modpath = " << modpath);
for( auto& i : mod.items() )
{
::AST::Path path = modpath + i.name;
diff --git a/src/parse/root.cpp b/src/parse/root.cpp
index dfbe8372..9b910504 100644
--- a/src/parse/root.cpp
+++ b/src/parse/root.cpp
@@ -1731,9 +1731,9 @@ void Parse_Mod_Item(TokenStream& lex, LList<AST::Module*>& modstack, bool file_c
case TOK_RWORD_MOD: {
GET_CHECK_TOK(tok, lex, TOK_IDENT);
- auto name = tok.str();
+ auto name = mv$(tok.str());
DEBUG("Sub module '" << name << "'");
- AST::Module submod( mv$(tok.str()));
+ AST::Module submod( name );
// Rules for external files (/ path handling):
// - IF using stdin (path='-') - Disallow and propagate '-' as path