PatchAndCheck applies all patchers and checks the tree.
(tree *parser.Tree, config *conf.Config)
| 70 | |
| 71 | // PatchAndCheck applies all patchers and checks the tree. |
| 72 | func (v *Checker) PatchAndCheck(tree *parser.Tree, config *conf.Config) (reflect.Type, error) { |
| 73 | v.reset(config) |
| 74 | if len(config.Visitors) > 0 { |
| 75 | // Run all patchers that dont support being run repeatedly first |
| 76 | v.runVisitors(tree, false) |
| 77 | |
| 78 | // Run patchers that require multiple passes next (currently only Operator patching) |
| 79 | v.runVisitors(tree, true) |
| 80 | } |
| 81 | return v.Check(tree, config) |
| 82 | } |
| 83 | |
| 84 | // Check checks types of the expression tree. It returns type of the expression |
| 85 | // and error if any. If config is nil, then default configuration will be used. |