summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-11-22 18:16:06 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-12-03 18:21:43 -0300
commit251703fcfe904b2c1b42ee1d2058916a97a3278f (patch)
treeb39d2510bb03e985329e00925f3685857ab923f6
parent0e6c6fab5946638628eab95af24d5de4eea558c3 (diff)
csharp: WIP - Cleanup unused parameters for structs
Ref T8414
-rw-r--r--src/bin/eolian_mono/eolian/mono/struct_definition.hh32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
index 70332c9..835a4de 100644
--- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
@@ -361,10 +361,20 @@ struct struct_internal_definition_generator
361 ).generate(sink, std::make_tuple(internal_name, external_name, internal_name), context)) 361 ).generate(sink, std::make_tuple(internal_name, external_name, internal_name), context))
362 return false; 362 return false;
363 363
364 for (auto const& field : struct_.fields) 364 if (struct_.fields.size() >= 1)
365 { 365 {
366 if (!to_internal_field_convert.generate(sink, field, context)) 366 for (auto const& field : struct_.fields)
367 return false; 367 {
368 if (!to_internal_field_convert.generate(sink, field, context))
369 return false;
370 }
371 }
372 else
373 {
374 if (!as_generator(
375 indent << scope_tab << scope_tab << "_internal_struct.field = _external_struct.field;\n"
376 ).generate(sink, attributes::unused, context))
377 return false;
368 } 378 }
369 379
370 if (!as_generator(indent << scope_tab << scope_tab << "return _internal_struct;\n" 380 if (!as_generator(indent << scope_tab << scope_tab << "return _internal_struct;\n"
@@ -380,10 +390,20 @@ struct struct_internal_definition_generator
380 ).generate(sink, std::make_tuple(external_name, internal_name, external_name), context)) 390 ).generate(sink, std::make_tuple(external_name, internal_name, external_name), context))
381 return false; 391 return false;
382 392
383 for (auto const& field : struct_.fields) 393 if (struct_.fields.size() != 0)
384 { 394 {
385 if (!to_external_field_convert.generate(sink, field, context)) 395 for (auto const& field : struct_.fields)
386 return false; 396 {
397 if (!to_external_field_convert.generate(sink, field, context))
398 return false;
399 }
400 }
401 else
402 {
403 if (!as_generator(
404 indent << scope_tab << scope_tab << "_external_struct.field = _internal_struct.field;\n"
405 ).generate(sink, attributes::unused, context))
406 return false;
387 } 407 }
388 408
389 if (!as_generator(indent << scope_tab << scope_tab << "return _external_struct;\n" 409 if (!as_generator(indent << scope_tab << scope_tab << "return _external_struct;\n"