OLD | NEW |
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 library fasta.prefix_builder; | 5 library fasta.prefix_builder; |
6 | 6 |
7 import 'builder.dart' show Builder, LibraryBuilder, MemberBuilder; | 7 import 'builder.dart' show Builder, LibraryBuilder, MemberBuilder; |
8 | 8 |
9 import '../messages.dart' show warning; | 9 import '../messages.dart' show warning; |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 return builder.member.isInstanceMember | 36 return builder.member.isInstanceMember |
37 ? internalError("Unexpected instance member in export scope") | 37 ? internalError("Unexpected instance member in export scope") |
38 : builder.member; | 38 : builder.member; |
39 } else if (builder is MemberBuilder) { | 39 } else if (builder is MemberBuilder) { |
40 return builder.target; | 40 return builder.target; |
41 } else { | 41 } else { |
42 return null; | 42 return null; |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 Builder combineAmbiguousImport( | |
47 String name, Builder other, LibraryBuilder library) { | |
48 if (other is PrefixBuilder) { | |
49 /// Handles the case where the same prefix is used for different imports. | |
50 other.exports.forEach((String name, Builder member) { | |
51 Builder existing = exports[name]; | |
52 if (existing != null) { | |
53 member = existing.combineAmbiguousImport(name, member, library); | |
54 } | |
55 exports[name] = member; | |
56 }); | |
57 return this; | |
58 } | |
59 return super.combineAmbiguousImport(name, other, library); | |
60 } | |
61 | |
62 @override | 46 @override |
63 String get fullNameForErrors => name; | 47 String get fullNameForErrors => name; |
64 } | 48 } |
OLD | NEW |