2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-05-06 11:32:59 +00:00

null annotations

This commit is contained in:
Ahmed Zamil 2024-07-28 21:30:29 +03:00
parent 68d1595542
commit 512b07ce8a

View File

@ -84,6 +84,7 @@ public static class TemplateGenerator
foreach (var p in template.Properties) foreach (var p in template.Properties)
{ {
var ptTypeName = GetTypeName(p.ValueType, templates); var ptTypeName = GetTypeName(p.ValueType, templates);
if (p.ReadAnnotation != null)
rt.AppendLine($"[Annotation({ToLiteral(p.ReadAnnotation)})]"); rt.AppendLine($"[Annotation({ToLiteral(p.ReadAnnotation)})]");
rt.AppendLine($"public {ptTypeName} {p.Name} {{ get; set; }}"); rt.AppendLine($"public {ptTypeName} {p.Name} {{ get; set; }}");
rt.AppendLine(); rt.AppendLine();
@ -297,6 +298,7 @@ public static class TemplateGenerator
var positionalArgs = f.Arguments.Where((x) => !x.Optional).ToArray(); var positionalArgs = f.Arguments.Where((x) => !x.Optional).ToArray();
var optionalArgs = f.Arguments.Where((x) => x.Optional).ToArray(); var optionalArgs = f.Arguments.Where((x) => x.Optional).ToArray();
if (f.Annotation != null)
rt.AppendLine($"[Annotation({ToLiteral(f.Annotation)})]"); rt.AppendLine($"[Annotation({ToLiteral(f.Annotation)})]");
if (f.IsStatic) if (f.IsStatic)
@ -361,6 +363,7 @@ public static class TemplateGenerator
if (p.Inherited) if (p.Inherited)
continue; continue;
if (p.ReadAnnotation != null)
rt.AppendLine($"[Annotation({ToLiteral(p.ReadAnnotation)})]"); rt.AppendLine($"[Annotation({ToLiteral(p.ReadAnnotation)})]");
var ptTypeName = GetTypeName(p.ValueType, templates); var ptTypeName = GetTypeName(p.ValueType, templates);
@ -378,6 +381,7 @@ public static class TemplateGenerator
if (c.Inherited) if (c.Inherited)
continue; continue;
if (c.Annotation != null)
rt.AppendLine($"[Annotation({ToLiteral(c.Annotation)})]"); rt.AppendLine($"[Annotation({ToLiteral(c.Annotation)})]");
var ctTypeName = GetTypeName(c.ValueType, templates); var ctTypeName = GetTypeName(c.ValueType, templates);
@ -398,7 +402,9 @@ public static class TemplateGenerator
var etTypeName = GetTypeName(e.ArgumentType, templates); var etTypeName = GetTypeName(e.ArgumentType, templates);
rt.AppendLine($"case {e.Index}: {e.Name}?.Invoke(({etTypeName})args); break;"); rt.AppendLine($"case {e.Index}: {e.Name}?.Invoke(({etTypeName})args); break;");
if (e.Annotation != null)
eventsList.AppendLine($"[Annotation({ToLiteral(e.Annotation)})]"); eventsList.AppendLine($"[Annotation({ToLiteral(e.Annotation)})]");
eventsList.AppendLine($"[Export] public event ResourceEventHandler<{etTypeName}> {e.Name};"); eventsList.AppendLine($"[Export] public event ResourceEventHandler<{etTypeName}> {e.Name};");
} }