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.dill_library_builder; | 5 library fasta.dill_library_builder; |
6 | 6 |
7 import 'dart:convert' show JSON; | 7 import 'dart:convert' show JSON; |
8 | 8 |
9 import 'package:kernel/ast.dart' | 9 import 'package:kernel/ast.dart' |
10 show | 10 show |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 | 141 |
142 @override | 142 @override |
143 String get fullNameForErrors { | 143 String get fullNameForErrors { |
144 return library.name ?? "<library '${library.fileUri}'>"; | 144 return library.name ?? "<library '${library.fileUri}'>"; |
145 } | 145 } |
146 | 146 |
147 void finalizeExports() { | 147 void finalizeExports() { |
148 if (additionalExports != null) { | 148 if (additionalExports != null) { |
149 for (List<String> additionalExport in additionalExports) { | 149 for (List<String> additionalExport in additionalExports) { |
150 Uri originUri = Uri.parse(additionalExport[0]); | 150 String uriString = additionalExport[0]; |
151 String name = additionalExport[1]; | 151 String name = additionalExport[1]; |
152 Builder builder; | 152 Builder builder; |
153 if (originUri == null) { | 153 if (uriString == null) { |
154 builder = new KernelInvalidTypeBuilder(name, -1, null, | 154 builder = new KernelInvalidTypeBuilder(name, -1, null, |
155 templateUnspecified.withArguments(additionalExport[2])); | 155 templateUnspecified.withArguments(additionalExport[2])); |
156 } else { | 156 } else { |
| 157 Uri originUri = Uri.parse(uriString); |
157 DillLibraryBuilder library = loader.read(originUri, -1); | 158 DillLibraryBuilder library = loader.read(originUri, -1); |
158 builder = library.exportScopeBuilder[name]; | 159 builder = library?.exportScopeBuilder[name]; |
159 if (library != null) { | |
160 builder = library.exportScopeBuilder[name]; | |
161 } | |
162 if (builder == null) { | 160 if (builder == null) { |
163 builder = new KernelInvalidTypeBuilder(name, -1, null); | 161 builder = new KernelInvalidTypeBuilder(name, -1, null); |
164 } | 162 } |
165 } | 163 } |
166 exportScopeBuilder.addMember(name, builder); | 164 exportScopeBuilder.addMember(name, builder); |
167 } | 165 } |
168 } | 166 } |
169 } | 167 } |
170 } | 168 } |
OLD | NEW |