Index: runtime/vm/parser.cc |
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
index 7763caebafa46d18c87a3665da8649eaa0d7f3eb..80e45eda4e766ec407edcb5f757bd7d676489615 100644 |
--- a/runtime/vm/parser.cc |
+++ b/runtime/vm/parser.cc |
@@ -43,6 +43,7 @@ DEFINE_FLAG(bool, enable_mirrors, true, |
DEFINE_FLAG(bool, load_deferred_eagerly, false, |
"Load deferred libraries eagerly."); |
DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); |
+DEFINE_FLAG(bool, supermixin, false, "Allow super calls in mixins."); |
DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); |
DECLARE_FLAG(bool, lazy_dispatchers); |
@@ -13218,12 +13219,14 @@ AstNode* Parser::ParsePrimary() { |
ReportError("class '%s' does not have a superclass", |
String::Handle(Z, current_class().Name()).ToCString()); |
} |
- if (current_class().IsMixinApplication()) { |
- const Type& mixin_type = Type::Handle(Z, current_class().mixin()); |
- if (mixin_type.type_class() == current_function().origin()) { |
- ReportError("method of mixin class '%s' may not refer to 'super'", |
- String::Handle(Z, Class::Handle(Z, |
- current_function().origin()).Name()).ToCString()); |
+ if (!FLAG_supermixin) { |
+ if (current_class().IsMixinApplication()) { |
+ const Type& mixin_type = Type::Handle(Z, current_class().mixin()); |
+ if (mixin_type.type_class() == current_function().origin()) { |
+ ReportError("method of mixin class '%s' may not refer to 'super'", |
+ String::Handle(Z, Class::Handle(Z, |
+ current_function().origin()).Name()).ToCString()); |
+ } |
} |
} |
const intptr_t super_pos = TokenPos(); |