UNPKG

1.32 kBJavaScriptView Raw
1(function() {
2 var self = this;
3 module.exports = function(terms) {
4 var self = this;
5 return terms.term({
6 constructor: function(iterator, collection, stmts) {
7 var self = this;
8 self.isForIn = true;
9 self.iterator = terms.definition(iterator, terms.nil());
10 self.collection = collection;
11 return self.statements = terms.subExpression(terms.functionCall(terms.block([ iterator ], stmts, {
12 returnLastStatement: false
13 }), [ iterator ]));
14 },
15 generate: function(scope) {
16 var self = this;
17 return self.code("for(", self.iterator.target.generate(scope), " in ", self.collection.generate(scope), "){", self.statements.generateStatement(scope), "}");
18 },
19 generateStatement: function() {
20 var self = this;
21 var args = Array.prototype.slice.call(arguments, 0, arguments.length);
22 var gen1_o;
23 gen1_o = self;
24 return gen1_o.generate.apply(gen1_o, args);
25 },
26 rewriteResultTermInto: function(returnTerm) {
27 var self = this;
28 return void 0;
29 }
30 });
31 };
32}).call(this);
\No newline at end of file