Skip to content

Commit

Permalink
Merge pull request #36 from xypwn/main
Browse files Browse the repository at this point in the history
 update ryegen and go.mod
  • Loading branch information
refaktor authored Oct 9, 2024
2 parents 3257805 + 406f690 commit 9182832
Show file tree
Hide file tree
Showing 9 changed files with 42,287 additions and 49,032 deletions.
33 changes: 33 additions & 0 deletions current/fyne_io_fyne_v2/custom.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Add your custom builtins to this file.

package fyne_io_fyne_v2

import (
"strings"

"github.com/refaktor/rye/env"
)

var builtinsCustom = map[string]*env.Builtin{
"nil": {
Doc: "nil value for go types",
Fn: func(ps *env.ProgramState, arg0, arg1, arg2, arg3, arg4 env.Object) env.Object {
return *env.NewInteger(0)
},
},
"kind": {
Doc: "underlying kind of a go native",
Fn: func(ps *env.ProgramState, arg0, arg1, arg2, arg3, arg4 env.Object) env.Object {
nat, ok := arg0.(env.Native)
if !ok {
ps.FailureFlag = true
return env.NewError("kind: arg0: expected native")
}
s := ps.Idx.GetWord(nat.Kind.Index)
s = s[3 : len(s)-1] // remove surrounding "Go()"
s = strings.TrimPrefix(s, "*") // remove potential pointer "*"
return *env.NewString(s)
},
},
// Add your custom builtins here:
}
Loading

0 comments on commit 9182832

Please sign in to comment.