Chromium Code Reviews| Index: runtime/vm/class_finalizer.cc |
| =================================================================== |
| --- runtime/vm/class_finalizer.cc (revision 11396) |
| +++ runtime/vm/class_finalizer.cc (working copy) |
| @@ -257,6 +257,7 @@ |
| if ((cls.library() != Library::CoreLibrary()) && |
| (cls.library() != Library::CoreImplLibrary())) { |
| // Prevent extending core implementation classes. |
| + bool is_error = false; |
| switch (super_class.id()) { |
| case kNumberCid: |
| case kIntegerCid: |
| @@ -295,16 +296,23 @@ |
| case kFloat64ArrayCid: |
| case kExternalFloat64ArrayCid: |
| case kDartFunctionCid: |
| - case kWeakPropertyCid: { |
| - const Script& script = Script::Handle(cls.script()); |
| - ReportError(script, cls.token_pos(), |
| - "'%s' is not allowed to extend '%s'", |
| - String::Handle(cls.Name()).ToCString(), |
| - String::Handle(super_class.Name()).ToCString()); |
| + case kWeakPropertyCid: |
| + is_error = true; |
| break; |
| - } |
| - default: break; |
| + default: |
| + // Special case: classes for which we don't have a known class id. |
| + if (Type::Handle(Type::Double()).type_class() == super_class.raw()) { |
| + is_error = true; |
| + } |
|
siva
2012/08/29 23:49:36
I presume this is tied to the TODO you have in dou
|
| + break; |
| } |
| + if (is_error) { |
| + const Script& script = Script::Handle(cls.script()); |
| + ReportError(script, cls.token_pos(), |
| + "'%s' is not allowed to extend '%s'", |
| + String::Handle(cls.Name()).ToCString(), |
| + String::Handle(super_class.Name()).ToCString()); |
| + } |
| } |
| return; |
| } |
| @@ -1227,7 +1235,7 @@ |
| if (interface.IsBoolInterface() || |
| interface.IsNumberType() || |
| interface.IsIntInterface() || |
| - interface.IsDoubleInterface() || |
| + interface.IsDoubleType() || |
| interface.IsStringInterface() || |
| (interface.IsFunctionType() && !cls.IsSignatureClass()) || |
| interface.IsDynamicType()) { |