NewProgram returns a new SSA Program. mode controls diagnostics and checking during SSA construction.
(mode BuilderMode)
| 20 | // mode controls diagnostics and checking during SSA construction. |
| 21 | // |
| 22 | func NewProgram(mode BuilderMode) *Program { |
| 23 | prog := &Program{ |
| 24 | imported: make(map[string]*SSAPackage), |
| 25 | packages: make(map[*Package]*SSAPackage), |
| 26 | thunks: make(map[selectionKey]*Function), |
| 27 | bounds: make(map[*Func]*Function), |
| 28 | mode: mode, |
| 29 | } |
| 30 | |
| 31 | h := MakeHasher() // protected by methodsMu, in effect |
| 32 | prog.methodSets.SetHasher(h) |
| 33 | prog.canon.SetHasher(h) |
| 34 | |
| 35 | return prog |
| 36 | } |
| 37 | |
| 38 | // memberFromObject populates package pkg with a member for the |
| 39 | // typechecker object obj. |
no test coverage detected