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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 for (intptr_t i = 0; i < super_interfaces.Length(); i++) { | 1143 for (intptr_t i = 0; i < super_interfaces.Length(); i++) { |
1144 interface ^= super_interfaces.At(i); | 1144 interface ^= super_interfaces.At(i); |
1145 ResolveType(cls, interface, kFinalizeWellFormed); | 1145 ResolveType(cls, interface, kFinalizeWellFormed); |
1146 if (interface.IsTypeParameter()) { | 1146 if (interface.IsTypeParameter()) { |
1147 const Script& script = Script::Handle(cls.script()); | 1147 const Script& script = Script::Handle(cls.script()); |
1148 ReportError(script, cls.token_index(), | 1148 ReportError(script, cls.token_index(), |
1149 "type parameter '%s' cannot be used as interface", | 1149 "type parameter '%s' cannot be used as interface", |
1150 String::Handle(interface.Name()).ToCString()); | 1150 String::Handle(interface.Name()).ToCString()); |
1151 } | 1151 } |
1152 interface_class = interface.type_class(); | 1152 interface_class = interface.type_class(); |
1153 if (!interface_class.is_interface()) { | 1153 if (interface_class.IsSignatureClass()) { |
1154 const Script& script = Script::Handle(cls.script()); | 1154 const Script& script = Script::Handle(cls.script()); |
1155 ReportError(script, cls.token_index(), | 1155 ReportError(script, cls.token_index(), |
1156 "class '%s' is used where an interface is expected", | 1156 "'%s' is used where an interface or class name is expected", |
1157 String::Handle(interface_class.Name()).ToCString()); | 1157 String::Handle(interface_class.Name()).ToCString()); |
1158 } | 1158 } |
1159 // Verify that unless cls belongs to core lib, it cannot extend or implement | 1159 // Verify that unless cls belongs to core lib, it cannot extend or implement |
1160 // any of bool, num, int, double, String, Function, Dynamic. | 1160 // any of bool, num, int, double, String, Function, Dynamic. |
1161 // The exception is signature classes, which are compiler generated and | 1161 // The exception is signature classes, which are compiler generated and |
1162 // represent a function type, therefore implementing the Function interface. | 1162 // represent a function type, therefore implementing the Function interface. |
1163 if (!cls_belongs_to_core_lib) { | 1163 if (!cls_belongs_to_core_lib) { |
1164 if (interface.IsBoolInterface() || | 1164 if (interface.IsBoolInterface() || |
1165 interface.IsNumberInterface() || | 1165 interface.IsNumberInterface() || |
1166 interface.IsIntInterface() || | 1166 interface.IsIntInterface() || |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 void ClassFinalizer::ReportError(const char* format, ...) { | 1322 void ClassFinalizer::ReportError(const char* format, ...) { |
1323 va_list args; | 1323 va_list args; |
1324 va_start(args, format); | 1324 va_start(args, format); |
1325 const Error& error = Error::Handle( | 1325 const Error& error = Error::Handle( |
1326 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); | 1326 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); |
1327 va_end(args); | 1327 va_end(args); |
1328 ReportError(error); | 1328 ReportError(error); |
1329 } | 1329 } |
1330 | 1330 |
1331 } // namespace dart | 1331 } // namespace dart |
OLD | NEW |