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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 DEFINE_FLAG(bool, warn_super, false, | 54 DEFINE_FLAG(bool, warn_super, false, |
55 "Warning if super initializer not last in initializer list."); | 55 "Warning if super initializer not last in initializer list."); |
56 DEFINE_FLAG(bool, warn_patch, false, "Warn on old-style patch syntax."); | 56 DEFINE_FLAG(bool, warn_patch, false, "Warn on old-style patch syntax."); |
57 DEFINE_FLAG(bool, await_is_keyword, false, | 57 DEFINE_FLAG(bool, await_is_keyword, false, |
58 "await and yield are treated as proper keywords in synchronous code."); | 58 "await and yield are treated as proper keywords in synchronous code."); |
59 DEFINE_FLAG(bool, assert_initializer, false, | 59 DEFINE_FLAG(bool, assert_initializer, false, |
60 "Allow asserts in initializer lists."); | 60 "Allow asserts in initializer lists."); |
61 | 61 |
62 DECLARE_FLAG(bool, profile_vm); | 62 DECLARE_FLAG(bool, profile_vm); |
63 DECLARE_FLAG(bool, trace_service); | 63 DECLARE_FLAG(bool, trace_service); |
| 64 DECLARE_FLAG(bool, ignore_patch_signature_mismatch); |
64 | 65 |
65 // Quick access to the current thread, isolate and zone. | 66 // Quick access to the current thread, isolate and zone. |
66 #define T (thread()) | 67 #define T (thread()) |
67 #define I (isolate()) | 68 #define I (isolate()) |
68 #define Z (zone()) | 69 #define Z (zone()) |
69 | 70 |
70 // Quick synthetic token position. | 71 // Quick synthetic token position. |
71 #define ST(token_pos) ((token_pos).ToSynthetic()) | 72 #define ST(token_pos) ((token_pos).ToSynthetic()) |
72 | 73 |
73 #if defined(DEBUG) | 74 #if defined(DEBUG) |
(...skipping 4650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4724 TypeArguments::Handle(Z, cls.type_parameters()); | 4725 TypeArguments::Handle(Z, cls.type_parameters()); |
4725 const int new_type_params_count = | 4726 const int new_type_params_count = |
4726 new_type_parameters.IsNull() ? 0 : new_type_parameters.Length(); | 4727 new_type_parameters.IsNull() ? 0 : new_type_parameters.Length(); |
4727 const int orig_type_params_count = | 4728 const int orig_type_params_count = |
4728 orig_type_parameters.IsNull() ? 0 : orig_type_parameters.Length(); | 4729 orig_type_parameters.IsNull() ? 0 : orig_type_parameters.Length(); |
4729 if (new_type_params_count != orig_type_params_count) { | 4730 if (new_type_params_count != orig_type_params_count) { |
4730 ReportError(classname_pos, | 4731 ReportError(classname_pos, |
4731 "class '%s' must be patched with identical type parameters", | 4732 "class '%s' must be patched with identical type parameters", |
4732 class_name.ToCString()); | 4733 class_name.ToCString()); |
4733 } | 4734 } |
4734 TypeParameter& new_type_param = TypeParameter::Handle(Z); | 4735 if (!FLAG_ignore_patch_signature_mismatch) { |
4735 TypeParameter& orig_type_param = TypeParameter::Handle(Z); | 4736 TypeParameter& new_type_param = TypeParameter::Handle(Z); |
4736 String& new_name = String::Handle(Z); | 4737 TypeParameter& orig_type_param = TypeParameter::Handle(Z); |
4737 String& orig_name = String::Handle(Z); | 4738 String& new_name = String::Handle(Z); |
4738 AbstractType& new_bound = AbstractType::Handle(Z); | 4739 String& orig_name = String::Handle(Z); |
4739 AbstractType& orig_bound = AbstractType::Handle(Z); | 4740 AbstractType& new_bound = AbstractType::Handle(Z); |
4740 for (int i = 0; i < new_type_params_count; i++) { | 4741 AbstractType& orig_bound = AbstractType::Handle(Z); |
4741 new_type_param ^= new_type_parameters.TypeAt(i); | 4742 for (int i = 0; i < new_type_params_count; i++) { |
4742 orig_type_param ^= orig_type_parameters.TypeAt(i); | 4743 new_type_param ^= new_type_parameters.TypeAt(i); |
4743 new_name = new_type_param.name(); | 4744 orig_type_param ^= orig_type_parameters.TypeAt(i); |
4744 orig_name = orig_type_param.name(); | 4745 new_name = new_type_param.name(); |
4745 if (!new_name.Equals(orig_name)) { | 4746 orig_name = orig_type_param.name(); |
4746 ReportError(new_type_param.token_pos(), | 4747 if (!new_name.Equals(orig_name)) { |
4747 "type parameter '%s' of patch class '%s' does not match " | 4748 ReportError(new_type_param.token_pos(), |
4748 "original type parameter '%s'", | 4749 "type parameter '%s' of patch class '%s' does not match " |
4749 new_name.ToCString(), | 4750 "original type parameter '%s'", |
4750 class_name.ToCString(), | 4751 new_name.ToCString(), |
4751 orig_name.ToCString()); | 4752 class_name.ToCString(), |
4752 } | 4753 orig_name.ToCString()); |
4753 new_bound = new_type_param.bound(); | 4754 } |
4754 orig_bound = orig_type_param.bound(); | 4755 new_bound = new_type_param.bound(); |
4755 if (!new_bound.Equals(orig_bound)) { | 4756 orig_bound = orig_type_param.bound(); |
4756 ReportError(new_type_param.token_pos(), | 4757 if (!new_bound.Equals(orig_bound)) { |
4757 "bound '%s' of type parameter '%s' of patch class '%s' " | 4758 ReportError(new_type_param.token_pos(), |
4758 "does not match original type parameter bound '%s'", | 4759 "bound '%s' of type parameter '%s' of patch class '%s' " |
4759 String::Handle(new_bound.UserVisibleName()).ToCString(), | 4760 "does not match original type parameter bound '%s'", |
4760 new_name.ToCString(), | 4761 String::Handle(new_bound.UserVisibleName()).ToCString(), |
4761 class_name.ToCString(), | 4762 new_name.ToCString(), |
4762 String::Handle(orig_bound.UserVisibleName()).ToCString()); | 4763 class_name.ToCString(), |
| 4764 String::Handle(orig_bound.UserVisibleName()).ToCString()); |
| 4765 } |
4763 } | 4766 } |
4764 } | 4767 } |
4765 cls.set_type_parameters(orig_type_parameters); | 4768 cls.set_type_parameters(orig_type_parameters); |
4766 } | 4769 } |
4767 | 4770 |
4768 if (is_abstract) { | 4771 if (is_abstract) { |
4769 cls.set_is_abstract(); | 4772 cls.set_is_abstract(); |
4770 } | 4773 } |
4771 if (FLAG_enable_mirrors && metadata_pos.IsReal()) { | 4774 if (FLAG_enable_mirrors && metadata_pos.IsReal()) { |
4772 library_.AddClassMetadata(cls, tl_owner, metadata_pos); | 4775 library_.AddClassMetadata(cls, tl_owner, metadata_pos); |
(...skipping 10321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15094 const ArgumentListNode& function_args, | 15097 const ArgumentListNode& function_args, |
15095 const LocalVariable* temp_for_last_arg, | 15098 const LocalVariable* temp_for_last_arg, |
15096 bool is_super_invocation) { | 15099 bool is_super_invocation) { |
15097 UNREACHABLE(); | 15100 UNREACHABLE(); |
15098 return NULL; | 15101 return NULL; |
15099 } | 15102 } |
15100 | 15103 |
15101 } // namespace dart | 15104 } // namespace dart |
15102 | 15105 |
15103 #endif // DART_PRECOMPILED_RUNTIME | 15106 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |