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

Side by Side Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 707073002: Fix analyzer's treatment of mixin constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improve error message. Created 6 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library engine.resolver.error_verifier; 5 library engine.resolver.error_verifier;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'java_engine.dart'; 10 import 'java_engine.dart';
(...skipping 3976 matching lines...) Expand 10 before | Expand all | Expand 10 after
3987 return false; 3987 return false;
3988 } 3988 }
3989 ClassElement superElement = superType.element; 3989 ClassElement superElement = superType.element;
3990 // try to find default generative super constructor 3990 // try to find default generative super constructor
3991 ConstructorElement superUnnamedConstructor = superElement.unnamedConstructor ; 3991 ConstructorElement superUnnamedConstructor = superElement.unnamedConstructor ;
3992 if (superUnnamedConstructor != null) { 3992 if (superUnnamedConstructor != null) {
3993 if (superUnnamedConstructor.isFactory) { 3993 if (superUnnamedConstructor.isFactory) {
3994 _errorReporter.reportErrorForNode(CompileTimeErrorCode.NON_GENERATIVE_CO NSTRUCTOR, node.name, [superUnnamedConstructor]); 3994 _errorReporter.reportErrorForNode(CompileTimeErrorCode.NON_GENERATIVE_CO NSTRUCTOR, node.name, [superUnnamedConstructor]);
3995 return true; 3995 return true;
3996 } 3996 }
3997 if (superUnnamedConstructor.isDefaultConstructor) { 3997 if (superUnnamedConstructor.isDefaultConstructor &&
3998 _enclosingClass.isSuperConstructorAccessible(
3999 superUnnamedConstructor)) {
3998 return true; 4000 return true;
3999 } 4001 }
4000 } 4002 }
4001 // report problem 4003 // report problem
4002 _errorReporter.reportErrorForNode(CompileTimeErrorCode.NO_DEFAULT_SUPER_CONS TRUCTOR_IMPLICIT, node.name, [superType.displayName]); 4004 _errorReporter.reportErrorForNode(CompileTimeErrorCode.NO_DEFAULT_SUPER_CONS TRUCTOR_IMPLICIT, node.name, [superType.displayName]);
4003 return true; 4005 return true;
4004 } 4006 }
4005 4007
4006 /** 4008 /**
4007 * This checks that passed class declaration overrides all members required by its superclasses 4009 * This checks that passed class declaration overrides all members required by its superclasses
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
4838 if (superType == null) { 4840 if (superType == null) {
4839 return false; 4841 return false;
4840 } 4842 }
4841 ClassElement superElement = superType.element; 4843 ClassElement superElement = superType.element;
4842 ConstructorElement superUnnamedConstructor = superElement.unnamedConstructor ; 4844 ConstructorElement superUnnamedConstructor = superElement.unnamedConstructor ;
4843 if (superUnnamedConstructor != null) { 4845 if (superUnnamedConstructor != null) {
4844 if (superUnnamedConstructor.isFactory) { 4846 if (superUnnamedConstructor.isFactory) {
4845 _errorReporter.reportErrorForNode(CompileTimeErrorCode.NON_GENERATIVE_CO NSTRUCTOR, node.returnType, [superUnnamedConstructor]); 4847 _errorReporter.reportErrorForNode(CompileTimeErrorCode.NON_GENERATIVE_CO NSTRUCTOR, node.returnType, [superUnnamedConstructor]);
4846 return true; 4848 return true;
4847 } 4849 }
4848 if (!superUnnamedConstructor.isDefaultConstructor) { 4850 if (!superUnnamedConstructor.isDefaultConstructor ||
4851 !_enclosingClass.isSuperConstructorAccessible(
4852 superUnnamedConstructor)) {
4849 int offset; 4853 int offset;
4850 int length; 4854 int length;
4851 { 4855 {
4852 Identifier returnType = node.returnType; 4856 Identifier returnType = node.returnType;
4853 SimpleIdentifier name = node.name; 4857 SimpleIdentifier name = node.name;
4854 offset = returnType.offset; 4858 offset = returnType.offset;
4855 length = (name != null ? name.end : returnType.end) - offset; 4859 length = (name != null ? name.end : returnType.end) - offset;
4856 } 4860 }
4857 _errorReporter.reportErrorForOffset(CompileTimeErrorCode.NO_DEFAULT_SUPE R_CONSTRUCTOR_EXPLICIT, offset, length, [superType.displayName]); 4861 _errorReporter.reportErrorForOffset(CompileTimeErrorCode.NO_DEFAULT_SUPE R_CONSTRUCTOR_EXPLICIT, offset, length, [superType.displayName]);
4858 } 4862 }
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
5467 toCheck.add(type.element); 5471 toCheck.add(type.element);
5468 // type arguments 5472 // type arguments
5469 if (type is InterfaceType) { 5473 if (type is InterfaceType) {
5470 InterfaceType interfaceType = type; 5474 InterfaceType interfaceType = type;
5471 for (DartType typeArgument in interfaceType.typeArguments) { 5475 for (DartType typeArgument in interfaceType.typeArguments) {
5472 _addTypeToCheck(typeArgument); 5476 _addTypeToCheck(typeArgument);
5473 } 5477 }
5474 } 5478 }
5475 } 5479 }
5476 } 5480 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698