mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 12:32:05 +01:00
parent
6bdd686a29
commit
820c996329
@ -622,6 +622,10 @@ func (cs *compileState) assign(block *block, fname string, pos token.Pos, lhs, r
|
|||||||
}
|
}
|
||||||
|
|
||||||
if define {
|
if define {
|
||||||
|
if _, ok := e.(*ast.Ident); !ok {
|
||||||
|
cs.addError(pos, "non-name on the left side of :=")
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
name := e.(*ast.Ident).Name
|
name := e.(*ast.Ident).Name
|
||||||
if name != "_" {
|
if name != "_" {
|
||||||
for _, v := range block.vars {
|
for _, v := range block.vars {
|
||||||
|
@ -3835,13 +3835,25 @@ func Bar() int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue #2891
|
// Issue #2891, #2910
|
||||||
func TestSyntaxTailingUnaryOperator(t *testing.T) {
|
func TestSyntaxTailingUnaryOperator(t *testing.T) {
|
||||||
if _, err := compileToIR([]byte(`package main
|
if _, err := compileToIR([]byte(`package main
|
||||||
|
|
||||||
func Foo() {
|
func Foo() {
|
||||||
1 + x := vec2(2)
|
1 + x := vec2(2)
|
||||||
}
|
}
|
||||||
|
`)); err == nil {
|
||||||
|
t.Error("compileToIR must return an error but did not")
|
||||||
|
}
|
||||||
|
if _, err := compileToIR([]byte(`package main
|
||||||
|
|
||||||
|
func Foo() {
|
||||||
|
1 + x, y := Bar()
|
||||||
|
}
|
||||||
|
|
||||||
|
func Bar() (int, int) {
|
||||||
|
return 0, 0
|
||||||
|
}
|
||||||
`)); err == nil {
|
`)); err == nil {
|
||||||
t.Error("compileToIR must return an error but did not")
|
t.Error("compileToIR must return an error but did not")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user