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

Unified Diff: runtime/vm/class_finalizer.cc

Issue 10876100: Convert double interface into abstract class (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | « lib/core/double.dart ('k') | runtime/vm/dart_api_message.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 11629)
+++ 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;
+ }
+ 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;
}
@@ -1231,7 +1239,7 @@
if (interface.IsBoolType() ||
interface.IsNumberType() ||
interface.IsIntInterface() ||
- interface.IsDoubleInterface() ||
+ interface.IsDoubleType() ||
interface.IsStringInterface() ||
(interface.IsFunctionType() && !cls.IsSignatureClass()) ||
interface.IsDynamicType()) {
« no previous file with comments | « lib/core/double.dart ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698