Appearance
| 1 | namespace Semantic.DotNet is | |
| 2 | use Collections.Iterable | |
| 3 | use Collections.LIST | |
| 4 | ||
| 5 | use Ghul.Pipes | |
| 6 | ||
| 7 | // Which assemblies a compile imports. Naming any assembly outright | |
| 8 | // names the whole set, so nothing is discovered; naming none leaves | |
| 9 | // the discovered default in force. Assemblies named as additional are | |
| 10 | // imported as well as whichever of the two that was. | |
| 11 | class REFERENCE_SET is | |
| 12 | resolve( | |
| 13 | named: Iterable[string]?, | |
| 14 | additional: Iterable[string], | |
| 15 | discover: () -> Iterable[string] | |
| 16 | ) -> LIST[string] static is | |
| 17 | let result = LIST[string]() | |
| 18 | ||
| 19 | if named? /\ named |> count() > 0 then | |
| 20 | result.add_range(named) | |
| 21 | else | |
| 22 | result.add_range(discover()) | |
| 23 | fi | |
| 24 | ||
| 25 | for path in additional do | |
| 26 | if !result.contains(path) then | |
| 27 | result.add(path) | |
| 28 | fi | |
| 29 | od | |
| 30 | ||
| 31 | return result | |
| 32 | si | |
| 33 | si | |
| 34 | si |