forked from roc-lang/roc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlow_level.rs
More file actions
105 lines (99 loc) · 1.85 KB
/
low_level.rs
File metadata and controls
105 lines (99 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
use roc_module::symbol::Symbol;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HigherOrder {
ListSortWith { xs: Symbol },
}
impl HigherOrder {
pub fn function_arity(&self) -> usize {
match self {
HigherOrder::ListSortWith { .. } => 2,
}
}
/// Index in the array of arguments of the symbol that is the closure data
/// (captured environment for this function)
pub const fn closure_data_index(&self) -> usize {
use HigherOrder::*;
match self {
ListSortWith { .. } => 2,
}
}
/// Index of the function symbol in the argument list
pub const fn function_index(&self) -> usize {
self.closure_data_index() - 1
}
}
#[allow(dead_code)]
enum FirstOrder {
StrConcat,
StrJoinWith,
StrIsEmpty,
StrStartsWith,
StrEndsWith,
StrSplit,
StrFromInt,
StrFromUtf8,
StrFromUtf8Range,
StrToUtf8,
StrRepeat,
StrFromFloat,
ListLenU64,
ListLenUsize,
ListGetUnsafe,
ListSublist,
ListDropAt,
ListConcat,
ListAppend,
ListPrepend,
ListSwap,
NumAdd,
NumAddWrap,
NumAddChecked,
NumSub,
NumSubWrap,
NumSubChecked,
NumMul,
NumMulWrap,
NumMulSaturated,
NumMulChecked,
NumGt,
NumGte,
NumLt,
NumLte,
NumCompare,
NumDivUnchecked,
NumRemUnchecked,
NumIsMultipleOf,
NumAbs,
NumNeg,
NumSin,
NumCos,
NumTan,
NumSqrtUnchecked,
NumLogUnchecked,
NumRound,
NumToFrac,
NumPow,
NumCeiling,
NumPowInt,
NumFloor,
NumIsNan,
NumIsInfinite,
NumIsFinite,
NumAtan,
NumAcos,
NumAsin,
NumBitwiseAnd,
NumBitwiseXor,
NumBitwiseOr,
NumShiftLeftBy,
NumShiftRightBy,
NumShiftRightZfBy,
NumIntCast,
NumFloatCast,
Eq,
NotEq,
And,
Or,
Not,
Hash,
}