Commit 73b96ac114
Changed files (1)
src
src/reduce.zig
@@ -7,24 +7,16 @@ const usage =
\\
;
-const Transformation = enum {
- none,
-};
-
// Roadmap:
// - add the main loop that checks for interestingness
// - add transformations
-// - gut function
-// - replace body with `@trap();`
-// - discard the parameters
// - add thread pool
// - add support for `@import` detection and other files
+// - reduce flags sent to the compiler
pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
const file_path = args[2];
- const transformation = std.meta.stringToEnum(Transformation, args[3]);
-
- assert(transformation == .none);
+ const transformation_index = try std.fmt.parseInt(u32, args[3], 0);
const source_code = try std.fs.cwd().readFileAllocOptions(
arena,
@@ -46,8 +38,7 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
rendered.clearRetainingCapacity();
var gut_functions: std.AutoHashMapUnmanaged(u32, void) = .{};
- try gut_functions.put(arena, 1, {});
- try gut_functions.put(arena, 3, {});
+ try gut_functions.put(arena, transformation_index, {});
try tree.renderToArrayList(&rendered, .{
.gut_functions = gut_functions,