| 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.builder; | 5 library fasta.builder; |
| 6 | 6 |
| 7 import '../errors.dart' show internalError; | 7 import '../errors.dart' show internalError; |
| 8 | 8 |
| 9 import '../messages.dart' show nit; | 9 import '../messages.dart' show nit; |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 export 'mixed_accessor.dart' show MixedAccessor; | 51 export 'mixed_accessor.dart' show MixedAccessor; |
| 52 | 52 |
| 53 export 'scope.dart' show AccessErrorBuilder; | 53 export 'scope.dart' show AccessErrorBuilder; |
| 54 | 54 |
| 55 export 'dynamic_type_builder.dart' show DynamicTypeBuilder; | 55 export 'dynamic_type_builder.dart' show DynamicTypeBuilder; |
| 56 | 56 |
| 57 export 'function_type_builder.dart' show FunctionTypeBuilder; | 57 export 'function_type_builder.dart' show FunctionTypeBuilder; |
| 58 | 58 |
| 59 import 'library_builder.dart' show LibraryBuilder; | 59 import 'library_builder.dart' show LibraryBuilder; |
| 60 | 60 |
| 61 import 'invalid_type_builder.dart' show InvalidTypeBuilder; |
| 62 |
| 61 abstract class Builder { | 63 abstract class Builder { |
| 62 /// Used when multiple things with the same name are declared within the same | 64 /// Used when multiple things with the same name are declared within the same |
| 63 /// parent. Only used for declarations, not for scopes. | 65 /// parent. Only used for declarations, not for scopes. |
| 64 /// | 66 /// |
| 65 // TODO(ahe): Move to member builder or something. Then we can make | 67 // TODO(ahe): Move to member builder or something. Then we can make |
| 66 // this a const class. | 68 // this a const class. |
| 67 Builder next; | 69 Builder next; |
| 68 | 70 |
| 69 /// The values of [parent], [charOffset], and [fileUri] aren't stored. We | 71 /// The values of [parent], [charOffset], and [fileUri] aren't stored. We |
| 70 /// need to evaluate the memory impact of doing so, but want to ensure the | 72 /// need to evaluate the memory impact of doing so, but want to ensure the |
| (...skipping 17 matching lines...) Expand all Loading... |
| 88 /// return the number of constructors resolved. | 90 /// return the number of constructors resolved. |
| 89 int resolveConstructors(covariant Builder parent) => 0; | 91 int resolveConstructors(covariant Builder parent) => 0; |
| 90 | 92 |
| 91 /// This builder and [other] has been imported into [library] using [name]. | 93 /// This builder and [other] has been imported into [library] using [name]. |
| 92 /// | 94 /// |
| 93 /// This method handles this case according to the Dart language | 95 /// This method handles this case according to the Dart language |
| 94 /// specification. | 96 /// specification. |
| 95 Builder combineAmbiguousImport( | 97 Builder combineAmbiguousImport( |
| 96 String name, Builder other, LibraryBuilder library) { | 98 String name, Builder other, LibraryBuilder library) { |
| 97 if (other == this) return this; | 99 if (other == this) return this; |
| 100 if (other is InvalidTypeBuilder) return other; |
| 98 bool isLocal = false; | 101 bool isLocal = false; |
| 99 Builder preferred; | 102 Builder preferred; |
| 100 Builder hidden; | 103 Builder hidden; |
| 101 if (library.members[name] == this) { | 104 if (library.members[name] == this) { |
| 102 isLocal = true; | 105 isLocal = true; |
| 103 preferred = this; | 106 preferred = this; |
| 104 hidden = other; | 107 hidden = other; |
| 105 } else if (getUri(other)?.scheme == "dart" && | 108 } else if (getUri(other)?.scheme == "dart" && |
| 106 getUri(this)?.scheme != "dart") { | 109 getUri(this)?.scheme != "dart") { |
| 107 preferred = this; | 110 preferred = this; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 170 |
| 168 static Uri getUri(Builder builder) { | 171 static Uri getUri(Builder builder) { |
| 169 if (builder == null) return internalError("Builder is null."); | 172 if (builder == null) return internalError("Builder is null."); |
| 170 while (builder != null) { | 173 while (builder != null) { |
| 171 if (builder is LibraryBuilder) return builder.uri; | 174 if (builder is LibraryBuilder) return builder.uri; |
| 172 builder = builder.parent; | 175 builder = builder.parent; |
| 173 } | 176 } |
| 174 return internalError("No library parent."); | 177 return internalError("No library parent."); |
| 175 } | 178 } |
| 176 } | 179 } |
| OLD | NEW |