mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
shader: Better error message
This commit is contained in:
parent
380b7382ac
commit
fb63df48ae
@ -18,6 +18,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"go/ast"
|
"go/ast"
|
||||||
"go/token"
|
"go/token"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/internal/shaderir"
|
"github.com/hajimehoshi/ebiten/internal/shaderir"
|
||||||
)
|
)
|
||||||
@ -117,7 +118,11 @@ func (cs *compileState) parseStmt(block *block, stmt ast.Stmt, inParams []variab
|
|||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
if len(ts) != 1 || ts[0].Main != shaderir.Bool {
|
if len(ts) != 1 || ts[0].Main != shaderir.Bool {
|
||||||
cs.addError(stmt.Pos(), fmt.Sprintf("if-condition must be bool but: %#v", ts))
|
var tss []string
|
||||||
|
for _, t := range ts {
|
||||||
|
tss = append(tss, t.String())
|
||||||
|
}
|
||||||
|
cs.addError(stmt.Pos(), fmt.Sprintf("if-condition must be bool but: %s", strings.Join(tss, ", ")))
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
stmts = append(stmts, ss...)
|
stmts = append(stmts, ss...)
|
||||||
|
Loading…
Reference in New Issue
Block a user