def transform_get_first_error(self, args: Tuple[ir.Expr, ...]): new_args = [] for arg in args: if isinstance(arg, ir.AtomicTypeLiteral) and arg.cpp_type == 'void': pass elif (isinstance(arg, ir.VariadicTypeExpansion) and isinstance(arg.inner_expr, ir.ClassMemberAccess) and isinstance(arg.inner_expr.inner_expr, ir.TemplateInstantiation) and isinstance(arg.inner_expr.inner_expr.template_expr, ir.AtomicTypeLiteral) and arg.inner_expr. inner_expr.template_expr.cpp_type.startswith('Select1stType') and len(arg.inner_expr.inner_expr.args) == 2 and isinstance( arg.inner_expr.inner_expr.args[0], ir.AtomicTypeLiteral) and arg.inner_expr.inner_expr.args[0].cpp_type == 'void'): # Select1stType*<void, expr>... pass else: new_args.append(arg) return ir.ClassMemberAccess(inner_expr=ir.TemplateInstantiation( template_expr=GlobalLiterals.GET_FIRST_ERROR, args=tuple(new_args), instantiation_might_trigger_static_asserts=False), expr_type=ir.TypeType(), member_name='type')
def _variadic_type_arg_decl(name: str): return ir.TemplateArgDecl(expr_type=ir.TypeType(), name=name, is_variadic=True)
def _variadic_type_arg_type(): return ir.TemplateArgType(expr_type=ir.TypeType(), is_variadic=True)
from _py2tmp.ir0_optimization._configuration_knobs import ConfigurationKnobs from _py2tmp.ir0 import NameReplacementTransformation, ToplevelWriter, Transformation, \ TemplateBodyWriter from _py2tmp.ir0_optimization._compute_non_expanded_variadic_vars import compute_non_expanded_variadic_vars from _py2tmp.ir0_optimization._local_optimizations import perform_local_optimizations_on_template_defn, \ perform_local_optimizations_on_toplevel_elems from _py2tmp.ir0_optimization._optimization_execution import apply_elem_optimization, describe_template_defns, \ describe_toplevel_elems from _py2tmp.ir0_optimization._replace_var_with_expr import replace_var_with_expr_in_template_body_elements, \ VariadicVarReplacementNotPossibleException, replace_var_with_expr_in_expr from _py2tmp.ir0_optimization._unify import unify_template_instantiation_with_definition _select1st_type_and_name = [ (ir.BoolType(), 'Bool'), (ir.Int64Type(), 'Int64'), (ir.TypeType(), 'Type'), ] TEMPLATE_DEFNS_DEFINED_AS_IR0 = [ ir.TemplateDefn( name='std::is_same', description='', result_element_names=['value'], args=[ ir.TemplateArgDecl( name='T', expr_type=ir.TypeType(), is_variadic=False), ir.TemplateArgDecl( name='U', expr_type=ir.TypeType(), is_variadic=False) ], main_definition=ir.TemplateSpecialization( args=[