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

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

Issue 471283002: Runtime support for evaluation of static field initializer expressions (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/ast_transformer.cc ('k') | runtime/vm/code_generator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 /* is_static = */ true, 1378 /* is_static = */ true,
1379 /* is_const = */ field.is_const(), 1379 /* is_const = */ field.is_const(),
1380 /* is_abstract = */ false, 1380 /* is_abstract = */ false,
1381 /* is_external = */ false, 1381 /* is_external = */ false,
1382 /* is_native = */ false, 1382 /* is_native = */ false,
1383 cls, 1383 cls,
1384 field.token_pos())); 1384 field.token_pos()));
1385 getter.set_result_type(type); 1385 getter.set_result_type(type);
1386 cls.AddFunction(getter); 1386 cls.AddFunction(getter);
1387 field.set_value(Instance::Handle(Object::sentinel().raw())); 1387 field.set_value(Instance::Handle(Object::sentinel().raw()));
1388
1389 // Create initializer function.
1390 if (!field.is_const()) {
1391 const Function& init_function = Function::ZoneHandle(
1392 Function::NewStaticInitializer(field));
1393 cls.AddFunction(init_function);
1394 }
1395 } 1388 }
1396 } 1389 }
1397 } 1390 }
1398 } 1391 }
1399 // Collect interfaces, super interfaces, and super classes of this class. 1392 // Collect interfaces, super interfaces, and super classes of this class.
1400 const GrowableObjectArray& interfaces = 1393 const GrowableObjectArray& interfaces =
1401 GrowableObjectArray::Handle(GrowableObjectArray::New()); 1394 GrowableObjectArray::Handle(GrowableObjectArray::New());
1402 CollectInterfaces(cls, interfaces); 1395 CollectInterfaces(cls, interfaces);
1403 // Include superclasses in list of interfaces and super interfaces. 1396 // Include superclasses in list of interfaces and super interfaces.
1404 super_class = cls.SuperClass(); 1397 super_class = cls.SuperClass();
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); 3071 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields());
3079 field ^= fields_array.At(0); 3072 field ^= fields_array.At(0);
3080 ASSERT(field.Offset() == ByteBuffer::data_offset()); 3073 ASSERT(field.Offset() == ByteBuffer::data_offset());
3081 name ^= field.name(); 3074 name ^= field.name();
3082 expected_name ^= String::New("_data"); 3075 expected_name ^= String::New("_data");
3083 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 3076 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
3084 #endif 3077 #endif
3085 } 3078 }
3086 3079
3087 } // namespace dart 3080 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/ast_transformer.cc ('k') | runtime/vm/code_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698