OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /// This file declares a "shadow hierarchy" of concrete classes which extend | 5 /// This file declares a "shadow hierarchy" of concrete classes which extend |
6 /// the kernel class hierarchy, adding methods and fields needed by the | 6 /// the kernel class hierarchy, adding methods and fields needed by the |
7 /// BodyBuilder. | 7 /// BodyBuilder. |
8 /// | 8 /// |
9 /// Instances of these classes may be created using the factory methods in | 9 /// Instances of these classes may be created using the factory methods in |
10 /// `ast_factory.dart`. | 10 /// `ast_factory.dart`. |
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 // implemented, so just skip it for now. | 1930 // implemented, so just skip it for now. |
1931 // TODO(paulberry): once the BodyBuilder uses shadow classes for | 1931 // TODO(paulberry): once the BodyBuilder uses shadow classes for |
1932 // everything, this case should no longer be needed. | 1932 // everything, this case should no longer be needed. |
1933 } | 1933 } |
1934 } | 1934 } |
1935 | 1935 |
1936 /// If the given [type] is a [TypeParameterType], resolve it to its bound. | 1936 /// If the given [type] is a [TypeParameterType], resolve it to its bound. |
1937 DartType resolveTypeParameter(DartType type) { | 1937 DartType resolveTypeParameter(DartType type) { |
1938 DartType resolveOneStep(DartType type) { | 1938 DartType resolveOneStep(DartType type) { |
1939 if (type is TypeParameterType) { | 1939 if (type is TypeParameterType) { |
1940 return type.bound ?? type.parameter.bound; | 1940 return type.bound; |
1941 } else { | 1941 } else { |
1942 return null; | 1942 return null; |
1943 } | 1943 } |
1944 } | 1944 } |
1945 | 1945 |
1946 var resolved = resolveOneStep(type); | 1946 var resolved = resolveOneStep(type); |
1947 if (resolved == null) return type; | 1947 if (resolved == null) return type; |
1948 | 1948 |
1949 // Detect circularities using the tortoise-and-hare algorithm. | 1949 // Detect circularities using the tortoise-and-hare algorithm. |
1950 type = resolved; | 1950 type = resolved; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 } | 2216 } |
2217 | 2217 |
2218 transformChildren(v) { | 2218 transformChildren(v) { |
2219 return internalError("Internal error: Unsupported operation."); | 2219 return internalError("Internal error: Unsupported operation."); |
2220 } | 2220 } |
2221 | 2221 |
2222 visitChildren(v) { | 2222 visitChildren(v) { |
2223 return internalError("Internal error: Unsupported operation."); | 2223 return internalError("Internal error: Unsupported operation."); |
2224 } | 2224 } |
2225 } | 2225 } |
OLD | NEW |