summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ast/crate.hpp3
-rw-r--r--src/expand/include.cpp4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/ast/crate.hpp b/src/ast/crate.hpp
index 11fba9c0..79cb9cd7 100644
--- a/src/ast/crate.hpp
+++ b/src/ast/crate.hpp
@@ -57,7 +57,8 @@ public:
bool m_test_harness = false;
::std::vector<TestDesc> m_tests;
- //::std::vector<::std::string> m_extra_files;
+ /// Files loaded using things like include! and include_str!
+ mutable ::std::vector<::std::string> m_extra_files;
// Procedural macros!
::std::vector<ProcMacroDef> m_proc_macros;
diff --git a/src/expand/include.cpp b/src/expand/include.cpp
index 59f33d47..8078d5d0 100644
--- a/src/expand/include.cpp
+++ b/src/expand/include.cpp
@@ -12,6 +12,7 @@
#include <parse/ttstream.hpp>
#include <parse/lex.hpp> // Lexer (new files)
#include <ast/expr.hpp>
+#include <ast/crate.hpp>
namespace {
@@ -75,6 +76,7 @@ class CIncludeExpander:
GET_CHECK_TOK(tok, lex, TOK_EOF);
::std::string file_path = get_path_relative_to(mod.m_file_info.path, mv$(path));
+ crate.m_extra_files.push_back(file_path);
try {
return box$( Lexer(file_path) );
@@ -101,6 +103,7 @@ class CIncludeBytesExpander:
GET_CHECK_TOK(tok, lex, TOK_EOF);
::std::string file_path = get_path_relative_to(mod.m_file_info.path, mv$(path));
+ crate.m_extra_files.push_back(file_path);
::std::ifstream is(file_path);
if( !is.good() ) {
@@ -130,6 +133,7 @@ class CIncludeStrExpander:
GET_CHECK_TOK(tok, lex, TOK_EOF);
::std::string file_path = get_path_relative_to(mod.m_file_info.path, mv$(path));
+ crate.m_extra_files.push_back(file_path);
::std::ifstream is(file_path);
if( !is.good() ) {