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 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1211 RawFunction::kImplicitStaticFinalGetter, | 1211 RawFunction::kImplicitStaticFinalGetter, |
1212 /* is_static = */ true, | 1212 /* is_static = */ true, |
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 | |
1222 // Create initializer function. | |
1223 // We don't have the start position of the initializer expression | |
1224 // here, but can compute it from the field identifier position: | |
1225 // The initializer expression starts after the assignment token at +2. | |
1226 const intptr_t initializer_pos = field.token_pos() + 2; | |
hausner
2013/10/31 21:53:47
The + 2 is incorrect. The token position is a byte
Florian Schneider
2013/11/01 10:23:42
Oops, yes that will go wrong. I'll fix it. I think
| |
1227 const Function& init_function = Function::ZoneHandle( | |
1228 Function::NewStaticInitializer( | |
1229 String::Handle(field.name()), | |
1230 type, | |
1231 cls, | |
1232 initializer_pos)); | |
1233 cls.AddFunction(init_function); | |
1221 } | 1234 } |
1222 } | 1235 } |
1223 } | 1236 } |
1224 } | 1237 } |
1225 // Collect interfaces, super interfaces, and super classes of this class. | 1238 // Collect interfaces, super interfaces, and super classes of this class. |
1226 const GrowableObjectArray& interfaces = | 1239 const GrowableObjectArray& interfaces = |
1227 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 1240 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
1228 CollectInterfaces(cls, interfaces); | 1241 CollectInterfaces(cls, interfaces); |
1229 // Include superclasses in list of interfaces and super interfaces. | 1242 // Include superclasses in list of interfaces and super interfaces. |
1230 super_class = cls.SuperClass(); | 1243 super_class = cls.SuperClass(); |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2751 expected_name ^= String::New("_offset"); | 2764 expected_name ^= String::New("_offset"); |
2752 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 2765 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
2753 field ^= fields_array.At(2); | 2766 field ^= fields_array.At(2); |
2754 ASSERT(field.Offset() == TypedDataView::length_offset()); | 2767 ASSERT(field.Offset() == TypedDataView::length_offset()); |
2755 name ^= field.name(); | 2768 name ^= field.name(); |
2756 ASSERT(name.Equals("length")); | 2769 ASSERT(name.Equals("length")); |
2757 #endif | 2770 #endif |
2758 } | 2771 } |
2759 | 2772 |
2760 } // namespace dart | 2773 } // namespace dart |
OLD | NEW |