diff options
author | John Hodge <tpg@mutabah.net> | 2016-03-20 12:29:44 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-03-20 12:29:44 +0800 |
commit | b79e71e5f11e14516f13ea2f8437d5deaa10e653 (patch) | |
tree | 3097c0251c83e32e4e673a840f5708110a8adc4c /src/ast/path.hpp | |
parent | 0ee80748a3dcb97f308e9b0b71c22d28868d12cf (diff) | |
download | mrust-b79e71e5f11e14516f13ea2f8437d5deaa10e653.tar.gz |
Tagged Union - Rework to remove indirection
Diffstat (limited to 'src/ast/path.hpp')
-rw-r--r-- | src/ast/path.hpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/ast/path.hpp b/src/ast/path.hpp index 1260ece3..d2f6302e 100644 --- a/src/ast/path.hpp +++ b/src/ast/path.hpp @@ -29,49 +29,49 @@ class Static; class Function; TAGGED_UNION(PathBinding, Unbound, - (Unbound, ( - )), - (Module, ( + (Unbound, struct { + }), + (Module, struct { const Module* module_; - )), - (Enum, ( + }), + (Enum, struct { const Enum* enum_; - )), - (Struct, ( + }), + (Struct, struct { const Struct* struct_; - )), - (Trait, ( + }), + (Trait, struct { const Trait* trait_; - )), - (Static, ( + }), + (Static, struct { const Static* static_; - )), - (Function, ( + }), + (Function, struct { const Function* func_; - )), - (EnumVar, ( + }), + (EnumVar, struct { const Enum* enum_; unsigned int idx; - )), - (TypeAlias, ( + }), + (TypeAlias, struct { const TypeAlias* alias_; - )), - (StructMethod, ( + }), + (StructMethod, struct { const Struct* struct_; ::std::string name; - )), - (TraitMethod, ( + }), + (TraitMethod, struct { const Trait* struct_; ::std::string name; - )), + }), - (TypeParameter, ( + (TypeParameter, struct { unsigned int level; unsigned int idx; - )), - (Variable, ( + }), + (Variable, struct { unsigned int slot; - )) + }) ); extern ::std::ostream& operator<<(::std::ostream& os, const PathBinding& x); @@ -103,28 +103,28 @@ class Path: { public: TAGGED_UNION(Class, Invalid, - (Invalid, ()), - (Local, ( // Variable / Type param (resolved) + (Invalid, struct {}), + (Local, struct { // Variable / Type param (resolved) ::std::string name; - ) ), - (Relative, ( // General relative + } ), + (Relative, struct { // General relative ::std::vector<PathNode> nodes; - ) ), - (Self, ( // Module-relative + } ), + (Self, struct { // Module-relative ::std::vector<PathNode> nodes; - ) ), - (Super, ( // Parent-relative + } ), + (Super, struct { // Parent-relative unsigned int count; ::std::vector<PathNode> nodes; - ) ), - (Absolute, ( // Absolute + } ), + (Absolute, struct { // Absolute ::std::vector<PathNode> nodes; - ) ), - (UFCS, ( // Type-relative + } ), + (UFCS, struct { // Type-relative ::std::unique_ptr<TypeRef> type; ::std::unique_ptr<TypeRef> trait; ::std::vector<PathNode> nodes; - ) ) + } ) ); private: |