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

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

Issue 9233039: Store resolved library prefix in unresolved class object in order not to repeat (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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 | runtime/vm/class_finalizer_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) 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 OS::Print("VerifyBootstrapClasses END.\n"); 254 OS::Print("VerifyBootstrapClasses END.\n");
255 } 255 }
256 Isolate::Current()->heap()->Verify(); 256 Isolate::Current()->heap()->Verify();
257 } 257 }
258 258
259 259
260 // Resolve unresolved_class in the library of cls. 260 // Resolve unresolved_class in the library of cls.
261 RawClass* ClassFinalizer::ResolveClass( 261 RawClass* ClassFinalizer::ResolveClass(
262 const Class& cls, const UnresolvedClass& unresolved_class) { 262 const Class& cls, const UnresolvedClass& unresolved_class) {
263 Library& lib = Library::Handle(); 263 Library& lib = Library::Handle();
264 if (unresolved_class.qualifier() == String::null()) { 264 if (unresolved_class.library_prefix() == LibraryPrefix::null()) {
265 lib = cls.library(); 265 lib = cls.library();
266 } else { 266 } else {
267 const String& qualifier = String::Handle(unresolved_class.qualifier());
268 LibraryPrefix& lib_prefix = LibraryPrefix::Handle(); 267 LibraryPrefix& lib_prefix = LibraryPrefix::Handle();
269 lib_prefix = cls.LookupLibraryPrefix(qualifier); 268 lib_prefix = unresolved_class.library_prefix();
270 if (lib_prefix.IsNull()) { 269 ASSERT(!lib_prefix.IsNull());
271 const Script& script = Script::Handle(cls.script());
272 ReportError(script, unresolved_class.token_index(),
273 "cannot resolve library prefix '%s' from '%s'.\n",
274 qualifier.ToCString(),
275 String::Handle(cls.Name()).ToCString());
276 }
277 lib = lib_prefix.library(); 270 lib = lib_prefix.library();
278 } 271 }
279 ASSERT(!lib.IsNull()); 272 ASSERT(!lib.IsNull());
280 const String& class_name = String::Handle(unresolved_class.ident()); 273 const String& class_name = String::Handle(unresolved_class.ident());
281 const Class& resolved_class = Class::Handle(lib.LookupClass(class_name)); 274 const Class& resolved_class = Class::Handle(lib.LookupClass(class_name));
282 if (resolved_class.IsNull()) { 275 if (resolved_class.IsNull()) {
283 const Script& script = Script::Handle(cls.script()); 276 const Script& script = Script::Handle(cls.script());
284 ReportError(script, unresolved_class.token_index(), 277 ReportError(script, unresolved_class.token_index(),
285 "cannot resolve class name '%s' from '%s'.\n", 278 "cannot resolve class name '%s' from '%s'.\n",
286 String::Handle(unresolved_class.Name()).ToCString(), 279 String::Handle(unresolved_class.Name()).ToCString(),
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 va_end(args); 1272 va_end(args);
1280 if (FLAG_warning_as_error) { 1273 if (FLAG_warning_as_error) {
1281 Isolate::Current()->long_jump_base()->Jump(1, error); 1274 Isolate::Current()->long_jump_base()->Jump(1, error);
1282 UNREACHABLE(); 1275 UNREACHABLE();
1283 } else { 1276 } else {
1284 OS::Print("%s", error.ToErrorCString()); 1277 OS::Print("%s", error.ToErrorCString());
1285 } 1278 }
1286 } 1279 }
1287 1280
1288 } // namespace dart 1281 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/class_finalizer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698