File tree Expand file tree Collapse file tree 5 files changed +23
-10
lines changed Expand file tree Collapse file tree 5 files changed +23
-10
lines changed Original file line number Diff line number Diff line change 2323#include " rust-ast-dump.h"
2424#include " rust-abi.h"
2525#include " rust-item.h"
26+ #include " rust-macro.h"
2627#include " rust-object-export.h"
2728
2829#include " md5.h"
@@ -111,14 +112,12 @@ ExportContext::emit_function (const HIR::Function &fn)
111112}
112113
113114void
114- ExportContext::emit_macro (NodeId macro)
115+ ExportContext::emit_macro (AST::MacroRulesDefinition & macro)
115116{
116117 std::stringstream oss;
117118 AST::Dump dumper (oss);
118119
119- AST::Item *item = mappings.lookup_ast_item (macro).value ();
120-
121- dumper.go (*item);
120+ dumper.go (macro);
122121
123122 public_interface_buffer += oss.str ();
124123}
@@ -195,7 +194,7 @@ PublicInterface::gather_export_data ()
195194 vis_item.accept_vis (visitor);
196195 }
197196
198- for (const auto ¯o : mappings.get_exported_macros ())
197+ for (auto ¯o : mappings.get_exported_macros ())
199198 context.emit_macro (macro);
200199}
201200
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ class ExportContext
4848 * directly refer to them using their NodeId. There's no need to keep an HIR
4949 * node for them.
5050 */
51- void emit_macro (NodeId macro);
51+ void emit_macro (AST::MacroRulesDefinition & macro);
5252
5353 const std::string &get_interface_buffer () const ;
5454
Original file line number Diff line number Diff line change @@ -925,10 +925,10 @@ Mappings::lookup_macro_invocation (AST::MacroInvocation &invoc)
925925void
926926Mappings::insert_exported_macro (AST::MacroRulesDefinition &def)
927927{
928- exportedMacros.emplace_back (def. get_node_id () );
928+ exportedMacros.emplace_back (def);
929929}
930930
931- std::vector<NodeId> &
931+ std::vector<AST::MacroRulesDefinition>
932932Mappings::get_exported_macros ()
933933{
934934 return exportedMacros;
Original file line number Diff line number Diff line change @@ -279,7 +279,7 @@ class Mappings
279279 lookup_macro_invocation (AST::MacroInvocation &invoc);
280280
281281 void insert_exported_macro (AST::MacroRulesDefinition &def);
282- std::vector<NodeId> & get_exported_macros ();
282+ std::vector<AST::MacroRulesDefinition> get_exported_macros ();
283283
284284 void insert_derive_proc_macros (CrateNum num,
285285 std::vector<CustomDeriveProcMacro> macros);
@@ -408,7 +408,7 @@ class Mappings
408408 std::map<NodeId, std::pair<AST::MacroRulesDefinition *, CrateNum>>
409409 macroMappings;
410410 std::map<NodeId, AST::MacroRulesDefinition *> macroInvocations;
411- std::vector<NodeId > exportedMacros;
411+ std::vector<AST::MacroRulesDefinition > exportedMacros;
412412
413413 // Procedural macros
414414 std::map<CrateNum, std::vector<CustomDeriveProcMacro>>
Original file line number Diff line number Diff line change 1+ macro_rules! quote_tokens {
2+ ( ) => {
3+ #[ macro_export]
4+ macro_rules! inner {
5+ ( ) => {
6+ $crate::
7+ }
8+ }
9+ } ;
10+ }
11+
12+ pub fn main ( ) {
13+ quote_tokens ! ( ) ;
14+ }
You can’t perform that action at this time.
0 commit comments