Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stdlibs): add encoding, encoding/{base32,binary,csv} #1290

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a58c9e0
feat: add encoding stdlib
notJoon Oct 25, 2023
a96c6ff
csv and varint
notJoon Oct 25, 2023
8a33d7f
create base32 and tests
notJoon Oct 26, 2023
7415d31
remove `fallthrough`
notJoon Oct 26, 2023
6a4d328
rewrite test for `varint`
notJoon Oct 27, 2023
7355668
update test and add some en/decode cases
notJoon Oct 31, 2023
1de0a69
porting base32 fin
notJoon Oct 31, 2023
febc76f
fix
notJoon Nov 12, 2023
ed78d3d
fix test
notJoon Nov 12, 2023
5d55e29
specifying package scope
notJoon Nov 12, 2023
e863269
type
notJoon Nov 12, 2023
d1ff5f1
another typo
notJoon Nov 12, 2023
de17d0e
nopadding
notJoon Nov 12, 2023
7b8c192
fix
notJoon Nov 12, 2023
eef4d2c
fix
notJoon Nov 12, 2023
62bb9c4
wip
notJoon Nov 12, 2023
62b297c
remove reflect on csv test
notJoon Nov 12, 2023
d69298a
fix
notJoon Nov 12, 2023
6abba1a
fix
notJoon Nov 13, 2023
97aa8a0
fix
notJoon Nov 13, 2023
30325f6
add simple reader test
notJoon Nov 13, 2023
0b63206
fmt
notJoon Nov 13, 2023
7ea23dc
Merge branch 'master' into add-encoding
notJoon Nov 13, 2023
ef756d6
package bufio -> bufio_test
thehowl Nov 16, 2023
d861226
fixes to pkg base32
thehowl Nov 16, 2023
ae61fca
rollback some changes
thehowl Nov 16, 2023
8b61830
revert chagnes in varint
thehowl Nov 16, 2023
bac1c37
csv fix-up
thehowl Nov 16, 2023
8efeb0d
fmt
thehowl Nov 16, 2023
2080c5d
Merge branch 'master' of github.com:gnolang/gno into add-encoding
thehowl Dec 8, 2024
a93e4c0
attempt reverting base32 to old state; side-quested on different issue
thehowl Dec 8, 2024
abddb96
fix(gnolang): use strconv.UnquoteChar to parse rune literals
thehowl Dec 8, 2024
25687c8
Merge branch 'dev/morgan/no-strconv-unquote' into add-encoding
thehowl Dec 8, 2024
f2ff51f
fixup
thehowl Dec 8, 2024
1fb863e
fix(gnovm): in op_binary, return typed booleans where appropriate
thehowl Dec 8, 2024
e92c78c
Merge branch 'dev/morgan/runtime-typed-bools' into add-encoding
thehowl Dec 8, 2024
183a1c1
fixup
thehowl Dec 8, 2024
9c28fbe
fmt
thehowl Dec 8, 2024
49a90df
update generated.go
thehowl Dec 8, 2024
fd5565d
Merge branch 'master' into add-encoding
thehowl Dec 8, 2024
0b20f19
Merge branch 'master' into add-encoding
thehowl Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions gnovm/pkg/gnolang/op_binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ func (m *Machine) doOpLand() {
lv.SetBool(lv.GetBool() && rv.GetBool())
}

// setMaybeUntypedBool sets lv to b; it will be untyped if both lv and rv are
// untyped; otherwise, it will be a typed bool.
func setMaybeUntypedBool(lv, rv *TypedValue, b bool) {
tp := BoolType
if isUntyped(lv.T) && isUntyped(rv.T) {
tp = UntypedBoolType
}
lv.T, lv.V = tp, nil
lv.SetBool(b)
}

func (m *Machine) doOpEql() {
m.PopExpr()

Expand All @@ -82,9 +93,7 @@ func (m *Machine) doOpEql() {
}
// set result in lv.
res := isEql(m.Store, lv, rv)
lv.T = UntypedBoolType
lv.V = nil
lv.SetBool(res)
setMaybeUntypedBool(lv, rv, res)
}

func (m *Machine) doOpNeq() {
Expand All @@ -99,9 +108,7 @@ func (m *Machine) doOpNeq() {

// set result in lv.
res := !isEql(m.Store, lv, rv)
lv.T = UntypedBoolType
lv.V = nil
lv.SetBool(res)
setMaybeUntypedBool(lv, rv, res)
}

func (m *Machine) doOpLss() {
Expand All @@ -116,9 +123,7 @@ func (m *Machine) doOpLss() {

// set the result in lv.
res := isLss(lv, rv)
lv.T = UntypedBoolType
lv.V = nil
lv.SetBool(res)
setMaybeUntypedBool(lv, rv, res)
}

func (m *Machine) doOpLeq() {
Expand All @@ -133,9 +138,7 @@ func (m *Machine) doOpLeq() {

// set the result in lv.
res := isLeq(lv, rv)
lv.T = UntypedBoolType
lv.V = nil
lv.SetBool(res)
setMaybeUntypedBool(lv, rv, res)
}

func (m *Machine) doOpGtr() {
Expand All @@ -150,9 +153,7 @@ func (m *Machine) doOpGtr() {

// set the result in lv.
res := isGtr(lv, rv)
lv.T = UntypedBoolType
lv.V = nil
lv.SetBool(res)
setMaybeUntypedBool(lv, rv, res)
}

func (m *Machine) doOpGeq() {
Expand All @@ -167,9 +168,7 @@ func (m *Machine) doOpGeq() {

// set the result in lv.
res := isGeq(lv, rv)
lv.T = UntypedBoolType
lv.V = nil
lv.SetBool(res)
setMaybeUntypedBool(lv, rv, res)
}

func (m *Machine) doOpAdd() {
Expand Down
Loading
Loading