| 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 part of dart_backend; | 5 part of dart_backend; |
| 6 | 6 |
| 7 // TODO(ahe): This class is simply wrong. This backend should use | 7 // TODO(ahe): This class is simply wrong. This backend should use |
| 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, | 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, |
| 9 // TreeElements>] is what is needed. | 9 // TreeElements>] is what is needed. |
| 10 class ElementAst { | 10 class ElementAst { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 fixedMemberNames.add(name.split(r'$').last); | 245 fixedMemberNames.add(name.split(r'$').last); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 // Even class names are added due to a delicate problem we have: | 248 // Even class names are added due to a delicate problem we have: |
| 249 // if one imports dart:core with a prefix, we cannot tell prefix.name | 249 // if one imports dart:core with a prefix, we cannot tell prefix.name |
| 250 // from dynamic invocation (alas!). So we'd better err on preserving | 250 // from dynamic invocation (alas!). So we'd better err on preserving |
| 251 // those names. | 251 // those names. |
| 252 fixedMemberNames.add(element.name.slowToString()); | 252 fixedMemberNames.add(element.name.slowToString()); |
| 253 }); | 253 }); |
| 254 } | 254 } |
| 255 // The VM will automatically invoke the call method of objects |
| 256 // that are invoked as functions. Make sure to not rename that. |
| 257 fixedMemberNames.add('call'); |
| 255 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in | 258 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in |
| 256 // runtime/lib/error.dart. Overall, all DartVM specific libs should be | 259 // runtime/lib/error.dart. Overall, all DartVM specific libs should be |
| 257 // accounted for. | 260 // accounted for. |
| 258 fixedMemberNames.add('srcType'); | 261 fixedMemberNames.add('srcType'); |
| 259 fixedMemberNames.add('dstType'); | 262 fixedMemberNames.add('dstType'); |
| 260 | 263 |
| 261 /** | 264 /** |
| 262 * Tells whether we should output given element. Corelib classes like | 265 * Tells whether we should output given element. Corelib classes like |
| 263 * Object should not be in the resulting code. | 266 * Object should not be in the resulting code. |
| 264 */ | 267 */ |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 } | 556 } |
| 554 | 557 |
| 555 compareElements(e0, e1) { | 558 compareElements(e0, e1) { |
| 556 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); | 559 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); |
| 557 if (result != 0) return result; | 560 if (result != 0) return result; |
| 558 return compareBy((e) => e.position().charOffset)(e0, e1); | 561 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 559 } | 562 } |
| 560 | 563 |
| 561 List<Element> sortElements(Collection<Element> elements) => | 564 List<Element> sortElements(Collection<Element> elements) => |
| 562 sorted(elements, compareElements); | 565 sorted(elements, compareElements); |
| OLD | NEW |