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

Side by Side Diff: runtime/vm/code_generator_test.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/globals.h" 6 #include "vm/globals.h"
7 #include "vm/ast.h" 7 #include "vm/ast.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 ASSERT(!core_lib.IsNull()); 268 ASSERT(!core_lib.IsNull());
269 const Namespace& core_ns = Namespace::Handle( 269 const Namespace& core_ns = Namespace::Handle(
270 Namespace::New(core_lib, Array::Handle(), Array::Handle())); 270 Namespace::New(core_lib, Array::Handle(), Array::Handle()));
271 lib.AddImport(core_ns); 271 lib.AddImport(core_ns);
272 return lib; 272 return lib;
273 } 273 }
274 274
275 275
276 static RawClass* LookupClass(const Library& lib, const char* name) { 276 static RawClass* LookupClass(const Library& lib, const char* name) {
277 const String& cls_name = String::ZoneHandle(Symbols::New(name)); 277 const String& cls_name = String::ZoneHandle(Symbols::New(name));
278 String& ambiguity_error_msg = String::Handle(); 278 return lib.LookupClass(cls_name);
279 return lib.LookupClass(cls_name, &ambiguity_error_msg);
280 } 279 }
281 280
282 281
283 CODEGEN_TEST_GENERATE(StaticCallCodegen, test) { 282 CODEGEN_TEST_GENERATE(StaticCallCodegen, test) {
284 const char* kScriptChars = 283 const char* kScriptChars =
285 "class A {\n" 284 "class A {\n"
286 " static bar() { return 42; }\n" 285 " static bar() { return 42; }\n"
287 " static fly() { return 5; }\n" 286 " static fly() { return 5; }\n"
288 "}\n"; 287 "}\n";
289 288
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 DartEntry::InvokeFunction(function, Object::empty_array())); 553 DartEntry::InvokeFunction(function, Object::empty_array()));
555 EXPECT(!result.IsError()); 554 EXPECT(!result.IsError());
556 const GrowableObjectArray& libs = GrowableObjectArray::Handle( 555 const GrowableObjectArray& libs = GrowableObjectArray::Handle(
557 Isolate::Current()->object_store()->libraries()); 556 Isolate::Current()->object_store()->libraries());
558 ASSERT(!libs.IsNull()); 557 ASSERT(!libs.IsNull());
559 // App lib is the last one that was loaded. 558 // App lib is the last one that was loaded.
560 intptr_t num_libs = libs.Length(); 559 intptr_t num_libs = libs.Length();
561 Library& app_lib = Library::Handle(); 560 Library& app_lib = Library::Handle();
562 app_lib ^= libs.At(num_libs - 1); 561 app_lib ^= libs.At(num_libs - 1);
563 ASSERT(!app_lib.IsNull()); 562 ASSERT(!app_lib.IsNull());
564 String& ambiguity_error_msg = String::Handle();
565 const Class& cls = Class::Handle( 563 const Class& cls = Class::Handle(
566 app_lib.LookupClass(String::Handle(Symbols::New("A")), 564 app_lib.LookupClass(String::Handle(Symbols::New("A"))));
567 &ambiguity_error_msg));
568 EXPECT_EQ(cls.raw(), result.clazz()); // No ambiguity error expected. 565 EXPECT_EQ(cls.raw(), result.clazz()); // No ambiguity error expected.
regis 2013/09/09 21:29:07 ditto
hausner 2013/09/09 21:52:08 Done.
569 } 566 }
570 567
571 } // namespace dart 568 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698