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

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

Issue 8339003: Fix build breakage (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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 | « no previous file | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 119
120 // Collect all interfaces of the class 'cls' and check that every function 120 // Collect all interfaces of the class 'cls' and check that every function
121 // defined in each interface can be found in the class. 121 // defined in each interface can be found in the class.
122 // No need to check instance fields since they have been turned into 122 // No need to check instance fields since they have been turned into
123 // getters/setters. 123 // getters/setters.
124 void ClassFinalizer::VerifyClassImplements(const Class& cls) { 124 void ClassFinalizer::VerifyClassImplements(const Class& cls) {
125 ASSERT(!cls.is_interface()); 125 ASSERT(!cls.is_interface());
126 GrowableArray<const Class*> interfaces; 126 GrowableArray<const Class*> interfaces;
127 CollectInterfaces(cls, &interfaces); 127 CollectInterfaces(cls, &interfaces);
128 const String& class_name = String::Handle(cls.Name());
128 for (int i = 0; i < interfaces.length(); i++) { 129 for (int i = 0; i < interfaces.length(); i++) {
129 const String& interface_name = String::Handle(interfaces[i]->Name()); 130 const String& interface_name = String::Handle(interfaces[i]->Name());
130 const Array& interface_functions = 131 const Array& interface_functions =
131 Array::Handle(interfaces[i]->functions()); 132 Array::Handle(interfaces[i]->functions());
132 for (intptr_t f = 0; f < interface_functions.Length(); f++) { 133 for (intptr_t f = 0; f < interface_functions.Length(); f++) {
133 Function& interface_function = Function::Handle(); 134 Function& interface_function = Function::Handle();
134 interface_function ^= interface_functions.At(f); 135 interface_function ^= interface_functions.At(f);
135 const String& function_name = String::Handle(interface_function.name()); 136 const String& function_name = String::Handle(interface_function.name());
136 // Check for constructor/factory. 137 // Check for constructor/factory.
137 if (function_name.StartsWith(interface_name)) { 138 if (function_name.StartsWith(interface_name)) {
138 // TODO(srdjan): convert 'InterfaceName.' to 'ClassName.' and check. 139 // TODO(srdjan): convert 'InterfaceName.' to 'ClassName.' and check.
139 continue; 140 continue;
140 } 141 }
141 if (interface_function.kind() == RawFunction::kConstImplicitGetter) { 142 if (interface_function.kind() == RawFunction::kConstImplicitGetter) {
142 // This interface constants are not overridable. 143 // This interface constants are not overridable.
143 continue; 144 continue;
144 } 145 }
145 // Lookup function in 'cls' and all its super classes. 146 // Lookup function in 'cls' and all its super classes.
146 Class& test_class = Class::Handle(cls.raw()); 147 Class& test_class = Class::Handle(cls.raw());
147 Function& class_function = 148 Function& class_function =
148 Function::Handle(test_class.LookupDynamicFunction(function_name)); 149 Function::Handle(test_class.LookupDynamicFunction(function_name));
149 while (class_function.IsNull()) { 150 while (class_function.IsNull()) {
150 test_class = test_class.SuperClass(); 151 test_class = test_class.SuperClass();
151 if (test_class.IsNull()) break; 152 if (test_class.IsNull()) break;
152 class_function = test_class.LookupDynamicFunction(function_name); 153 class_function = test_class.LookupDynamicFunction(function_name);
153 } 154 }
154 if (class_function.IsNull()) { 155 if (class_function.IsNull()) {
155 const String& class_name = String::Handle(cls.Name());
156 OS::Print("%s implements '%s' missing: '%s'\n", 156 OS::Print("%s implements '%s' missing: '%s'\n",
157 class_name.ToCString(), 157 class_name.ToCString(),
158 interface_name.ToCString(), 158 interface_name.ToCString(),
159 function_name.ToCString()); 159 function_name.ToCString());
160 } else if (!class_function.IsSubtypeOf(interface_function)) { 160 } else if (class_function.IsSubtypeOf(interface_function)) {
161 const String& class_name = String::Handle(cls.Name());
162 OS::Print("The type of instance method '%s' in class '%s' is not a " 161 OS::Print("The type of instance method '%s' in class '%s' is not a "
163 "subtype of the type of '%s' in interface '%s'\n", 162 "subtype of the type of '%s' in interface '%s'\n",
164 function_name.ToCString(), 163 function_name.ToCString(),
165 class_name.ToCString(), 164 class_name.ToCString(),
166 function_name.ToCString(), 165 function_name.ToCString(),
167 interface_name.ToCString()); 166 interface_name.ToCString());
168 } 167 }
169 } 168 }
170 } 169 }
171 } 170 }
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 ASSERT(msg_buffer != NULL); 983 ASSERT(msg_buffer != NULL);
985 va_list args; 984 va_list args;
986 va_start(args, format); 985 va_start(args, format);
987 OS::VSNPrint(msg_buffer, kBufferLength, format, args); 986 OS::VSNPrint(msg_buffer, kBufferLength, format, args);
988 va_end(args); 987 va_end(args);
989 isolate->long_jump_base()->Jump(1, msg_buffer); 988 isolate->long_jump_base()->Jump(1, msg_buffer);
990 UNREACHABLE(); 989 UNREACHABLE();
991 } 990 }
992 991
993 } // namespace dart 992 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698