Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: pkg/compiler/lib/src/dart_backend/placeholder_collector.dart

Issue 878843003: Support enums in dart2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/dart_backend/outputter.dart ('k') | tests/language/enum_duplicate_lib.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/dart_backend/placeholder_collector.dart
diff --git a/pkg/compiler/lib/src/dart_backend/placeholder_collector.dart b/pkg/compiler/lib/src/dart_backend/placeholder_collector.dart
index 7b694626a3f810c0533299b465da103094e2ca22..694b62379db603a5b0c8af8c90592fb6a26579ea 100644
--- a/pkg/compiler/lib/src/dart_backend/placeholder_collector.dart
+++ b/pkg/compiler/lib/src/dart_backend/placeholder_collector.dart
@@ -345,6 +345,14 @@ class PlaceholderCollector extends Visitor {
if (library.isPlatformLibrary && !element.isTopLevel) {
return;
}
+
+ ClassElement cls = element.enclosingClass;
+ if (cls != null && cls.isEnumClass) {
+ // Enums and enum values cannot be changed, since the semantics of
+ // `toString` is defined by the names of the declarations.
+ return;
+ }
+
if (element.isGetter || element.isSetter) {
element = (element as FunctionElement).abstractField;
}
« no previous file with comments | « pkg/compiler/lib/src/dart_backend/outputter.dart ('k') | tests/language/enum_duplicate_lib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698