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

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

Issue 1868803002: Use symbols when looking up fields in a class (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
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/debugger.h" 8 #include "vm/debugger.h"
9 #include "vm/longjump.h" 9 #include "vm/longjump.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 bool is_final) { 58 bool is_final) {
59 const String& classname = String::Handle(Symbols::New(class_name)); 59 const String& classname = String::Handle(Symbols::New(class_name));
60 Class& cls = Class::Handle(lib.LookupClass(classname)); 60 Class& cls = Class::Handle(lib.LookupClass(classname));
61 EXPECT(!cls.IsNull()); 61 EXPECT(!cls.IsNull());
62 62
63 String& fieldname = String::Handle(String::New(field_name)); 63 String& fieldname = String::Handle(String::New(field_name));
64 String& functionname = String::Handle(); 64 String& functionname = String::Handle();
65 Function& function = Function::Handle(); 65 Function& function = Function::Handle();
66 Field& field = Field::Handle(); 66 Field& field = Field::Handle();
67 if (expect_static) { 67 if (expect_static) {
68 field ^= cls.LookupStaticField(fieldname); 68 field ^= cls.LookupStaticFieldAllowPrivate(fieldname);
69 functionname ^= Field::GetterName(fieldname); 69 functionname ^= Field::GetterName(fieldname);
70 function ^= cls.LookupStaticFunction(functionname); 70 function ^= cls.LookupStaticFunction(functionname);
71 EXPECT(function.IsNull()); 71 EXPECT(function.IsNull());
72 functionname ^= Field::SetterName(fieldname); 72 functionname ^= Field::SetterName(fieldname);
73 function ^= cls.LookupStaticFunction(functionname); 73 function ^= cls.LookupStaticFunction(functionname);
74 EXPECT(function.IsNull()); 74 EXPECT(function.IsNull());
75 } else { 75 } else {
76 field ^= cls.LookupInstanceField(fieldname); 76 field ^= cls.LookupInstanceFieldAllowPrivate(fieldname);
77 functionname ^= Field::GetterName(fieldname); 77 functionname ^= Field::GetterName(fieldname);
78 function ^= cls.LookupDynamicFunction(functionname); 78 function ^= cls.LookupDynamicFunction(functionname);
79 EXPECT(!function.IsNull()); 79 EXPECT(!function.IsNull());
80 functionname ^= Field::SetterName(fieldname); 80 functionname ^= Field::SetterName(fieldname);
81 function ^= cls.LookupDynamicFunction(functionname); 81 function ^= cls.LookupDynamicFunction(functionname);
82 EXPECT(is_final ? function.IsNull() : !function.IsNull()); 82 EXPECT(is_final ? function.IsNull() : !function.IsNull());
83 } 83 }
84 EXPECT(!field.IsNull()); 84 EXPECT(!field.IsNull());
85 85
86 EXPECT_EQ(field.is_static(), expect_static); 86 EXPECT_EQ(field.is_static(), expect_static);
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 " name=:current_context_var\n" 570 " name=:current_context_var\n"
571 " 1 ContextLevel level=1 scope=2 begin=3 end=79\n" 571 " 1 ContextLevel level=1 scope=2 begin=3 end=79\n"
572 " 2 ContextVar level=1 begin=9 end=79 name=x\n" 572 " 2 ContextVar level=1 begin=9 end=79 name=x\n"
573 " 3 StackVar scope=2 begin=11 end=79 name=b\n", 573 " 3 StackVar scope=2 begin=11 end=79 name=b\n",
574 CaptureVarsAtLine(lib, "a", 10)); 574 CaptureVarsAtLine(lib, "a", 10));
575 } 575 }
576 576
577 #endif // !PRODUCT 577 #endif // !PRODUCT
578 578
579 } // namespace dart 579 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698