Chromium Code Reviews| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 // if one imports dart:core with a prefix, we cannot tell prefix.name | 273 // if one imports dart:core with a prefix, we cannot tell prefix.name |
| 274 // from dynamic invocation (alas!). So we'd better err on preserving | 274 // from dynamic invocation (alas!). So we'd better err on preserving |
| 275 // those names. | 275 // those names. |
| 276 fixedMemberNames.add(element.name.slowToString()); | 276 fixedMemberNames.add(element.name.slowToString()); |
| 277 }); | 277 }); |
| 278 } | 278 } |
| 279 // As of now names of named optionals are not renamed. Therefore add all | 279 // As of now names of named optionals are not renamed. Therefore add all |
| 280 // field names used as named optionals into [fixedMemberNames]. | 280 // field names used as named optionals into [fixedMemberNames]. |
| 281 for (final element in resolvedElements.keys) { | 281 for (final element in resolvedElements.keys) { |
| 282 if (!element.isConstructor()) continue; | 282 if (!element.isConstructor()) continue; |
| 283 for (final optional in element.functionSignature.optionalParameters) { | 283 Link<Element> optionalParameters = |
| 284 element.computeSignature(compiler).optionalParameters; | |
|
ahe
2013/04/15 13:36:46
This looks really bad. Why hasn't computeSignatur
karlklose
2013/04/25 11:25:53
It is not necessary, I forgot to delete it.
| |
| 285 for (final optional in optionalParameters) { | |
| 284 if (optional.kind != ElementKind.FIELD_PARAMETER) continue; | 286 if (optional.kind != ElementKind.FIELD_PARAMETER) continue; |
| 285 fixedMemberNames.add(optional.name.slowToString()); | 287 fixedMemberNames.add(optional.name.slowToString()); |
| 286 } | 288 } |
| 287 } | 289 } |
| 288 // The VM will automatically invoke the call method of objects | 290 // The VM will automatically invoke the call method of objects |
| 289 // that are invoked as functions. Make sure to not rename that. | 291 // that are invoked as functions. Make sure to not rename that. |
| 290 fixedMemberNames.add('call'); | 292 fixedMemberNames.add('call'); |
| 291 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in | 293 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in |
| 292 // runtime/lib/error.dart. Overall, all DartVM specific libs should be | 294 // runtime/lib/error.dart. Overall, all DartVM specific libs should be |
| 293 // accounted for. | 295 // accounted for. |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 594 } | 596 } |
| 595 | 597 |
| 596 compareElements(e0, e1) { | 598 compareElements(e0, e1) { |
| 597 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); | 599 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); |
| 598 if (result != 0) return result; | 600 if (result != 0) return result; |
| 599 return compareBy((e) => e.position().charOffset)(e0, e1); | 601 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 600 } | 602 } |
| 601 | 603 |
| 602 List<Element> sortElements(Iterable<Element> elements) => | 604 List<Element> sortElements(Iterable<Element> elements) => |
| 603 sorted(elements, compareElements); | 605 sorted(elements, compareElements); |
| OLD | NEW |