[Dart] Getting tests/DartTest.sh to work on master. (#5915)

* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case.

* Fixed Dart Tests by removing code-gen for included files.
This commit is contained in:
Derek Bailey
2020-05-15 18:13:29 -07:00
committed by GitHub
parent 424a473e1f
commit 0fa087657e
4 changed files with 4 additions and 9 deletions

View File

@@ -2854,7 +2854,7 @@ class CppGenerator : public BaseGenerator {
*code_ptr += " (void)padding" + NumToString((*id)++) + "__;";
}
void GenStructConstructor(const StructDef& struct_def) {
void GenStructConstructor(const StructDef &struct_def) {
std::string arg_list;
std::string init_list;
int padding_id = 0;
@@ -2869,8 +2869,7 @@ class CppGenerator : public BaseGenerator {
}
const auto member_name = Name(field) + "_";
const auto arg_name = "_" + Name(field);
const auto arg_type =
GenTypeGet(field_type, " ", "const ", " &", true);
const auto arg_type = GenTypeGet(field_type, " ", "const ", " &", true);
if (it != first) { arg_list += ", "; }
arg_list += arg_type;

View File

@@ -72,10 +72,6 @@ class DartGenerator : public BaseGenerator {
code += "import 'package:flat_buffers/flat_buffers.dart' as " + _kFb +
";\n\n";
if (parser_.opts.include_dependence_headers) {
GenIncludeDependencies(&code, kv->first);
}
for (auto kv2 = namespace_code.begin(); kv2 != namespace_code.end();
++kv2) {
if (kv2->first != kv->first) {

View File

@@ -680,7 +680,7 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
if (struct_def.fixed) {
auto valid = IsScalar(type.base_type) || IsStruct(type);
if (!valid && IsArray(type)) {
const auto& elem_type = type.VectorType();
const auto &elem_type = type.VectorType();
valid |= IsScalar(elem_type.base_type) || IsStruct(elem_type);
}
if (!valid)

View File

@@ -20,7 +20,7 @@ command -v pub >/dev/null 2>&1 || { echo >&2 "Dart tests require `pub` but it's
command -v dart >/dev/null 2>&1 || { echo >&2 "Dart tests require dart to be in path but it's not installed. Aborting."; exit 1; }
# output required files to the dart folder so that pub will be able to
# distribute them and more people can more easily run the dart tests
../flatc --dart --no-includes -I include_test -o ../dart/test monster_test.fbs
../flatc --dart -I include_test -o ../dart/test monster_test.fbs
cp monsterdata_test.mon ../dart/test
cd ../dart