diff options
author | John Hodge <tpg@mutabah.net> | 2016-08-29 12:49:28 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-08-29 12:49:28 +0800 |
commit | 8aecde47456213e13280a690a1cace4fd7dceada (patch) | |
tree | 015522fae4eb7e5cda827e9e7a48e26b002ffaa1 /src/macro_rules | |
parent | 6b0311dec3a645c4ff9ef664fa8d836336a2cc66 (diff) | |
download | mrust-8aecde47456213e13280a690a1cace4fd7dceada.tar.gz |
HIR - Remove dependency on macro_rules.hpp
Diffstat (limited to 'src/macro_rules')
-rw-r--r-- | src/macro_rules/macro_rules.hpp | 10 | ||||
-rw-r--r-- | src/macro_rules/macro_rules_ptr.hpp | 14 | ||||
-rw-r--r-- | src/macro_rules/mod.cpp | 3 |
3 files changed, 19 insertions, 8 deletions
diff --git a/src/macro_rules/macro_rules.hpp b/src/macro_rules/macro_rules.hpp index 9568019a..3606bf99 100644 --- a/src/macro_rules/macro_rules.hpp +++ b/src/macro_rules/macro_rules.hpp @@ -1,3 +1,10 @@ +/*
+ * MRustC - Rust Compiler
+ * - By John Hodge (Mutabah/thePowersGang)
+ *
+ * macro_rules/macro_rules.hpp
+ * - Macros by example - `macro_rules!`
+ */
#ifndef MACROS_HPP_INCLUDED
#define MACROS_HPP_INCLUDED
@@ -139,6 +146,9 @@ class MacroRules: {
public:
bool m_exported;
+
+ ::std::string m_source_crate; // Populated on load, used for $crate
+
/// Parsing patterns
MacroRulesPatFrag m_pattern;
/// Expansion rules
diff --git a/src/macro_rules/macro_rules_ptr.hpp b/src/macro_rules/macro_rules_ptr.hpp index 512cbda2..b910d2af 100644 --- a/src/macro_rules/macro_rules_ptr.hpp +++ b/src/macro_rules/macro_rules_ptr.hpp @@ -1,11 +1,15 @@ /* + * MRustC - Rust Compiler + * - By John Hodge (Mutabah/thePowersGang) + * + * macro_rules/macro_rules_ptr.hpp + * - Pointer to a MacroRules instance */ #pragma once class MacroRules; -class MacroRulesPtr: - public Serialisable +class MacroRulesPtr { MacroRules* m_ptr; public: @@ -24,8 +28,8 @@ public: ~MacroRulesPtr(); - MacroRules& operator*() { assert(m_ptr); return *m_ptr; } const MacroRules& operator*() const { assert(m_ptr); return *m_ptr; } - - SERIALISABLE_PROTOTYPES(); + MacroRules& operator*() { assert(m_ptr); return *m_ptr; } + const MacroRules* operator->() const { assert(m_ptr); return m_ptr; } + MacroRules* operator->() { assert(m_ptr); return m_ptr; } }; diff --git a/src/macro_rules/mod.cpp b/src/macro_rules/mod.cpp index 4e914066..c5914f47 100644 --- a/src/macro_rules/mod.cpp +++ b/src/macro_rules/mod.cpp @@ -101,9 +101,6 @@ MacroRulesPtr::~MacroRulesPtr() m_ptr = nullptr;
}
}
-SERIALISE_TYPE(MacroRulesPtr::, "MacroRulesPtr", {
-},{
-})
SERIALISE_TYPE_S(MacroRulesArm, {
})
|