File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -654,34 +654,15 @@ class DartGenerator : public BaseGenerator {
654654
655655 std::string NamespaceAliasFromUnionType (Namespace* root_namespace,
656656 const Type& type) {
657- const std::vector<std::string> qualified_name_parts =
658- type.struct_def ->defined_namespace ->components ;
659- if (std::equal (root_namespace->components .begin (),
660- root_namespace->components .end (),
661- qualified_name_parts.begin ())) {
657+ const Namespace& type_namespace = *type.struct_def ->defined_namespace ;
658+ if (root_namespace->components == type_namespace.components ) {
662659 return namer_.Type (*type.struct_def );
663660 }
664661
665- std::string ns;
666-
667- for (auto it = qualified_name_parts.begin ();
668- it != qualified_name_parts.end (); ++it) {
669- auto & part = *it;
670-
671- for (size_t i = 0 ; i < part.length (); i++) {
672- if (i && !isdigit (part[i]) && part[i] == CharToUpper (part[i])) {
673- ns += " _" ;
674- ns += CharToLower (part[i]);
675- } else {
676- ns += CharToLower (part[i]);
677- }
678- }
679- if (it != qualified_name_parts.end () - 1 ) {
680- ns += " _" ;
681- }
682- }
683-
684- return ns + " ." + namer_.Type (*type.struct_def );
662+ const std::string ns = namer_.Namespace (type_namespace);
663+ return ns.empty ()
664+ ? namer_.Type (*type.struct_def )
665+ : ImportAliasName (ns) + " ." + namer_.Type (*type.struct_def );
685666 }
686667
687668 void GenImplementationGetters (
You can’t perform that action at this time.
0 commit comments