| 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 class TypeCheckerTask extends CompilerTask { | 5 class TypeCheckerTask extends CompilerTask { |
| 6 TypeCheckerTask(Compiler compiler) : super(compiler); | 6 TypeCheckerTask(Compiler compiler) : super(compiler); |
| 7 String get name() => "Type checker"; | 7 String get name() => "Type checker"; |
| 8 | 8 |
| 9 static final bool LOG_FAILURES = false; | 9 static final bool LOG_FAILURES = false; |
| 10 | 10 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 265 |
| 266 /** Dart Programming Language Specification: 11.5.1 For Loop */ | 266 /** Dart Programming Language Specification: 11.5.1 For Loop */ |
| 267 Type visitFor(For node) { | 267 Type visitFor(For node) { |
| 268 analyzeWithDefault(node.initializer, StatementType.NOT_RETURNING); | 268 analyzeWithDefault(node.initializer, StatementType.NOT_RETURNING); |
| 269 checkCondition(node.condition); | 269 checkCondition(node.condition); |
| 270 analyzeWithDefault(node.update, StatementType.NOT_RETURNING); | 270 analyzeWithDefault(node.update, StatementType.NOT_RETURNING); |
| 271 StatementType bodyType = analyze(node.body); | 271 StatementType bodyType = analyze(node.body); |
| 272 return bodyType.join(StatementType.NOT_RETURNING); | 272 return bodyType.join(StatementType.NOT_RETURNING); |
| 273 } | 273 } |
| 274 | 274 |
| 275 Type visitFunctionDeclaration(FunctionDeclaration node) { |
| 276 analyze(node.function); |
| 277 return StatementType.NOT_RETURNING; |
| 278 } |
| 279 |
| 275 Type visitFunctionExpression(FunctionExpression node) { | 280 Type visitFunctionExpression(FunctionExpression node) { |
| 276 Type type; | 281 Type type; |
| 277 Type returnType; | 282 Type returnType; |
| 278 Type previousType; | 283 Type previousType; |
| 279 final FunctionElement element = elements[node]; | 284 final FunctionElement element = elements[node]; |
| 280 if (element.kind === ElementKind.GENERATIVE_CONSTRUCTOR || | 285 if (element.kind === ElementKind.GENERATIVE_CONSTRUCTOR || |
| 281 element.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { | 286 element.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { |
| 282 type = types.dynamicType; | 287 type = types.dynamicType; |
| 283 returnType = types.voidType; | 288 returnType = types.voidType; |
| 284 } else { | 289 } else { |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 } | 671 } |
| 667 | 672 |
| 668 visitCatchBlock(CatchBlock node) { | 673 visitCatchBlock(CatchBlock node) { |
| 669 compiler.unimplemented('visitCatchBlock', node: node); | 674 compiler.unimplemented('visitCatchBlock', node: node); |
| 670 } | 675 } |
| 671 | 676 |
| 672 visitTypedef(Typedef node) { | 677 visitTypedef(Typedef node) { |
| 673 compiler.unimplemented('visitTypedef', node: node); | 678 compiler.unimplemented('visitTypedef', node: node); |
| 674 } | 679 } |
| 675 } | 680 } |
| OLD | NEW |