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

Side by Side Diff: pkg/analyzer/lib/src/summary/prelink.dart

Issue 2678273007: When a name is both exported and defined locally, the name is defined. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | pkg/analyzer/test/src/summary/resynthesize_common.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:analyzer/src/generated/utilities_dart.dart'; 5 import 'package:analyzer/src/generated/utilities_dart.dart';
6 import 'package:analyzer/src/summary/format.dart'; 6 import 'package:analyzer/src/summary/format.dart';
7 import 'package:analyzer/src/summary/idl.dart'; 7 import 'package:analyzer/src/summary/idl.dart';
8 import 'package:analyzer/src/summary/name_filter.dart'; 8 import 'package:analyzer/src/summary/name_filter.dart';
9 9
10 /** 10 /**
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 unitNum, dependency, name.numTypeParameters, namespace)); 277 unitNum, dependency, name.numTypeParameters, namespace));
278 } else { 278 } else {
279 aggregated.add( 279 aggregated.add(
280 name.name, 280 name.name,
281 new _Meaning( 281 new _Meaning(
282 unitNum, name.kind, dependency, name.numTypeParameters)); 282 unitNum, name.kind, dependency, name.numTypeParameters));
283 } 283 }
284 } 284 }
285 } 285 }
286 286
287 aggregated.rememberLibraryNames();
288
287 dependencyToPublicNamespace.add(aggregated); 289 dependencyToPublicNamespace.add(aggregated);
288 return aggregated; 290 return aggregated;
289 } 291 }
290 292
291 /** 293 /**
292 * Compute the export namespace for the library whose URI is reachable from 294 * Compute the export namespace for the library whose URI is reachable from
293 * [definingUnit] via [relativeUri], by aggregating together public namespace 295 * [definingUnit] via [relativeUri], by aggregating together public namespace
294 * information from the library and the transitive closure of its exports. 296 * information from the library and the transitive closure of its exports.
295 * 297 *
296 * If [relativeUri] is `null` (meaning the export namespace of [definingUnit] 298 * If [relativeUri] is `null` (meaning the export namespace of [definingUnit]
(...skipping 10 matching lines...) Expand all
307 getImportCached(relativeUri); 309 getImportCached(relativeUri);
308 if (exportedNamespace != null) { 310 if (exportedNamespace != null) {
309 for (UnlinkedExportPublic export in exportedNamespace.exports) { 311 for (UnlinkedExportPublic export in exportedNamespace.exports) {
310 String relativeExportUri = 312 String relativeExportUri =
311 _selectUri(export.uri, export.configurations); 313 _selectUri(export.uri, export.configurations);
312 String exportUri = resolveUri(relativeUri, relativeExportUri); 314 String exportUri = resolveUri(relativeUri, relativeExportUri);
313 NameFilter newFilter = filter.merge( 315 NameFilter newFilter = filter.merge(
314 new NameFilter.forUnlinkedCombinators(export.combinators)); 316 new NameFilter.forUnlinkedCombinators(export.combinators));
315 aggregatePublicNamespace(exportUri) 317 aggregatePublicNamespace(exportUri)
316 .forEach((String name, _Meaning meaning) { 318 .forEach((String name, _Meaning meaning) {
317 if (newFilter.accepts(name)) { 319 if (newFilter.accepts(name) &&
320 !exportNamespace.definesLibraryName(name)) {
318 exportNamespace.add(name, meaning); 321 exportNamespace.add(name, meaning);
319 } 322 }
320 }); 323 });
321 chaseExports(newFilter, exportUri, seenUris); 324 chaseExports(newFilter, exportUri, seenUris);
322 } 325 }
323 } 326 }
324 seenUris.remove(relativeUri); 327 seenUris.remove(relativeUri);
325 } 328 }
326 } 329 }
327 330
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 String _selectUri( 607 String _selectUri(
605 String defaultUri, List<UnlinkedConfiguration> configurations) { 608 String defaultUri, List<UnlinkedConfiguration> configurations) {
606 for (UnlinkedConfiguration configuration in configurations) { 609 for (UnlinkedConfiguration configuration in configurations) {
607 if (getDeclaredVariable(configuration.name) == configuration.value) { 610 if (getDeclaredVariable(configuration.name) == configuration.value) {
608 return configuration.uri; 611 return configuration.uri;
609 } 612 }
610 } 613 }
611 return defaultUri; 614 return defaultUri;
612 } 615 }
613 } 616 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698