| OLD | NEW |
| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 case kUint64ArrayCid: | 288 case kUint64ArrayCid: |
| 289 case kExternalUint64ArrayCid: | 289 case kExternalUint64ArrayCid: |
| 290 case kFloat32ArrayCid: | 290 case kFloat32ArrayCid: |
| 291 case kExternalFloat32ArrayCid: | 291 case kExternalFloat32ArrayCid: |
| 292 case kFloat64ArrayCid: | 292 case kFloat64ArrayCid: |
| 293 case kExternalFloat64ArrayCid: | 293 case kExternalFloat64ArrayCid: |
| 294 case kDartFunctionCid: | 294 case kDartFunctionCid: |
| 295 case kWeakPropertyCid: | 295 case kWeakPropertyCid: |
| 296 is_error = true; | 296 is_error = true; |
| 297 break; | 297 break; |
| 298 default: | 298 default: { |
| 299 // Special case: classes for which we don't have a known class id. | 299 // Special case: classes for which we don't have a known class id. |
| 300 // TODO(regis): Why isn't comparing to kIntegerCid enough? | 300 // TODO(regis): Why isn't comparing to kIntegerCid enough? |
| 301 if (Type::Handle(Type::Double()).type_class() == super_class.raw() || | 301 if (Type::Handle(Type::Double()).type_class() == super_class.raw() || |
| 302 Type::Handle(Type::IntType()).type_class() == super_class.raw()) { | 302 Type::Handle(Type::IntType()).type_class() == super_class.raw() || |
| 303 Type::Handle( |
| 304 Type::StringType()).type_class() == super_class.raw()) { |
| 303 is_error = true; | 305 is_error = true; |
| 304 } | 306 } |
| 305 break; | 307 break; |
| 308 } |
| 306 } | 309 } |
| 307 if (is_error) { | 310 if (is_error) { |
| 308 const Script& script = Script::Handle(cls.script()); | 311 const Script& script = Script::Handle(cls.script()); |
| 309 ReportError(script, cls.token_pos(), | 312 ReportError(script, cls.token_pos(), |
| 310 "'%s' is not allowed to extend '%s'", | 313 "'%s' is not allowed to extend '%s'", |
| 311 String::Handle(cls.Name()).ToCString(), | 314 String::Handle(cls.Name()).ToCString(), |
| 312 String::Handle(super_class.Name()).ToCString()); | 315 String::Handle(super_class.Name()).ToCString()); |
| 313 } | 316 } |
| 314 } | 317 } |
| 315 return; | 318 return; |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 } | 1388 } |
| 1386 // Verify that unless cls belongs to core lib, it cannot extend or implement | 1389 // Verify that unless cls belongs to core lib, it cannot extend or implement |
| 1387 // any of bool, num, int, double, String, Function, dynamic. | 1390 // any of bool, num, int, double, String, Function, dynamic. |
| 1388 // The exception is signature classes, which are compiler generated and | 1391 // The exception is signature classes, which are compiler generated and |
| 1389 // represent a function type, therefore implementing the Function interface. | 1392 // represent a function type, therefore implementing the Function interface. |
| 1390 if (!cls_belongs_to_core_lib) { | 1393 if (!cls_belongs_to_core_lib) { |
| 1391 if (interface.IsBoolType() || | 1394 if (interface.IsBoolType() || |
| 1392 interface.IsNumberType() || | 1395 interface.IsNumberType() || |
| 1393 interface.IsIntType() || | 1396 interface.IsIntType() || |
| 1394 interface.IsDoubleType() || | 1397 interface.IsDoubleType() || |
| 1395 interface.IsStringInterface() || | 1398 interface.IsStringType() || |
| 1396 (interface.IsFunctionType() && !cls.IsSignatureClass()) || | 1399 (interface.IsFunctionType() && !cls.IsSignatureClass()) || |
| 1397 interface.IsDynamicType()) { | 1400 interface.IsDynamicType()) { |
| 1398 const Script& script = Script::Handle(cls.script()); | 1401 const Script& script = Script::Handle(cls.script()); |
| 1399 ReportError(script, cls.token_pos(), | 1402 ReportError(script, cls.token_pos(), |
| 1400 "'%s' is not allowed to extend or implement '%s'", | 1403 "'%s' is not allowed to extend or implement '%s'", |
| 1401 String::Handle(cls.Name()).ToCString(), | 1404 String::Handle(cls.Name()).ToCString(), |
| 1402 String::Handle(interface_class.Name()).ToCString()); | 1405 String::Handle(interface_class.Name()).ToCString()); |
| 1403 } | 1406 } |
| 1404 } | 1407 } |
| 1405 // Now resolve the super interfaces. | 1408 // Now resolve the super interfaces. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 void ClassFinalizer::ReportError(const char* format, ...) { | 1591 void ClassFinalizer::ReportError(const char* format, ...) { |
| 1589 va_list args; | 1592 va_list args; |
| 1590 va_start(args, format); | 1593 va_start(args, format); |
| 1591 const Error& error = Error::Handle( | 1594 const Error& error = Error::Handle( |
| 1592 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); | 1595 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); |
| 1593 va_end(args); | 1596 va_end(args); |
| 1594 ReportError(error); | 1597 ReportError(error); |
| 1595 } | 1598 } |
| 1596 | 1599 |
| 1597 } // namespace dart | 1600 } // namespace dart |
| OLD | NEW |