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

Unified Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 1119973003: Fix NPE when analyzing Object (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/dart.dart
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
index ddd3bcd295a851bc6bcc1c7a55489a337109eb27..dc1db29d13ea65749fff5c1b0e978eb328ece069 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -334,7 +334,6 @@ class BuildClassConstructorsTask extends SourceBasedAnalysisTask {
ClassElementImpl classElement = this.target;
List<ConstructorElement> superConstructors = inputs[SUPER_CONSTRUCTORS];
DartType superType = classElement.supertype;
- ClassElement superElement = superType.element;
//
// Shortcut for ClassElement(s) without implicit constructors.
//
@@ -359,7 +358,7 @@ class BuildClassConstructorsTask extends SourceBasedAnalysisTask {
errors.add(new AnalysisError.con2(classElement.source,
classElement.nameOffset, classElement.name.length,
CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS,
- [superElement.name]));
+ [superType.element.name]));
} else {
classElement.constructors = implicitConstructors;
}
@@ -381,7 +380,7 @@ class BuildClassConstructorsTask extends SourceBasedAnalysisTask {
SourceRange withRange = classElement.withClauseRange;
errors.add(new AnalysisError.con2(classElement.source, withRange.offset,
withRange.length, CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS,
- [superElement.name]));
+ [superType.element.name]));
classElement.mixinErrorsReported = true;
}
outputs[CONSTRUCTORS] = classElement.constructors;
@@ -469,7 +468,7 @@ class BuildClassConstructorsTask extends SourceBasedAnalysisTask {
* [superType], to the class or mixin application [classElement],
* and pass information about them to [callback].
*
- * Return true if some constructors were considered. (A false return value
+ * Return `true` if some constructors were considered. (A `false` return value
* can only happen if the supeclass is a built-in type, in which case it
* can't be used as a mixin anyway).
*/
@@ -477,6 +476,9 @@ class BuildClassConstructorsTask extends SourceBasedAnalysisTask {
InterfaceType superType, void callback(
ConstructorElement explicitConstructor, List<DartType> parameterTypes,
List<DartType> argumentTypes)) {
+ if (superType == null) {
+ return false;
+ }
ClassElement superclassElement = superType.element;
List<ConstructorElement> constructors = superclassElement.constructors;
int count = constructors.length;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698