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

Side by Side Diff: runtime/vm/class_finalizer.cc

Issue 10933039: Make int an abstract class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Now with correct base. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/core/int.dart ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/class_finalizer.h" 5 #include "vm/class_finalizer.h"
6 6
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/heap.h" 8 #include "vm/heap.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 case kFloat32ArrayCid: 294 case kFloat32ArrayCid:
295 case kExternalFloat32ArrayCid: 295 case kExternalFloat32ArrayCid:
296 case kFloat64ArrayCid: 296 case kFloat64ArrayCid:
297 case kExternalFloat64ArrayCid: 297 case kExternalFloat64ArrayCid:
298 case kDartFunctionCid: 298 case kDartFunctionCid:
299 case kWeakPropertyCid: 299 case kWeakPropertyCid:
300 is_error = true; 300 is_error = true;
301 break; 301 break;
302 default: 302 default:
303 // Special case: classes for which we don't have a known class id. 303 // Special case: classes for which we don't have a known class id.
304 if (Type::Handle(Type::Double()).type_class() == super_class.raw()) { 304 if (Type::Handle(Type::Double()).type_class() == super_class.raw() ||
305 Type::Handle(Type::IntType()).type_class() == super_class.raw()) {
regis 2012/09/12 16:30:25 I do not quite understand why kIntegerCid (and act
Lasse Reichstein Nielsen 2012/09/13 07:19:21 I think it worked for int before because it was an
305 is_error = true; 306 is_error = true;
306 } 307 }
307 break; 308 break;
308 } 309 }
309 if (is_error) { 310 if (is_error) {
310 const Script& script = Script::Handle(cls.script()); 311 const Script& script = Script::Handle(cls.script());
311 ReportError(script, cls.token_pos(), 312 ReportError(script, cls.token_pos(),
312 "'%s' is not allowed to extend '%s'", 313 "'%s' is not allowed to extend '%s'",
313 String::Handle(cls.Name()).ToCString(), 314 String::Handle(cls.Name()).ToCString(),
314 String::Handle(super_class.Name()).ToCString()); 315 String::Handle(super_class.Name()).ToCString());
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 "'%s' is used where an interface or class name is expected", 1232 "'%s' is used where an interface or class name is expected",
1232 String::Handle(interface_class.Name()).ToCString()); 1233 String::Handle(interface_class.Name()).ToCString());
1233 } 1234 }
1234 // Verify that unless cls belongs to core lib, it cannot extend or implement 1235 // Verify that unless cls belongs to core lib, it cannot extend or implement
1235 // any of bool, num, int, double, String, Function, Dynamic. 1236 // any of bool, num, int, double, String, Function, Dynamic.
1236 // The exception is signature classes, which are compiler generated and 1237 // The exception is signature classes, which are compiler generated and
1237 // represent a function type, therefore implementing the Function interface. 1238 // represent a function type, therefore implementing the Function interface.
1238 if (!cls_belongs_to_core_lib) { 1239 if (!cls_belongs_to_core_lib) {
1239 if (interface.IsBoolType() || 1240 if (interface.IsBoolType() ||
1240 interface.IsNumberType() || 1241 interface.IsNumberType() ||
1241 interface.IsIntInterface() || 1242 interface.IsIntType() ||
1242 interface.IsDoubleType() || 1243 interface.IsDoubleType() ||
1243 interface.IsStringInterface() || 1244 interface.IsStringInterface() ||
1244 (interface.IsFunctionType() && !cls.IsSignatureClass()) || 1245 (interface.IsFunctionType() && !cls.IsSignatureClass()) ||
1245 interface.IsDynamicType()) { 1246 interface.IsDynamicType()) {
1246 const Script& script = Script::Handle(cls.script()); 1247 const Script& script = Script::Handle(cls.script());
1247 ReportError(script, cls.token_pos(), 1248 ReportError(script, cls.token_pos(),
1248 "'%s' is not allowed to extend or implement '%s'", 1249 "'%s' is not allowed to extend or implement '%s'",
1249 String::Handle(cls.Name()).ToCString(), 1250 String::Handle(cls.Name()).ToCString(),
1250 String::Handle(interface_class.Name()).ToCString()); 1251 String::Handle(interface_class.Name()).ToCString());
1251 } 1252 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 void ClassFinalizer::ReportError(const char* format, ...) { 1405 void ClassFinalizer::ReportError(const char* format, ...) {
1405 va_list args; 1406 va_list args;
1406 va_start(args, format); 1407 va_start(args, format);
1407 const Error& error = Error::Handle( 1408 const Error& error = Error::Handle(
1408 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); 1409 Parser::FormatError(Script::Handle(), -1, "Error", format, args));
1409 va_end(args); 1410 va_end(args);
1410 ReportError(error); 1411 ReportError(error);
1411 } 1412 }
1412 1413
1413 } // namespace dart 1414 } // namespace dart
OLDNEW
« no previous file with comments | « lib/core/int.dart ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698