Spaces:
Sleeping
Sleeping
File size: 856 Bytes
1ae2e8e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
using Microsoft.CodeAnalysis;
namespace RobloxCS
{
using TransformMethod = Func<SyntaxTree, ConfigData, SyntaxTree>;
public static partial class BuiltInTransformers
{
public static TransformMethod Main()
{
return (tree, config) => new MainTransformer(tree, config).TransformTree();
}
public static TransformMethod Get(string name)
{
return name.ToLower() switch
{
"debug" => (tree, config) => new DebugTransformer(tree, config).TransformTree(),
_ => FailedToGetTransformer(name)
};
}
private static TransformMethod FailedToGetTransformer(string name)
{
Logger.Error($"No built-in transformer \"{name}\" exists (roblox-cs.yml)");
return null!; // hack
}
}
}
|