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

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

Issue 2655713002: Fix prelinker when a local name shadows an import prefix. (Closed)
Patch Set: Created 3 years, 11 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/generated/compile_time_error_code_driver_test.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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 /** 345 /**
346 * Filter the export namespace for the library whose URI is reachable from 346 * Filter the export namespace for the library whose URI is reachable from
347 * [definingUnit] via [relativeUri], retaining only those names accepted by 347 * [definingUnit] via [relativeUri], retaining only those names accepted by
348 * [combinators], and store the resulting names in [result]. Names that 348 * [combinators], and store the resulting names in [result]. Names that
349 * already exist in [result] are not overwritten. 349 * already exist in [result] are not overwritten.
350 */ 350 */
351 void filterExportNamespace(String relativeUri, 351 void filterExportNamespace(String relativeUri,
352 List<UnlinkedCombinator> combinators, Map<String, _Meaning> result) { 352 List<UnlinkedCombinator> combinators, Map<String, _Meaning> result) {
353 Map<String, _Meaning> exportNamespace = computeExportNamespace(relativeUri); 353 Map<String, _Meaning> exportNamespace = computeExportNamespace(relativeUri);
354 if (result == null) {
355 // This can happen if the import prefix was shadowed by a local name, so
356 // the imported symbols are inaccessible.
357 return;
358 }
354 NameFilter filter = new NameFilter.forUnlinkedCombinators(combinators); 359 NameFilter filter = new NameFilter.forUnlinkedCombinators(combinators);
355 exportNamespace.forEach((String name, _Meaning meaning) { 360 exportNamespace.forEach((String name, _Meaning meaning) {
356 if (filter.accepts(name) && !result.containsKey(name)) { 361 if (filter.accepts(name) && !result.containsKey(name)) {
357 result[name] = meaning; 362 result[name] = meaning;
358 } 363 }
359 }); 364 });
360 } 365 }
361 366
362 /** 367 /**
363 * Wrapper around [getImport] that caches the return value in [importCache]. 368 * Wrapper around [getImport] that caches the return value in [importCache].
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 String _selectUri( 540 String _selectUri(
536 String defaultUri, List<UnlinkedConfiguration> configurations) { 541 String defaultUri, List<UnlinkedConfiguration> configurations) {
537 for (UnlinkedConfiguration configuration in configurations) { 542 for (UnlinkedConfiguration configuration in configurations) {
538 if (getDeclaredVariable(configuration.name) == configuration.value) { 543 if (getDeclaredVariable(configuration.name) == configuration.value) {
539 return configuration.uri; 544 return configuration.uri;
540 } 545 }
541 } 546 }
542 return defaultUri; 547 return defaultUri;
543 } 548 }
544 } 549 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698