runSet executes the DSL for all expressions in the given set. The expression DSLs may append to the set as they execute.
(set ExpressionSet)
| 188 | // runSet executes the DSL for all expressions in the given set. The expression |
| 189 | // DSLs may append to the set as they execute. |
| 190 | func runSet(set ExpressionSet) { |
| 191 | executed := 0 |
| 192 | recursed := 0 |
| 193 | for executed < len(set) { |
| 194 | recursed++ |
| 195 | for _, def := range set[executed:] { |
| 196 | executed++ |
| 197 | if def == nil { |
| 198 | continue |
| 199 | } |
| 200 | if source, ok := def.(Source); ok { |
| 201 | Execute(source.DSL(), def) |
| 202 | } |
| 203 | } |
| 204 | if recursed > 100 { |
| 205 | Context.Record(&Error{GoError: fmt.Errorf("too many generated expressions, infinite loop?")}) |
| 206 | return |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | // prepareSet runs the pre validation steps on all the set expressions that |
| 212 | // define one. |