Skip to content
← Back

src/semantic/iterable_spelling.ghul

1
namespace Semantic is
2
// `T{}` is how `Collections.Iterable[T]` is written and shown, as
3
// `T[]` is for an array. This says whether a generic is the one
4
// spelled that way, by the reflected trait it is built on.
5
class ITERABLE_SPELLING is
6
applies_to(unspecialized: Symbols.Symbol, argument_count: int) -> bool static is
7
// Checked by name first: every generic rendered comes through
8
// here, and only the one named `Iterable` needs the lookup.
9
if argument_count != 1 \/ unspecialized.name !~ "Iterable" then
10
return false
11
fi
12
13
let iterable = IoC.CONTAINER.instance.innate_symbol_lookup.get_unspecialized_iterable_type()
14
15
if let iterable_trait = iterable.symbol?.root_unspecialized_symbol then
16
return iterable_trait == unspecialized.root_unspecialized_symbol
17
fi
18
19
return false
20
si
21
si
22
si