Fix .Net generator.

GitOrigin-RevId: ec7bf9f7ce7f39eda70bfb2cd633f2e984d5ccce
This commit is contained in:
levlam 2019-06-27 02:47:28 +03:00
parent da4dd220b8
commit edf829b2b9
2 changed files with 12 additions and 6 deletions

View File

@ -206,9 +206,12 @@ EOT
$colon = '';
foreach ($known_fields as $name => $type) {
$field_type = $this->getTypeName($type);
if (substr($field_type, 0, 5) !== 'Array' && substr($field_type, 0, 6) !== 'String' &&
ucfirst($field_type) === $field_type) {
$field_type = '::Telegram::Td::Api::'.$field_type;
$pos = 0;
while (substr($field_type, $pos, 6) === 'Array<') {
$pos += 6;
}
if (substr($field_type, $pos, 6) !== 'String' && ucfirst(substr($field_type, $pos)) === substr($field_type, $pos)) {
$field_type = substr($field_type, 0, $pos).'::Telegram::Td::Api::'.substr($field_type, $pos);
}
$full_constructor .= $colon.$field_type.' '.$this->getParameterName($name, $class_name);
$colon = ', ';

View File

@ -284,9 +284,12 @@ class TlWriterDotNet : public TL_writer {
std::stringstream ss;
ss << (field_num == 0 ? "" : ", ");
auto field_type = gen_field_type(a);
if (field_type.substr(0, 5) != "Array" && field_type.substr(0, 6) != "String" &&
to_upper(field_type[0]) == field_type[0]) {
field_type = "::Telegram::Td::Api::" + field_type;
auto pos = 0;
while (field_type.substr(pos, 6) == "Array<") {
pos += 6;
}
if (field_type.substr(pos, 6) != "String" && to_upper(field_type[pos]) == field_type[pos]) {
field_type = field_type.substr(0, pos) + "::Telegram::Td::Api::" + field_type.substr(pos);
}
ss << field_type << " " << to_camelCase(a.name);
return ss.str();