-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.chestnut
146 lines (106 loc) · 1.94 KB
/
code.chestnut
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
class Tuple<A, B> {}
class GridPiece {}
class Array<T> {}
/*
void print_position(Tuple<i32[]&, i32?>[3]?& position) pure {}
void print_grid(GridPiece&[3][4]?[] pieces) {}
*/
void silly() {
}
void set_error_callback() {
}
export void set_element() mut {
}
void takes_in_function<T>() {
}
// i128 proxy(i128() x) {
// return x();
// }
class Node<T> {
Node<T>& neXt;
public T value;
unsafe {
cpp "/* he he i am silly cpp */";
}
public void traverse() {
let x = 9;
}
public void set() mut {
}
}
T add<T, T>(T a, T b) pure => a + b;
i32 do_thing(i32 only_arg) {
// let u = proxy(() => 2);
let a = only_arg;
let b = 10;
let c = a + b;
let d = a * c;
let e = a + b + c + d + 1 + 2 + 3 + 4 + 5;
return e;
}
void test() {
_& x;
u32& y = x;
}
i128 lets_return_a_reference() {
_ x;
return x;
}
T dbg<T>(T item) {
unsafe {
cpp "std::cout << Chn_item << std::endl;";
}
return item;
}
Node<T> sam<T, U>(T x, U y) {
}
T extract<T>(Node<T> x) {
}
i32 get_an_int() => 5;
T get_back<T>(T value) => value;
void get_an_int_test() {
let get_an_int_test_variable = get_an_int();
let get_back_test_variable = get_back("hi");
}
void main() {
takes_in_function<void(void())>();
// print_position(3);
// let _ = do_thing();
mut char t;
/*unsafe {
t = 10;
}*/
t = t;
mut i32 d;
// d.value;
// TODO: infer these int types
u16 x = 2u16 + (3u16 - 4u16);
_ iw;
iw = add(x, x);
let long_name_so_i_can_find_it_in_the_debugger = add<_, u64>(x, x);
mut a = 3 + 5 + (2 - 3) * -9 + 4/2;
a += 10;
a *= 9 + 10;
Node bob = sam(3, 4);
let boom = extract(bob);
Node<_> u;
Tuple<_> not_enough;
Tuple<_, _, _> too_many;
let cvxjnk = dbg(-10);
4+2+4;
.3u + (0xDead_Beefu - 2iz) - 7u32 * 0b1010_1001i128 / 0o7f;
bool Q;
bool X;
Q &&= X;
mut r = 10;
let aa = 'a';
// 3 + a(); -> error
void goofy_void() {
}
let b = 'b';
let cc = 'c';
_ variable;
Node variablee;
// a + b(); -> error
// (string err) => print(err);
}