lauromoura pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f10c91cda9795a43e6984814b7394383cf9da812

commit f10c91cda9795a43e6984814b7394383cf9da812
Author: Lauro Moura <[email protected]>
Date:   Tue Nov 26 11:56:57 2019 -0300

    csharp: CA1717 - Add [Flags] for enums
    
    Summary:
    Using the naive approach of checking if the name ends with `Flags`.
    
    Ref T8411
    
    Depends on D10708
    
    Reviewers: brunobelo, segfaultxavi, felipealmeida, YOhoho
    
    Reviewed By: felipealmeida
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Maniphest Tasks: T8411
    
    Differential Revision: https://phab.enlightenment.org/D10709
---
 src/bin/eolian_mono/eolian/mono/enum_definition.hh | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/bin/eolian_mono/eolian/mono/enum_definition.hh 
b/src/bin/eolian_mono/eolian/mono/enum_definition.hh
index 76bad3baa2..2c304fcd0f 100644
--- a/src/bin/eolian_mono/eolian/mono/enum_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/enum_definition.hh
@@ -40,15 +40,21 @@ struct enum_definition_generator
      if(!name_helpers::open_namespaces(sink, enum_.namespaces, context))
        return false;
 
-     if(!as_generator(documentation).generate(sink, enum_, context))
-       return false;
+     std::string enum_name = name_helpers::typedecl_managed_name(enum_);
+     std::string flags_attribute;
+
+     // CA1717
+     if (utils::ends_with(enum_name, "Flags") || utils::ends_with(enum_name, 
"InputHints")) // Special provision while Text api is revamped
+       flags_attribute = "[Flags]";
 
      if(!as_generator
         (
-         "[Efl.Eo.BindingEntity]\n"
-         "public enum " << string << "\n{\n"
+         documentation
+         << flags_attribute
+         << "[Efl.Eo.BindingEntity]\n"
+         "public enum " << enum_name << "\n{\n"
          )
-        .generate(sink, name_helpers::typedecl_managed_name(enum_), context))
+        .generate(sink, enum_, context))
        return false;
 
      // iterate enum fiels

-- 


Reply via email to