library: encoding/{binary, base64}
This commit is contained in:
@@ -291,6 +291,8 @@ Here are the Go packages that can be imported correctly:
|
||||
* [fmt](https://pkg.go.dev/fmt) (partially)
|
||||
* [reflect](https://pkg.go.dev/reflect) (partially)
|
||||
* [time](https://pkg.go.dev/time) (partially)
|
||||
* [encoding/binary](https://pkg.go.dev/encoding/binary)
|
||||
* [encoding/base64](https://pkg.go.dev/encoding/base64)
|
||||
* [regexp](https://pkg.go.dev/regexp)
|
||||
* [regexp/syntax](https://pkg.go.dev/regexp/syntax)
|
||||
|
||||
|
||||
18
_cmptest/base64demo/base64.go
Normal file
18
_cmptest/base64demo/base64.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
msg := "Hello, 世界"
|
||||
encoded := base64.StdEncoding.EncodeToString([]byte(msg))
|
||||
fmt.Println(encoded)
|
||||
decoded, err := base64.StdEncoding.DecodeString(encoded)
|
||||
if err != nil {
|
||||
fmt.Println("decode error:", err)
|
||||
return
|
||||
}
|
||||
fmt.Println(string(decoded))
|
||||
}
|
||||
@@ -699,6 +699,7 @@ func (b Builder) ChangeType(t Type, x Expr) (ret Expr) {
|
||||
case vkFuncDecl:
|
||||
ret.impl = checkExpr(x, t.raw.Type, b).impl
|
||||
case vkClosure:
|
||||
// TODO(xsw): change type should be a noop instruction
|
||||
convType := func() Expr {
|
||||
r := Expr{llvm.CreateAlloca(b.impl, t.ll), b.Prog.Pointer(t)}
|
||||
b.Store(r, x)
|
||||
|
||||
Reference in New Issue
Block a user