| 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 | 7 import '../errors.dart' show |
| 8 internalError; | 8 internalError; |
| 9 | 9 |
| 10 export 'class_builder.dart' show | 10 export 'class_builder.dart' show |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 abstract class Builder { | 82 abstract class Builder { |
| 83 /// Used when multiple things with the same name are declared within the same | 83 /// Used when multiple things with the same name are declared within the same |
| 84 /// parent. Only used for declarations, not for scopes. | 84 /// parent. Only used for declarations, not for scopes. |
| 85 /// | 85 /// |
| 86 // TODO(ahe): Move to member builder or something. Then we can make | 86 // TODO(ahe): Move to member builder or something. Then we can make |
| 87 // this a const class. | 87 // this a const class. |
| 88 Builder next; | 88 Builder next; |
| 89 | 89 |
| 90 /// Resolve types (lookup names in scope) recorded in this builder and return | 90 /// Resolve types (lookup names in scope) recorded in this builder and return |
| 91 /// the number of types resolved. | 91 /// the number of types resolved. |
| 92 int resolveTypes(Builder parent) => 0; | 92 int resolveTypes(covariant Builder parent) => 0; |
| 93 | 93 |
| 94 /// Resolve constructors (lookup names in scope) recorded in this builder and | 94 /// Resolve constructors (lookup names in scope) recorded in this builder and |
| 95 /// return the number of constructors resolved. | 95 /// return the number of constructors resolved. |
| 96 int resolveConstructors(Builder parent) => 0; | 96 int resolveConstructors(covariant Builder parent) => 0; |
| 97 | 97 |
| 98 /// Look for methods with the same name as their enclosing class and convert | 98 /// Look for methods with the same name as their enclosing class and convert |
| 99 /// them to constructors. Return the number of methods converted to | 99 /// them to constructors. Return the number of methods converted to |
| 100 /// constructors. | 100 /// constructors. |
| 101 int convertConstructors(Builder parent) => 0; | 101 int convertConstructors(covariant Builder parent) => 0; |
| 102 | 102 |
| 103 /// This builder and [other] has been imported into [library] using [name]. | 103 /// This builder and [other] has been imported into [library] using [name]. |
| 104 /// | 104 /// |
| 105 /// This method handles this case according to the Dart language | 105 /// This method handles this case according to the Dart language |
| 106 /// specification. | 106 /// specification. |
| 107 Builder combineAmbiguousImport(String name, Builder other, | 107 Builder combineAmbiguousImport(String name, Builder other, |
| 108 LibraryBuilder library) { | 108 LibraryBuilder library) { |
| 109 if (other == this) return this; | 109 if (other == this) return this; |
| 110 bool isLocal = false; | 110 bool isLocal = false; |
| 111 Builder preferred; | 111 Builder preferred; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 static Uri getUri(Builder builder) { | 170 static Uri getUri(Builder builder) { |
| 171 if (builder == null) return internalError("Builder is null."); | 171 if (builder == null) return internalError("Builder is null."); |
| 172 while (builder != null) { | 172 while (builder != null) { |
| 173 if (builder is LibraryBuilder) return builder.uri; | 173 if (builder is LibraryBuilder) return builder.uri; |
| 174 builder = builder.parent; | 174 builder = builder.parent; |
| 175 } | 175 } |
| 176 return internalError("No library parent."); | 176 return internalError("No library parent."); |
| 177 } | 177 } |
| 178 } | 178 } |
| OLD | NEW |