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.h" | 5 #include "vm/kernel.h" |
| 6 #include "vm/kernel_binary_flowgraph.h" |
6 | 7 |
7 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
8 namespace dart { | 9 namespace dart { |
9 | 10 |
10 namespace kernel {} // namespace kernel | 11 namespace kernel { |
| 12 |
| 13 bool FieldHasFunctionLiteralInitializer(const Field& field, |
| 14 TokenPosition* start, |
| 15 TokenPosition* end) { |
| 16 Zone* zone = Thread::Current()->zone(); |
| 17 const Script& script = Script::Handle(zone, field.Script()); |
| 18 |
| 19 TranslationHelper translation_helper( |
| 20 Thread::Current(), script.kernel_string_offsets(), |
| 21 script.kernel_string_data(), script.kernel_canonical_names()); |
| 22 |
| 23 StreamingFlowGraphBuilder builder( |
| 24 &translation_helper, zone, field.kernel_offset(), |
| 25 TypedData::Handle(zone, field.kernel_data())); |
| 26 kernel::FieldHelper field_helper(&builder); |
| 27 field_helper.ReadUntilExcluding(kernel::FieldHelper::kEnd, true); |
| 28 return field_helper.FieldHasFunctionLiteralInitializer(start, end); |
| 29 } |
| 30 |
| 31 } // namespace kernel |
11 | 32 |
12 } // namespace dart | 33 } // namespace dart |
13 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 34 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |