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

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

Issue 19662003: Refactor resolution code in the vm to properly handle ambiguity errors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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) 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 5
6 #include "vm/ast_printer.h" 6 #include "vm/ast_printer.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/longjump.h" 8 #include "vm/longjump.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/parser.h" 10 #include "vm/parser.h"
11 #include "vm/symbols.h" 11 #include "vm/symbols.h"
12 #include "vm/unit_test.h" 12 #include "vm/unit_test.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 16
17 void DumpFunction(const Library& lib, const char* cname, const char* fname) { 17 void DumpFunction(const Library& lib, const char* cname, const char* fname) {
18 const String& classname = String::Handle(Symbols::New(cname)); 18 const String& classname = String::Handle(Symbols::New(cname));
19 Class& cls = Class::Handle(lib.LookupClass(classname)); 19 Class& cls = Class::Handle(lib.LookupClass(classname, NULL));
20 EXPECT(!cls.IsNull()); 20 EXPECT(!cls.IsNull());
siva 2013/07/22 22:21:46 Ditto comment in these tests.
regis 2013/07/22 23:51:27 Done.
21 21
22 String& funcname = String::Handle(String::New(fname)); 22 String& funcname = String::Handle(String::New(fname));
23 Function& function = Function::ZoneHandle(cls.LookupStaticFunction(funcname)); 23 Function& function = Function::ZoneHandle(cls.LookupStaticFunction(funcname));
24 EXPECT(!function.IsNull()); 24 EXPECT(!function.IsNull());
25 25
26 bool retval; 26 bool retval;
27 Isolate* isolate = Isolate::Current(); 27 Isolate* isolate = Isolate::Current();
28 EXPECT(isolate != NULL); 28 EXPECT(isolate != NULL);
29 LongJump* base = isolate->long_jump_base(); 29 LongJump* base = isolate->long_jump_base();
30 LongJump jump; 30 LongJump jump;
(...skipping 12 matching lines...) Expand all
43 isolate->set_long_jump_base(base); 43 isolate->set_long_jump_base(base);
44 } 44 }
45 45
46 46
47 void CheckField(const Library& lib, 47 void CheckField(const Library& lib,
48 const char* class_name, 48 const char* class_name,
49 const char* field_name, 49 const char* field_name,
50 bool expect_static, 50 bool expect_static,
51 bool is_final) { 51 bool is_final) {
52 const String& classname = String::Handle(Symbols::New(class_name)); 52 const String& classname = String::Handle(Symbols::New(class_name));
53 Class& cls = Class::Handle(lib.LookupClass(classname)); 53 Class& cls = Class::Handle(lib.LookupClass(classname, NULL));
54 EXPECT(!cls.IsNull()); 54 EXPECT(!cls.IsNull());
55 55
56 String& fieldname = String::Handle(String::New(field_name)); 56 String& fieldname = String::Handle(String::New(field_name));
57 String& functionname = String::Handle(); 57 String& functionname = String::Handle();
58 Function& function = Function::Handle(); 58 Function& function = Function::Handle();
59 Field& field = Field::Handle(); 59 Field& field = Field::Handle();
60 if (expect_static) { 60 if (expect_static) {
61 field ^= cls.LookupStaticField(fieldname); 61 field ^= cls.LookupStaticField(fieldname);
62 functionname ^= Field::GetterName(fieldname); 62 functionname ^= Field::GetterName(fieldname);
63 function ^= cls.LookupStaticFunction(functionname); 63 function ^= cls.LookupStaticFunction(functionname);
(...skipping 14 matching lines...) Expand all
78 78
79 EXPECT_EQ(field.is_static(), expect_static); 79 EXPECT_EQ(field.is_static(), expect_static);
80 } 80 }
81 81
82 82
83 void CheckFunction(const Library& lib, 83 void CheckFunction(const Library& lib,
84 const char* class_name, 84 const char* class_name,
85 const char* function_name, 85 const char* function_name,
86 bool expect_static) { 86 bool expect_static) {
87 const String& classname = String::Handle(Symbols::New(class_name)); 87 const String& classname = String::Handle(Symbols::New(class_name));
88 Class& cls = Class::Handle(lib.LookupClass(classname)); 88 Class& cls = Class::Handle(lib.LookupClass(classname, NULL));
89 EXPECT(!cls.IsNull()); 89 EXPECT(!cls.IsNull());
90 90
91 String& functionname = String::Handle(String::New(function_name)); 91 String& functionname = String::Handle(String::New(function_name));
92 Function& function = Function::Handle(); 92 Function& function = Function::Handle();
93 if (expect_static) { 93 if (expect_static) {
94 function ^= cls.LookupStaticFunction(functionname); 94 function ^= cls.LookupStaticFunction(functionname);
95 } else { 95 } else {
96 function ^= cls.LookupDynamicFunction(functionname); 96 function ^= cls.LookupDynamicFunction(functionname);
97 } 97 }
98 EXPECT(!function.IsNull()); 98 EXPECT(!function.IsNull());
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 Parser::ParseCompilationUnit(lib, script); 160 Parser::ParseCompilationUnit(lib, script);
161 EXPECT(ClassFinalizer::FinalizePendingClasses()); 161 EXPECT(ClassFinalizer::FinalizePendingClasses());
162 162
163 DumpFunction(lib, "A", "foo"); 163 DumpFunction(lib, "A", "foo");
164 DumpFunction(lib, "A", "bar"); 164 DumpFunction(lib, "A", "bar");
165 DumpFunction(lib, "A", "baz"); 165 DumpFunction(lib, "A", "baz");
166 DumpFunction(lib, "B", "bam"); 166 DumpFunction(lib, "B", "bam");
167 } 167 }
168 168
169 } // namespace dart 169 } // namespace dart
OLDNEW
« runtime/vm/object.cc ('K') | « runtime/vm/parser.cc ('k') | runtime/vm/resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698