Generate C code for "a[i] = x".

This commit is contained in:
Nigel Tao committed 2017-06-09 18:00:33 +10:00
1 parent f5af981f15
commit 587bc2a55d
5 files changed
+69 -7

No files matched your search

+10 -2
View File
@@ -997,8 +997,16 @@ func (g *gen) writeExprOther(n *a.Expr, rp replacementPolicy, depth uint32) erro
// TODO.
case t.KeyOpenBracket:
// n is an index.
// TODO.
// n is an index.
if err := g.writeExpr(n.LHS().Expr(), rp, parenthesesMandatory, depth); err != nil {
return err
}
g.writeb('[')
if err := g.writeExpr(n.RHS().Expr(), rp, parenthesesOptional, depth); err != nil {
return err
}
g.writeb(']')
return nil
case t.KeyColon:
// n is a slice.