| 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 import '../common.dart'; | 5 import '../common.dart'; |
| 6 import '../common/backend_api.dart' show ForeignResolver; | 6 import '../common/backend_api.dart' show ForeignResolver; |
| 7 import '../common/resolution.dart' show ParsingContext, Resolution; | 7 import '../common/resolution.dart' show ParsingContext, Resolution; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../constants/values.dart'; | 9 import '../constants/values.dart'; |
| 10 import '../core_types.dart' show CoreTypes; | 10 import '../core_types.dart' show CoreTypes; |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 !isInterop || compiler.options.trustJSInteropTypeAnnotations | 698 !isInterop || compiler.options.trustJSInteropTypeAnnotations |
| 699 ? returnType | 699 ? returnType |
| 700 : const DynamicType()); | 700 : const DynamicType()); |
| 701 if (!type.returnType.isVoid) { | 701 if (!type.returnType.isVoid) { |
| 702 // Declared types are nullable. | 702 // Declared types are nullable. |
| 703 behavior.typesReturned.add(compiler.coreTypes.nullType); | 703 behavior.typesReturned.add(compiler.coreTypes.nullType); |
| 704 } | 704 } |
| 705 behavior._capture(type, compiler.resolution, | 705 behavior._capture(type, compiler.resolution, |
| 706 isInterop: isInterop, compiler: compiler); | 706 isInterop: isInterop, compiler: compiler); |
| 707 | 707 |
| 708 // TODO(sra): Optional arguments are currently missing from the | 708 for (DartType type in type.optionalParameterTypes) { |
| 709 // DartType. This should be fixed so the following work-around can be | 709 behavior._escape(type, compiler.resolution); |
| 710 // removed. | 710 } |
| 711 method.functionSignature | 711 for (DartType type in type.namedParameterTypes) { |
| 712 .forEachOptionalParameter((ParameterElement parameter) { | 712 behavior._escape(type, compiler.resolution); |
| 713 behavior._escape(parameter.type, compiler.resolution); | 713 } |
| 714 }); | |
| 715 | 714 |
| 716 behavior._overrideWithAnnotations(method, compiler); | 715 behavior._overrideWithAnnotations(method, compiler); |
| 717 return behavior; | 716 return behavior; |
| 718 } | 717 } |
| 719 | 718 |
| 720 static NativeBehavior ofFieldLoad(MemberElement field, Compiler compiler) { | 719 static NativeBehavior ofFieldLoad(MemberElement field, Compiler compiler) { |
| 721 Resolution resolution = compiler.resolution; | 720 Resolution resolution = compiler.resolution; |
| 722 DartType type = field.computeType(resolution); | 721 DartType type = field.computeType(resolution); |
| 723 var behavior = new NativeBehavior(); | 722 var behavior = new NativeBehavior(); |
| 724 bool isInterop = compiler.backend.isJsInterop(field); | 723 bool isInterop = compiler.backend.isJsInterop(field); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 reporter.reportErrorMessage(_errorNode(locationNodeOrElement, parsing), | 899 reporter.reportErrorMessage(_errorNode(locationNodeOrElement, parsing), |
| 901 MessageKind.GENERIC, {'text': "Type '$typeString' not found."}); | 900 MessageKind.GENERIC, {'text': "Type '$typeString' not found."}); |
| 902 return const DynamicType(); | 901 return const DynamicType(); |
| 903 } | 902 } |
| 904 | 903 |
| 905 static _errorNode(locationNodeOrElement, ParsingContext parsing) { | 904 static _errorNode(locationNodeOrElement, ParsingContext parsing) { |
| 906 if (locationNodeOrElement is Node) return locationNodeOrElement; | 905 if (locationNodeOrElement is Node) return locationNodeOrElement; |
| 907 return locationNodeOrElement.parseNode(parsing); | 906 return locationNodeOrElement.parseNode(parsing); |
| 908 } | 907 } |
| 909 } | 908 } |
| OLD | NEW |