-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from xypwn/main
update ryegen and go.mod
- Loading branch information
Showing
9 changed files
with
42,287 additions
and
49,032 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
} |
Oops, something went wrong.