Commit 73cb42d
authored
Refactor checker to use Nature (#665)
This PR introduces a new concept inside Expr's type checker - Nature.
It's an abstraction other reflect.Type which carries additional information about possible type, methods and builtin function.
I was able to find and fix a few bugs in type checker and optimizer. Implementation of nature concept has proven itself. As well nature will allow to bring more feature for type checker in future.
Why Nature? I was looking for a name to replace Type. Type name already carries much information, as well can be confused with reflect.Type. Nature name should be understood as "nature of the node", same as "type of the node".1 parent 7e6e6f5 commit 73cb42d
File tree
28 files changed
+1218
-901
lines changed- ast
- builtin
- checker
- nature
- compiler
- optimizer
- testdata
- test/fuzz
28 files changed
+1218
-901
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
| |||
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
28 | | - | |
29 | | - | |
| 36 | + | |
| 37 | + | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
| |||
39 | 47 | | |
40 | 48 | | |
41 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
42 | 69 | | |
43 | 70 | | |
44 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
45 | 75 | | |
46 | 76 | | |
47 | 77 | | |
48 | 78 | | |
49 | | - | |
| 79 | + | |
50 | 80 | | |
51 | 81 | | |
52 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| |||
0 commit comments