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

Unified Diff: runtime/vm/class_finalizer.cc

Issue 1407103002: Make enum values array canonical (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: wip Created 5 years, 2 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 | « no previous file | tests/language/enum_test.dart » ('j') | tests/language/enum_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_finalizer.cc
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 4d8178bc67252b9b224a18cdf367afe97f9fda3c..1ac848c468acdb54f2e2527ceb9e7610472b21a3 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -2438,10 +2438,7 @@ void ClassFinalizer::AllocateEnumValues(const Class &enum_cls) {
enum_value.SetField(index_field, ordinal_value);
const char* error_msg = "";
enum_value = enum_value.CheckAndCanonicalize(&error_msg);
- if (enum_value.IsNull()) {
- ReportError(enum_cls, enum_cls.token_pos(), "Failed finalizing values.");
- UNREACHABLE();
- }
+ ASSERT(!enum_value.IsNull());
ASSERT(enum_value.IsCanonical());
field.SetStaticValue(enum_value, true);
field.RecordStore(enum_value);
@@ -2450,6 +2447,9 @@ void ClassFinalizer::AllocateEnumValues(const Class &enum_cls) {
values_list.SetAt(ord, enum_value);
}
values_list.MakeImmutable();
+ const char* error_msg = NULL;
+ values_list ^= values_list.CheckAndCanonicalize(&error_msg);
+ ASSERT(!values_list.IsNull());
}
« no previous file with comments | « no previous file | tests/language/enum_test.dart » ('j') | tests/language/enum_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698