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

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

Issue 23484020: Update handling of ambiguous name references (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
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/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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 if (FLAG_trace_class_finalization) { 248 if (FLAG_trace_class_finalization) {
249 OS::Print("VerifyBootstrapClasses END.\n"); 249 OS::Print("VerifyBootstrapClasses END.\n");
250 } 250 }
251 Isolate::Current()->heap()->Verify(); 251 Isolate::Current()->heap()->Verify();
252 } 252 }
253 253
254 254
255 // Resolve unresolved_class in the library of cls, or return null. 255 // Resolve unresolved_class in the library of cls, or return null.
256 RawClass* ClassFinalizer::ResolveClass(const Class& cls, 256 RawClass* ClassFinalizer::ResolveClass(const Class& cls,
257 const UnresolvedClass& unresolved_class, 257 const UnresolvedClass& unresolved_class,
258 Error* ambiguity_error) { 258 Error* ambiguity_error) {
regis 2013/09/09 21:29:07 Remove this unused parameter ambiguity_error.
hausner 2013/09/09 21:52:08 Done.
259 const String& class_name = String::Handle(unresolved_class.ident()); 259 const String& class_name = String::Handle(unresolved_class.ident());
260 Library& lib = Library::Handle(); 260 Library& lib = Library::Handle();
261 Class& resolved_class = Class::Handle(); 261 Class& resolved_class = Class::Handle();
262 String& ambiguity_error_msg = String::Handle();
263 if (unresolved_class.library_prefix() == LibraryPrefix::null()) { 262 if (unresolved_class.library_prefix() == LibraryPrefix::null()) {
264 lib = cls.library(); 263 lib = cls.library();
265 ASSERT(!lib.IsNull()); 264 ASSERT(!lib.IsNull());
266 resolved_class = lib.LookupClass(class_name, &ambiguity_error_msg); 265 resolved_class = lib.LookupClass(class_name);
267 } else { 266 } else {
268 LibraryPrefix& lib_prefix = LibraryPrefix::Handle(); 267 LibraryPrefix& lib_prefix = LibraryPrefix::Handle();
269 lib_prefix = unresolved_class.library_prefix(); 268 lib_prefix = unresolved_class.library_prefix();
270 ASSERT(!lib_prefix.IsNull()); 269 ASSERT(!lib_prefix.IsNull());
271 resolved_class = lib_prefix.LookupClass(class_name, &ambiguity_error_msg); 270 resolved_class = lib_prefix.LookupClass(class_name);
272 }
273 if (resolved_class.IsNull() && !ambiguity_error_msg.IsNull()) {
274 const Script& script = Script::Handle(cls.script());
275 *ambiguity_error = Parser::FormatErrorMsg(
276 script, unresolved_class.token_pos(), "Error",
277 "%s", ambiguity_error_msg.ToCString());
278 } 271 }
279 return resolved_class.raw(); 272 return resolved_class.raw();
280 } 273 }
281 274
282 275
283 276
284 void ClassFinalizer::ResolveRedirectingFactory(const Class& cls, 277 void ClassFinalizer::ResolveRedirectingFactory(const Class& cls,
285 const Function& factory) { 278 const Function& factory) {
286 const Function& target = Function::Handle(factory.RedirectionTarget()); 279 const Function& target = Function::Handle(factory.RedirectionTarget());
287 if (target.IsNull()) { 280 if (target.IsNull()) {
(...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after
2327 expected_name ^= String::New("_offset"); 2320 expected_name ^= String::New("_offset");
2328 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 2321 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
2329 field ^= fields_array.At(2); 2322 field ^= fields_array.At(2);
2330 ASSERT(field.Offset() == TypedDataView::length_offset()); 2323 ASSERT(field.Offset() == TypedDataView::length_offset());
2331 name ^= field.name(); 2324 name ^= field.name();
2332 ASSERT(name.Equals("length")); 2325 ASSERT(name.Equals("length"));
2333 #endif 2326 #endif
2334 } 2327 }
2335 2328
2336 } // namespace dart 2329 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698