Skip to content

Commit

Permalink
fix copyExpr with *syntax.ListExpr
Browse files Browse the repository at this point in the history
  • Loading branch information
xhd2015 committed Apr 1, 2024
1 parent 4375601 commit 27e25aa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/xgo/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import "fmt"

const VERSION = "1.0.11"
const REVISION = "b1b21571259df7c1632d86cef35ba681727a0cde+1"
const NUMBER = 143
const REVISION = "43756010e13cabfae008c1de9d72f98b946b0a09+1"
const NUMBER = 144

func getRevision() string {
return fmt.Sprintf("%s %s BUILD_%d", VERSION, REVISION, NUMBER)
Expand Down
12 changes: 12 additions & 0 deletions patch/syntax/rewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ func copyName(name *syntax.Name) *syntax.Name {
return &x
}

func copyExprs(exprs []syntax.Expr) []syntax.Expr {
copyExprs := make([]syntax.Expr, len(exprs))
for i, expr := range exprs {
copyExprs[i] = copyExpr(expr)
}
return copyExprs
}

func copyExpr(expr syntax.Expr) syntax.Expr {
if expr == nil {
return nil
Expand Down Expand Up @@ -421,6 +429,10 @@ func copyExpr(expr syntax.Expr) syntax.Expr {
x := *expr
x.MethodList = copyFields(expr.MethodList)
return &x
case *syntax.ListExpr:
x := *expr
x.ElemList = copyExprs(expr.ElemList)
return &x
default:
panic(fmt.Errorf("unrecognized expr while copying: %T", expr))
}
Expand Down
4 changes: 2 additions & 2 deletions runtime/core/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
)

const VERSION = "1.0.11"
const REVISION = "b1b21571259df7c1632d86cef35ba681727a0cde+1"
const NUMBER = 143
const REVISION = "43756010e13cabfae008c1de9d72f98b946b0a09+1"
const NUMBER = 144

// these fields will be filled by compiler
const XGO_VERSION = ""
Expand Down

0 comments on commit 27e25aa

Please sign in to comment.