OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/parser.h" | 5 #include "vm/parser.h" |
6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
7 | 7 |
8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
9 | 9 |
10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
(...skipping 4016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4027 method->has_native, | 4027 method->has_native, |
4028 current_class(), | 4028 current_class(), |
4029 method->decl_begin_pos)); | 4029 method->decl_begin_pos)); |
4030 func.set_result_type(*method->type); | 4030 func.set_result_type(*method->type); |
4031 func.set_end_token_pos(method_end_pos); | 4031 func.set_end_token_pos(method_end_pos); |
4032 func.set_is_redirecting(is_redirecting); | 4032 func.set_is_redirecting(is_redirecting); |
4033 func.set_modifier(async_modifier); | 4033 func.set_modifier(async_modifier); |
4034 if (library_.is_dart_scheme() && library_.IsPrivate(*method->name)) { | 4034 if (library_.is_dart_scheme() && library_.IsPrivate(*method->name)) { |
4035 func.set_is_reflectable(false); | 4035 func.set_is_reflectable(false); |
4036 } | 4036 } |
| 4037 if (is_patch_source() && IsPatchAnnotation(method->metadata_pos)) { |
| 4038 // Currently, we just ignore the patch annotation. If the function |
| 4039 // name already exists in the patched class, this function will replace |
| 4040 // the one in the patched class. |
| 4041 method->metadata_pos = TokenPosition::kNoSource; |
| 4042 } |
4037 if (FLAG_enable_mirrors && (method->metadata_pos.IsReal())) { | 4043 if (FLAG_enable_mirrors && (method->metadata_pos.IsReal())) { |
4038 library_.AddFunctionMetadata(func, method->metadata_pos); | 4044 library_.AddFunctionMetadata(func, method->metadata_pos); |
4039 } | 4045 } |
4040 if (method->has_native) { | 4046 if (method->has_native) { |
4041 func.set_native_name(*native_name); | 4047 func.set_native_name(*native_name); |
4042 } | 4048 } |
4043 | 4049 |
4044 // If this method is a redirecting factory, set the redirection information. | 4050 // If this method is a redirecting factory, set the redirection information. |
4045 if (!redirection_type.IsNull()) { | 4051 if (!redirection_type.IsNull()) { |
4046 ASSERT(func.IsFactory()); | 4052 ASSERT(func.IsFactory()); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4127 field->has_static, | 4133 field->has_static, |
4128 field->has_final, | 4134 field->has_final, |
4129 field->has_const, | 4135 field->has_const, |
4130 is_reflectable, | 4136 is_reflectable, |
4131 current_class(), | 4137 current_class(), |
4132 *field->type, | 4138 *field->type, |
4133 field->name_pos); | 4139 field->name_pos); |
4134 class_field.set_has_initializer(has_initializer); | 4140 class_field.set_has_initializer(has_initializer); |
4135 members->AddField(class_field); | 4141 members->AddField(class_field); |
4136 field->field_ = &class_field; | 4142 field->field_ = &class_field; |
| 4143 if (is_patch_source() && IsPatchAnnotation(field->metadata_pos)) { |
| 4144 // Currently, we just ignore the patch annotation on fields. |
| 4145 // All fields in the patch class are added to the patched class. |
| 4146 field->metadata_pos = TokenPosition::kNoSource; |
| 4147 } |
4137 if (FLAG_enable_mirrors && (field->metadata_pos.IsReal())) { | 4148 if (FLAG_enable_mirrors && (field->metadata_pos.IsReal())) { |
4138 library_.AddFieldMetadata(class_field, field->metadata_pos); | 4149 library_.AddFieldMetadata(class_field, field->metadata_pos); |
4139 } | 4150 } |
4140 | 4151 |
4141 // Start tracking types for fields with simple initializers in their | 4152 // Start tracking types for fields with simple initializers in their |
4142 // definition. This avoids some of the overhead to track this at runtime | 4153 // definition. This avoids some of the overhead to track this at runtime |
4143 // and rules out many fields from being unnecessary unboxing candidates. | 4154 // and rules out many fields from being unnecessary unboxing candidates. |
4144 if (!field->has_static && has_initializer && has_simple_literal) { | 4155 if (!field->has_static && has_initializer && has_simple_literal) { |
4145 class_field.RecordStore(init_value); | 4156 class_field.RecordStore(init_value); |
4146 if (!init_value.IsNull() && init_value.IsDouble()) { | 4157 if (!init_value.IsNull() && init_value.IsDouble()) { |
(...skipping 10618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14765 const ArgumentListNode& function_args, | 14776 const ArgumentListNode& function_args, |
14766 const LocalVariable* temp_for_last_arg, | 14777 const LocalVariable* temp_for_last_arg, |
14767 bool is_super_invocation) { | 14778 bool is_super_invocation) { |
14768 UNREACHABLE(); | 14779 UNREACHABLE(); |
14769 return NULL; | 14780 return NULL; |
14770 } | 14781 } |
14771 | 14782 |
14772 } // namespace dart | 14783 } // namespace dart |
14773 | 14784 |
14774 #endif // DART_PRECOMPILED_RUNTIME | 14785 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |