LILAC
Language to language Interop LAyer Compiler
Loading...
Searching...
No Matches
IExporter.cs
Go to the documentation of this file.
1using System.CodeDom.Compiler;
2using System.Runtime.InteropServices.JavaScript;
3using System.Xml.Linq;
4using Microsoft.CodeAnalysis;
5
7
8public interface IExporter
9{
10 public void GenerateUnmanagedCode(IndentedTextWriter source, IndentedTextWriter header);
11 public void GenerateManagedCode(IndentedTextWriter builder);
12
13 public static IExporter Create(ISymbol symbol)
14 {
15 return symbol switch
16 {
17 IMethodSymbol m => new MethodExporter(m),
18 INamedTypeSymbol { TypeKind: TypeKind.Enum } t => new EnumExporter(t),
19 INamedTypeSymbol t => new TypeExporter(t),
20 _ => throw new NotSupportedException(
21 $"{symbol.GetType().Name}({symbol.ToDisplayString()}) couldn't be exported")
22 };
23 }
24}
static IExporter Create(ISymbol symbol)
Definition IExporter.cs:13
void GenerateUnmanagedCode(IndentedTextWriter source, IndentedTextWriter header)
void GenerateManagedCode(IndentedTextWriter builder)