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

Unified Diff: runtime/vm/class_finalizer.cc

Issue 745023002: - Properly canonicalize enum values. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month 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 | runtime/vm/snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_finalizer.cc
===================================================================
--- runtime/vm/class_finalizer.cc (revision 41861)
+++ runtime/vm/class_finalizer.cc (working copy)
@@ -2383,6 +2383,13 @@
if (!ordinal_value.IsSmi()) continue;
enum_value = Instance::New(enum_cls, Heap::kOld);
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.IsCanonical());
field.set_value(enum_value);
field.RecordStore(enum_value);
intptr_t ord = Smi::Cast(ordinal_value).Value();
« no previous file with comments | « no previous file | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698