Get rid of bytecodes for list literals.

Just compile them to:

new List
.add(...)
.add(...)
...

Gets rid of some code in the interpreter loop, which is always good.
Also addresses the old limitation where a list literal could only have
255 elements.
This commit is contained in:
Bob Nystrom
2015-01-25 22:49:30 -08:00
parent a9bd864c6b
commit ed8e595f54
6 changed files with 27 additions and 45 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
class Sequence {
map(f) {
var result = []
var result = new List
for (element in this) {
result.add(f.call(element))
}
@@ -8,7 +8,7 @@ class Sequence {
}
where(f) {
var result = []
var result = new List
for (element in this) {
if (f.call(element)) result.add(element)
}