diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2021-04-22 00:08:03 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2021-04-22 00:08:03 +0200 |
| commit | 9b8563dfc0ac54a270b0667b77047e0a4cba9e8d (patch) | |
| tree | 620e8eb9b74d01cd75b7a9007970cc8e8086118e /tools | |
| parent | b18e8898d81a7358865d8601c28a3fb80ca9bcf2 (diff) | |
style
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/odinfmt/flag/flag.odin | 3 | ||||
| -rw-r--r-- | tools/odinfmt/main.odin | 5 |
2 files changed, 0 insertions, 8 deletions
diff --git a/tools/odinfmt/flag/flag.odin b/tools/odinfmt/flag/flag.odin index 041b69df0..a943a5a1c 100644 --- a/tools/odinfmt/flag/flag.odin +++ b/tools/odinfmt/flag/flag.odin @@ -146,13 +146,11 @@ reflect_args_structure :: proc(ctx: ^Flag_Context, v: any) -> Flag_Error { tags := reflect.struct_field_tags(v.id);
for name, i in names {
-
flag: Flag;
type := types[i];
if named_type, ok := type.variant.(Type_Info_Named); ok {
-
if union_type, ok := named_type.base.variant.(Type_Info_Union); ok && union_type.maybe && len(union_type.variants) == 1 {
flag.optional = true;
flag.tag_ptr = rawptr(uintptr(union_type.tag_offset) + uintptr(v.data) + uintptr(offsets[i]));
@@ -202,7 +200,6 @@ parse :: proc(v: any, args: []string) -> Flag_Error { //validate that the required flags were actually set
for k, v in ctx.seen_flags {
-
if v.optional && v.parsed {
tag_value: i32 = 1;
mem.copy(v.tag_ptr, &tag_value, 4); //4 constant is probably not portable, but it works for me currently
diff --git a/tools/odinfmt/main.odin b/tools/odinfmt/main.odin index 29c1f6c1b..a651aaff0 100644 --- a/tools/odinfmt/main.odin +++ b/tools/odinfmt/main.odin @@ -68,9 +68,7 @@ main :: proc() { tick_time := time.tick_now();
if os.is_file(path) {
-
if _, ok := args.write.(bool); ok {
-
backup_path := strings.concatenate({path, "_bk"}, context.temp_allocator);
if data, ok := format_file(path); ok {
@@ -84,17 +82,14 @@ main :: proc() { fmt.eprintf("failed to write %v", path);
}
} else {
-
if data, ok := format_file(path); ok {
fmt.println(transmute(string)data);
}
}
} else if os.is_dir(path) {
-
filepath.walk(path, walk_files);
for file in files {
-
fmt.println(file);
backup_path := strings.concatenate({file, "_bk"}, context.temp_allocator);
|