Skip to content

Fixing Feature.Detect .net features#13

Merged
kelnishi merged 1 commit intomainfrom
feature-detect
Nov 18, 2024
Merged

Fixing Feature.Detect .net features#13
kelnishi merged 1 commit intomainfrom
feature-detect

Conversation

@kelnishi
Copy link
Copy Markdown
Owner

No description provided.

@kelnishi kelnishi merged commit 77e389e into main Nov 18, 2024
@kelnishi kelnishi deleted the feature-detect branch November 18, 2024 09:07
kelnishi added a commit that referenced this pull request Apr 27, 2026
Adds directory iteration — guests walking a tree call
read-directory once per directory and pull entries via
read-directory-entry until None signals exhausted.

  read-directory() -> result<own<directory-entry-stream>, error-code>
  resource directory-entry-stream {
    read-directory-entry: func()
      -> result<option<directory-entry>, error-code>;
  }
  record directory-entry {
    type: descriptor-type,
    name: string,
  }

Types added:
- DirectoryEntry class (Type: DescriptorType, Name: string)
- DirectoryEntryStream resource — array-backed by default;
  pos cursor advances on each ReadDirectoryEntry call;
  null when exhausted.

Descriptor.ReadDirectory() default impl walks
Directory.EnumerateDirectories + Directory.EnumerateFiles
on the underlying Path, builds a DirectoryEntry[] with
the appropriate DescriptorType per entry. Subclasses
override for VFS shims.

WasiInterfaceBinder.BindStreamResultResourceMethod gains
return shape #13: option<directory-entry>. 20-byte total
layout:
- +0: outer disc (Ok)
- +4: option disc (None=0, Some=1)
- +8: type (u8)
- +12: name ptr (i32)
- +16: name len (i32)

When Some: type byte at +8, name UTF-8 bytes allocated
via cabi_realloc with (ptr, len) at +12/+16.

WIT keyword "type" can't be used as a field name without
escaping; the dep .wit uses "%type" to satisfy
wasm-tools.

wasi-fs-readdir-component fixture: hand-written WAT
chains read-directory → read-directory-entry, packs
(option-disc, type, name-len, first-name-byte) into a u32.
Stub yields ("first.txt", RegularFile) as the first entry;
test asserts each packed byte matches.

Test counts (sequential): 603 transpiler + 344 component-
model + 7 bindgen + 73 WASI.Preview2 = 1027/1027 passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant