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

support generic #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ $ make build

- [yuroyoro](https://github.com/yuroyoro)
- [paulvollmer](https://github.com/paulvollmer)
- [caixw](https://github.com/caixw)
4 changes: 2 additions & 2 deletions ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func Parse(filename string, source string) (a *Ast, dump string, err error) {
return a, string(bf.Bytes()), nil
}

func BuildAst(prefix string, n interface{}) (astobj *Ast, err error) {
func BuildAst(prefix string, n any) (astobj *Ast, err error) {
v := reflect.ValueOf(n)
t := v.Type()

Expand Down Expand Up @@ -128,7 +128,7 @@ func BuildAst(prefix string, n interface{}) (astobj *Ast, err error) {
return &a, nil
}

func Label(prefix string, n interface{}) string {
func Label(prefix string, n any) string {

var bf bytes.Buffer

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/yuroyoro/goast-viewer

go 1.12
go 1.21
2 changes: 1 addition & 1 deletion goast.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func main() {\n\
}

$scope.parse = function() {
window.global.source = $scope.source
window.source = $scope.source
run()
let data = JSON.parse(output);
$scope.asts = [data.ast];
Expand Down
Binary file modified lib.wasm
Binary file not shown.