base.Timer.Start("fe", "parse")
mode := syntax.CheckBranches
+ if base.Flag.G != 0 {
+ mode |= syntax.AllowGenerics
+ }
// Limit the number of simultaneously open files.
sem := make(chan struct{}, runtime.GOMAXPROCS(0)+10)
for e := range p.err {
p.errorAt(e.Pos, "%s", e.Msg)
}
- lines += p.file.Lines
+ lines += p.file.EOF.Line()
}
base.Timer.AddEvent(int64(lines), "lines")
+ if base.Flag.G != 0 {
+ // Use types2 to type-check and possibly generate IR.
+ check2(noders)
+ return
+ }
+
for _, p := range noders {
p.node()
p.file = nil // release memory
case *syntax.DeclStmt:
return ir.NewBlockStmt(src.NoXPos, p.decls(stmt.DeclList))
case *syntax.AssignStmt:
- if stmt.Rhs == syntax.ImplicitOne {
- one := constant.MakeInt64(1)
+ if stmt.Rhs == nil {
pos := p.pos(stmt)
n := ir.NewAssignOpStmt(pos, p.binOp(stmt.Op), p.expr(stmt.Lhs), ir.NewBasicLit(pos, one))
n.IncDec = true