-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTODO
More file actions
190 lines (149 loc) · 9.64 KB
/
TODO
File metadata and controls
190 lines (149 loc) · 9.64 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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
* i am giving up on the "compile every fn node whenever you see it" because there's too much that we need
to keep in scope to reasonably do this, and compiling a function without it's associated scope is a huge
pain.
* should eventually verify that functions, methods etc are returning empty exprs, but nonempty function arrays
* somehow proxy or something the functions expression, so that i can check if they're ever used, and error
if they arent.
* should sweep the code for S.Const(0) and make sure that i cant just return a null expr instead.
* variables is still scope related. is that what i want? not sure...
* ExpressionStatements are the ones that need to return null. i should probably use enums
so that weird cases like this are easier to search for.
and declare let x = stupid also returns null.
* binary expression "x = 5" - shouldnt i be evaluating x? e.g. if x is actually array[1] = 5;.
* im creating an arrow function node twice.
* I need to handle this as a type parameter. yikes!
* when i finish all this function craziness, i should do a similar sort of thing for classes.
* then remove activeScope parameter of Functions.
* can i get a better type return for getParentTypeOfMethod
* merge it with GetMethodTypeInfo?
* things that would make my debugging life easier:
* the frustrating thing is it still COMPILES the whole program, and the bug is often in the compilation step.
* the proper way to do this is probably to separate out into individual jest functions. im worried it would be slow, tho
* ACTUAL stack traces. So I can tell when i have a mem access exception.
* i should be able to generate S.Call from a Function. - see elementaccess
* Before I do any serious object literals, I need Array<T> to handle T = String. Somehow.
Hmm. I would need to scan the entire code base to find Array<T> and duplicate the templated
code for every value of T.
* in function.ts, im hacking a fq name by appending __string or whatever.
* instead of properties.get() which looks up a method by hunting down the class, i should
be able to go directly from a symbol to a method. then i could rewrite methods so they could
figure out their type parameters without a ton of hacking.
* function and method code is really similar:
* in scopes/functions
* in parser/(function|method)
* this basically means i need to abstract over tstypes and create my own - since i'm going to
have to invent types for every T. Oh well, it was bound to happen eventually.
* remove check if its a type parameter in parameter.ts after this happens.
and scope.ts
* in callexpression, construct an actual type rather than a string.
* clear out T after we use it in call expression, so it doesn't linger around.
* use valueDeclaration, not declarations.
* object literals
* We need to do deduping of object literal types:
* Typescript will accept { b: number, a: number } and { a: number, b: number } to be passed
into the same function, even though we treat those as distinct types.
* handle for...in
* does it bother you that object literal code is scattered between
objectliteralexpression and propertyaccess? it bothers me.
* storing scopes... AT ALL... is kind of a dumb idea. there's no need, since TS does all the scope validation
you could ever want, and the TS api lets you look up any type's declaration and get whatever you need!!!
* probably a better approach would just be to have a generic "type schema" deliverer that would produce or fetch type
schemas on the fly given a specific symbol or type...
* objects with index signatures...
* handle i64 - note that this will require arrays to double their elem size.
* doesn't ImportSpecifiers if statement cascade look weird? Its because there shuold be a generic handler guy who
puts stuff into scopes - it shouldn't be scattered all around the code.
* i've been doing everything wrong - should be checking type with symbol.flags
* now that i can pull fqname off types, do i really need name in the function struct?
* dont handle the case where two classes with the same name are defined in two separate modules.
* what happens when a function fqname clashes with another name eg i have a variable named StringInternal__indexOf or something?
* I'm beginning to think that even constructing and sharing a TableId is a bad idea because we probably have
enough information from the typechecker to get something unique. i mean, we could get line and character number. that
itself is more than enough...
* importing variables is hard because it leads to cyclical references...
* modules
* is functions.getAll even necessary?
* S.Func should just take a Function.
* we will have to generate some sort of unique identifier for each file, which we can use as a module name.
* for things like "import "fs"", will have to generate a wrapper output file
which appropriately hooks stuff up.
* going to need to make relative and absolute paths the same and parse out any redundant paths.
* shuold be doing path normalization higher up
* if i want to write log() correctly i basically have to handle union types, which seems hard
* functions can return [] and it's pretty FREAKING annoying
* calls to malloc should find the ACTUAL name of malloc. somehow.
* use llvm instead?
* Fat arrow / function / method declarations share a lot of common code.
* Remove Sx
* remove wasmType from variables
* functions and fat arrows are not compiling BSBlocks correctly. They should just .compile() the block rather than doing...the...thing.
* call expression double evaluates a in a.b();. Should probably ensure that this doesn't cause any issues
or, more ideally, just cache it...
* unify the 3 separate methods for compiling functions - and probably name them something else other than compile().
* functions should pass in Function into S.Func
* They should also pass in the appropriate (wasm) return value
* print arrays correctly (log pls)
* i think there may be a large bug with strings where i always write mem in 4 byte chunks, meaning writing at the final char would overwrite the
next thing in memory.
* cant have two for loops in scope with the same name lol. i think the i should be scoped INSIDE the for loop ??????
* come to think of it, even if has its own scope.
* merge the logic in callexpression to get the function type name with the logic in function to create a function type name.
* proprety and function look up e.g. in properties.ts should be done by a class key rather than a filter.
* need some sort of debug flag to keep debug information
* position in stack
* names of functions (or even variables).
* have some sort of sexpr option for newlines at end of sexprs.
* Sexprs can be better created if i use some sort of function overloading syntax such that S("add") automagically
figures out the right arguments (and return type!).
* log:
* get correct file name.
* i should handle functions returning void rather than just saying everything returns an i32 lol (in functions.ts)
* move everything in functions towards getting functions by identifier
* looks like we're generating string_temp when we shouldnt be
* callexpression ALWAYS uses the function table. however it's pretty easy not to when we have identifiers.
* should work out what left hand side expression is. see: decorator.ts
* Remove the string-specific array handling in elementaccess.ts
* BuiltInArrays need to be generic.
* elementAccess needs to calculate the element size offset propertly rather than defaulting to 4.
* better error handling
* offset() could also indicate arrays.
* the initial pass to add functions to the file is now entirely unnecessary
* Figure out some way to write Sexprs better.
* vscode integration
* figure out a way to inline constructors
* I'm beginning to have a good idea of how to do this. The only "hard" part is parsing the string/array literal. the
rest i can write code for. So I should just have a couple of builtins for the literals, and then use a constructor like
normal.
* handle weird types of literals in numericliteral
* THOUGHT: should Sexpr be Sexpr<T> where T is the type? I feel like it could be?
* put getExpressionNode on BaseNode
cant be done, circular dependencies.
* add imports so that my code isnt such a mess
* http://fredkschott.com/post/2014/06/require-and-the-module-system/
* remove all !
* rename parseStatementListBS
* for special functions (like log), we should ensure you actually imported them from somewhere,
otherwise you dont get them.
* assertEquals() rather than just returning true from inside code blocks
* eventually eradicate all getText()
* hard stuff
* closures
* generics (is there a better way than just copy pasting the asm implementation n times for n call sites)
* async/await
* rewrite log to use malloc so its not a ticking time bomb!!!!!!! it was overwriting my malloc offset and causing everything to explode.
* okay so the main thing is that log is polymorphic on argument type, but that's impossible to currently do rn because
all values are the same and have no type information. HOWEVER, it's not impossible in theory because i could write
static functions to... wait no, yeah, it's impossible. lol.
* use data segment
* ok... bs is a pretty bad acronym...
* generate straight wasm rather than wat
* fun optimization ideas:
* pull out constant expressions that are repeatedly evaluated
* inline functions
* generate a d.ts file for the exported members of the wasm thing
* actually check for TS errors n stuff.
useful to get wat snippets
https://mbebenita.github.io/WasmExplorer/
https://blog.scottlogic.com/2018/05/29/transpiling-webassembly.html
JS unit tests as far as the eye can see.
https://github.com/v8/v8/tree/master/test/mjsunit