Skip to content
← Back

src/ir/values/assert_support.ghul

1
namespace IR.Values is
2
use Semantic.Types.Type
3
4
// The two framework members `assert` reaches for. Neither is named
5
// by a symbol in this compilation, so each is a value of its own
6
// rather than a call the resolver produced.
7
class CALL_STRING_CONCAT: Value is
8
init() is
9
super.init()
10
si
11
12
gen(context: IR.CONTEXT) is
13
let body = context.current_srm_body_emitter!
14
body.call(context.resolve_string_concat())
15
si
16
17
to_string() -> string => "call-string-concat"
18
si
19
20
// `=~` and `!~` on two strings. Named by no symbol in this
21
// compilation for the same reason CALL_STRING_CONCAT is not: the
22
// innate operation stands in for the member rather than resolving
23
// it.
24
class CALL_STRING_EQUALITY: Value is
25
init() is
26
super.init()
27
si
28
29
gen(context: IR.CONTEXT) is
30
let body = context.current_srm_body_emitter!
31
body.call(context.resolve_string_equality())
32
si
33
34
to_string() -> string => "call-string-equality"
35
si
36
37
class NEW_NOT_IMPLEMENTED_EXCEPTION: Value is
38
init() is
39
super.init()
40
si
41
42
gen(context: IR.CONTEXT) is
43
let body = context.current_srm_body_emitter!
44
45
body.new_object(context.resolve_not_implemented_constructor())
46
si
47
48
to_string() -> string => "new-not-implemented-exception"
49
si
50
51
class NEW_NOT_SUPPORTED_EXCEPTION: Value is
52
init() is
53
super.init()
54
si
55
56
gen(context: IR.CONTEXT) is
57
let body = context.current_srm_body_emitter!
58
59
body.new_object(context.resolve_not_supported_constructor())
60
si
61
62
to_string() -> string => "new-not-supported-exception"
63
si
64
65
class NEW_ASSERT_FAILED_EXCEPTION: Value is
66
init() is
67
super.init()
68
si
69
70
gen(context: IR.CONTEXT) is
71
let body = context.current_srm_body_emitter!
72
body.new_object(context.resolve_assert_failed_constructor())
73
si
74
75
to_string() -> string => "new-assert-failed-exception"
76
si
77
si