| OLD | NEW |
| 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/dart_api_impl.h" | 5 #include "vm/dart_api_impl.h" |
| 6 #include "vm/dart_api_state.h" | 6 #include "vm/dart_api_state.h" |
| 7 #include "vm/intermediate_language.h" | 7 #include "vm/intermediate_language.h" |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/unit_test.h" | 9 #include "vm/unit_test.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 RawField* LookupField(Dart_Handle library, const char* class_name, | 13 RawField* LookupField(Dart_Handle library, const char* class_name, |
| 14 const char* field_name) { | 14 const char* field_name) { |
| 15 RawLibrary* raw_library = Library::RawCast(Api::UnwrapHandle(library)); | 15 RawLibrary* raw_library = Library::RawCast(Api::UnwrapHandle(library)); |
| 16 Library& lib = Library::ZoneHandle(raw_library); | 16 Library& lib = Library::ZoneHandle(raw_library); |
| 17 const String& classname = String::Handle(Symbols::New(class_name)); | 17 const String& classname = String::Handle(Symbols::New(class_name)); |
| 18 String& ambiguity_error_msg = String::Handle(); | 18 Class& cls = Class::Handle(lib.LookupClass(classname)); |
| 19 Class& cls = Class::Handle(lib.LookupClass(classname, &ambiguity_error_msg)); | |
| 20 EXPECT(!cls.IsNull()); // No ambiguity error expected. | 19 EXPECT(!cls.IsNull()); // No ambiguity error expected. |
| 21 | 20 |
| 22 String& fieldname = String::Handle(String::New(field_name)); | 21 String& fieldname = String::Handle(String::New(field_name)); |
| 23 Field& field = Field::ZoneHandle(cls.LookupInstanceField(fieldname)); | 22 Field& field = Field::ZoneHandle(cls.LookupInstanceField(fieldname)); |
| 24 EXPECT(!field.IsNull()); | 23 EXPECT(!field.IsNull()); |
| 25 return field.raw(); | 24 return field.raw(); |
| 26 } | 25 } |
| 27 | 26 |
| 28 | 27 |
| 29 TEST_CASE(GuardFieldSimpleTest) { | 28 TEST_CASE(GuardFieldSimpleTest) { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 263 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 265 EXPECT_VALID(result); | 264 EXPECT_VALID(result); |
| 266 Field& f3 = Field::ZoneHandle(LookupField(lib, "A", "f3")); | 265 Field& f3 = Field::ZoneHandle(LookupField(lib, "A", "f3")); |
| 267 const intptr_t no_length = Field::kNoFixedLength; | 266 const intptr_t no_length = Field::kNoFixedLength; |
| 268 EXPECT_EQ(no_length, f3.guarded_list_length()); | 267 EXPECT_EQ(no_length, f3.guarded_list_length()); |
| 269 EXPECT_EQ(kTypedDataFloat32ArrayCid, f3.guarded_cid()); | 268 EXPECT_EQ(kTypedDataFloat32ArrayCid, f3.guarded_cid()); |
| 270 EXPECT_EQ(false, f3.is_nullable()); | 269 EXPECT_EQ(false, f3.is_nullable()); |
| 271 } | 270 } |
| 272 | 271 |
| 273 } // namespace dart | 272 } // namespace dart |
| OLD | NEW |