diff options
Diffstat (limited to 'src/macro_rules')
-rw-r--r-- | src/macro_rules/eval.cpp | 9 | ||||
-rw-r--r-- | src/macro_rules/macro_rules.hpp | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/macro_rules/eval.cpp b/src/macro_rules/eval.cpp index 966c1149..50b92466 100644 --- a/src/macro_rules/eval.cpp +++ b/src/macro_rules/eval.cpp @@ -499,9 +499,12 @@ void Macro_HandlePatternCap(TTStream& lex, unsigned int index, MacroPatEnt::Type case MacroPatEnt::PAT_META: bound_tts.insert( index, iterations, InterpolatedFragment( Parse_MetaItem(lex) ) ); break; - case MacroPatEnt::PAT_ITEM: - bound_tts.insert( index, iterations, InterpolatedFragment( Parse_Mod_Item_S(lex, false, "!", lex.parse_state().module->path(), false, AST::MetaItems{}) ) ); - break; + case MacroPatEnt::PAT_ITEM: { + assert( lex.parse_state().module ); + const auto& cur_mod = *lex.parse_state().module; + // TODO: Pass the filename for `cur_mod` and if it controls its dir + bound_tts.insert( index, iterations, InterpolatedFragment( Parse_Mod_Item_S(lex, cur_mod.m_file_info, cur_mod.path(), false, AST::MetaItems{}) ) ); + } break; case MacroPatEnt::PAT_IDENT: GET_CHECK_TOK(tok, lex, TOK_IDENT); bound_tts.insert( index, iterations, InterpolatedFragment( TokenTree(tok) ) ); diff --git a/src/macro_rules/macro_rules.hpp b/src/macro_rules/macro_rules.hpp index 7f93edf9..265ea73a 100644 --- a/src/macro_rules/macro_rules.hpp +++ b/src/macro_rules/macro_rules.hpp @@ -22,6 +22,7 @@ class MacroExpander; TAGGED_UNION_EX(MacroExpansionEnt, (: public Serialisable), Token, (
// TODO: have a "raw" stream instead of just tokens
(Token, Token),
+ // TODO: Have a flag on `NamedValue` that indicates that it is the only/last usage of this particular value (at this level)
// NOTE: This is a 2:30 bitfield - with the high range indicating $crate
(NamedValue, unsigned int),
(Loop, struct {
|