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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 664 intptr_t kind = static_cast<int>(kernel_procedure->kind()); | 664 intptr_t kind = static_cast<int>(kernel_procedure->kind()); |
| 665 if (kind == Procedure::kIncompleteProcedure) { | 665 if (kind == Procedure::kIncompleteProcedure) { |
| 666 return RawFunction::kSignatureFunction; | 666 return RawFunction::kSignatureFunction; |
| 667 } else { | 667 } else { |
| 668 ASSERT(0 <= kind && kind <= Procedure::kFactory); | 668 ASSERT(0 <= kind && kind <= Procedure::kFactory); |
| 669 return static_cast<RawFunction::Kind>(lookuptable[kind]); | 669 return static_cast<RawFunction::Kind>(lookuptable[kind]); |
| 670 } | 670 } |
| 671 } | 671 } |
| 672 | 672 |
| 673 | 673 |
| 674 ParsedFunction* ParseStaticFieldInitializer(Zone* zone, | |
| 675 const dart::Field& field) { | |
| 676 Thread* thread = Thread::Current(); | |
| 677 kernel::Field* kernel_field = kernel::Field::Cast( | |
| 678 reinterpret_cast<kernel::Node*>(field.kernel_field())); | |
| 679 const dart::String& init_name = dart::String::Handle( | |
| 680 zone, Symbols::FromConcat(thread, Symbols::InitPrefix(), | |
| 681 dart::String::Handle(zone, field.name()))); | |
|
kustermann
2016/11/18 18:38:15
You could use just one String::Handle and reuse it
Vyacheslav Egorov (Google)
2016/11/18 18:48:45
Done.
| |
| 682 | |
| 683 // Create a static initializer. | |
| 684 const dart::Class& owner = dart::Class::Handle(zone, field.Owner()); | |
| 685 const Function& initializer_fun = Function::ZoneHandle( | |
| 686 zone, | |
| 687 dart::Function::New(init_name, RawFunction::kImplicitStaticFinalGetter, | |
| 688 true, // is_static | |
| 689 false, // is_const | |
| 690 false, // is_abstract | |
| 691 false, // is_external | |
| 692 false, // is_native | |
| 693 owner, TokenPosition::kNoSource)); | |
| 694 initializer_fun.set_kernel_function(kernel_field); | |
| 695 initializer_fun.set_result_type(AbstractType::Handle(zone, field.type())); | |
| 696 initializer_fun.set_is_debuggable(false); | |
| 697 initializer_fun.set_is_reflectable(false); | |
| 698 initializer_fun.set_is_inlinable(false); | |
| 699 return new (zone) ParsedFunction(thread, initializer_fun); | |
| 700 } | |
| 701 | |
| 702 | |
| 674 } // namespace kernel | 703 } // namespace kernel |
| 675 } // namespace dart | 704 } // namespace dart |
| 676 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 705 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |