| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // from dynamic invocation (alas!). So we'd better err on preserving | 233 // from dynamic invocation (alas!). So we'd better err on preserving |
| 234 // those names. | 234 // those names. |
| 235 fixedMemberNames.add(element.name.slowToString()); | 235 fixedMemberNames.add(element.name.slowToString()); |
| 236 }); | 236 }); |
| 237 } | 237 } |
| 238 // As of now names of named optionals are not renamed. Therefore add all | 238 // As of now names of named optionals are not renamed. Therefore add all |
| 239 // field names used as named optionals into [fixedMemberNames]. | 239 // field names used as named optionals into [fixedMemberNames]. |
| 240 for (final element in resolvedElements.keys) { | 240 for (final element in resolvedElements.keys) { |
| 241 if (!element.isConstructor()) continue; | 241 if (!element.isConstructor()) continue; |
| 242 Link<Element> optionalParameters = | 242 Link<Element> optionalParameters = |
| 243 element.functionSignature.optionalParameters; | 243 element.computeSignature(compiler).optionalParameters; |
| 244 for (final optional in optionalParameters) { | 244 for (final optional in optionalParameters) { |
| 245 if (optional.kind != ElementKind.FIELD_PARAMETER) continue; | 245 if (optional.kind != ElementKind.FIELD_PARAMETER) continue; |
| 246 fixedMemberNames.add(optional.name.slowToString()); | 246 fixedMemberNames.add(optional.name.slowToString()); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 // The VM will automatically invoke the call method of objects | 249 // The VM will automatically invoke the call method of objects |
| 250 // that are invoked as functions. Make sure to not rename that. | 250 // that are invoked as functions. Make sure to not rename that. |
| 251 fixedMemberNames.add('call'); | 251 fixedMemberNames.add('call'); |
| 252 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in | 252 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in |
| 253 // runtime/lib/error.dart. Overall, all DartVM specific libs should be | 253 // runtime/lib/error.dart. Overall, all DartVM specific libs should be |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 } | 546 } |
| 547 | 547 |
| 548 compareElements(e0, e1) { | 548 compareElements(e0, e1) { |
| 549 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); | 549 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); |
| 550 if (result != 0) return result; | 550 if (result != 0) return result; |
| 551 return compareBy((e) => e.position().charOffset)(e0, e1); | 551 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 552 } | 552 } |
| 553 | 553 |
| 554 List<Element> sortElements(Iterable<Element> elements) => | 554 List<Element> sortElements(Iterable<Element> elements) => |
| 555 sorted(elements, compareElements); | 555 sorted(elements, compareElements); |
| OLD | NEW |