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/class_finalizer.h" | 5 #include "vm/class_finalizer.h" |
6 | 6 |
7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
8 #include "vm/heap.h" | 8 #include "vm/heap.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 /* is_const = */ field.is_const(), | 1213 /* is_const = */ field.is_const(), |
1214 /* is_abstract = */ false, | 1214 /* is_abstract = */ false, |
1215 /* is_external = */ false, | 1215 /* is_external = */ false, |
1216 cls, | 1216 cls, |
1217 field.token_pos())); | 1217 field.token_pos())); |
1218 getter.set_result_type(type); | 1218 getter.set_result_type(type); |
1219 cls.AddFunction(getter); | 1219 cls.AddFunction(getter); |
1220 field.set_value(Instance::Handle(Object::sentinel().raw())); | 1220 field.set_value(Instance::Handle(Object::sentinel().raw())); |
1221 | 1221 |
1222 // Create initializer function. | 1222 // Create initializer function. |
1223 // We don't have the start position of the initializer expression | 1223 if (!field.is_const()) { |
1224 // here, but can compute it from the field identifier position: | 1224 const Function& init_function = Function::ZoneHandle( |
1225 // The initializer expression starts after the assignment token at +2. | 1225 Function::NewStaticInitializer(field)); |
1226 const intptr_t initializer_pos = field.token_pos() + 2; | 1226 cls.AddFunction(init_function); |
1227 const Function& init_function = Function::ZoneHandle( | 1227 } |
1228 Function::NewStaticInitializer( | |
1229 String::Handle(field.name()), | |
1230 type, | |
1231 cls, | |
1232 initializer_pos)); | |
1233 cls.AddFunction(init_function); | |
1234 } | 1228 } |
1235 } | 1229 } |
1236 } | 1230 } |
1237 } | 1231 } |
1238 // Collect interfaces, super interfaces, and super classes of this class. | 1232 // Collect interfaces, super interfaces, and super classes of this class. |
1239 const GrowableObjectArray& interfaces = | 1233 const GrowableObjectArray& interfaces = |
1240 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 1234 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
1241 CollectInterfaces(cls, interfaces); | 1235 CollectInterfaces(cls, interfaces); |
1242 // Include superclasses in list of interfaces and super interfaces. | 1236 // Include superclasses in list of interfaces and super interfaces. |
1243 super_class = cls.SuperClass(); | 1237 super_class = cls.SuperClass(); |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2764 expected_name ^= String::New("_offset"); | 2758 expected_name ^= String::New("_offset"); |
2765 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 2759 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
2766 field ^= fields_array.At(2); | 2760 field ^= fields_array.At(2); |
2767 ASSERT(field.Offset() == TypedDataView::length_offset()); | 2761 ASSERT(field.Offset() == TypedDataView::length_offset()); |
2768 name ^= field.name(); | 2762 name ^= field.name(); |
2769 ASSERT(name.Equals("length")); | 2763 ASSERT(name.Equals("length")); |
2770 #endif | 2764 #endif |
2771 } | 2765 } |
2772 | 2766 |
2773 } // namespace dart | 2767 } // namespace dart |
OLD | NEW |