From fec722f925cf923ab2bfaac6aa3f2cce29801afa Mon Sep 17 00:00:00 2001 From: Guido Zuidhof Date: Sun, 21 Jul 2024 00:17:04 +0200 Subject: [PATCH] Map rune to number --- examples/rune/index.ts | 9 +++++++++ examples/rune/rune.go | 4 ++++ tygo.yaml | 1 + tygo/write.go | 3 ++- 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 examples/rune/index.ts create mode 100644 examples/rune/rune.go diff --git a/examples/rune/index.ts b/examples/rune/index.ts new file mode 100644 index 0000000..ad2336d --- /dev/null +++ b/examples/rune/index.ts @@ -0,0 +1,9 @@ +// Code generated by tygo. DO NOT EDIT. + +////////// +// source: rune.go + +/** + * Should be a number in TypeScript. + */ +export type MyRune = number /* rune */; diff --git a/examples/rune/rune.go b/examples/rune/rune.go new file mode 100644 index 0000000..a04f6a4 --- /dev/null +++ b/examples/rune/rune.go @@ -0,0 +1,4 @@ +package rune + +// Should be a number in TypeScript. +type MyRune rune diff --git a/tygo.yaml b/tygo.yaml index b14c1d5..4f5455d 100644 --- a/tygo.yaml +++ b/tygo.yaml @@ -53,5 +53,6 @@ packages: - path: "github.com/gzuidhof/tygo/examples/emit" exclude_files: - "excluded.go" + - path: "github.com/gzuidhof/tygo/examples/rune" diff --git a/tygo/write.go b/tygo/write.go index 6dc6a42..3caf4f2 100644 --- a/tygo/write.go +++ b/tygo/write.go @@ -43,7 +43,8 @@ func getIdent(s string) string { case "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64", "float32", "float64", - "complex64", "complex128": + "complex64", "complex128", + "rune": return "number /* " + s + " */" } return s