@shd101wyy/yo 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +7 -6
  2. package/out/cjs/index.cjs +568 -563
  3. package/out/cjs/yo-cli.cjs +686 -556
  4. package/out/esm/index.mjs +509 -504
  5. package/out/types/src/build-runner.d.ts +22 -0
  6. package/out/types/src/cache.d.ts +3 -0
  7. package/out/types/src/codegen/async/state-machine.d.ts +1 -1
  8. package/out/types/src/codegen/codegen-c.d.ts +3 -0
  9. package/out/types/src/codegen/exprs/await.d.ts +1 -0
  10. package/out/types/src/codegen/exprs/return.d.ts +1 -0
  11. package/out/types/src/codegen/exprs/while.d.ts +1 -1
  12. package/out/types/src/codegen/functions/context.d.ts +6 -18
  13. package/out/types/src/codegen/functions/declarations.d.ts +10 -2
  14. package/out/types/src/codegen/index.d.ts +4 -0
  15. package/out/types/src/codegen/utils/index.d.ts +3 -0
  16. package/out/types/src/evaluator/async/await-analysis.d.ts +1 -0
  17. package/out/types/src/evaluator/builtins/build.d.ts +135 -0
  18. package/out/types/src/evaluator/context.d.ts +1 -0
  19. package/out/types/src/expr.d.ts +18 -0
  20. package/out/types/src/fetch-command.d.ts +6 -0
  21. package/out/types/src/fetch.d.ts +10 -0
  22. package/out/types/src/function-value.d.ts +1 -0
  23. package/out/types/src/init.d.ts +5 -0
  24. package/out/types/src/install-command.d.ts +6 -0
  25. package/out/types/src/lock-file.d.ts +16 -0
  26. package/out/types/src/module-manager.d.ts +3 -1
  27. package/out/types/src/pkg-config.d.ts +11 -0
  28. package/out/types/src/target.d.ts +28 -0
  29. package/out/types/src/tests/build-system.test.d.ts +1 -0
  30. package/out/types/src/types/creators.d.ts +2 -1
  31. package/out/types/src/types/definitions.d.ts +2 -1
  32. package/out/types/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +1 -1
  34. package/std/build.yo +287 -0
  35. package/std/crypto/random.yo +27 -15
  36. package/std/encoding/base64.yo +24 -49
  37. package/std/encoding/hex.yo +25 -22
  38. package/std/encoding/json.yo +25 -3
  39. package/std/encoding/utf16.yo +6 -5
  40. package/std/fs/dir.yo +107 -104
  41. package/std/fs/file.yo +122 -158
  42. package/std/fs/metadata.yo +23 -22
  43. package/std/fs/temp.yo +42 -48
  44. package/std/fs/walker.yo +48 -55
  45. package/std/net/addr.yo +8 -7
  46. package/std/net/dns.yo +27 -33
  47. package/std/net/errors.yo +13 -8
  48. package/std/net/tcp.yo +92 -113
  49. package/std/net/udp.yo +50 -54
  50. package/std/os/env.yo +5 -5
  51. package/std/os/signal.yo +21 -16
  52. package/std/path.yo +2 -2
  53. package/std/prelude.yo +23 -2
  54. package/std/process.yo +23 -43
  55. package/std/sys/clock.yo +1 -1
  56. package/std/sys/constants.yo +3 -3
  57. package/std/sys/errors.yo +45 -33
  58. package/std/sys/mmap.yo +2 -2
  59. package/std/sys/signals.yo +4 -4
  60. package/std/sys/socket.yo +25 -25
  61. package/std/sys/sysinfo.yo +4 -4
  62. package/std/url/url.yo +19 -32
  63. package/out/types/src/codegen/effects/effect-state-machine.d.ts +0 -34
@@ -6,11 +6,12 @@
6
6
  // { utf8_to_utf16, utf16_to_utf8 } :: import "std/encoding/utf16";
7
7
  //
8
8
  // words := utf8_to_utf16("hello");
9
- // s := utf16_to_utf8(words).unwrap();
9
+ // s := utf16_to_utf8(words);
10
10
 
11
11
  open import "../string";
12
12
  { ArrayList } :: import "../collections/array_list";
13
13
  { EncodingError } :: import "./hex";
14
+ { Error, AnyError, Exception } :: import "../error";
14
15
 
15
16
  // ============================================================================
16
17
  // UTF-8 → UTF-16
@@ -63,7 +64,7 @@ export utf8_to_utf16;
63
64
  // UTF-16 → UTF-8
64
65
  // ============================================================================
65
66
 
66
- utf16_to_utf8 :: (fn(data: ArrayList(u16)) -> Result(String, EncodingError))({
67
+ utf16_to_utf8 :: (fn(data: ArrayList(u16), using(exn : Exception)) -> String)({
67
68
  out := ArrayList(u8).new();
68
69
  i := usize(0);
69
70
  while (i < data.len()), {
@@ -73,14 +74,14 @@ utf16_to_utf8 :: (fn(data: ArrayList(u16)) -> Result(String, EncodingError))({
73
74
  ((w >= u32(0xD800)) && (w <= u32(0xDBFF))) => {
74
75
  cond(
75
76
  ((i + usize(1)) >= data.len()) => {
76
- return .Err(.InvalidChar(u8(0)));
77
+ exn.throw(dyn EncodingError.InvalidChar(u8(0)));
77
78
  },
78
79
  true => ()
79
80
  );
80
81
  w2 := u32(data.get((i + usize(1))).unwrap());
81
82
  cond(
82
83
  ((w2 < u32(0xDC00)) || (w2 > u32(0xDFFF))) => {
83
- return .Err(.InvalidChar(u8(0)));
84
+ exn.throw(dyn EncodingError.InvalidChar(u8(0)));
84
85
  },
85
86
  true => ()
86
87
  );
@@ -109,7 +110,7 @@ utf16_to_utf8 :: (fn(data: ArrayList(u16)) -> Result(String, EncodingError))({
109
110
  }
110
111
  );
111
112
  };
112
- .Ok(String.from_bytes(out))
113
+ String.from_bytes(out)
113
114
  });
114
115
 
115
116
  export utf16_to_utf8;
package/std/fs/dir.yo CHANGED
@@ -1,12 +1,18 @@
1
1
  // std/fs/dir.yo - High-level directory operations
2
2
  //
3
- // Wraps low-level std/sys/dir with typed APIs using Result and IOError.
3
+ // Wraps low-level std/sys/dir with typed APIs using Exception effect.
4
4
  //
5
5
  // Example:
6
6
  // { create_dir, remove_dir, read_dir } :: import "std/fs/dir";
7
7
  // { Path } :: import "std/path";
8
8
  //
9
9
  // main :: (fn(using(io : IO)) -> unit)({
10
+ // given(exn) : Exception = {
11
+ // throw : (fn(forall(T : Type), error: AnyError) -> T)(
12
+ // { println(error.to_string()); exit(i32(1)); }
13
+ // )
14
+ // };
15
+ //
10
16
  // io.await(create_dir(Path.new(`/tmp/yo_test`)));
11
17
  // entries := io.await(read_dir(Path.new(`/tmp/yo_test`)));
12
18
  // io.await(remove_dir(Path.new(`/tmp/yo_test`)));
@@ -18,6 +24,7 @@
18
24
  open import "../string";
19
25
  { Path } :: import "../path";
20
26
  { IOError } :: import "../sys/errors";
27
+ { Error, AnyError, Exception } :: import "../error";
21
28
  IO_dir :: import "../sys/dir";
22
29
  IO_file :: import "../sys/file";
23
30
  { platform, Platform } :: import "../process";
@@ -57,39 +64,39 @@ export DirEntry;
57
64
  // ============================================================================
58
65
 
59
66
  // Create a directory at the given path.
60
- create_dir :: (fn(path: Path, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))(
61
- io.async((using(io : IO)) => {
67
+ create_dir :: (fn(path: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
68
+ io.async((using(io, exn)) => {
62
69
  cstr_bytes := path.to_string().to_cstr();
63
70
  cstr := cstr_bytes.ptr().unwrap();
64
71
  result := io.await(IO_dir.mkdir(AT_FDCWD, cstr, i32(DEFAULT_DIR_MODE)));
65
72
  cond(
66
- (result < i32(0)) => .Err(IOError.from_errno((i32(0) - result))),
67
- true => .Ok(())
73
+ (result < i32(0)) => exn.throw(dyn IOError.from_errno((i32(0) - result))),
74
+ true => ()
68
75
  )
69
76
  })
70
77
  );
71
78
 
72
79
  // Create a directory (str version).
73
- create_dir_str :: (fn(path: str, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))(
74
- create_dir(Path.new(String.from(path)), using(io))
80
+ create_dir_str :: (fn(path: str, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
81
+ create_dir(Path.new(String.from(path)))
75
82
  );
76
83
 
77
84
  // Create a directory and all parent directories.
78
85
  // Does not error if the directory already exists.
79
- create_dir_all :: (fn(path: Path, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))(
80
- io.async((using(io : IO)) => {
86
+ create_dir_all :: (fn(path: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
87
+ io.async((using(io, exn)) => {
81
88
  path_s := path.to_string();
82
89
  cstr_bytes := path_s.to_cstr();
83
90
  cstr := cstr_bytes.ptr().unwrap();
84
91
  // Try creating the directory directly first
85
92
  result := io.await(IO_dir.mkdir(AT_FDCWD, cstr, i32(DEFAULT_DIR_MODE)));
86
93
  cond(
87
- (result >= i32(0)) => .Ok(()),
94
+ (result >= i32(0)) => (),
88
95
  true => {
89
96
  errno := (i32(0) - result);
90
97
  cond(
91
98
  // Already exists is OK
92
- (errno == i32(17)) => .Ok(()),
99
+ (errno == i32(17)) => (),
93
100
  // ENOENT - try to create parents
94
101
  (errno == i32(2)) => {
95
102
  // Walk the path and create each component
@@ -98,7 +105,7 @@ create_dir_all :: (fn(path: Path, using(io : IO)) -> Impl(Future(Result(unit, IO
98
105
  // On Windows, skip past drive letter root (e.g., "C:\")
99
106
  // to avoid trying to mkdir "C:" which fails with EACCES
100
107
  cond(
101
- (platform == Platform.Win32) => {
108
+ (platform == Platform.Windows) => {
102
109
  cond(
103
110
  (bytes.len() >= usize(3)) => {
104
111
  first := bytes.get(usize(0)).unwrap();
@@ -123,8 +130,7 @@ create_dir_all :: (fn(path: Path, using(io : IO)) -> Impl(Future(Result(unit, IO
123
130
  // Ignore EEXIST errors
124
131
  cond(
125
132
  ((r < i32(0)) && ((i32(0) - r) != i32(17))) => {
126
- (ret : Result(unit, IOError)) = .Err(IOError.from_errno((i32(0) - r)));
127
- return ret;
133
+ exn.throw(dyn IOError.from_errno((i32(0) - r)));
128
134
  },
129
135
  true => ()
130
136
  );
@@ -136,17 +142,17 @@ create_dir_all :: (fn(path: Path, using(io : IO)) -> Impl(Future(Result(unit, IO
136
142
  // Create the final directory
137
143
  final_result := io.await(IO_dir.mkdir(AT_FDCWD, cstr, i32(DEFAULT_DIR_MODE)));
138
144
  cond(
139
- (final_result >= i32(0)) => .Ok(()),
145
+ (final_result >= i32(0)) => (),
140
146
  true => {
141
147
  final_errno := (i32(0) - final_result);
142
148
  cond(
143
- (final_errno == i32(17)) => .Ok(()),
144
- true => .Err(IOError.from_errno(final_errno))
149
+ (final_errno == i32(17)) => (),
150
+ true => exn.throw(dyn IOError.from_errno(final_errno))
145
151
  )
146
152
  }
147
153
  )
148
154
  },
149
- true => .Err(IOError.from_errno(errno))
155
+ true => exn.throw(dyn IOError.from_errno(errno))
150
156
  )
151
157
  }
152
158
  )
@@ -154,99 +160,99 @@ create_dir_all :: (fn(path: Path, using(io : IO)) -> Impl(Future(Result(unit, IO
154
160
  );
155
161
 
156
162
  // Create a directory and all parents (str version).
157
- create_dir_all_str :: (fn(path: str, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))(
158
- create_dir_all(Path.new(String.from(path)), using(io))
163
+ create_dir_all_str :: (fn(path: str, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
164
+ create_dir_all(Path.new(String.from(path)))
159
165
  );
160
166
 
161
167
  // Remove an empty directory.
162
- remove_dir :: (fn(path: Path, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))(
163
- io.async((using(io : IO)) => {
168
+ remove_dir :: (fn(path: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
169
+ io.async((using(io, exn)) => {
164
170
  cstr_bytes := path.to_string().to_cstr();
165
171
  cstr := cstr_bytes.ptr().unwrap();
166
172
  result := io.await(IO_dir.unlink(AT_FDCWD, cstr, AT_REMOVEDIR));
167
173
  cond(
168
- (result < i32(0)) => .Err(IOError.from_errno((i32(0) - result))),
169
- true => .Ok(())
174
+ (result < i32(0)) => exn.throw(dyn IOError.from_errno((i32(0) - result))),
175
+ true => ()
170
176
  )
171
177
  })
172
178
  );
173
179
 
174
- remove_dir_str :: (fn(path: str, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))(
175
- remove_dir(Path.new(String.from(path)), using(io))
180
+ remove_dir_str :: (fn(path: str, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
181
+ remove_dir(Path.new(String.from(path)))
176
182
  );
177
183
 
178
184
  // Remove a file.
179
- remove_file :: (fn(path: Path, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))(
180
- io.async((using(io : IO)) => {
185
+ remove_file :: (fn(path: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
186
+ io.async((using(io, exn)) => {
181
187
  cstr_bytes := path.to_string().to_cstr();
182
188
  cstr := cstr_bytes.ptr().unwrap();
183
189
  result := io.await(IO_dir.unlink(AT_FDCWD, cstr, i32(0)));
184
190
  cond(
185
- (result < i32(0)) => .Err(IOError.from_errno((i32(0) - result))),
186
- true => .Ok(())
191
+ (result < i32(0)) => exn.throw(dyn IOError.from_errno((i32(0) - result))),
192
+ true => ()
187
193
  )
188
194
  })
189
195
  );
190
196
 
191
- remove_file_str :: (fn(path: str, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))
192
- remove_file(Path.new(String.from(path)), using(io))
197
+ remove_file_str :: (fn(path: str, using(io : IO)) -> Impl(Future(unit, IO, Exception)))
198
+ remove_file(Path.new(String.from(path)))
193
199
  ;
194
200
 
195
201
  // Rename/move a file or directory.
196
- rename :: (fn(from: Path, to: Path, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))(
197
- io.async((using(io : IO)) => {
202
+ rename :: (fn(from: Path, to: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
203
+ io.async((using(io, exn)) => {
198
204
  from_cstr_bytes := from.to_string().to_cstr();
199
205
  from_cstr := from_cstr_bytes.ptr().unwrap();
200
206
  to_cstr_bytes := to.to_string().to_cstr();
201
207
  to_cstr := to_cstr_bytes.ptr().unwrap();
202
208
  result := io.await(IO_dir.rename(AT_FDCWD, from_cstr, AT_FDCWD, to_cstr));
203
209
  cond(
204
- (result < i32(0)) => .Err(IOError.from_errno((i32(0) - result))),
205
- true => .Ok(())
210
+ (result < i32(0)) => exn.throw(dyn IOError.from_errno((i32(0) - result))),
211
+ true => ()
206
212
  )
207
213
  })
208
214
  );
209
215
 
210
- rename_str :: (fn(from: str, to: str, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))
211
- rename(Path.new(String.from(from)), Path.new(String.from(to)), using(io))
216
+ rename_str :: (fn(from: str, to: str, using(io : IO)) -> Impl(Future(unit, IO, Exception)))
217
+ rename(Path.new(String.from(from)), Path.new(String.from(to)))
212
218
  ;
213
219
 
214
220
  // Create a hard link from src to dst.
215
- hard_link :: (fn(src: Path, dst: Path, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))(
216
- io.async((using(io : IO)) => {
221
+ hard_link :: (fn(src: Path, dst: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
222
+ io.async((using(io, exn)) => {
217
223
  src_cstr_bytes := src.to_string().to_cstr();
218
224
  src_cstr := src_cstr_bytes.ptr().unwrap();
219
225
  dst_cstr_bytes := dst.to_string().to_cstr();
220
226
  dst_cstr := dst_cstr_bytes.ptr().unwrap();
221
227
  result := io.await(IO_dir.link(AT_FDCWD, src_cstr, AT_FDCWD, dst_cstr, i32(0)));
222
228
  cond(
223
- (result < i32(0)) => .Err(IOError.from_errno((i32(0) - result))),
224
- true => .Ok(())
229
+ (result < i32(0)) => exn.throw(dyn IOError.from_errno((i32(0) - result))),
230
+ true => ()
225
231
  )
226
232
  })
227
233
  );
228
234
 
229
- hard_link_str :: (fn(src: str, dst: str, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))
230
- hard_link(Path.new(String.from(src)), Path.new(String.from(dst)), using(io))
235
+ hard_link_str :: (fn(src: str, dst: str, using(io : IO)) -> Impl(Future(unit, IO, Exception)))
236
+ hard_link(Path.new(String.from(src)), Path.new(String.from(dst)))
231
237
  ;
232
238
 
233
239
  // Create a symbolic link at dst pointing to src.
234
- symlink :: (fn(src: Path, dst: Path, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))(
235
- io.async((using(io : IO)) => {
240
+ symlink :: (fn(src: Path, dst: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
241
+ io.async((using(io, exn)) => {
236
242
  src_cstr_bytes := src.to_string().to_cstr();
237
243
  src_cstr := src_cstr_bytes.ptr().unwrap();
238
244
  dst_cstr_bytes := dst.to_string().to_cstr();
239
245
  dst_cstr := dst_cstr_bytes.ptr().unwrap();
240
246
  result := io.await(IO_dir.symlink(src_cstr, AT_FDCWD, dst_cstr));
241
247
  cond(
242
- (result < i32(0)) => .Err(IOError.from_errno((i32(0) - result))),
243
- true => .Ok(())
248
+ (result < i32(0)) => exn.throw(dyn IOError.from_errno((i32(0) - result))),
249
+ true => ()
244
250
  )
245
251
  })
246
252
  );
247
253
 
248
- symlink_str :: (fn(src: str, dst: str, using(io : IO)) -> Impl(Future(Result(unit, IOError), IO)))
249
- symlink(Path.new(String.from(src)), Path.new(String.from(dst)), using(io))
254
+ symlink_str :: (fn(src: str, dst: str, using(io : IO)) -> Impl(Future(unit, IO, Exception)))
255
+ symlink(Path.new(String.from(src)), Path.new(String.from(dst)))
250
256
  ;
251
257
 
252
258
  // ============================================================================
@@ -254,69 +260,66 @@ symlink_str :: (fn(src: str, dst: str, using(io : IO)) -> Impl(Future(Result(uni
254
260
  // ============================================================================
255
261
 
256
262
  // Read directory entries from a path.
257
- read_dir :: (fn(path: Path, using(io : IO)) -> Impl(Future(Result(ArrayList(DirEntry), IOError), IO)))(
258
- io.async((using(io : IO)) => {
263
+ read_dir :: (fn(path: Path, using(io : IO)) -> Impl(Future(ArrayList(DirEntry), IO, Exception)))(
264
+ io.async((using(io, exn)) => {
259
265
  cstr_bytes := path.to_string().to_cstr();
260
266
  cstr := cstr_bytes.ptr().unwrap();
261
267
  // Open the directory
262
268
  fd_result := io.await(IO_file.openat(AT_FDCWD, cstr, (O_RDONLY | O_DIRECTORY), i32(0)));
263
269
  cond(
264
- (fd_result < i32(0)) => .Err(IOError.from_errno((i32(0) - fd_result))),
265
- true => {
266
- fd := fd_result;
267
- entries := ArrayList(DirEntry).new();
268
- buf_size := u32(4096);
269
- buf := *(u8)(malloc(usize(buf_size)).unwrap());
270
- while runtime(true), {
271
- n := io.await(IO_dir.getdents(fd, buf, buf_size));
272
- cond(
273
- (n < i32(0)) => {
274
- free(.Some(*(void)(buf)));
275
- io.await(IO_file.close(fd));
276
- (ret : Result(ArrayList(DirEntry), IOError)) = .Err(IOError.from_errno((i32(0) - n)));
277
- return ret;
278
- },
279
- (n == i32(0)) => { break; },
280
- true => {
281
- offset := usize(0);
282
- while runtime((offset < usize(n))), {
283
- entry_ptr := (buf &+ offset);
284
- name_ptr := IO_dir.dirent_name(entry_ptr);
285
- name := String.from_cstr(name_ptr).unwrap();
286
- // Skip "." and ".."
287
- cond(
288
- ((name == String.from(".")) || (name == String.from(".."))) => (),
289
- true => {
290
- dt := IO_dir.dirent_type(entry_ptr);
291
- ft := cond(
292
- (dt == DT_REG) => FileType.File,
293
- (dt == DT_DIR) => FileType.Directory,
294
- (dt == DT_LNK) => FileType.Symlink,
295
- true => FileType.Other
296
- );
297
- entries.push(DirEntry(
298
- name: name,
299
- file_type: ft,
300
- ino: IO_dir.dirent_ino(entry_ptr)
301
- ));
302
- }
270
+ (fd_result < i32(0)) => exn.throw(dyn IOError.from_errno((i32(0) - fd_result))),
271
+ true => ()
272
+ );
273
+ fd := fd_result;
274
+ entries := ArrayList(DirEntry).new();
275
+ buf_size := u32(4096);
276
+ buf := *(u8)(malloc(usize(buf_size)).unwrap());
277
+ while runtime(true), {
278
+ n := io.await(IO_dir.getdents(fd, buf, buf_size));
279
+ cond(
280
+ (n < i32(0)) => {
281
+ free(.Some(*(void)(buf)));
282
+ io.await(IO_file.close(fd));
283
+ exn.throw(dyn IOError.from_errno((i32(0) - n)));
284
+ },
285
+ (n == i32(0)) => { break; },
286
+ true => {
287
+ offset := usize(0);
288
+ while runtime((offset < usize(n))), {
289
+ entry_ptr := (buf &+ offset);
290
+ name_ptr := IO_dir.dirent_name(entry_ptr);
291
+ name := String.from_cstr(name_ptr).unwrap();
292
+ // Skip "." and ".."
293
+ cond(
294
+ ((name == String.from(".")) || (name == String.from(".."))) => (),
295
+ true => {
296
+ dt := IO_dir.dirent_type(entry_ptr);
297
+ ft := cond(
298
+ (dt == DT_REG) => FileType.File,
299
+ (dt == DT_DIR) => FileType.Directory,
300
+ (dt == DT_LNK) => FileType.Symlink,
301
+ true => FileType.Other
303
302
  );
304
- offset = (offset + usize(IO_dir.dirent_reclen(entry_ptr)));
305
- };
306
- }
307
- );
308
- };
309
- free(.Some(*(void)(buf)));
310
- io.await(IO_file.close(fd));
311
- (ret : Result(ArrayList(DirEntry), IOError)) = .Ok(entries);
312
- return ret;
313
- }
314
- )
303
+ entries.push(DirEntry(
304
+ name: name,
305
+ file_type: ft,
306
+ ino: IO_dir.dirent_ino(entry_ptr)
307
+ ));
308
+ }
309
+ );
310
+ offset = (offset + usize(IO_dir.dirent_reclen(entry_ptr)));
311
+ };
312
+ }
313
+ );
314
+ };
315
+ free(.Some(*(void)(buf)));
316
+ io.await(IO_file.close(fd));
317
+ entries
315
318
  })
316
319
  );
317
320
 
318
- read_dir_str :: (fn(path: str, using(io : IO)) -> Impl(Future(Result(ArrayList(DirEntry), IOError), IO)))
319
- read_dir(Path.new(String.from(path)), using(io))
321
+ read_dir_str :: (fn(path: str, using(io : IO)) -> Impl(Future(ArrayList(DirEntry), IO, Exception)))
322
+ read_dir(Path.new(String.from(path)))
320
323
  ;
321
324
 
322
325
  export