| ... | @@ -242,7 +242,7 @@ pub const Compilation = struct { | ... | @@ -242,7 +242,7 @@ pub const Compilation = struct { |
| 242 | | 242 | |
| 243 | c_int_types: [CInt.list.len]*Type.Int, | 243 | c_int_types: [CInt.list.len]*Type.Int, |
| 244 | | 244 | |
| 245 | fs_watch: *fs.Watch(*Scope.Root), | 245 | // fs_watch: *fs.Watch(*Scope.Root), |
| 246 | | 246 | |
| 247 | const IntTypeTable = std.HashMap(*const Type.Int.Key, *Type.Int, Type.Int.Key.hash, Type.Int.Key.eql); | 247 | const IntTypeTable = std.HashMap(*const Type.Int.Key, *Type.Int, Type.Int.Key.hash, Type.Int.Key.eql); |
| 248 | const ArrayTypeTable = std.HashMap(*const Type.Array.Key, *Type.Array, Type.Array.Key.hash, Type.Array.Key.eql); | 248 | const ArrayTypeTable = std.HashMap(*const Type.Array.Key, *Type.Array, Type.Array.Key.hash, Type.Array.Key.eql); |
| ... | @@ -462,7 +462,7 @@ pub const Compilation = struct { | ... | @@ -462,7 +462,7 @@ pub const Compilation = struct { |
| 462 | .have_err_ret_tracing = false, | 462 | .have_err_ret_tracing = false, |
| 463 | .primitive_type_table = undefined, | 463 | .primitive_type_table = undefined, |
| 464 | | 464 | |
| 465 | .fs_watch = undefined, | 465 | // .fs_watch = undefined, |
| 466 | }; | 466 | }; |
| 467 | comp.link_libs_list = ArrayList(*LinkLib).init(comp.arena()); | 467 | comp.link_libs_list = ArrayList(*LinkLib).init(comp.arena()); |
| 468 | comp.primitive_type_table = TypeTable.init(comp.arena()); | 468 | comp.primitive_type_table = TypeTable.init(comp.arena()); |
| ... | @@ -531,8 +531,8 @@ pub const Compilation = struct { | ... | @@ -531,8 +531,8 @@ pub const Compilation = struct { |
| 531 | comp.root_package = try Package.create(comp.arena(), ".", ""); | 531 | comp.root_package = try Package.create(comp.arena(), ".", ""); |
| 532 | } | 532 | } |
| 533 | | 533 | |
| 534 | comp.fs_watch = try fs.Watch(*Scope.Root).create(16); | 534 | // comp.fs_watch = try fs.Watch(*Scope.Root).create(16); |
| 535 | defer comp.fs_watch.destroy(); | 535 | // defer comp.fs_watch.destroy(); |
| 536 | | 536 | |
| 537 | try comp.initTypes(); | 537 | try comp.initTypes(); |
| 538 | defer comp.primitive_type_table.deinit(); | 538 | defer comp.primitive_type_table.deinit(); |
| ... | @@ -791,46 +791,47 @@ pub const Compilation = struct { | ... | @@ -791,46 +791,47 @@ pub const Compilation = struct { |
| 791 | self.events.put(Event{ .Error = err }); | 791 | self.events.put(Event{ .Error = err }); |
| 792 | } | 792 | } |
| 793 | | 793 | |
| 794 | // First, get an item from the watch channel, waiting on the channel. | 794 | // // First, get an item from the watch channel, waiting on the channel. |
| 795 | var group = event.Group(BuildError!void).init(self.gpa()); | 795 | // var group = event.Group(BuildError!void).init(self.gpa()); |
| 796 | { | 796 | // { |
| 797 | const ev = (self.fs_watch.channel.get()) catch |err| { | 797 | // const ev = (self.fs_watch.channel.get()) catch |err| { |
| 798 | build_result = err; | 798 | // build_result = err; |
| 799 | continue; | 799 | // continue; |
| 800 | }; | 800 | // }; |
| 801 | const root_scope = ev.data; | 801 | // const root_scope = ev.data; |
| 802 | group.call(rebuildFile, self, root_scope) catch |err| { | 802 | // group.call(rebuildFile, self, root_scope) catch |err| { |
| 803 | build_result = err; | 803 | // build_result = err; |
| 804 | continue; | 804 | // continue; |
| 805 | }; | 805 | // }; |
| 806 | } | 806 | // } |
| 807 | // Next, get all the items from the channel that are buffered up. | 807 | // // Next, get all the items from the channel that are buffered up. |
| 808 | while (self.fs_watch.channel.getOrNull()) |ev_or_err| { | 808 | // while (self.fs_watch.channel.getOrNull()) |ev_or_err| { |
| 809 | if (ev_or_err) |ev| { | 809 | // if (ev_or_err) |ev| { |
| 810 | const root_scope = ev.data; | 810 | // const root_scope = ev.data; |
| 811 | group.call(rebuildFile, self, root_scope) catch |err| { | 811 | // group.call(rebuildFile, self, root_scope) catch |err| { |
| 812 | build_result = err; | 812 | // build_result = err; |
| 813 | continue; | 813 | // continue; |
| 814 | }; | 814 | // }; |
| 815 | } else |err| { | 815 | // } else |err| { |
| 816 | build_result = err; | 816 | // build_result = err; |
| 817 | continue; | 817 | // continue; |
| 818 | } | 818 | // } |
| 819 | } | 819 | // } |
| 820 | build_result = group.wait(); | 820 | // build_result = group.wait(); |
| 821 | } | 821 | } |
| 822 | } | 822 | } |
| 823 | | 823 | |
| 824 | async fn rebuildFile(self: *Compilation, root_scope: *Scope.Root) !void { | 824 | async fn rebuildFile(self: *Compilation, root_scope: *Scope.Root) !void { |
| 825 | const tree_scope = blk: { | 825 | const tree_scope = blk: { |
| 826 | const source_code = fs.readFile( | 826 | const source_code = ""; |
| 827 | root_scope.realpath, | 827 | // const source_code = fs.readFile( |
| 828 | max_src_size, | 828 | // root_scope.realpath, |
| 829 | ) catch |err| { | 829 | // max_src_size, |
| 830 | try self.addCompileErrorCli(root_scope.realpath, "unable to open: {}", @errorName(err)); | 830 | // ) catch |err| { |
| 831 | return; | 831 | // try self.addCompileErrorCli(root_scope.realpath, "unable to open: {}", @errorName(err)); |
| 832 | }; | 832 | // return; |
| 833 | errdefer self.gpa().free(source_code); | 833 | // }; |
| | 834 | // errdefer self.gpa().free(source_code); |
| 834 | | 835 | |
| 835 | const tree = try std.zig.parse(self.gpa(), source_code); | 836 | const tree = try std.zig.parse(self.gpa(), source_code); |
| 836 | errdefer { | 837 | errdefer { |
| ... | @@ -972,7 +973,7 @@ pub const Compilation = struct { | ... | @@ -972,7 +973,7 @@ pub const Compilation = struct { |
| 972 | }; | 973 | }; |
| 973 | defer root_scope.base.deref(self); | 974 | defer root_scope.base.deref(self); |
| 974 | | 975 | |
| 975 | assert((try self.fs_watch.addFile(root_scope.realpath, root_scope)) == null); | 976 | // assert((try self.fs_watch.addFile(root_scope.realpath, root_scope)) == null); |
| 976 | try self.rebuildFile(root_scope); | 977 | try self.rebuildFile(root_scope); |
| 977 | } | 978 | } |
| 978 | } | 979 | } |