Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/kernel_reader.h" | 5 #include "vm/kernel_reader.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 555 array_object ^= AsSortedDuplicateFreeArray( | 555 array_object ^= AsSortedDuplicateFreeArray( |
| 556 source_uri_index, &program_->yield_token_positions); | 556 source_uri_index, &program_->yield_token_positions); |
| 557 script.set_yield_positions(array_object); | 557 script.set_yield_positions(array_object); |
| 558 } | 558 } |
| 559 return script; | 559 return script; |
| 560 } | 560 } |
| 561 | 561 |
| 562 void KernelReader::GenerateFieldAccessors(const dart::Class& klass, | 562 void KernelReader::GenerateFieldAccessors(const dart::Class& klass, |
| 563 const dart::Field& field, | 563 const dart::Field& field, |
| 564 Field* kernel_field) { | 564 Field* kernel_field) { |
| 565 if (kernel_field->IsStatic() && kernel_field->initializer() == NULL) { | |
| 566 field.SetStaticValue(Instance::Handle(Z), true); | |
|
Kevin Millikin (Google)
2017/03/22 14:11:26
Comment:
// Static fields without an initializer
| |
| 567 return; | |
| 568 } | |
| 565 if (kernel_field->initializer() != NULL) { | 569 if (kernel_field->initializer() != NULL) { |
| 566 SimpleExpressionConverter converter(H.thread()); | 570 SimpleExpressionConverter converter(H.thread()); |
| 567 const bool has_simple_initializer = | 571 const bool has_simple_initializer = |
| 568 converter.IsSimple(kernel_field->initializer()); | 572 converter.IsSimple(kernel_field->initializer()); |
| 569 if (kernel_field->IsStatic()) { | 573 if (kernel_field->IsStatic()) { |
| 570 // Static fields with initializers either have the static value set to the | 574 // Static fields with initializers either have the static value set to the |
| 571 // initializer value if it is simple enough or else set to an | 575 // initializer value if it is simple enough or else set to an |
| 572 // uninitialized sentinel. | 576 // uninitialized sentinel. |
| 573 if (has_simple_initializer) { | 577 if (has_simple_initializer) { |
| 574 // We do not need a getter. | 578 // We do not need a getter. |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 830 initializer_fun.set_is_debuggable(false); | 834 initializer_fun.set_is_debuggable(false); |
| 831 initializer_fun.set_is_reflectable(false); | 835 initializer_fun.set_is_reflectable(false); |
| 832 initializer_fun.set_is_inlinable(false); | 836 initializer_fun.set_is_inlinable(false); |
| 833 return new (zone) ParsedFunction(thread, initializer_fun); | 837 return new (zone) ParsedFunction(thread, initializer_fun); |
| 834 } | 838 } |
| 835 | 839 |
| 836 | 840 |
| 837 } // namespace kernel | 841 } // namespace kernel |
| 838 } // namespace dart | 842 } // namespace dart |
| 839 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 843 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |