OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 typedef bool IsSafeToRemoveTypeDeclarations( | 7 typedef bool IsSafeToRemoveTypeDeclarations( |
8 Map<ClassElement, Iterable<Element>> classMembers); | 8 Map<ClassElement, Iterable<Element>> classMembers); |
9 typedef void ElementCallback<E>(E element); | 9 typedef void ElementCallback<E>(E element); |
10 typedef void ElementPostProcessFunction( | 10 typedef void ElementPostProcessFunction( |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 fixedDynamicNames.add(parameter.name); | 292 fixedDynamicNames.add(parameter.name); |
293 } | 293 } |
294 } | 294 } |
295 ClassElement cls = element.enclosingClass; | 295 ClassElement cls = element.enclosingClass; |
296 if (cls != null && cls.isEnumClass) { | 296 if (cls != null && cls.isEnumClass) { |
297 fixedDynamicNames.add('index'); | 297 fixedDynamicNames.add('index'); |
298 | 298 |
299 ClassElement existingEnumClass = | 299 ClassElement existingEnumClass = |
300 enumClassMap.putIfAbsent(cls.name, () => cls); | 300 enumClassMap.putIfAbsent(cls.name, () => cls); |
301 if (existingEnumClass != cls) { | 301 if (existingEnumClass != cls) { |
302 listener.reportError(cls, MessageKind.GENERIC, | 302 listener.reportError( |
303 {'text': "Duplicate enum names are not supported in dart2dart."}); | 303 listener.createMessage( |
304 listener.reportInfo(existingEnumClass, MessageKind.GENERIC, | 304 cls, |
305 {'text': "This is the other declaration of '${cls.name}'."}); | 305 MessageKind.GENERIC, |
| 306 {'text': "Duplicate enum names are not supported " |
| 307 "in dart2dart."}), |
| 308 <DiagnosticMessage>[ |
| 309 listener.createMessage( |
| 310 existingEnumClass, |
| 311 MessageKind.GENERIC, |
| 312 {'text': "This is the other declaration of '${cls.name}'."}), |
| 313 ]); |
306 } | 314 } |
307 } | 315 } |
308 } | 316 } |
309 | 317 |
310 fixedStaticNames.addAll(enumClassMap.keys); | 318 fixedStaticNames.addAll(enumClassMap.keys); |
311 | 319 |
312 // The VM will automatically invoke the call method of objects | 320 // The VM will automatically invoke the call method of objects |
313 // that are invoked as functions. Make sure to not rename that. | 321 // that are invoked as functions. Make sure to not rename that. |
314 fixedDynamicNames.add('call'); | 322 fixedDynamicNames.add('call'); |
315 | 323 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 outputProvider("", "dart") | 596 outputProvider("", "dart") |
589 ..add(code) | 597 ..add(code) |
590 ..close(); | 598 ..close(); |
591 | 599 |
592 totalSize = code.length; | 600 totalSize = code.length; |
593 } | 601 } |
594 | 602 |
595 return totalSize; | 603 return totalSize; |
596 } | 604 } |
597 } | 605 } |
OLD | NEW |