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

Unified Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 1262163002: Implement DEP 34 (less restricted mixins) in analysis engine. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
Index: pkg/analyzer/lib/src/generated/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 8d88bc100935a24b95f00f37c3ff1ebbab4bc35c..9e25a8555177d3ccadb652fa0a579bd458f18448 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -255,10 +255,16 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
List<InterfaceType> _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT;
/**
+ * If `true`, mixins are allowed to inherit from types other than Object, and
+ * are allowed to reference `super`.
+ */
+ final bool enableSuperMixins;
+
+ /**
* Initialize a newly created error verifier.
*/
ErrorVerifier(this._errorReporter, this._currentLibrary, this._typeProvider,
- this._inheritanceManager) {
+ this._inheritanceManager, this.enableSuperMixins) {
this._isInSystemLibrary = _currentLibrary.source.isInSystemLibrary;
this._hasExtUri = _currentLibrary.hasExtUri;
_isEnclosingConstructorConst = false;
@@ -1651,7 +1657,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
if (_checkForMixinDeclaresConstructor(mixinName, mixinElement)) {
problemReported = true;
}
- if (_checkForMixinInheritsNotFromObject(mixinName, mixinElement)) {
+ if (!enableSuperMixins &&
+ _checkForMixinInheritsNotFromObject(mixinName, mixinElement)) {
problemReported = true;
}
if (_checkForMixinReferencesSuper(mixinName, mixinElement)) {
@@ -4209,7 +4216,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
*/
bool _checkForMixinReferencesSuper(
TypeName mixinName, ClassElement mixinElement) {
- if (mixinElement.hasReferenceToSuper) {
+ if (!enableSuperMixins && mixinElement.hasReferenceToSuper) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.MIXIN_REFERENCES_SUPER, mixinName,
[mixinElement.name]);
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/lib/src/generated/incremental_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698