Appearance
| 1 | namespace Semantic.Types is | |
| 2 | ||
| 3 | use Source.LOCATION; | |
| 4 | ||
| 5 | class ARRAY: GENERIC is | |
| 6 | short_description: string => get_short_description(self); | |
| 7 | ||
| 8 | get_short_description(reference: GENERIC) -> string static => "{reference.arguments[0].to_string()}[]"; | |
| 9 | ||
| 10 | init( | |
| 11 | location: LOCATION, | |
| 12 | symbol: Symbols.Classy, | |
| 13 | arguments: Collections.List[Type] | |
| 14 | ) is | |
| 15 | super.init(Symbols.ARRAY(location, symbol, arguments[0])); | |
| 16 | si | |
| 17 | ||
| 18 | // Arrays are declared covariant; effective_argument_variance | |
| 19 | // downgrades this to invariant for a value-typed element, same | |
| 20 | // as it does for any other type's declared variance. | |
| 21 | get_argument_type_variance(index: int) -> TypeVariance => TypeVariance.COVARIANT; | |
| 22 | ||
| 23 | create( | |
| 24 | location: LOCATION, | |
| 25 | symbol: Symbols.Classy, | |
| 26 | arguments: Collections.List[Type] | |
| 27 | ) -> GENERIC => | |
| 28 | Types.ARRAY(location, symbol, arguments); | |
| 29 | ||
| 30 | gen_class_name(buffer: System.Text.StringBuilder) is | |
| 31 | gen_type(buffer); | |
| 32 | si | |
| 33 | ||
| 34 | gen_type(buffer: System.Text.StringBuilder) is | |
| 35 | arguments[0].gen_type(buffer); | |
| 36 | buffer.append("[] "); | |
| 37 | si | |
| 38 | ||
| 39 | to_string() -> string => get_short_description(self); | |
| 40 | si | |
| 41 | si |