OLD | NEW |
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 "vm/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2731 | 2731 |
2732 | 2732 |
2733 RawField* Class::LookupField(const String& name, intptr_t type) const { | 2733 RawField* Class::LookupField(const String& name, intptr_t type) const { |
2734 Isolate* isolate = Isolate::Current(); | 2734 Isolate* isolate = Isolate::Current(); |
2735 if (EnsureIsFinalized(isolate) != Error::null()) { | 2735 if (EnsureIsFinalized(isolate) != Error::null()) { |
2736 return Field::null(); | 2736 return Field::null(); |
2737 } | 2737 } |
2738 ReusableHandleScope reused_handles(isolate); | 2738 ReusableHandleScope reused_handles(isolate); |
2739 Array& flds = reused_handles.ArrayHandle(); | 2739 Array& flds = reused_handles.ArrayHandle(); |
2740 flds ^= fields(); | 2740 flds ^= fields(); |
| 2741 if (flds.IsNull()) { |
| 2742 // This can occur, e.g., for Null classes. |
| 2743 return Field::null(); |
| 2744 } |
2741 Field& field = reused_handles.FieldHandle(); | 2745 Field& field = reused_handles.FieldHandle(); |
2742 String& field_name = reused_handles.StringHandle(); | 2746 String& field_name = reused_handles.StringHandle(); |
2743 intptr_t len = flds.Length(); | 2747 intptr_t len = flds.Length(); |
2744 for (intptr_t i = 0; i < len; i++) { | 2748 for (intptr_t i = 0; i < len; i++) { |
2745 field ^= flds.At(i); | 2749 field ^= flds.At(i); |
2746 field_name ^= field.name(); | 2750 field_name ^= field.name(); |
2747 if (String::EqualsIgnoringPrivateKey(field_name, name)) { | 2751 if (String::EqualsIgnoringPrivateKey(field_name, name)) { |
2748 if (type == kInstance) { | 2752 if (type == kInstance) { |
2749 if (!field.is_static()) { | 2753 if (!field.is_static()) { |
2750 return field.raw(); | 2754 return field.raw(); |
(...skipping 11408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14159 } | 14163 } |
14160 | 14164 |
14161 | 14165 |
14162 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14166 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
14163 stream->OpenObject(); | 14167 stream->OpenObject(); |
14164 stream->CloseObject(); | 14168 stream->CloseObject(); |
14165 } | 14169 } |
14166 | 14170 |
14167 | 14171 |
14168 } // namespace dart | 14172 } // namespace dart |
OLD | NEW |