@@ -1494,7 +1494,7 @@ public class WASIBridgeToHost: WASI {
14941494 }
14951495
14961496 func fd_advise( fd: WASIAbi . Fd , offset: WASIAbi . FileSize , length: WASIAbi . FileSize , advice: WASIAbi . Advice ) throws {
1497- guard case let . file( fileEntry) = fdTable [ fd] else {
1497+ guard case . file( let fileEntry) = fdTable [ fd] else {
14981498 throw WASIAbi . Errno. EBADF
14991499 }
15001500 try fileEntry. advise ( offset: offset, length: length, advice: advice)
@@ -1518,7 +1518,7 @@ public class WASIBridgeToHost: WASI {
15181518 }
15191519
15201520 func fd_datasync( fd: WASIAbi . Fd ) throws {
1521- guard case let . file( fileEntry) = fdTable [ fd] else {
1521+ guard case . file( let fileEntry) = fdTable [ fd] else {
15221522 throw WASIAbi . Errno. EBADF
15231523 }
15241524 return try fileEntry. datasync ( )
@@ -1527,7 +1527,7 @@ public class WASIBridgeToHost: WASI {
15271527 func fd_fdstat_get( fileDescriptor: UInt32 ) throws -> WASIAbi . FdStat {
15281528 let entry = self . fdTable [ fileDescriptor]
15291529 switch entry {
1530- case let . file( entry) :
1530+ case . file( let entry) :
15311531 return try entry. fdStat ( )
15321532 case . directory:
15331533 return WASIAbi . FdStat (
@@ -1542,7 +1542,7 @@ public class WASIBridgeToHost: WASI {
15421542 }
15431543
15441544 func fd_fdstat_set_flags( fd: WASIAbi . Fd , flags: WASIAbi . Fdflags ) throws {
1545- guard case let . file( fileEntry) = fdTable [ fd] else {
1545+ guard case . file( let fileEntry) = fdTable [ fd] else {
15461546 throw WASIAbi . Errno. EBADF
15471547 }
15481548 try fileEntry. setFdStatFlags ( flags)
@@ -1564,7 +1564,7 @@ public class WASIBridgeToHost: WASI {
15641564 }
15651565
15661566 func fd_filestat_set_size( fd: WASIAbi . Fd , size: WASIAbi . FileSize ) throws {
1567- guard case let . file( entry) = fdTable [ fd] else {
1567+ guard case . file( let entry) = fdTable [ fd] else {
15681568 throw WASIAbi . Errno. EBADF
15691569 }
15701570 return try entry. setFilestatSize ( size)
@@ -1584,14 +1584,14 @@ public class WASIBridgeToHost: WASI {
15841584 fd: WASIAbi . Fd , iovs: UnsafeGuestBufferPointer < WASIAbi . IOVec > ,
15851585 offset: WASIAbi . FileSize
15861586 ) throws -> WASIAbi . Size {
1587- guard case let . file( fileEntry) = fdTable [ fd] else {
1587+ guard case . file( let fileEntry) = fdTable [ fd] else {
15881588 throw WASIAbi . Errno. EBADF
15891589 }
15901590 return try fileEntry. pread ( into: iovs, offset: offset)
15911591 }
15921592
15931593 func fd_prestat_get( fd: WASIAbi . Fd ) throws -> WASIAbi . Prestat {
1594- guard case let . directory( entry) = fdTable [ fd] ,
1594+ guard case . directory( let entry) = fdTable [ fd] ,
15951595 let preopenPath = entry. preopenPath
15961596 else {
15971597 throw WASIAbi . Errno. EBADF
@@ -1600,7 +1600,7 @@ public class WASIBridgeToHost: WASI {
16001600 }
16011601
16021602 func fd_prestat_dir_name( fd: WASIAbi . Fd , path: UnsafeGuestPointer < UInt8 > , maxPathLength: WASIAbi . Size ) throws {
1603- guard case let . directory( entry) = fdTable [ fd] ,
1603+ guard case . directory( let entry) = fdTable [ fd] ,
16041604 var preopenPath = entry. preopenPath
16051605 else {
16061606 throw WASIAbi . Errno. EBADF
@@ -1620,7 +1620,7 @@ public class WASIBridgeToHost: WASI {
16201620 fd: WASIAbi . Fd , iovs: UnsafeGuestBufferPointer < WASIAbi . IOVec > ,
16211621 offset: WASIAbi . FileSize
16221622 ) throws -> WASIAbi . Size {
1623- guard case let . file( fileEntry) = fdTable [ fd] else {
1623+ guard case . file( let fileEntry) = fdTable [ fd] else {
16241624 throw WASIAbi . Errno. EBADF
16251625 }
16261626 return try fileEntry. pwrite ( vectored: iovs, offset: offset)
@@ -1630,7 +1630,7 @@ public class WASIBridgeToHost: WASI {
16301630 fd: WASIAbi . Fd ,
16311631 iovs: UnsafeGuestBufferPointer < WASIAbi . IOVec >
16321632 ) throws -> WASIAbi . Size {
1633- guard case let . file( fileEntry) = fdTable [ fd] else {
1633+ guard case . file( let fileEntry) = fdTable [ fd] else {
16341634 throw WASIAbi . Errno. EBADF
16351635 }
16361636 return try fileEntry. read ( into: iovs)
@@ -1641,7 +1641,7 @@ public class WASIBridgeToHost: WASI {
16411641 buffer: UnsafeGuestBufferPointer < UInt8 > ,
16421642 cookie: WASIAbi . DirCookie
16431643 ) throws -> WASIAbi . Size {
1644- guard case let . directory( dirEntry) = fdTable [ fd] else {
1644+ guard case . directory( let dirEntry) = fdTable [ fd] else {
16451645 throw WASIAbi . Errno. EBADF
16461646 }
16471647
@@ -1693,21 +1693,21 @@ public class WASIBridgeToHost: WASI {
16931693 }
16941694
16951695 func fd_seek( fd: WASIAbi . Fd , offset: WASIAbi . FileDelta , whence: WASIAbi . Whence ) throws -> WASIAbi . FileSize {
1696- guard case let . file( fileEntry) = fdTable [ fd] else {
1696+ guard case . file( let fileEntry) = fdTable [ fd] else {
16971697 throw WASIAbi . Errno. EBADF
16981698 }
16991699 return try fileEntry. seek ( offset: offset, whence: whence)
17001700 }
17011701
17021702 func fd_sync( fd: WASIAbi . Fd ) throws {
1703- guard case let . file( fileEntry) = fdTable [ fd] else {
1703+ guard case . file( let fileEntry) = fdTable [ fd] else {
17041704 throw WASIAbi . Errno. EBADF
17051705 }
17061706 return try fileEntry. sync ( )
17071707 }
17081708
17091709 func fd_tell( fd: WASIAbi . Fd ) throws -> WASIAbi . FileSize {
1710- guard case let . file( fileEntry) = fdTable [ fd] else {
1710+ guard case . file( let fileEntry) = fdTable [ fd] else {
17111711 throw WASIAbi . Errno. EBADF
17121712 }
17131713 return try fileEntry. tell ( )
@@ -1717,14 +1717,14 @@ public class WASIBridgeToHost: WASI {
17171717 fileDescriptor: WASIAbi . Fd ,
17181718 ioVectors: UnsafeGuestBufferPointer < WASIAbi . IOVec >
17191719 ) throws -> UInt32 {
1720- guard case let . file( entry) = self . fdTable [ fileDescriptor] else {
1720+ guard case . file( let entry) = self . fdTable [ fileDescriptor] else {
17211721 throw WASIAbi . Errno. EBADF
17221722 }
17231723 return try entry. write ( vectored: ioVectors)
17241724 }
17251725
17261726 func path_create_directory( dirFd: WASIAbi . Fd , path: String ) throws {
1727- guard case let . directory( dirEntry) = fdTable [ dirFd] else {
1727+ guard case . directory( let dirEntry) = fdTable [ dirFd] else {
17281728 throw WASIAbi . Errno. ENOTDIR
17291729 }
17301730 try dirEntry. createDirectory ( atPath: path)
@@ -1733,7 +1733,7 @@ public class WASIBridgeToHost: WASI {
17331733 func path_filestat_get(
17341734 dirFd: WASIAbi . Fd , flags: WASIAbi . LookupFlags , path: String
17351735 ) throws -> WASIAbi . Filestat {
1736- guard case let . directory( dirEntry) = fdTable [ dirFd] else {
1736+ guard case . directory( let dirEntry) = fdTable [ dirFd] else {
17371737 throw WASIAbi . Errno. ENOTDIR
17381738 }
17391739 return try dirEntry. attributes (
@@ -1746,7 +1746,7 @@ public class WASIBridgeToHost: WASI {
17461746 path: String , atim: WASIAbi . Timestamp , mtim: WASIAbi . Timestamp ,
17471747 fstFlags: WASIAbi . FstFlags
17481748 ) throws {
1749- guard case let . directory( dirEntry) = fdTable [ dirFd] else {
1749+ guard case . directory( let dirEntry) = fdTable [ dirFd] else {
17501750 throw WASIAbi . Errno. ENOTDIR
17511751 }
17521752 try dirEntry. setFilestatTimes (
@@ -1775,7 +1775,7 @@ public class WASIBridgeToHost: WASI {
17751775 #if os(Windows)
17761776 throw WASIAbi . Errno. ENOTSUP
17771777 #else
1778- guard case let . directory( dirEntry) = fdTable [ dirFd] else {
1778+ guard case . directory( let dirEntry) = fdTable [ dirFd] else {
17791779 throw WASIAbi . Errno. ENOTDIR
17801780 }
17811781 var accessMode : FileAccessMode = [ ]
@@ -1814,7 +1814,7 @@ public class WASIBridgeToHost: WASI {
18141814 }
18151815
18161816 func path_remove_directory( dirFd: WASIAbi . Fd , path: String ) throws {
1817- guard case let . directory( dirEntry) = fdTable [ dirFd] else {
1817+ guard case . directory( let dirEntry) = fdTable [ dirFd] else {
18181818 throw WASIAbi . Errno. ENOTDIR
18191819 }
18201820 try dirEntry. removeDirectory ( atPath: path)
@@ -1824,24 +1824,24 @@ public class WASIBridgeToHost: WASI {
18241824 oldFd: WASIAbi . Fd , oldPath: String ,
18251825 newFd: WASIAbi . Fd , newPath: String
18261826 ) throws {
1827- guard case let . directory( oldDirEntry) = fdTable [ oldFd] else {
1827+ guard case . directory( let oldDirEntry) = fdTable [ oldFd] else {
18281828 throw WASIAbi . Errno. ENOTDIR
18291829 }
1830- guard case let . directory( newDirEntry) = fdTable [ newFd] else {
1830+ guard case . directory( let newDirEntry) = fdTable [ newFd] else {
18311831 throw WASIAbi . Errno. ENOTDIR
18321832 }
18331833 try oldDirEntry. rename ( from: oldPath, toDir: newDirEntry, to: newPath)
18341834 }
18351835
18361836 func path_symlink( oldPath: String , dirFd: WASIAbi . Fd , newPath: String ) throws {
1837- guard case let . directory( dirEntry) = fdTable [ dirFd] else {
1837+ guard case . directory( let dirEntry) = fdTable [ dirFd] else {
18381838 throw WASIAbi . Errno. ENOTDIR
18391839 }
18401840 try dirEntry. symlink ( from: oldPath, to: newPath)
18411841 }
18421842
18431843 func path_unlink_file( dirFd: WASIAbi . Fd , path: String ) throws {
1844- guard case let . directory( dirEntry) = fdTable [ dirFd] else {
1844+ guard case . directory( let dirEntry) = fdTable [ dirFd] else {
18451845 throw WASIAbi . Errno. ENOTDIR
18461846 }
18471847 try dirEntry. removeFile ( atPath: path)
0 commit comments