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

Fix -a flag and extend token lists #7

Merged
merged 4 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ILTransform/ILRewriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ private void RewriteFile(string source)
}
}
int identEnd = charIndex;
string sourceName = Path.GetFileNameWithoutExtension(source);
TestProject.GetKeyNameRootNameAndSuffix(_testProject.TestProjectAlias, out _, out string sourceName, out _);
Copy link
Owner

Choose a reason for hiding this comment

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

I think this might need to be RelativePath and not TestProjectAlias. The latter has already had GetFileNameWithoutExtension run on it, so with something like a.b.csproj, this would pull out a "second extension".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch

if (sourceName != assemblyName)
{
string end = line.Substring(identEnd);
Expand Down Expand Up @@ -734,7 +734,7 @@ private static bool IsTypePrefix(List<string> tokens, List<TokenKind> kinds, int
&& ((tokens[index + 1] == "::") || (tokens[index + 1] == "/")) // type::field or type::nestedtype
&& (kinds[index + 2] == TokenKind.Identifier || kinds[index + 2] == TokenKind.SingleQuoted);

private static string[] TypeDefTokens = { "public", "auto", "ansi" };
private static string[] TypeDefTokens = { "public", "abstract", "auto", "ansi", "sealed", "beforefieldinit" };
private static bool IsTypeNameDef(List<string> tokens, List<TokenKind> kinds, int index)
{
for (; index >= 2; index -= 2)
Expand Down
2 changes: 1 addition & 1 deletion ILTransform/TestProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public static bool MakePublic(bool isILTest, ref string line, bool force)

public static List<string> SpecialTokens() => new List<string> {
"add", "and", "br", "brtrue", "brfalse", "ble", "blt", "beq", "bge", "bgt", "call", "ceq", "cgt", "ckfinite", "clt", "cpblk", "div",
"dup", "filter", "finally", "initblk", "jmp", "ldobj", "ldtoken", "mul", "neg", "nested", "nop", "rem", "ret", "sub", "xor", "callvirt",
"dup", "filter", "finally", "initblk", "jmp", "ldobj", "ldtoken", "ldftn", "mul", "neg", "nested", "nop", "rem", "ret", "sub", "xor", "callvirt",
"castclass", "cpobj", "initobj", "isinst", "switch", "rethrow"
};

Expand Down