Пример #1
0
 public string Accept(TArray type, string jsonVarName, string fieldName)
 {
     if (type.Apply(SimpleJsonTypeVisitor.Ins))
     {
         return($"{fieldName} = {jsonVarName}");
     }
     else
     {
         return($"{fieldName} = []\n        for _ele in {jsonVarName}: {type.ElementType.Apply(this, "_ele", "_e")}; {fieldName}.append(_e)");
     }
 }
Пример #2
0
 public string Accept(TArray type, string jsonVarName, string fieldName)
 {
     if (type.Apply(SimpleJsonTypeVisitor.Ins))
     {
         return($"{fieldName} = {jsonVarName};");
     }
     else
     {
         return($"{{ {fieldName} = []; for(var _ele of {jsonVarName}) {{ let _e :{type.ElementType.Apply(TsDefineTypeName.Ins)};{type.ElementType.Apply(this, "_ele", "_e")} {fieldName}.push(_e);}}}}");
     }
 }