Added in the beginnings of pass three which can parse and emit statements and code blocks

This commit is contained in:
Nathan Braswell
2016-01-07 02:52:22 -05:00
parent 337bc424ee
commit daae39fe19
6 changed files with 57 additions and 12 deletions

View File

@@ -71,13 +71,19 @@ obj vector<T> (Object, Serializable) {
}
fun operator+(other:vector<T>):vector<T> {
var newVec.construct():vector<T>
for (var i = 0; i < size; i++;)
newVec.addEnd(get(i))
// lets be at least a little bit smarter by copy_constructing our copy.
// We could get a lot better than this by initially creating enough space
// for both and copy_constructing all of them, but this is just a quick fix
var newVec.copy_construct(this):vector<T>
for (var i = 0; i < other.size; i++;)
newVec.addEnd(other.get(i))
return newVec
}
fun operator+(other: T):vector<T> {
var newVec.copy_construct(this):vector<T>
newVec.addEnd(other)
return newVec
}
fun operator+=(other: T):void {
addEnd(other)