| 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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 } | 1073 } |
| 1074 // Mark as finalized before resolving type parameter upper bounds and member | 1074 // Mark as finalized before resolving type parameter upper bounds and member |
| 1075 // types in order to break cycles. | 1075 // types in order to break cycles. |
| 1076 cls.Finalize(); | 1076 cls.Finalize(); |
| 1077 ResolveAndFinalizeUpperBounds(cls); | 1077 ResolveAndFinalizeUpperBounds(cls); |
| 1078 ResolveAndFinalizeMemberTypes(cls); | 1078 ResolveAndFinalizeMemberTypes(cls); |
| 1079 // Run additional checks after all types are finalized. | 1079 // Run additional checks after all types are finalized. |
| 1080 if (cls.is_const()) { | 1080 if (cls.is_const()) { |
| 1081 CheckForLegalConstClass(cls); | 1081 CheckForLegalConstClass(cls); |
| 1082 } | 1082 } |
| 1083 // Check to ensure we don't have classes with native fields in libraries | |
| 1084 // which do not have a native resolver. | |
| 1085 // TODO(regis): Re-enable native resolver checking after Dartium is fixed. | |
| 1086 if (false && cls.num_native_fields() != 0) { | |
| 1087 const Library& lib = Library::Handle(cls.library()); | |
| 1088 if (lib.native_entry_resolver() == NULL) { | |
| 1089 const String& cls_name = String::Handle(cls.Name()); | |
| 1090 const String& lib_name = String::Handle(lib.url()); | |
| 1091 const Script& script = Script::Handle(cls.script()); | |
| 1092 ReportError(script, cls.token_pos(), | |
| 1093 "class '%s' is trying to extend a native fields class, " | |
| 1094 "but library '%s' has no native resolvers", | |
| 1095 cls_name.ToCString(), lib_name.ToCString()); | |
| 1096 } | |
| 1097 } | |
| 1098 // Add this class to the direct subclasses of the superclass, unless the | 1083 // Add this class to the direct subclasses of the superclass, unless the |
| 1099 // superclass is Object. | 1084 // superclass is Object. |
| 1100 if (!super_type.IsNull() && !super_type.IsObjectType()) { | 1085 if (!super_type.IsNull() && !super_type.IsObjectType()) { |
| 1101 ASSERT(!super_class.IsNull()); | 1086 ASSERT(!super_class.IsNull()); |
| 1102 super_class.AddDirectSubclass(cls); | 1087 super_class.AddDirectSubclass(cls); |
| 1103 } | 1088 } |
| 1104 } | 1089 } |
| 1105 | 1090 |
| 1106 | 1091 |
| 1107 bool ClassFinalizer::IsSuperCycleFree(const Class& cls) { | 1092 bool ClassFinalizer::IsSuperCycleFree(const Class& cls) { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 void ClassFinalizer::ReportError(const char* format, ...) { | 1390 void ClassFinalizer::ReportError(const char* format, ...) { |
| 1406 va_list args; | 1391 va_list args; |
| 1407 va_start(args, format); | 1392 va_start(args, format); |
| 1408 const Error& error = Error::Handle( | 1393 const Error& error = Error::Handle( |
| 1409 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); | 1394 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); |
| 1410 va_end(args); | 1395 va_end(args); |
| 1411 ReportError(error); | 1396 ReportError(error); |
| 1412 } | 1397 } |
| 1413 | 1398 |
| 1414 } // namespace dart | 1399 } // namespace dart |
| OLD | NEW |