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

Unified Diff: runtime/vm/parser.cc

Issue 1232613005: Allow super calls in mixins (for now behind a --supermixin flag). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 5 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
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/language/language_analyzer.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/language/language_analyzer.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698