mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +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 _, ok := e.(*ast.Ident); !ok {
|
||||
cs.addError(pos, "non-name on the left side of :=")
|
||||
return nil, false
|
||||
}
|
||||
name := e.(*ast.Ident).Name
|
||||
if name != "_" {
|
||||
for _, v := range block.vars {
|
||||
|
@ -3835,13 +3835,25 @@ func Bar() int {
|
||||
}
|
||||
}
|
||||
|
||||
// Issue #2891
|
||||
// Issue #2891, #2910
|
||||
func TestSyntaxTailingUnaryOperator(t *testing.T) {
|
||||
if _, err := compileToIR([]byte(`package main
|
||||
|
||||
func Foo() {
|
||||
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 {
|
||||
t.Error("compileToIR must return an error but did not")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user