Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: runtime/vm/class_finalizer.cc

Issue 883263004: Allows turning on checked mode on a per-isolate basis (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698