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

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

Issue 2812673002: Add missing checks for null imported/exportedLibraries. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/element_resolver.dart ('k') | no next file » | 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 analyzer.src.generated.resolver; 5 library analyzer.src.generated.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 } 2097 }
2098 2098
2099 @override 2099 @override
2100 Object visitExportDirective(ExportDirective node) { 2100 Object visitExportDirective(ExportDirective node) {
2101 ExportElement exportElement = node.element; 2101 ExportElement exportElement = node.element;
2102 if (exportElement != null) { 2102 if (exportElement != null) {
2103 // The element is null when the URI is invalid 2103 // The element is null when the URI is invalid
2104 LibraryElement library = exportElement.exportedLibrary; 2104 LibraryElement library = exportElement.exportedLibrary;
2105 if (library != null && !library.isSynthetic) { 2105 if (library != null && !library.isSynthetic) {
2106 for (Combinator combinator in node.combinators) { 2106 for (Combinator combinator in node.combinators) {
2107 _checkCombinator(exportElement.exportedLibrary, combinator); 2107 _checkCombinator(library, combinator);
2108 } 2108 }
2109 } 2109 }
2110 } 2110 }
2111 return super.visitExportDirective(node); 2111 return super.visitExportDirective(node);
2112 } 2112 }
2113 2113
2114 @override 2114 @override
2115 Object visitIfStatement(IfStatement node) { 2115 Object visitIfStatement(IfStatement node) {
2116 Expression conditionExpression = node.condition; 2116 Expression conditionExpression = node.condition;
2117 conditionExpression?.accept(this); 2117 conditionExpression?.accept(this);
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
4075 } 4075 }
4076 } 4076 }
4077 } 4077 }
4078 } 4078 }
4079 4079
4080 /** 4080 /**
4081 * Recursively add any exported library elements into the [libraryMap]. 4081 * Recursively add any exported library elements into the [libraryMap].
4082 */ 4082 */
4083 void _addAdditionalLibrariesForExports(LibraryElement library, 4083 void _addAdditionalLibrariesForExports(LibraryElement library,
4084 ImportDirective importDirective, Set<LibraryElement> visitedLibraries) { 4084 ImportDirective importDirective, Set<LibraryElement> visitedLibraries) {
4085 if (!visitedLibraries.add(library)) { 4085 if (library == null || !visitedLibraries.add(library)) {
4086 return; 4086 return;
4087 } 4087 }
4088 List<ExportElement> exports = library.exports; 4088 List<ExportElement> exports = library.exports;
4089 int length = exports.length; 4089 int length = exports.length;
4090 for (int i = 0; i < length; i++) { 4090 for (int i = 0; i < length; i++) {
4091 ExportElement exportElt = exports[i]; 4091 ExportElement exportElt = exports[i];
4092 LibraryElement exportedLibrary = exportElt.exportedLibrary; 4092 LibraryElement exportedLibrary = exportElt.exportedLibrary;
4093 _putIntoLibraryMap(exportedLibrary, importDirective); 4093 _putIntoLibraryMap(exportedLibrary, importDirective);
4094 _addAdditionalLibrariesForExports( 4094 _addAdditionalLibrariesForExports(
4095 exportedLibrary, importDirective, visitedLibraries); 4095 exportedLibrary, importDirective, visitedLibraries);
(...skipping 6831 matching lines...) Expand 10 before | Expand all | Expand 10 after
10927 return null; 10927 return null;
10928 } 10928 }
10929 if (identical(node.staticElement, variable)) { 10929 if (identical(node.staticElement, variable)) {
10930 if (node.inSetterContext()) { 10930 if (node.inSetterContext()) {
10931 result = true; 10931 result = true;
10932 } 10932 }
10933 } 10933 }
10934 return null; 10934 return null;
10935 } 10935 }
10936 } 10936 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/element_resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698