From b79e71e5f11e14516f13ea2f8437d5deaa10e653 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 20 Mar 2016 12:29:44 +0800 Subject: Tagged Union - Rework to remove indirection --- src/ast/path.hpp | 78 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'src/ast/path.hpp') 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 nodes; - ) ), - (Self, ( // Module-relative + } ), + (Self, struct { // Module-relative ::std::vector nodes; - ) ), - (Super, ( // Parent-relative + } ), + (Super, struct { // Parent-relative unsigned int count; ::std::vector nodes; - ) ), - (Absolute, ( // Absolute + } ), + (Absolute, struct { // Absolute ::std::vector nodes; - ) ), - (UFCS, ( // Type-relative + } ), + (UFCS, struct { // Type-relative ::std::unique_ptr type; ::std::unique_ptr trait; ::std::vector nodes; - ) ) + } ) ); private: -- cgit v1.2.3