OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.signatures; | 5 library dart2js.resolution.signatures; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../compiler.dart' show | 8 import '../compiler.dart' show |
9 Compiler; | 9 Compiler; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
11 import '../elements/elements.dart'; | 11 import '../elements/elements.dart'; |
12 import '../elements/modelx.dart' show | 12 import '../elements/modelx.dart' show |
13 ErroneousFieldElementX, | 13 ErroneousFieldElementX, |
14 ErroneousInitializingFormalElementX, | 14 ErroneousInitializingFormalElementX, |
15 FormalElementX, | 15 FormalElementX, |
16 FunctionElementX, | 16 FunctionElementX, |
17 FunctionSignatureX, | 17 FunctionSignatureX, |
18 InitializingFormalElementX, | 18 InitializingFormalElementX, |
19 LocalParameterElementX; | 19 LocalParameterElementX; |
20 import '../tree/tree.dart'; | 20 import '../tree/tree.dart'; |
| 21 import '../universe/use.dart' show |
| 22 TypeUse; |
21 import '../util/util.dart' show | 23 import '../util/util.dart' show |
22 Link, | 24 Link, |
23 LinkBuilder; | 25 LinkBuilder; |
24 | 26 |
25 import 'members.dart' show | 27 import 'members.dart' show |
26 ResolverVisitor; | 28 ResolverVisitor; |
27 import 'registry.dart' show | 29 import 'registry.dart' show |
28 ResolutionRegistry; | 30 ResolutionRegistry; |
29 import 'resolution_common.dart' show | 31 import 'resolution_common.dart' show |
30 MappingVisitor; | 32 MappingVisitor; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 visitor.analyzeNodes(formalParameters.nodes); | 336 visitor.analyzeNodes(formalParameters.nodes); |
335 requiredParameterCount = parametersBuilder.length; | 337 requiredParameterCount = parametersBuilder.length; |
336 parameters = parametersBuilder.toList(); | 338 parameters = parametersBuilder.toList(); |
337 } | 339 } |
338 DartType returnType; | 340 DartType returnType; |
339 if (element.isFactoryConstructor) { | 341 if (element.isFactoryConstructor) { |
340 returnType = element.enclosingClass.thisType; | 342 returnType = element.enclosingClass.thisType; |
341 // Because there is no type annotation for the return type of | 343 // Because there is no type annotation for the return type of |
342 // this element, we explicitly add one. | 344 // this element, we explicitly add one. |
343 if (compiler.enableTypeAssertions) { | 345 if (compiler.enableTypeAssertions) { |
344 registry.registerIsCheck(returnType); | 346 registry.registerTypeUse(new TypeUse.checkedModeCheck(returnType)); |
345 } | 347 } |
346 } else { | 348 } else { |
347 AsyncMarker asyncMarker = AsyncMarker.SYNC; | 349 AsyncMarker asyncMarker = AsyncMarker.SYNC; |
348 if (isFunctionExpression) { | 350 if (isFunctionExpression) { |
349 // Use async marker to determine the return type of function | 351 // Use async marker to determine the return type of function |
350 // expressions. | 352 // expressions. |
351 FunctionElement function = element; | 353 FunctionElement function = element; |
352 asyncMarker = function.asyncMarker; | 354 asyncMarker = function.asyncMarker; |
353 } | 355 } |
354 switch (asyncMarker) { | 356 switch (asyncMarker) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 439 |
438 DartType resolveReturnType(TypeAnnotation annotation) { | 440 DartType resolveReturnType(TypeAnnotation annotation) { |
439 if (annotation == null) return const DynamicType(); | 441 if (annotation == null) return const DynamicType(); |
440 DartType result = resolver.resolveTypeAnnotation(annotation); | 442 DartType result = resolver.resolveTypeAnnotation(annotation); |
441 if (result == null) { | 443 if (result == null) { |
442 return const DynamicType(); | 444 return const DynamicType(); |
443 } | 445 } |
444 return result; | 446 return result; |
445 } | 447 } |
446 } | 448 } |
OLD | NEW |