diff --git a/src/bin/eolian_mono/eolian/mono/helpers.hh b/src/bin/eolian_mono/eolian/mono/helpers.hh index dffb38b820..c3e1114c98 100644 --- a/src/bin/eolian_mono/eolian/mono/helpers.hh +++ b/src/bin/eolian_mono/eolian/mono/helpers.hh @@ -3,6 +3,7 @@ #include "grammar/klass_def.hpp" #include "blacklist.hh" +#include "generation_contexts.hh" #include "name_helpers.hh" namespace eolian_mono { @@ -165,11 +166,19 @@ bool has_regular_ancestor(attributes::klass_def const& cls) /* * Gets all methods that this class should implement (i.e. that come from an unimplemented interface/mixin and the class itself) */ -std::vector get_all_implementable_methods(attributes::klass_def const& cls) +template +std::vector get_all_implementable_methods(attributes::klass_def const& cls, Context const& context) { + bool want_beta = efl::eolian::grammar::context_find_tag(context).want_beta; std::vector ret; + auto filter_beta = [&want_beta](attributes::function_def const& func) { + if (!want_beta) + return !func.is_beta; + else + return true; + }; - std::copy(cls.functions.begin(), cls.functions.end(), std::back_inserter(ret)); + std::copy_if(cls.functions.begin(), cls.functions.end(), std::back_inserter(ret), filter_beta); // Non implemented interfaces std::set implemented_interfaces; @@ -206,7 +215,7 @@ std::vector get_all_implementable_methods(attributes:: for (auto&& inherit : interfaces) { attributes::klass_def klass(get_klass(inherit, cls.unit), cls.unit); - std::copy(klass.functions.cbegin(), klass.functions.cend(), std::back_inserter(ret)); + std::copy_if(klass.functions.cbegin(), klass.functions.cend(), std::back_inserter(ret), filter_beta); } return ret; diff --git a/src/bin/eolian_mono/eolian/mono/klass.hh b/src/bin/eolian_mono/eolian/mono/klass.hh index c34d7c06e0..831f48d85b 100644 --- a/src/bin/eolian_mono/eolian/mono/klass.hh +++ b/src/bin/eolian_mono/eolian/mono/klass.hh @@ -36,7 +36,7 @@ template static std::size_t get_implementable_function_count(grammar::attributes::klass_def const& cls, Context context) { - auto methods = helpers::get_all_implementable_methods(cls); + auto methods = helpers::get_all_implementable_methods(cls, context); return std::count_if(methods.cbegin(), methods.cend(), [&context](grammar::attributes::function_def const& func) { return !blacklist::is_function_blacklisted(func, context) && !func.is_static; @@ -230,7 +230,7 @@ struct klass .generate(sink, cls.parts, concrete_cxt)) return false; // Concrete function definitions - auto implemented_methods = helpers::get_all_implementable_methods(cls); + auto implemented_methods = helpers::get_all_implementable_methods(cls, concrete_cxt); if(!as_generator(*(function_definition)) .generate(sink, implemented_methods, concrete_cxt)) return false; @@ -302,7 +302,7 @@ struct klass .generate(sink, cls.parts, inherit_cxt)) return false; // Inherit function definitions - auto implemented_methods = helpers::get_all_implementable_methods(cls); + auto implemented_methods = helpers::get_all_implementable_methods(cls, inherit_cxt); if(!as_generator(*(function_definition(true))) .generate(sink, implemented_methods, inherit_cxt)) return false; @@ -354,7 +354,7 @@ struct klass context); auto native_inherit_name = name_helpers::klass_native_inherit_name(cls); auto inherit_name = name_helpers::klass_inherit_name(cls); - auto implementable_methods = helpers::get_all_implementable_methods(cls); + auto implementable_methods = helpers::get_all_implementable_methods(cls, context); bool root = !helpers::has_regular_ancestor(cls); auto const& indent = current_indentation(inative_cxt);