OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Top level generator object for writing code and keeping track of | 6 * Top level generator object for writing code and keeping track of |
7 * dependencies. | 7 * dependencies. |
8 * | 8 * |
9 * Should have two compilation models, but only one implemented so far. | 9 * Should have two compilation models, but only one implemented so far. |
10 * | 10 * |
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 var itemType = method.resolveType(node.item.type, false, true); | 1567 var itemType = method.resolveType(node.item.type, false, true); |
1568 var list = node.list.visit(this); | 1568 var list = node.list.visit(this); |
1569 _visitLoop(node, () { | 1569 _visitLoop(node, () { |
1570 _visitForInBody(node, itemType, list); | 1570 _visitForInBody(node, itemType, list); |
1571 }); | 1571 }); |
1572 return false; | 1572 return false; |
1573 } | 1573 } |
1574 | 1574 |
1575 void _visitForInBody(ForInStatement node, Type itemType, Value list) { | 1575 void _visitForInBody(ForInStatement node, Type itemType, Value list) { |
1576 // TODO(jimhug): Check that itemType matches list members... | 1576 // TODO(jimhug): Check that itemType matches list members... |
1577 bool isFinal = _isFinal(node.item.type); | 1577 bool isFinal = node.item.isFinal; |
1578 var itemName = node.item.name.name; | 1578 var itemName = node.item.name.name; |
1579 var item = _scope.create(itemName, itemType, node.item.name.span, isFinal); | 1579 var item = _scope.create(itemName, itemType, node.item.name.span, isFinal); |
1580 if (list.needsTemp) { | 1580 if (list.needsTemp) { |
1581 var listVar = _scope.create('\$list', list.type, null); | 1581 var listVar = _scope.create('\$list', list.type, null); |
1582 writer.writeln('var ${listVar.code} = ${list.code};'); | 1582 writer.writeln('var ${listVar.code} = ${list.code};'); |
1583 list = listVar; | 1583 list = listVar; |
1584 } | 1584 } |
1585 | 1585 |
1586 // Special path for concrete Arrays for readability and perf optimization. | 1586 // Special path for concrete Arrays for readability and perf optimization. |
1587 if (list.type.genericType == world.listFactoryType) { | 1587 if (list.type.genericType == world.listFactoryType) { |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2458 return true; | 2458 return true; |
2459 } | 2459 } |
2460 | 2460 |
2461 } | 2461 } |
2462 | 2462 |
2463 class ReturnKind { | 2463 class ReturnKind { |
2464 static final int IGNORE = 1; | 2464 static final int IGNORE = 1; |
2465 static final int POST = 2; | 2465 static final int POST = 2; |
2466 static final int PRE = 3; | 2466 static final int PRE = 3; |
2467 } | 2467 } |
OLD | NEW |