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/ast.hpp | 59 +++++++++++++++++++++------------------------------------ 1 file changed, 22 insertions(+), 37 deletions(-) (limited to 'src/ast/ast.hpp') diff --git a/src/ast/ast.hpp b/src/ast/ast.hpp index 886766ff..fd72552a 100644 --- a/src/ast/ast.hpp +++ b/src/ast/ast.hpp @@ -227,15 +227,15 @@ public: TAGGED_UNION_EX(EnumVariantData, (: public Serialisable), Value, ( - (Value, ( + (Value, struct { ::AST::Expr m_value; - )), - (Tuple, ( + }), + (Tuple, struct { ::std::vector m_sub_types; - )), - (Struct, ( + }), + (Struct, struct { ::std::vector m_fields; - )) + }) ), (), (), ( @@ -319,12 +319,12 @@ public: TAGGED_UNION_EX(StructData, (: public Serialisable), Struct, ( - (Tuple, ( + (Tuple, struct { ::std::vector ents; - )), - (Struct, ( + }), + (Struct, struct { ::std::vector ents; - )) + }) ), (),(), ( @@ -593,34 +593,19 @@ private: TAGGED_UNION_EX(Item, (: public Serialisable), None, ( - (None, ( - )), - (Module, ( - Module e; - )), - (Crate, ( + (None, struct {} ), + (Module, Module), + (Crate, struct { ::std::string name; - )), - - (Type, ( - TypeAlias e; - )), - (Struct, ( - Struct e; - )), - (Enum, ( - Enum e; - )), - (Trait, ( - Trait e; - )), - - (Function, ( - Function e; - )), - (Static, ( - Static e; - )) + }), + + (Type, TypeAlias), + (Struct, Struct), + (Enum, Enum), + (Trait, Trait), + + (Function, Function), + (Static, Static) ), (, attrs(mv$(x.attrs))), (attrs = mv$(x.attrs);), -- cgit v1.2.3