<commit_before>/**
 * @file
 */
#include "bi/io/cpp/CppConstructorGenerator.hpp"

bi::CppConstructorGenerator::CppConstructorGenerator(std::ostream& base,
    const int level, const bool header) :
    CppBaseGenerator(base, level, header) {
  //
}

void bi::CppConstructorGenerator::visit(const Class* o) {
  if (!header) {
    genTemplateParams(o);
    start("bi::" << o->name);
    genTemplateArgs(o);
    middle("::");
  } else {
    start("");
  }
  middle(o->name);
  CppBaseGenerator aux(base, level, header);
  aux << '(' << o->params << ')';
  if (header) {
    finish(";\n");
  } else {
    finish(" :");
    in();
    in();
    start("super_type(");
    if (!o->args->isEmpty()) {
      middle(o->args);
    }
    middle(')');
    for (auto iter = o->params->begin(); iter != o->params->end(); ++iter) {
      *this << *iter;
    }
    *this << o->braces->strip();
    out();
    out();
    finish(" {");
    in();
    line("//");
    out();
    line("}\n");
  }
}

void bi::CppConstructorGenerator::visit(const MemberParameter* o) {
  finish(',');
  start(o->name << '(' << o->name << ')');
}

void bi::CppConstructorGenerator::visit(const MemberVariable* o) {
  if (o->type->isClass()) {
    finish(',');
    start(o->name << '(');
    middle("bi::make_object<" << o->type << ">(" << o->args << ')');
    middle(')');
  } else if (o->type->isArray()) {
    finish(',');
    start(o->name << "(bi::make_frame(" << o->brackets << ')');
    if (!o->args->isEmpty()) {
      middle(", " << o->args);
    }
    middle(')');
  } else if (!o->value->isEmpty()) {
    finish(',');
    start(o->name << '(' << o->value << ')');
  }
}

void bi::CppConstructorGenerator::visit(const MemberFunction* o) {
  //
}

void bi::CppConstructorGenerator::visit(const MemberFiber* o) {
  //
}

void bi::CppConstructorGenerator::visit(const ConversionOperator* o) {
  //
}

void bi::CppConstructorGenerator::visit(const AssignmentOperator* o) {
  //
}
<commit_msg>Fixed initialization of arrays with no size in constructors.<commit_after>/**
 * @file
 */
#include "bi/io/cpp/CppConstructorGenerator.hpp"

bi::CppConstructorGenerator::CppConstructorGenerator(std::ostream& base,
    const int level, const bool header) :
    CppBaseGenerator(base, level, header) {
  //
}

void bi::CppConstructorGenerator::visit(const Class* o) {
  if (!header) {
    genTemplateParams(o);
    start("bi::" << o->name);
    genTemplateArgs(o);
    middle("::");
  } else {
    start("");
  }
  middle(o->name);
  CppBaseGenerator aux(base, level, header);
  aux << '(' << o->params << ')';
  if (header) {
    finish(";\n");
  } else {
    finish(" :");
    in();
    in();
    start("super_type(");
    if (!o->args->isEmpty()) {
      middle(o->args);
    }
    middle(')');
    for (auto iter = o->params->begin(); iter != o->params->end(); ++iter) {
      *this << *iter;
    }
    *this << o->braces->strip();
    out();
    out();
    finish(" {");
    in();
    line("//");
    out();
    line("}\n");
  }
}

void bi::CppConstructorGenerator::visit(const MemberParameter* o) {
  finish(',');
  start(o->name << '(' << o->name << ')');
}

void bi::CppConstructorGenerator::visit(const MemberVariable* o) {
  if (o->type->isClass()) {
    finish(',');
    start(o->name << '(');
    middle("bi::make_object<" << o->type << ">(" << o->args << ')');
    middle(')');
  } else if (o->type->isArray() && !o->brackets->isEmpty()) {
    finish(',');
    start(o->name << "(bi::make_frame(" << o->brackets << ')');
    if (!o->args->isEmpty()) {
      middle(", " << o->args);
    }
    middle(')');
  } else if (!o->value->isEmpty()) {
    finish(',');
    start(o->name << '(' << o->value << ')');
  }
}

void bi::CppConstructorGenerator::visit(const MemberFunction* o) {
  //
}

void bi::CppConstructorGenerator::visit(const MemberFiber* o) {
  //
}

void bi::CppConstructorGenerator::visit(const ConversionOperator* o) {
  //
}

void bi::CppConstructorGenerator::visit(const AssignmentOperator* o) {
  //
}

{'fraction_non_alphanumeric': 0.24208940231039677, 'fraction_numerical': 0.0, 'mean_word_length': 3.264453961456103, 'pattern_counts': {'":': 2, '<': 89, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4875817', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1390, 'n_words': 245}