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 '../compiler.dart' show | 7 import '../compiler.dart' show |
8 Compiler, | 8 Compiler; |
9 isPrivateName; | |
10 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
11 import '../diagnostics/invariant.dart' show | 10 import '../diagnostics/invariant.dart' show |
12 invariant; | 11 invariant; |
13 import '../diagnostics/messages.dart' show | 12 import '../diagnostics/messages.dart' show |
14 MessageKind; | 13 MessageKind; |
15 import '../elements/elements.dart'; | 14 import '../elements/elements.dart'; |
16 import '../elements/modelx.dart' show | 15 import '../elements/modelx.dart' show |
17 ErroneousFieldElementX, | 16 ErroneousFieldElementX, |
18 ErroneousInitializingFormalElementX, | 17 ErroneousInitializingFormalElementX, |
19 FormalElementX, | 18 FormalElementX, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 if (currentDefinitions.metadata != null) { | 104 if (currentDefinitions.metadata != null) { |
106 element.metadata = compiler.resolver.resolveMetadata(element, node); | 105 element.metadata = compiler.resolver.resolveMetadata(element, node); |
107 } | 106 } |
108 currentDefinitions = null; | 107 currentDefinitions = null; |
109 return element; | 108 return element; |
110 } | 109 } |
111 | 110 |
112 void validateName(Identifier node) { | 111 void validateName(Identifier node) { |
113 if (isOptionalParameter && | 112 if (isOptionalParameter && |
114 optionalParametersAreNamed && | 113 optionalParametersAreNamed && |
115 isPrivateName(node.source)) { | 114 Name.isPrivateName(node.source)) { |
116 compiler.reportError(node, MessageKind.PRIVATE_NAMED_PARAMETER); | 115 compiler.reportError(node, MessageKind.PRIVATE_NAMED_PARAMETER); |
117 } | 116 } |
118 } | 117 } |
119 | 118 |
120 void computeParameterType(FormalElementX element, | 119 void computeParameterType(FormalElementX element, |
121 [VariableElement fieldElement]) { | 120 [VariableElement fieldElement]) { |
122 void computeFunctionType(FunctionExpression functionExpression) { | 121 void computeFunctionType(FunctionExpression functionExpression) { |
123 FunctionSignature functionSignature = SignatureResolver.analyze( | 122 FunctionSignature functionSignature = SignatureResolver.analyze( |
124 compiler, functionExpression.parameters, | 123 compiler, functionExpression.parameters, |
125 functionExpression.returnType, element, registry, | 124 functionExpression.returnType, element, registry, |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 432 |
434 DartType resolveReturnType(TypeAnnotation annotation) { | 433 DartType resolveReturnType(TypeAnnotation annotation) { |
435 if (annotation == null) return const DynamicType(); | 434 if (annotation == null) return const DynamicType(); |
436 DartType result = resolver.resolveTypeAnnotation(annotation); | 435 DartType result = resolver.resolveTypeAnnotation(annotation); |
437 if (result == null) { | 436 if (result == null) { |
438 return const DynamicType(); | 437 return const DynamicType(); |
439 } | 438 } |
440 return result; | 439 return result; |
441 } | 440 } |
442 } | 441 } |
OLD | NEW |