mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 08:54:53 +00:00
@@ -54,5 +54,33 @@ template main() =
|
||||
doAssert c == "foo"
|
||||
|
||||
|
||||
when not defined(js):
|
||||
block: # bug #19698
|
||||
type
|
||||
FormatInfo = object
|
||||
readproc: ReadProc
|
||||
writeproc: WriteProc
|
||||
|
||||
ReadProc = proc (s: pointer)
|
||||
WriteProc = proc (s: pointer)
|
||||
|
||||
func initFormatInfo(readproc: ReadProc, writeproc: WriteProc = nil): FormatInfo {.compileTime.} =
|
||||
result = FormatInfo(readproc: readproc, writeproc: nil)
|
||||
|
||||
proc readSampleImage(s: pointer) = discard
|
||||
|
||||
const SampleFormatInfo = initFormatInfo(readproc = readSampleImage)
|
||||
|
||||
const KnownFormats = [SampleFormatInfo]
|
||||
|
||||
func sortedFormatInfos(): array[len KnownFormats, FormatInfo] {.compileTime.} =
|
||||
result = default(array[len KnownFormats, FormatInfo])
|
||||
for i, info in KnownFormats:
|
||||
result[i] = info
|
||||
|
||||
const SortedFormats = sortedFormatInfos()
|
||||
|
||||
discard SortedFormats
|
||||
|
||||
static: main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user