| 1360 | } |
| 1361 | |
| 1362 | func (e *encoder) stat(n semantic.Statement) (outID uint64) { |
| 1363 | e.build(&e.instances.Statement, e.maps.Statement, n, &outID, func() *Statement { |
| 1364 | p := &Statement{} |
| 1365 | switch n := n.(type) { |
| 1366 | case *semantic.Abort: |
| 1367 | p.Ty = &Statement_Abort{e.abort(n)} |
| 1368 | case *semantic.ArrayAssign: |
| 1369 | p.Ty = &Statement_ArrayAssign{e.arrayAssign(n)} |
| 1370 | case *semantic.Assert: |
| 1371 | p.Ty = &Statement_Assert{e.assert(n)} |
| 1372 | case *semantic.Assign: |
| 1373 | p.Ty = &Statement_Assign{e.assign(n)} |
| 1374 | case *semantic.Branch: |
| 1375 | p.Ty = &Statement_Branch{e.branch(n)} |
| 1376 | case *semantic.Call: |
| 1377 | p.Ty = &Statement_Call{e.call(n)} |
| 1378 | case *semantic.Copy: |
| 1379 | p.Ty = &Statement_Copy{e.copy(n)} |
| 1380 | case *semantic.DeclareLocal: |
| 1381 | p.Ty = &Statement_DeclareLocal{e.declareLocal(n)} |
| 1382 | case *semantic.Fence: |
| 1383 | p.Ty = &Statement_Fence{e.fence(n)} |
| 1384 | case *semantic.Iteration: |
| 1385 | p.Ty = &Statement_Iteration{e.iteration(n)} |
| 1386 | case *semantic.MapAssign: |
| 1387 | p.Ty = &Statement_MapAssign{e.mapAssign(n)} |
| 1388 | case *semantic.MapIteration: |
| 1389 | p.Ty = &Statement_MapIteration{e.mapIteration(n)} |
| 1390 | case *semantic.MapRemove: |
| 1391 | p.Ty = &Statement_MapRemove{e.mapRemove(n)} |
| 1392 | case *semantic.MapClear: |
| 1393 | p.Ty = &Statement_MapClear{e.mapClear(n)} |
| 1394 | case *semantic.Read: |
| 1395 | p.Ty = &Statement_Read{e.read(n)} |
| 1396 | case *semantic.Return: |
| 1397 | p.Ty = &Statement_Return{e.return_(n)} |
| 1398 | case *semantic.SliceAssign: |
| 1399 | p.Ty = &Statement_SliceAssign{e.sliceAssign(n)} |
| 1400 | case *semantic.Switch: |
| 1401 | p.Ty = &Statement_Switch{e.switch_(n)} |
| 1402 | case *semantic.Write: |
| 1403 | p.Ty = &Statement_Write{e.write(n)} |
| 1404 | default: |
| 1405 | panic(fmt.Errorf("Unhandled statement type %T", n)) |
| 1406 | } |
| 1407 | return p |
| 1408 | }) |
| 1409 | return |
| 1410 | } |
| 1411 | |
| 1412 | func (e *encoder) staticArray(n *semantic.StaticArray) (outID uint64) { |
| 1413 | e.build(&e.instances.StaticArray, e.maps.StaticArray, n, &outID, func() *StaticArray { |