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

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

Issue 119673004: Version 1.1.0-dev.5.2 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 11 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 | « dart/runtime/vm/class_finalizer.h ('k') | dart/runtime/vm/code_descriptors_test.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 HANDLESCOPE(isolate); 114 HANDLESCOPE(isolate);
115 ObjectStore* object_store = isolate->object_store(); 115 ObjectStore* object_store = isolate->object_store();
116 const Error& error = Error::Handle(isolate, object_store->sticky_error()); 116 const Error& error = Error::Handle(isolate, object_store->sticky_error());
117 if (!error.IsNull()) { 117 if (!error.IsNull()) {
118 return false; 118 return false;
119 } 119 }
120 if (AllClassesFinalized()) { 120 if (AllClassesFinalized()) {
121 return true; 121 return true;
122 } 122 }
123 123
124 LongJump* base = isolate->long_jump_base(); 124 LongJumpScope jump;
125 LongJump jump;
126 isolate->set_long_jump_base(&jump);
127 if (setjmp(*jump.Set()) == 0) { 125 if (setjmp(*jump.Set()) == 0) {
128 GrowableObjectArray& class_array = GrowableObjectArray::Handle(); 126 GrowableObjectArray& class_array = GrowableObjectArray::Handle();
129 class_array = object_store->pending_classes(); 127 class_array = object_store->pending_classes();
130 ASSERT(!class_array.IsNull()); 128 ASSERT(!class_array.IsNull());
131 Class& cls = Class::Handle(); 129 Class& cls = Class::Handle();
132 // First resolve all superclasses. 130 // First resolve all superclasses.
133 for (intptr_t i = 0; i < class_array.Length(); i++) { 131 for (intptr_t i = 0; i < class_array.Length(); i++) {
134 cls ^= class_array.At(i); 132 cls ^= class_array.At(i);
135 GrowableArray<intptr_t> visited_interfaces; 133 GrowableArray<intptr_t> visited_interfaces;
136 ResolveSuperTypeAndInterfaces(cls, &visited_interfaces); 134 ResolveSuperTypeAndInterfaces(cls, &visited_interfaces);
137 } 135 }
138 // Finalize all classes. 136 // Finalize all classes.
139 for (intptr_t i = 0; i < class_array.Length(); i++) { 137 for (intptr_t i = 0; i < class_array.Length(); i++) {
140 cls ^= class_array.At(i); 138 cls ^= class_array.At(i);
141 FinalizeTypesInClass(cls); 139 FinalizeTypesInClass(cls);
142 } 140 }
143 if (FLAG_print_classes) { 141 if (FLAG_print_classes) {
144 for (intptr_t i = 0; i < class_array.Length(); i++) { 142 for (intptr_t i = 0; i < class_array.Length(); i++) {
145 cls ^= class_array.At(i); 143 cls ^= class_array.At(i);
146 PrintClassInformation(cls); 144 PrintClassInformation(cls);
147 } 145 }
148 } 146 }
149 // Clear pending classes array. 147 // Clear pending classes array.
150 class_array = GrowableObjectArray::New(); 148 class_array = GrowableObjectArray::New();
151 object_store->set_pending_classes(class_array); 149 object_store->set_pending_classes(class_array);
152 VerifyImplicitFieldOffsets(); // Verification after an error may fail. 150 VerifyImplicitFieldOffsets(); // Verification after an error may fail.
153 } else { 151 } else {
154 retval = false; 152 retval = false;
155 } 153 }
156 isolate->set_long_jump_base(base);
157 return retval; 154 return retval;
158 } 155 }
159 156
160 157
161 // Adds all interfaces of cls into 'collected'. Duplicate entries may occur. 158 // Adds all interfaces of cls into 'collected'. Duplicate entries may occur.
162 // No cycles are allowed. 159 // No cycles are allowed.
163 void ClassFinalizer::CollectInterfaces(const Class& cls, 160 void ClassFinalizer::CollectInterfaces(const Class& cls,
164 const GrowableObjectArray& collected) { 161 const GrowableObjectArray& collected) {
165 const Array& interface_array = Array::Handle(cls.interfaces()); 162 const Array& interface_array = Array::Handle(cls.interfaces());
166 AbstractType& interface = AbstractType::Handle(); 163 AbstractType& interface = AbstractType::Handle();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (!target.IsNull()) { 310 if (!target.IsNull()) {
314 // Already resolved. 311 // Already resolved.
315 return; 312 return;
316 } 313 }
317 314
318 // Target is not resolved yet. 315 // Target is not resolved yet.
319 if (FLAG_trace_class_finalization) { 316 if (FLAG_trace_class_finalization) {
320 OS::Print("Resolving redirecting factory: %s\n", 317 OS::Print("Resolving redirecting factory: %s\n",
321 String::Handle(factory.name()).ToCString()); 318 String::Handle(factory.name()).ToCString());
322 } 319 }
323 ResolveType(cls, type, kCanonicalize); 320 ResolveType(cls, type);
324 type ^= FinalizeType(cls, type, kCanonicalize); 321 type ^= FinalizeType(cls, type, kCanonicalize);
325 factory.SetRedirectionType(type); 322 factory.SetRedirectionType(type);
326 if (type.IsMalformedOrMalbounded()) { 323 if (type.IsMalformedOrMalbounded()) {
327 ASSERT(factory.RedirectionTarget() == Function::null()); 324 ASSERT(factory.RedirectionTarget() == Function::null());
328 return; 325 return;
329 } 326 }
330 ASSERT(!type.IsTypeParameter()); // Resolved in parser. 327 ASSERT(!type.IsTypeParameter()); // Resolved in parser.
331 if (type.IsDynamicType()) { 328 if (type.IsDynamicType()) {
332 // Replace the type with a malformed type and compile a throw when called. 329 // Replace the type with a malformed type and compile a throw when called.
333 type = NewFinalizedMalformedType( 330 type = NewFinalizedMalformedType(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 "cannot resolve redirecting factory"); 427 "cannot resolve redirecting factory");
431 target_target = Function::null(); 428 target_target = Function::null();
432 } 429 }
433 } 430 }
434 } 431 }
435 factory.SetRedirectionType(target_type); 432 factory.SetRedirectionType(target_type);
436 factory.SetRedirectionTarget(target_target); 433 factory.SetRedirectionTarget(target_target);
437 } 434 }
438 435
439 436
440 void ClassFinalizer::ResolveType(const Class& cls, 437 void ClassFinalizer::ResolveType(const Class& cls, const AbstractType& type) {
441 const AbstractType& type,
442 FinalizationKind finalization) {
443 if (type.IsResolved() || type.IsFinalized()) { 438 if (type.IsResolved() || type.IsFinalized()) {
444 return; 439 return;
445 } 440 }
446 if (FLAG_trace_type_finalization) { 441 if (FLAG_trace_type_finalization) {
447 OS::Print("Resolve type '%s'\n", String::Handle(type.Name()).ToCString()); 442 OS::Print("Resolve type '%s'\n", String::Handle(type.Name()).ToCString());
448 } 443 }
449 444
450 // Resolve the type class. 445 // Resolve the type class.
451 if (!type.HasResolvedTypeClass()) { 446 if (!type.HasResolvedTypeClass()) {
452 // Type parameters are always resolved in the parser in the correct 447 // Type parameters are always resolved in the parser in the correct
(...skipping 25 matching lines...) Expand all
478 } 473 }
479 474
480 // Resolve type arguments, if any. 475 // Resolve type arguments, if any.
481 const AbstractTypeArguments& arguments = 476 const AbstractTypeArguments& arguments =
482 AbstractTypeArguments::Handle(type.arguments()); 477 AbstractTypeArguments::Handle(type.arguments());
483 if (!arguments.IsNull()) { 478 if (!arguments.IsNull()) {
484 const intptr_t num_arguments = arguments.Length(); 479 const intptr_t num_arguments = arguments.Length();
485 AbstractType& type_argument = AbstractType::Handle(); 480 AbstractType& type_argument = AbstractType::Handle();
486 for (intptr_t i = 0; i < num_arguments; i++) { 481 for (intptr_t i = 0; i < num_arguments; i++) {
487 type_argument = arguments.TypeAt(i); 482 type_argument = arguments.TypeAt(i);
488 ResolveType(cls, type_argument, finalization); 483 ResolveType(cls, type_argument);
489 } 484 }
490 } 485 }
491 } 486 }
492 487
493 488
494 void ClassFinalizer::FinalizeTypeParameters( 489 void ClassFinalizer::FinalizeTypeParameters(
495 const Class& cls, 490 const Class& cls,
496 GrowableObjectArray* pending_types) { 491 GrowableObjectArray* pending_types) {
497 if (cls.IsMixinApplication()) { 492 if (cls.IsMixinApplication()) {
498 // Setup the type parameters of the mixin application and finalize the 493 // Setup the type parameters of the mixin application and finalize the
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 } 981 }
987 } 982 }
988 983
989 984
990 void ClassFinalizer::ResolveAndFinalizeSignature(const Class& cls, 985 void ClassFinalizer::ResolveAndFinalizeSignature(const Class& cls,
991 const Function& function) { 986 const Function& function) {
992 // Resolve result type. 987 // Resolve result type.
993 AbstractType& type = AbstractType::Handle(function.result_type()); 988 AbstractType& type = AbstractType::Handle(function.result_type());
994 // It is not a compile time error if this name does not resolve to a class or 989 // It is not a compile time error if this name does not resolve to a class or
995 // interface. 990 // interface.
996 ResolveType(cls, type, kCanonicalize); 991 ResolveType(cls, type);
997 type = FinalizeType(cls, type, kCanonicalize); 992 type = FinalizeType(cls, type, kCanonicalize);
998 // The result type may be malformed or malbounded. 993 // The result type may be malformed or malbounded.
999 function.set_result_type(type); 994 function.set_result_type(type);
1000 // Resolve formal parameter types. 995 // Resolve formal parameter types.
1001 const intptr_t num_parameters = function.NumParameters(); 996 const intptr_t num_parameters = function.NumParameters();
1002 for (intptr_t i = 0; i < num_parameters; i++) { 997 for (intptr_t i = 0; i < num_parameters; i++) {
1003 type = function.ParameterTypeAt(i); 998 type = function.ParameterTypeAt(i);
1004 ResolveType(cls, type, kCanonicalize); 999 ResolveType(cls, type);
1005 type = FinalizeType(cls, type, kCanonicalize); 1000 type = FinalizeType(cls, type, kCanonicalize);
1006 // The parameter type may be malformed or malbounded. 1001 // The parameter type may be malformed or malbounded.
1007 function.SetParameterTypeAt(i, type); 1002 function.SetParameterTypeAt(i, type);
1008 } 1003 }
1009 } 1004 }
1010 1005
1011 1006
1012 // Check if an instance field, getter, or method of same name exists 1007 // Check if an instance field, getter, or method of same name exists
1013 // in any super class. 1008 // in any super class.
1014 static RawClass* FindSuperOwnerOfInstanceMember(const Class& cls, 1009 static RawClass* FindSuperOwnerOfInstanceMember(const Class& cls,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 AbstractType& bound = AbstractType::Handle(); 1058 AbstractType& bound = AbstractType::Handle();
1064 const AbstractTypeArguments& type_params = 1059 const AbstractTypeArguments& type_params =
1065 AbstractTypeArguments::Handle(cls.type_parameters()); 1060 AbstractTypeArguments::Handle(cls.type_parameters());
1066 ASSERT((type_params.IsNull() && (num_type_params == 0)) || 1061 ASSERT((type_params.IsNull() && (num_type_params == 0)) ||
1067 (type_params.Length() == num_type_params)); 1062 (type_params.Length() == num_type_params));
1068 // In a first pass, resolve all bounds. This guarantees that finalization 1063 // In a first pass, resolve all bounds. This guarantees that finalization
1069 // of mutually referencing bounds will not encounter an unresolved bound. 1064 // of mutually referencing bounds will not encounter an unresolved bound.
1070 for (intptr_t i = 0; i < num_type_params; i++) { 1065 for (intptr_t i = 0; i < num_type_params; i++) {
1071 type_param ^= type_params.TypeAt(i); 1066 type_param ^= type_params.TypeAt(i);
1072 bound = type_param.bound(); 1067 bound = type_param.bound();
1073 ResolveType(cls, bound, kCanonicalize); 1068 ResolveType(cls, bound);
1074 } 1069 }
1075 } 1070 }
1076 1071
1077 1072
1078 // Finalize the upper bounds of the type parameters of class cls. 1073 // Finalize the upper bounds of the type parameters of class cls.
1079 void ClassFinalizer::FinalizeUpperBounds(const Class& cls) { 1074 void ClassFinalizer::FinalizeUpperBounds(const Class& cls) {
1080 const intptr_t num_type_params = cls.NumTypeParameters(); 1075 const intptr_t num_type_params = cls.NumTypeParameters();
1081 TypeParameter& type_param = TypeParameter::Handle(); 1076 TypeParameter& type_param = TypeParameter::Handle();
1082 AbstractType& bound = AbstractType::Handle(); 1077 AbstractType& bound = AbstractType::Handle();
1083 const AbstractTypeArguments& type_params = 1078 const AbstractTypeArguments& type_params =
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 Field& field = Field::Handle(); 1118 Field& field = Field::Handle();
1124 AbstractType& type = AbstractType::Handle(); 1119 AbstractType& type = AbstractType::Handle();
1125 String& name = String::Handle(); 1120 String& name = String::Handle();
1126 String& getter_name = String::Handle(); 1121 String& getter_name = String::Handle();
1127 String& setter_name = String::Handle(); 1122 String& setter_name = String::Handle();
1128 Class& super_class = Class::Handle(); 1123 Class& super_class = Class::Handle();
1129 const intptr_t num_fields = array.Length(); 1124 const intptr_t num_fields = array.Length();
1130 for (intptr_t i = 0; i < num_fields; i++) { 1125 for (intptr_t i = 0; i < num_fields; i++) {
1131 field ^= array.At(i); 1126 field ^= array.At(i);
1132 type = field.type(); 1127 type = field.type();
1133 ResolveType(cls, type, kCanonicalize); 1128 ResolveType(cls, type);
1134 type = FinalizeType(cls, type, kCanonicalize); 1129 type = FinalizeType(cls, type, kCanonicalize);
1135 field.set_type(type); 1130 field.set_type(type);
1136 name = field.name(); 1131 name = field.name();
1137 if (field.is_static()) { 1132 if (field.is_static()) {
1138 getter_name = Field::GetterSymbol(name); 1133 getter_name = Field::GetterSymbol(name);
1139 super_class = FindSuperOwnerOfInstanceMember(cls, name, getter_name); 1134 super_class = FindSuperOwnerOfInstanceMember(cls, name, getter_name);
1140 if (!super_class.IsNull()) { 1135 if (!super_class.IsNull()) {
1141 const String& class_name = String::Handle(cls.Name()); 1136 const String& class_name = String::Handle(cls.Name());
1142 const String& super_class_name = String::Handle(super_class.Name()); 1137 const String& super_class_name = String::Handle(super_class.Name());
1143 const Script& script = Script::Handle(cls.script()); 1138 const Script& script = Script::Handle(cls.script());
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
2149 return true; 2144 return true;
2150 } 2145 }
2151 2146
2152 2147
2153 // Helper function called by IsAliasCycleFree. 2148 // Helper function called by IsAliasCycleFree.
2154 bool ClassFinalizer::IsTypeCycleFree( 2149 bool ClassFinalizer::IsTypeCycleFree(
2155 const Class& cls, 2150 const Class& cls,
2156 const AbstractType& type, 2151 const AbstractType& type,
2157 GrowableArray<intptr_t>* visited) { 2152 GrowableArray<intptr_t>* visited) {
2158 ASSERT(visited != NULL); 2153 ASSERT(visited != NULL);
2159 ResolveType(cls, type, kCanonicalize); 2154 ResolveType(cls, type);
2160 if (type.IsType() && !type.IsMalformed()) { 2155 if (type.IsType() && !type.IsMalformed()) {
2161 const Class& type_class = Class::Handle(type.type_class()); 2156 const Class& type_class = Class::Handle(type.type_class());
2162 if (!type_class.is_type_finalized() && 2157 if (!type_class.is_type_finalized() &&
2163 type_class.IsSignatureClass() && 2158 type_class.IsSignatureClass() &&
2164 !IsAliasCycleFree(type_class, visited)) { 2159 !IsAliasCycleFree(type_class, visited)) {
2165 return false; 2160 return false;
2166 } 2161 }
2167 const AbstractTypeArguments& type_args = AbstractTypeArguments::Handle( 2162 const AbstractTypeArguments& type_args = AbstractTypeArguments::Handle(
2168 type.arguments()); 2163 type.arguments());
2169 if (!type_args.IsNull()) { 2164 if (!type_args.IsNull()) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 // Lookup or create mixin application classes in the library of cls 2304 // Lookup or create mixin application classes in the library of cls
2310 // and resolve super type and mixin types. 2305 // and resolve super type and mixin types.
2311 const Library& library = Library::Handle(cls.library()); 2306 const Library& library = Library::Handle(cls.library());
2312 ASSERT(!library.IsNull()); 2307 ASSERT(!library.IsNull());
2313 const Script& script = Script::Handle(cls.script()); 2308 const Script& script = Script::Handle(cls.script());
2314 ASSERT(!script.IsNull()); 2309 ASSERT(!script.IsNull());
2315 const GrowableObjectArray& type_args = 2310 const GrowableObjectArray& type_args =
2316 GrowableObjectArray::Handle(GrowableObjectArray::New()); 2311 GrowableObjectArray::Handle(GrowableObjectArray::New());
2317 AbstractType& mixin_super_type = 2312 AbstractType& mixin_super_type =
2318 AbstractType::Handle(mixin_app_type.super_type()); 2313 AbstractType::Handle(mixin_app_type.super_type());
2319 ResolveType(cls, mixin_super_type, kCanonicalizeWellFormed); 2314 ResolveType(cls, mixin_super_type);
2320 ASSERT(mixin_super_type.HasResolvedTypeClass()); 2315 ASSERT(mixin_super_type.HasResolvedTypeClass());
2321 // TODO(14453): May need to handle BoundedType here. 2316 // TODO(14453): May need to handle BoundedType here.
2322 ASSERT(mixin_super_type.IsType()); 2317 ASSERT(mixin_super_type.IsType());
2323 CollectTypeArguments(cls, Type::Cast(mixin_super_type), type_args); 2318 CollectTypeArguments(cls, Type::Cast(mixin_super_type), type_args);
2324 AbstractType& mixin_type = AbstractType::Handle(); 2319 AbstractType& mixin_type = AbstractType::Handle();
2325 Type& generic_mixin_type = Type::Handle(); 2320 Type& generic_mixin_type = Type::Handle();
2326 Class& mixin_type_class = Class::Handle(); 2321 Class& mixin_type_class = Class::Handle();
2327 Class& mixin_app_class = Class::Handle(); 2322 Class& mixin_app_class = Class::Handle();
2328 String& mixin_app_class_name = String::Handle(); 2323 String& mixin_app_class_name = String::Handle();
2329 String& mixin_type_class_name = String::Handle(); 2324 String& mixin_type_class_name = String::Handle();
2330 const intptr_t depth = mixin_app_type.Depth(); 2325 const intptr_t depth = mixin_app_type.Depth();
2331 for (intptr_t i = 0; i < depth; i++) { 2326 for (intptr_t i = 0; i < depth; i++) {
2332 mixin_type = mixin_app_type.MixinTypeAt(i); 2327 mixin_type = mixin_app_type.MixinTypeAt(i);
2333 ASSERT(!mixin_type.IsNull()); 2328 ASSERT(!mixin_type.IsNull());
2334 ResolveType(cls, mixin_type, kCanonicalizeWellFormed); 2329 ResolveType(cls, mixin_type);
2335 ASSERT(mixin_type.HasResolvedTypeClass()); 2330 ASSERT(mixin_type.HasResolvedTypeClass());
2336 ASSERT(mixin_type.IsType()); 2331 ASSERT(mixin_type.IsType());
2337 CollectTypeArguments(cls, Type::Cast(mixin_type), type_args); 2332 CollectTypeArguments(cls, Type::Cast(mixin_type), type_args);
2338 2333
2339 // The name of the mixin application class is a combination of 2334 // The name of the mixin application class is a combination of
2340 // the super class name and mixin class name. 2335 // the super class name and mixin class name.
2341 mixin_app_class_name = mixin_super_type.ClassName(); 2336 mixin_app_class_name = mixin_super_type.ClassName();
2342 mixin_app_class_name = String::Concat(mixin_app_class_name, 2337 mixin_app_class_name = String::Concat(mixin_app_class_name,
2343 Symbols::Ampersand()); 2338 Symbols::Ampersand());
2344 mixin_type_class_name = mixin_type.ClassName(); 2339 mixin_type_class_name = mixin_type.ClassName();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2439 // If cls belongs to core lib, restrictions about allowed interfaces 2434 // If cls belongs to core lib, restrictions about allowed interfaces
2440 // are lifted. 2435 // are lifted.
2441 const bool cls_belongs_to_core_lib = cls.library() == Library::CoreLibrary(); 2436 const bool cls_belongs_to_core_lib = cls.library() == Library::CoreLibrary();
2442 2437
2443 // Resolve and check the super type and interfaces of cls. 2438 // Resolve and check the super type and interfaces of cls.
2444 visited->Add(cls_index); 2439 visited->Add(cls_index);
2445 AbstractType& interface = AbstractType::Handle(); 2440 AbstractType& interface = AbstractType::Handle();
2446 Class& interface_class = Class::Handle(); 2441 Class& interface_class = Class::Handle();
2447 2442
2448 // Resolve super type. Failures lead to a longjmp. 2443 // Resolve super type. Failures lead to a longjmp.
2449 ResolveType(cls, super_type, kCanonicalizeWellFormed); 2444 ResolveType(cls, super_type);
2450 if (super_type.IsMalformedOrMalbounded()) { 2445 if (super_type.IsMalformedOrMalbounded()) {
2451 ReportError(Error::Handle(super_type.error())); 2446 ReportError(Error::Handle(super_type.error()));
2452 } 2447 }
2453 if (super_type.IsDynamicType()) { 2448 if (super_type.IsDynamicType()) {
2454 const Script& script = Script::Handle(cls.script()); 2449 const Script& script = Script::Handle(cls.script());
2455 ReportError(Error::Handle(), // No previous error. 2450 ReportError(Error::Handle(), // No previous error.
2456 script, cls.token_pos(), 2451 script, cls.token_pos(),
2457 "class '%s' may not extend 'dynamic'", 2452 "class '%s' may not extend 'dynamic'",
2458 String::Handle(cls.Name()).ToCString()); 2453 String::Handle(cls.Name()).ToCString());
2459 } 2454 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2516 String::Handle(cls.Name()).ToCString(), 2511 String::Handle(cls.Name()).ToCString(),
2517 String::Handle(interface_class.Name()).ToCString()); 2512 String::Handle(interface_class.Name()).ToCString());
2518 } 2513 }
2519 } 2514 }
2520 // Now resolve the super interfaces of the super type. 2515 // Now resolve the super interfaces of the super type.
2521 ResolveSuperTypeAndInterfaces(interface_class, visited); 2516 ResolveSuperTypeAndInterfaces(interface_class, visited);
2522 2517
2523 // Resolve interfaces. Failures lead to a longjmp. 2518 // Resolve interfaces. Failures lead to a longjmp.
2524 for (intptr_t i = 0; i < super_interfaces.Length(); i++) { 2519 for (intptr_t i = 0; i < super_interfaces.Length(); i++) {
2525 interface ^= super_interfaces.At(i); 2520 interface ^= super_interfaces.At(i);
2526 ResolveType(cls, interface, kCanonicalizeWellFormed); 2521 ResolveType(cls, interface);
2527 ASSERT(!interface.IsTypeParameter()); // Should be detected by parser. 2522 ASSERT(!interface.IsTypeParameter()); // Should be detected by parser.
2528 // A malbounded interface is only reported when involved in a type test. 2523 // A malbounded interface is only reported when involved in a type test.
2529 if (interface.IsMalformed()) { 2524 if (interface.IsMalformed()) {
2530 ReportError(Error::Handle(interface.error())); 2525 ReportError(Error::Handle(interface.error()));
2531 } 2526 }
2532 if (interface.IsDynamicType()) { 2527 if (interface.IsDynamicType()) {
2533 const Script& script = Script::Handle(cls.script()); 2528 const Script& script = Script::Handle(cls.script());
2534 ReportError(Error::Handle(), // No previous error. 2529 ReportError(Error::Handle(), // No previous error.
2535 script, cls.token_pos(), 2530 script, cls.token_pos(),
2536 "'dynamic' may not be used as interface"); 2531 "'dynamic' may not be used as interface");
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2805 expected_name ^= String::New("_offset"); 2800 expected_name ^= String::New("_offset");
2806 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 2801 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
2807 field ^= fields_array.At(2); 2802 field ^= fields_array.At(2);
2808 ASSERT(field.Offset() == TypedDataView::length_offset()); 2803 ASSERT(field.Offset() == TypedDataView::length_offset());
2809 name ^= field.name(); 2804 name ^= field.name();
2810 ASSERT(name.Equals("length")); 2805 ASSERT(name.Equals("length"));
2811 #endif 2806 #endif
2812 } 2807 }
2813 2808
2814 } // namespace dart 2809 } // namespace dart
OLDNEW
« no previous file with comments | « dart/runtime/vm/class_finalizer.h ('k') | dart/runtime/vm/code_descriptors_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698