OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.resolution.types; | 5 library dart2js.resolution.types; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart' show Resolution; | 8 import '../common/resolution.dart' show Resolution; |
9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
10 import '../elements/elements.dart' | 10 import '../elements/elements.dart' |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if (element is ErroneousElement) { | 147 if (element is ErroneousElement) { |
148 type = reportFailureAndCreateType( | 148 type = reportFailureAndCreateType( |
149 element.messageKind, element.messageArguments, | 149 element.messageKind, element.messageArguments, |
150 erroneousElement: element); | 150 erroneousElement: element); |
151 } else { | 151 } else { |
152 type = const DynamicType(); | 152 type = const DynamicType(); |
153 } | 153 } |
154 } else if (!element.impliesType) { | 154 } else if (!element.impliesType) { |
155 type = reportFailureAndCreateType( | 155 type = reportFailureAndCreateType( |
156 MessageKind.NOT_A_TYPE, {'node': node.typeName}); | 156 MessageKind.NOT_A_TYPE, {'node': node.typeName}); |
| 157 } else if (element.library.isPlatformLibrary && |
| 158 element.name == 'FutureOr') { |
| 159 type = const DynamicType(); |
| 160 registry.useType(node, type); |
| 161 return type; |
157 } else { | 162 } else { |
158 bool addTypeVariableBoundsCheck = false; | 163 bool addTypeVariableBoundsCheck = false; |
159 if (element.isClass) { | 164 if (element.isClass) { |
160 ClassElement cls = element; | 165 ClassElement cls = element; |
161 // TODO(johnniwinther): [ensureClassWillBeResolvedInternal] should imply | 166 // TODO(johnniwinther): [ensureClassWillBeResolvedInternal] should imply |
162 // [computeType]. | 167 // [computeType]. |
163 resolver.ensureClassWillBeResolvedInternal(cls); | 168 resolver.ensureClassWillBeResolvedInternal(cls); |
164 cls.computeType(resolution); | 169 cls.computeType(resolution); |
165 List<DartType> arguments = <DartType>[]; | 170 List<DartType> arguments = <DartType>[]; |
166 bool hasTypeArgumentMismatch = | 171 bool hasTypeArgumentMismatch = |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 arguments.add(argType); | 280 arguments.add(argType); |
276 } | 281 } |
277 if (index < expectedVariables) { | 282 if (index < expectedVariables) { |
278 reporter.reportWarningMessage( | 283 reporter.reportWarningMessage( |
279 node.typeArguments, MessageKind.MISSING_TYPE_ARGUMENT); | 284 node.typeArguments, MessageKind.MISSING_TYPE_ARGUMENT); |
280 typeArgumentCountMismatch = true; | 285 typeArgumentCountMismatch = true; |
281 } | 286 } |
282 return typeArgumentCountMismatch; | 287 return typeArgumentCountMismatch; |
283 } | 288 } |
284 } | 289 } |
OLD | NEW |