| OLD | NEW |
| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 if (FLAG_trace_class_finalization) { | 253 if (FLAG_trace_class_finalization) { |
| 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 const String& class_name = String::Handle(unresolved_class.ident()); |
| 263 Library& lib = Library::Handle(); | 264 Library& lib = Library::Handle(); |
| 265 Class& resolved_class = Class::Handle(); |
| 264 if (unresolved_class.library_prefix() == LibraryPrefix::null()) { | 266 if (unresolved_class.library_prefix() == LibraryPrefix::null()) { |
| 265 lib = cls.library(); | 267 lib = cls.library(); |
| 268 resolved_class = lib.LookupClass(class_name); |
| 266 } else { | 269 } else { |
| 267 LibraryPrefix& lib_prefix = LibraryPrefix::Handle(); | 270 LibraryPrefix& lib_prefix = LibraryPrefix::Handle(); |
| 268 lib_prefix = unresolved_class.library_prefix(); | 271 lib_prefix = unresolved_class.library_prefix(); |
| 269 ASSERT(!lib_prefix.IsNull()); | 272 ASSERT(!lib_prefix.IsNull()); |
| 270 lib = lib_prefix.library(); | 273 lib = lib_prefix.library(); |
| 274 resolved_class = lib.LookupLocalClass(class_name); |
| 271 } | 275 } |
| 272 ASSERT(!lib.IsNull()); | |
| 273 const String& class_name = String::Handle(unresolved_class.ident()); | |
| 274 const Class& resolved_class = Class::Handle(lib.LookupClass(class_name)); | |
| 275 if (resolved_class.IsNull()) { | 276 if (resolved_class.IsNull()) { |
| 276 const Script& script = Script::Handle(cls.script()); | 277 const Script& script = Script::Handle(cls.script()); |
| 277 ReportError(script, unresolved_class.token_index(), | 278 ReportError(script, unresolved_class.token_index(), |
| 278 "cannot resolve class name '%s' from '%s'.\n", | 279 "cannot resolve class name '%s' from '%s'.\n", |
| 279 String::Handle(unresolved_class.Name()).ToCString(), | 280 String::Handle(unresolved_class.Name()).ToCString(), |
| 280 String::Handle(cls.Name()).ToCString()); | 281 String::Handle(cls.Name()).ToCString()); |
| 281 } | 282 } |
| 282 return resolved_class.raw(); | 283 return resolved_class.raw(); |
| 283 } | 284 } |
| 284 | 285 |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 va_end(args); | 1224 va_end(args); |
| 1224 if (FLAG_warning_as_error) { | 1225 if (FLAG_warning_as_error) { |
| 1225 Isolate::Current()->long_jump_base()->Jump(1, error); | 1226 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 1226 UNREACHABLE(); | 1227 UNREACHABLE(); |
| 1227 } else { | 1228 } else { |
| 1228 OS::Print("%s", error.ToErrorCString()); | 1229 OS::Print("%s", error.ToErrorCString()); |
| 1229 } | 1230 } |
| 1230 } | 1231 } |
| 1231 | 1232 |
| 1232 } // namespace dart | 1233 } // namespace dart |
| OLD | NEW |