Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft for IL decompilation #357

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

jl0pd
Copy link
Contributor

@jl0pd jl0pd commented Nov 25, 2023

This PR add new type CompiledLibrary which contains compiled library bytes, producing compilation and methods to assert that compilation was right.

Example usage:

string program = $"""
    module Math =
        fn test of x =
            x + 2
    end
    """;

CompileLibrary library = CompileLibrary(program);

library.AssertIL("Math.test", """
    {
        ldarg.0
        ldc.i4.2
        ret
    }
    """)

library.Execute("Math.test", b => {
    b.WithArguments(7);
    b.Return(result => {
         Assert.Equal(9, result);
    });
});

@jl0pd jl0pd marked this pull request as draft November 25, 2023 19:31
Comment on lines +65 to +66
Assert.True(CilSpaceAgnosticStringComparer.Ordinal.Equals(il, actualIl));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thing has bad debugging experience. It just tells that string didn't match, but doesn't say where

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant