|
12 | 12 | using JetBrains.Annotations;
|
13 | 13 | using Mono.Cecil;
|
14 | 14 | using Mono.Cecil.Cil;
|
| 15 | +using TruePath; |
15 | 16 | using Yoakke.Streams;
|
16 | 17 | using Yoakke.SynKit.C.Syntax;
|
17 | 18 |
|
@@ -49,7 +50,12 @@ protected static (AssemblyDefinition, byte[]) GenerateAssembly(
|
49 | 50 | string globalTypeFqn = "",
|
50 | 51 | string[]? referencePaths = null)
|
51 | 52 | {
|
52 |
| - var context = CreateAssembly(runtime, arch, @namespace: @namespace, globalTypeFqn: globalTypeFqn, referencePaths); |
| 53 | + var context = CreateAssembly( |
| 54 | + runtime, |
| 55 | + arch, |
| 56 | + @namespace: @namespace, |
| 57 | + globalTypeFqn: globalTypeFqn, |
| 58 | + referencePaths?.Select(x => new LocalPath(x)).ToArray()); |
53 | 59 | GenerateCode(context, sources);
|
54 | 60 | return EmitAssembly(context);
|
55 | 61 | }
|
@@ -82,22 +88,22 @@ private static AssemblyContext CreateAssembly(
|
82 | 88 | TargetArchitectureSet targetArchitectureSet = TargetArchitectureSet.Dynamic,
|
83 | 89 | string @namespace = "",
|
84 | 90 | string globalTypeFqn = "",
|
85 |
| - string[]? referencePaths = null) |
| 91 | + LocalPath[]? referencePaths = null) |
86 | 92 | {
|
87 |
| - var allReferences = (referencePaths ?? Array.Empty<string>()).ToList(); |
88 |
| - allReferences.Insert(0, typeof(Console).Assembly.Location); |
| 93 | + var allReferences = (referencePaths ?? []).ToList(); |
| 94 | + allReferences.Insert(0, new LocalPath(typeof(Console).Assembly.Location)); |
89 | 95 |
|
90 | 96 | CompilationOptions compilationOptions = new(
|
91 | 97 | targetRuntime ?? CSharpCompilationUtil.DefaultRuntime,
|
92 | 98 | targetArchitectureSet,
|
93 | 99 | ModuleKind.Console,
|
94 |
| - typeof(Math).Assembly.Location, |
95 |
| - typeof(RuntimeHelpers).Assembly.Location, |
| 100 | + new LocalPath(typeof(Math).Assembly.Location), |
| 101 | + new LocalPath(typeof(RuntimeHelpers).Assembly.Location), |
96 | 102 | allReferences,
|
97 | 103 | @namespace,
|
98 | 104 | globalTypeFqn,
|
99 |
| - Array.Empty<string>(), |
100 |
| - Array.Empty<string>(), |
| 105 | + [], |
| 106 | + [], |
101 | 107 | ProducePreprocessedFile: false,
|
102 | 108 | ProduceAstFile: false);
|
103 | 109 | return AssemblyContext.Create(
|
|
0 commit comments