Appearance
| 1 | namespace Semantic.Types is | |
| 2 | use Source.LOCATION; | |
| 3 | ||
| 4 | use Ghul.Pipes; | |
| 5 | ||
| 6 | class ACTION: GENERIC is | |
| 7 | is_action: bool => true; | |
| 8 | is_function: bool => true; | |
| 9 | ||
| 10 | short_description: string => get_short_description(self); | |
| 11 | ||
| 12 | get_short_description(action: GENERIC) -> string static is | |
| 13 | let result = System.Text.StringBuilder(); | |
| 14 | ||
| 15 | let args = action.arguments; | |
| 16 | ||
| 17 | if args.count == 1 then | |
| 18 | result | |
| 19 | .append(args[0]) | |
| 20 | .append(" -> void"); | |
| 21 | else | |
| 22 | result.append('('); | |
| 23 | ||
| 24 | (0..args.count) |> map(i => args[i]) |> append_to(result); | |
| 25 | ||
| 26 | result.append(") -> void"); | |
| 27 | fi | |
| 28 | ||
| 29 | return result.to_string(); | |
| 30 | si | |
| 31 | ||
| 32 | init( | |
| 33 | location: LOCATION, | |
| 34 | symbol: Symbols.Classy, | |
| 35 | arguments: Collections.List[Type] | |
| 36 | ) is | |
| 37 | super.init(location, symbol, arguments); | |
| 38 | si | |
| 39 | ||
| 40 | get_argument_type_variance(index: int) -> TypeVariance => TypeVariance.CONTRAVARIANT; | |
| 41 | ||
| 42 | create( | |
| 43 | location: LOCATION, | |
| 44 | symbol: Symbols.Classy, | |
| 45 | arguments: Collections.List[Type] | |
| 46 | ) -> GENERIC => | |
| 47 | ACTION(location, symbol, arguments); | |
| 48 | ||
| 49 | to_string() -> string => get_short_description(self); | |
| 50 | si | |
| 51 | si |