private static string GetTypeHint(TypeDecl decl, ParamDecl parameter) { if (parameter.Value != null) { string result = GetValue(parameter.Value); return(parameter.Vector == YesNo.Y ? $"List[{result}]" : result); } else if (parameter.Data != null) { string paramNamespace = !PyExtensions.IsPackageEquals(decl, parameter.Data) ? PyExtensions.GetAlias(parameter.Data) + "." : ""; string result = $"{paramNamespace}{parameter.Data.Name}"; return(parameter.Vector == YesNo.Y ? $"List[{result}]" : result); } else if (parameter.Key != null) { return(parameter.Vector == YesNo.Y ? "List[str]" : "str"); } else if (parameter.Enum != null) { string paramNamespace = !PyExtensions.IsPackageEquals(decl, parameter.Enum) ? PyExtensions.GetAlias(parameter.Enum) + "." : ""; string result = $"{paramNamespace}{parameter.Enum.Name}"; return(parameter.Vector == YesNo.Y ? $"List[{result}]" : result); } else { throw new ArgumentException("Can't deduct type"); } }
public static string GetType(ParamDecl element) { string type = element.Value != null?CppElementBuilder.GetValue(element.Value) : element.Data != null ? $"{element.Data.Name.Underscore()}_data" : element.Key != null ? $"{element.Key.Name.Underscore()}_key" : element.Enum != null?element.Enum.Name.Underscore() : throw new ArgumentException("Can't deduct type"); return(element.Vector == YesNo.Y ? $"dot::list<{type}>" : type); }