Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Feb 12, 2024
1 parent d2de95d commit 5221b7f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
6 changes: 2 additions & 4 deletions chibias.core.Tests/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ private string Run(
coreLibPath, tmp2Path,
}.
Concat(additionalReferencePaths ?? Array.Empty<string>()).
Select(Path.GetFileName).
Select(Path.GetFileNameWithoutExtension).
Distinct().
ToArray();

var assember = new Assembler(
logger,
referenceAssemblyBasePaths);
var assember = new Assembler(logger);

var outputAssemblyPath =
Path.Combine(basePath, "output.dll");
Expand Down
9 changes: 3 additions & 6 deletions chibias.core/Assembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,8 @@ public sealed class Assembler
//private readonly DefaultAssemblyResolver assemblyResolver;
//private readonly ReaderParameters readerParameters;

public Assembler(
ILogger logger,
params string[] referenceAssemblyBasePaths)
{
public Assembler(ILogger logger) =>
this.logger = logger;
}

private TypeDefinitionCache LoadPublicTypesFrom(
string[] referenceAssemblyBasePaths,
Expand All @@ -71,7 +67,8 @@ private TypeDefinitionCache LoadPublicTypesFrom(
try
{
if (referenceAssemblyBasePaths.
Select(basePath => Path.Combine(basePath, name)).
SelectMany(basePath => new[] { $"{name}.dll", $"lib{name}.dll" }.
Select(n => Path.Combine(basePath, n))).
Where(File.Exists).
FirstOrDefault() is not { } path)
{
Expand Down
1 change: 0 additions & 1 deletion chibias/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ public static Options Parse(string[] args)
ToArray();
options.AssemblerOptions.ReferenceAssemblyNames = referenceAssemblyNames.
Distinct().
Select(name => $"lib{name}.dll").
ToArray();

return options;
Expand Down
2 changes: 1 addition & 1 deletion chibias/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"chibias": {
"commandName": "Project",
"commandLineArgs": "--log trace -f net6.0 -a /home/kouji/.dotnet/sdk/6.0.418/AppHostTemplate/apphost -r /home/kouji/.dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Private.CoreLib.dll -r stage2/libc-bootstrap.dll -o stage2/chibicc stage2/./codegen.o stage2/./main.o stage2/./parse.o stage2/./strings.o stage2/./tokenize.o stage2/./type.o stage2/./utils.o",
"commandLineArgs": "--log trace -f net6.0 -a /home/kouji/.dotnet/sdk/6.0.418/AppHostTemplate/apphost -L/home/kouji/.dotnet/shared/Microsoft.NETCore.App/6.0.26 -lSystem.Private.CoreLib -L. -lc-bootstrap -o test/alignof test/alignof.o test/common.o",
"workingDirectory": "/home/kouji/Projects/chibicc-cil"
}
}
Expand Down

0 comments on commit 5221b7f

Please sign in to comment.