| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 _freeTemps = []; | 538 _freeTemps = []; |
| 539 } | 539 } |
| 540 | 540 |
| 541 // TODO(jimhug): Where does this really belong? | 541 // TODO(jimhug): Where does this really belong? |
| 542 MemberSet findMembers(String name) { | 542 MemberSet findMembers(String name) { |
| 543 return method.library._findMembers(name); | 543 return method.library._findMembers(name); |
| 544 } | 544 } |
| 545 | 545 |
| 546 bool get isClosure() => (enclosingMethod != null); | 546 bool get isClosure() => (enclosingMethod != null); |
| 547 | 547 |
| 548 bool get isStatic() => method.isStatic; |
| 549 |
| 548 Value getTemp(Value value) { | 550 Value getTemp(Value value) { |
| 549 return value.needsTemp ? forceTemp(value) : value; | 551 return value.needsTemp ? forceTemp(value) : value; |
| 550 } | 552 } |
| 551 | 553 |
| 552 Value forceTemp(Value value) { | 554 Value forceTemp(Value value) { |
| 553 String name; | 555 String name; |
| 554 if (_freeTemps.length > 0) { | 556 if (_freeTemps.length > 0) { |
| 555 name = _freeTemps.removeLast(); | 557 name = _freeTemps.removeLast(); |
| 556 } else { | 558 } else { |
| 557 name = '\$' + _usedTemps.length; | 559 name = '\$' + _usedTemps.length; |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 writer.writeln('${value.code};'); | 1415 writer.writeln('${value.code};'); |
| 1414 return false; | 1416 return false; |
| 1415 } | 1417 } |
| 1416 | 1418 |
| 1417 bool visitEmptyStatement(EmptyStatement node) { | 1419 bool visitEmptyStatement(EmptyStatement node) { |
| 1418 writer.writeln(';'); | 1420 writer.writeln(';'); |
| 1419 return false; | 1421 return false; |
| 1420 } | 1422 } |
| 1421 | 1423 |
| 1422 _checkNonStatic(Node node) { | 1424 _checkNonStatic(Node node) { |
| 1423 if (method.isStatic) { | 1425 if (isStatic) { |
| 1424 world.warning('not allowed in static method', node.span); | 1426 world.warning('not allowed in static method', node.span); |
| 1425 } | 1427 } |
| 1426 } | 1428 } |
| 1427 | 1429 |
| 1428 _makeSuperValue(Node node) { | 1430 _makeSuperValue(Node node) { |
| 1429 var parentType = method.declaringType.parent; | 1431 var parentType = method.declaringType.parent; |
| 1430 _checkNonStatic(node); | 1432 _checkNonStatic(node); |
| 1431 if (parentType == null) { | 1433 if (parentType == null) { |
| 1432 world.error('no super class', node.span); | 1434 world.error('no super class', node.span); |
| 1433 } | 1435 } |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2169 result.add(new Value(world.varType, '\$$i', false, /*needsTemp:*/false)); | 2171 result.add(new Value(world.varType, '\$$i', false, /*needsTemp:*/false)); |
| 2170 } | 2172 } |
| 2171 for (int i = bareCount; i < length; i++) { | 2173 for (int i = bareCount; i < length; i++) { |
| 2172 var name = getName(i); | 2174 var name = getName(i); |
| 2173 if (name == null) name = '\$$i'; | 2175 if (name == null) name = '\$$i'; |
| 2174 result.add(new Value(world.varType, name, false, /*needsTemp:*/false)); | 2176 result.add(new Value(world.varType, name, false, /*needsTemp:*/false)); |
| 2175 } | 2177 } |
| 2176 return new Arguments(nodes, result); | 2178 return new Arguments(nodes, result); |
| 2177 } | 2179 } |
| 2178 } | 2180 } |
| OLD | NEW |