summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx/grammar/context.hpp
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2020-01-30 16:49:04 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2020-02-18 16:47:38 -0300
commit595cb754b3aa280cdbebcb5fa0c51f287099b713 (patch)
tree49ce2ed6e0e25b7268267d8255dddf46266dfe71 /src/lib/eolian_cxx/grammar/context.hpp
parentd00dadb79ab1c216ecc0519716ca25a1f92c3632 (diff)
eolian-mono: Make Get/Set internal for generated properties
Make Get and Set methods internal for properties that get the property syntax generated. Reviewed-by: João Paulo Taylor Ienczak Zanette <joao.tiz@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D11252
Diffstat (limited to '')
-rw-r--r--src/lib/eolian_cxx/grammar/context.hpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/lib/eolian_cxx/grammar/context.hpp b/src/lib/eolian_cxx/grammar/context.hpp
index 9e175a8ee5..e7bc014acb 100644
--- a/src/lib/eolian_cxx/grammar/context.hpp
+++ b/src/lib/eolian_cxx/grammar/context.hpp
@@ -40,28 +40,25 @@ context_add_tag(NewTag const& tag, context_null context)
40 return context_cons<NewTag, context_null>{tag, context}; 40 return context_cons<NewTag, context_null>{tag, context};
41} 41}
42 42
43template <typename Tag, typename SameTag, typename Tail> 43template <typename Tag, typename Tail>
44constexpr context_cons<SameTag, Tail> 44constexpr context_cons<Tag, Tail>
45context_replace_tag(Tag const& tag, context_cons<SameTag, Tail> const& context 45context_replace_tag(Tag const& tag, context_cons<Tag, Tail> const& context)
46 , typename std::enable_if<std::is_same<Tag, SameTag>::value>::type* = nullptr)
47{ 46{
48 return {tag, context.tail}; 47 return {tag, context.tail};
49} 48}
50 49
51template <typename Tag, typename OtherTag, typename Tail> 50template <typename Tag>
52constexpr context_cons<OtherTag, Tail> 51constexpr context_cons<Tag, context_null>
53context_replace_tag(Tag const& tag, context_cons<OtherTag, Tail> const& context 52context_replace_tag(Tag const& tag, context_null const&)
54 , typename std::enable_if<!std::is_same<Tag, OtherTag>::value>::type* = nullptr)
55{ 53{
56 return {context.tag, context_replace_tag(tag, context.tail)}; 54 return context_cons<Tag, context_null>{tag, context_null{}};
57} 55}
58 56
59template <typename Tag> 57template <typename Tag, typename OtherTag, typename Tail>
60constexpr context_null 58constexpr context_cons<OtherTag, decltype(context_replace_tag(std::declval<Tag>(), std::declval<Tail>()))>
61context_replace_tag(Tag const& tag, context_null const&) 59context_replace_tag(Tag const& tag, context_cons<OtherTag, Tail> const& context)
62{ 60{
63 static_assert(std::is_same<Tag, context_null>::value, "Tag type not available in this generation context"); 61 return {context.tag, context_replace_tag(tag, context.tail)};
64 return tag;
65} 62}
66 63
67template <typename Tag, typename Context> 64template <typename Tag, typename Context>