forked from gnolang/gno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stdlibs): add package
strconv
(gnolang#1464)
This PR adds the full `strconv` package, implemented as pure Gno code. It removes the native functions `Itoa` (and others), and adds support for new functions such as `FormatFloat`. # Summary of changes - Standard libraries - Changes of `strconv` from Go stdlib: https://gist.github.com/thehowl/904b42b1ea53fef9b8a0486155c02b73 -- tldr: - removed everything related to complex types. - avoid using reflection and dot imports. - instead of loading testfp.txt, embed the file directly into the source. - define min/max explicitly as they're not built-in yet. - remove go:build tags. - (all of these mostly involve test files.) - `unicode` - Update tables, so that `strconv` tests succeed. - `unicode/utf8` - Update to latest go version. Mostly, use `fallback` (as we now half-support it) and use `AppendString`. - GnoVM - PackageInjector is no longer necessary (hallelujah), see gnolang#814 for context. This justifies the changes in `store.go`, `store_test.go`, `nodes.go`, `tests/imports.go`. - `gonative.go` and `machine.go` changes improve some error messages. - `preprocess.go` changes fix a bug which can be seen in the `for20.gno` test. If a `for` loop is labeled, then a bare `break` (ie. without a label to break to) would panic, as it wouldn't find any for loop without a label (in `findBranchLabel`). I added a regression test as well as a couple test showing the error message for when we misplace continue/break statements. - Tests. - `strconv.Itoa` now uses more gas than its existing native implementation. This is to be expected; we can consider moving it back to a native implementation if we deem it useful for performance, but I think it's good for us to work on having as much code implemented directly in gno before moving it back to Go for performance. --------- Co-authored-by: Manfred Touron <[email protected]>
- Loading branch information
Showing
56 changed files
with
9,703 additions
and
750 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
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
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
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
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
Oops, something went wrong.