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

Unified Diff: runtime/vm/object_reload.cc

Issue 2926203002: [hot reload] Give a better error message when changing between a regular class and a typedef. (Closed)
Patch Set: Created 3 years, 6 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 | « runtime/vm/isolate_reload_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_reload.cc
diff --git a/runtime/vm/object_reload.cc b/runtime/vm/object_reload.cc
index 181ff495e616e4087b71dd8f6b0aaa9bd354ee87..cd065f7d1fe6bfd0bf4a786d7ef196be91e8fd2a 100644
--- a/runtime/vm/object_reload.cc
+++ b/runtime/vm/object_reload.cc
@@ -436,6 +436,21 @@ class EnumClassConflict : public ClassReasonForCancelling {
};
+class TypedefClassConflict : public ClassReasonForCancelling {
+ public:
+ TypedefClassConflict(Zone* zone, const Class& from, const Class& to)
+ : ClassReasonForCancelling(zone, from, to) {}
+
+ RawString* ToString() {
+ return String::NewFormatted(
+ from_.IsTypedefClass()
+ ? "Typedef class cannot be redefined to be a non-typedef class: %s"
+ : "Class cannot be redefined to be a typedef class: %s",
+ from_.ToCString());
+ }
+};
+
+
class EnsureFinalizedError : public ClassReasonForCancelling {
public:
EnsureFinalizedError(Zone* zone,
@@ -555,6 +570,13 @@ void Class::CheckReload(const Class& replacement,
return;
}
+ // Class cannot change typedef property.
+ if (IsTypedefClass() != replacement.IsTypedefClass()) {
+ context->AddReasonForCancelling(new (context->zone()) TypedefClassConflict(
+ context->zone(), *this, replacement));
+ return;
+ }
+
if (is_finalized()) {
// Ensure the replacement class is also finalized.
const Error& error =
« no previous file with comments | « runtime/vm/isolate_reload_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698