| 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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 class TypeCheckerTask extends CompilerTask { | 7 class TypeCheckerTask extends CompilerTask { |
| 8 TypeCheckerTask(Compiler compiler) : super(compiler); | 8 TypeCheckerTask(Compiler compiler) : super(compiler); |
| 9 String get name => "Type checker"; | 9 String get name => "Type checker"; |
| 10 | 10 |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 } | 787 } |
| 788 | 788 |
| 789 /** Dart Programming Language Specification: 11.10 Return */ | 789 /** Dart Programming Language Specification: 11.10 Return */ |
| 790 DartType visitReturn(Return node) { | 790 DartType visitReturn(Return node) { |
| 791 if (identical(node.getBeginToken().stringValue, 'native')) { | 791 if (identical(node.getBeginToken().stringValue, 'native')) { |
| 792 return StatementType.RETURNING; | 792 return StatementType.RETURNING; |
| 793 } | 793 } |
| 794 if (node.isRedirectingFactoryBody) { | 794 if (node.isRedirectingFactoryBody) { |
| 795 // TODO(lrn): Typecheck the body. It must refer to the constructor | 795 // TODO(lrn): Typecheck the body. It must refer to the constructor |
| 796 // of a subtype. | 796 // of a subtype. |
| 797 return elements.getType(node); | 797 return StatementType.RETURNING; |
| 798 } | 798 } |
| 799 | 799 |
| 800 final expression = node.expression; | 800 final expression = node.expression; |
| 801 final isVoidFunction = (identical(expectedReturnType, types.voidType)); | 801 final isVoidFunction = (identical(expectedReturnType, types.voidType)); |
| 802 | 802 |
| 803 // Executing a return statement return e; [...] It is a static type warning | 803 // Executing a return statement return e; [...] It is a static type warning |
| 804 // if the type of e may not be assigned to the declared return type of the | 804 // if the type of e may not be assigned to the declared return type of the |
| 805 // immediately enclosing function. | 805 // immediately enclosing function. |
| 806 if (expression != null) { | 806 if (expression != null) { |
| 807 final expressionType = analyze(expression); | 807 final expressionType = analyze(expression); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 DartType visitStringNode(StringNode node) { | 1030 DartType visitStringNode(StringNode node) { |
| 1031 compiler.unimplemented('visitNode', node: node); | 1031 compiler.unimplemented('visitNode', node: node); |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 DartType visitLibraryDependency(LibraryDependency node) { | 1034 DartType visitLibraryDependency(LibraryDependency node) { |
| 1035 compiler.unimplemented('visitNode', node: node); | 1035 compiler.unimplemented('visitNode', node: node); |
| 1036 } | 1036 } |
| 1037 } | 1037 } |
| OLD | NEW |