Chromium Code Reviews| Index: runtime/vm/class_finalizer.cc |
| =================================================================== |
| --- runtime/vm/class_finalizer.cc (revision 43426) |
| +++ runtime/vm/class_finalizer.cc (working copy) |
| @@ -25,6 +25,17 @@ |
| DECLARE_FLAG(bool, enable_type_checks); |
| DECLARE_FLAG(bool, use_cha); |
| + |
| +static bool ErrorOnBadTypeEnabled() { |
| + return FLAG_error_on_bad_type || Isolate::Current()->checked_mode(); |
|
regis
2015/02/03 22:23:17
--checked does not include --error-on-bad-type or
|
| +} |
| + |
| + |
| +static bool ErrorOnBadOverrideEnabled() { |
| + return FLAG_error_on_bad_override || Isolate::Current()->checked_mode(); |
| +} |
| + |
| + |
| bool ClassFinalizer::AllClassesFinalized() { |
| ObjectStore* object_store = Isolate::Current()->object_store(); |
| const GrowableObjectArray& classes = |
| @@ -373,7 +384,7 @@ |
| return; |
| } |
| - if (FLAG_error_on_bad_override) { |
| + if (ErrorOnBadOverrideEnabled()) { |
| // Verify that the target is compatible with the redirecting factory. |
| Error& error = Error::Handle(); |
| if (!target.HasCompatibleParametersWith(factory, &error)) { |
| @@ -983,7 +994,7 @@ |
| TypeArguments::Handle(isolate, parameterized_type.arguments()); |
| if (!arguments.IsNull() && (arguments.Length() != num_type_parameters)) { |
| // Wrong number of type arguments. The type is mapped to the raw type. |
| - if (FLAG_error_on_bad_type) { |
| + if (ErrorOnBadTypeEnabled()) { |
| const String& type_class_name = |
| String::Handle(isolate, type_class.Name()); |
| ReportError(cls, parameterized_type.token_pos(), |
| @@ -1354,7 +1365,7 @@ |
| !const_value.IsInstanceOf(type, |
| Object::null_type_arguments(), |
| &error))) { |
| - if (FLAG_error_on_bad_type) { |
| + if (ErrorOnBadTypeEnabled()) { |
| const AbstractType& const_value_type = AbstractType::Handle( |
| I, const_value.GetType()); |
| const String& const_value_type_name = String::Handle( |
| @@ -1417,7 +1428,7 @@ |
| function ^= array.At(i); |
| ResolveAndFinalizeSignature(cls, function); |
| name = function.name(); |
| - if (FLAG_error_on_bad_override && // Report signature conflicts only. |
| + if (ErrorOnBadOverrideEnabled() && // Report signature conflicts only. |
| !function.is_static() && !function.IsConstructor()) { |
| // A constructor cannot override anything. |
| for (intptr_t i = 0; i < interfaces.Length(); i++) { |
| @@ -2565,7 +2576,7 @@ |
| } |
| return; |
| } |
| - if (FLAG_error_on_bad_type) { |
| + if (ErrorOnBadTypeEnabled()) { |
| const String& type_class_name = String::Handle(type_class.Name()); |
| ReportError(cls, type.token_pos(), |
| "wrong number of type arguments for class '%s'", |
| @@ -2988,7 +2999,7 @@ |
| prev_error, script, type.token_pos(), |
| Report::kMalformedType, Heap::kOld, |
| format, args)); |
| - if (FLAG_error_on_bad_type) { |
| + if (ErrorOnBadTypeEnabled()) { |
| ReportError(error); |
| } |
| type.set_error(error); |
| @@ -3050,7 +3061,7 @@ |
| Report::kMalboundedType, Heap::kOld, |
| format, args)); |
| va_end(args); |
| - if (FLAG_error_on_bad_type) { |
| + if (ErrorOnBadTypeEnabled()) { |
| ReportError(error); |
| } |
| type.set_error(error); |