OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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.members; | 5 library dart2js.resolution.members; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/names.dart' show | 8 import '../common/names.dart' show |
9 Selectors; | 9 Selectors; |
10 import '../common/resolution.dart' show | 10 import '../common/resolution.dart' show |
(...skipping 3656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3667 | 3667 |
3668 ResolutionResult visitReturn(Return node) { | 3668 ResolutionResult visitReturn(Return node) { |
3669 Node expression = node.expression; | 3669 Node expression = node.expression; |
3670 if (expression != null) { | 3670 if (expression != null) { |
3671 if (enclosingElement.isGenerativeConstructor) { | 3671 if (enclosingElement.isGenerativeConstructor) { |
3672 // It is a compile-time error if a return statement of the form | 3672 // It is a compile-time error if a return statement of the form |
3673 // `return e;` appears in a generative constructor. (Dart Language | 3673 // `return e;` appears in a generative constructor. (Dart Language |
3674 // Specification 13.12.) | 3674 // Specification 13.12.) |
3675 reporter.reportErrorMessage( | 3675 reporter.reportErrorMessage( |
3676 expression, | 3676 expression, |
3677 MessageKind.CANNOT_RETURN_FROM_CONSTRUCTOR); | 3677 MessageKind.RETURN_IN_GENERATIVE_CONSTRUCTOR); |
3678 } else if (!node.isArrowBody && currentAsyncMarker.isYielding) { | 3678 } else if (!node.isArrowBody && currentAsyncMarker.isYielding) { |
3679 reporter.reportErrorMessage( | 3679 reporter.reportErrorMessage( |
3680 node, | 3680 node, |
3681 MessageKind.RETURN_IN_GENERATOR, | 3681 MessageKind.RETURN_IN_GENERATOR, |
3682 {'modifier': currentAsyncMarker}); | 3682 {'modifier': currentAsyncMarker}); |
3683 } | 3683 } |
3684 } | 3684 } |
3685 visit(node.expression); | 3685 visit(node.expression); |
3686 return const NoneResult(); | 3686 return const NoneResult(); |
3687 } | 3687 } |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4864 } | 4864 } |
4865 return const NoneResult(); | 4865 return const NoneResult(); |
4866 } | 4866 } |
4867 } | 4867 } |
4868 | 4868 |
4869 /// Looks up [name] in [scope] and unwraps the result. | 4869 /// Looks up [name] in [scope] and unwraps the result. |
4870 Element lookupInScope(DiagnosticReporter reporter, Node node, | 4870 Element lookupInScope(DiagnosticReporter reporter, Node node, |
4871 Scope scope, String name) { | 4871 Scope scope, String name) { |
4872 return Elements.unwrap(scope.lookup(name), reporter, node); | 4872 return Elements.unwrap(scope.lookup(name), reporter, node); |
4873 } | 4873 } |
OLD | NEW |