fixed another oneString CGenerator bug. Most of these should really be removed, but I wanna commit this one now

This commit is contained in:
Nathan Braswell
2015-06-12 15:02:22 -04:00
parent cd1b10a633
commit 36833ec263
3 changed files with 17 additions and 1 deletions

View File

@@ -572,7 +572,7 @@ CCodeTriple CGenerator::generate(NodeTree<ASTData>* from, NodeTree<ASTData>* enc
}
} else {
//return "((" + generate(children[1], enclosingObject) + ")" + name + generate(children[2], enclosingObject) + ")";
return "((" + generate(children[1], enclosingObject, true).oneString() + ")" + name + generate(children[2], nullptr, true).oneString() + ")";
return "((" + generate(children[1], enclosingObject, true) + ")" + name + generate(children[2], nullptr, true) + ")";
}
} else {
//It's a normal function call, not a special one or a method or anything. Name decorate.

View File

@@ -0,0 +1,2 @@
1
0

14
tests/test_cgen_bug.krak Normal file
View File

@@ -0,0 +1,14 @@
import io:*
import vector:*
fun onlyMatch(vec: vector<int>, matchWith: int): vector<int> {
return vec.filter(fun(it:int, other:int):bool { return it == other; }, matchWith)
}
fun main():int {
var vec = vector(7)
println(onlyMatch(vec,7).size)
println(onlyMatch(vec,9).size)
return 0
}