Move the check for 'locals hides exports' to DillLibraryBuilder.buildAmbiguousBuilder().

R=ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2893383002 .
This commit is contained in:
Konstantin Shcheglov 2017-05-22 13:07:40 -07:00
parent 79b4382784
commit 5139a1f85c
2 changed files with 8 additions and 5 deletions

View file

@ -98,11 +98,6 @@ abstract class LibraryBuilder<T extends TypeBuilder, R> extends Builder {
Builder existing = map[name];
if (existing == member) return false;
if (existing != null) {
// For each entry mapping key `k` to declaration `d` in `NS` an entry
// mapping `k` to `d` is added to the exported namespace of `L` unless a
// top-level declaration with the name `k` exists in `L`.
if (existing.parent == this) return false;
Builder result =
buildAmbiguousBuilder(name, existing, member, -1, isExport: true);
map[name] = result;

View file

@ -24,6 +24,7 @@ import '../errors.dart' show internalError;
import '../kernel/kernel_builder.dart'
show
Builder,
InvalidTypeBuilder,
KernelInvalidTypeBuilder,
KernelTypeBuilder,
LibraryBuilder,
@ -120,6 +121,13 @@ class DillLibraryBuilder extends LibraryBuilder<KernelTypeBuilder, Library> {
Builder buildAmbiguousBuilder(
String name, Builder builder, Builder other, int charOffset,
{bool isExport: false, bool isImport: false}) {
if (builder == other) return builder;
if (builder is InvalidTypeBuilder) return builder;
if (other is InvalidTypeBuilder) return other;
// For each entry mapping key `k` to declaration `d` in `NS` an entry
// mapping `k` to `d` is added to the exported namespace of `L` unless a
// top-level declaration with the name `k` exists in `L`.
if (builder.parent == this) return builder;
return new KernelInvalidTypeBuilder(name, charOffset, fileUri);
}