mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 00:47:28 +01:00
Place some vars at the top of functions
This commit is contained in:
1 parent
87b8b44778
commit
bac74a830d
6 files changed
+15
-11
No files matched your search
@@ -462,7 +462,7 @@ func (q *checker) bcheckAssignment1(lhs *a.Expr, lTyp *a.TypeExpr, op t.ID, rhs
|
||||
}
|
||||
|
||||
rb := bounds{}
|
||||
if op == t.IDEq {
|
||||
if op == t.IDEq || op == t.IDEqQuestion {
|
||||
rb, err = q.bcheckExpr(rhs, 0)
|
||||
} else {
|
||||
rb, err = q.bcheckExprBinaryOp(op.BinaryForm(), lhs, rhs, 0)
|
||||
|
||||
+1
-1
@@ -313,7 +313,7 @@ func (q *checker) tcheckAssign(n *a.Assign) error {
|
||||
lTyp := lhs.MType()
|
||||
rTyp := rhs.MType()
|
||||
|
||||
if n.Operator() == t.IDEq {
|
||||
if op := n.Operator(); op == t.IDEq || op == t.IDEqQuestion {
|
||||
return q.tcheckEq(0, lhs, lTyp, rhs, rTyp)
|
||||
}
|
||||
|
||||
|
||||
@@ -645,9 +645,6 @@ func (p *parser) parseStatement1() (*a.Node, error) {
|
||||
|
||||
op := p.peek1()
|
||||
if op.IsAssign() {
|
||||
if op == t.IDEqQuestion {
|
||||
return nil, fmt.Errorf(`parse: TODO: support "=?" without "var" at %s:%d`, p.filename, p.line())
|
||||
}
|
||||
p.src = p.src[1:]
|
||||
lhs = rhs
|
||||
if lhs.Effect() != 0 {
|
||||
|
||||
Reference in new issue
Block a user