| 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 if (member !== null && member.kind == ElementKind.FUNCTION) { | 459 if (member !== null && member.kind == ElementKind.FUNCTION) { |
| 460 return computeType(member); | 460 return computeType(member); |
| 461 } | 461 } |
| 462 reportTypeWarning(node, MessageKind.METHOD_NOT_FOUND, | 462 reportTypeWarning(node, MessageKind.METHOD_NOT_FOUND, |
| 463 [classElement.name, name]); | 463 [classElement.name, name]); |
| 464 return types.dynamicType; | 464 return types.dynamicType; |
| 465 } | 465 } |
| 466 | 466 |
| 467 void analyzeArguments(Send send, FunctionType funType) { | 467 void analyzeArguments(Send send, Type type) { |
| 468 Link<Node> arguments = send.arguments; | 468 Link<Node> arguments = send.arguments; |
| 469 if (funType === null || funType === types.dynamicType) { | 469 if (type === null || type === types.dynamicType) { |
| 470 while(!arguments.isEmpty()) { | 470 while(!arguments.isEmpty()) { |
| 471 analyze(arguments.head); | 471 analyze(arguments.head); |
| 472 arguments = arguments.tail; | 472 arguments = arguments.tail; |
| 473 } | 473 } |
| 474 } else { | 474 } else { |
| 475 FunctionType funType = type; |
| 475 Link<Type> parameterTypes = funType.parameterTypes; | 476 Link<Type> parameterTypes = funType.parameterTypes; |
| 476 while (!arguments.isEmpty() && !parameterTypes.isEmpty()) { | 477 while (!arguments.isEmpty() && !parameterTypes.isEmpty()) { |
| 477 checkAssignable(arguments.head, parameterTypes.head, | 478 checkAssignable(arguments.head, parameterTypes.head, |
| 478 analyze(arguments.head)); | 479 analyze(arguments.head)); |
| 479 arguments = arguments.tail; | 480 arguments = arguments.tail; |
| 480 parameterTypes = parameterTypes.tail; | 481 parameterTypes = parameterTypes.tail; |
| 481 } | 482 } |
| 482 if (!arguments.isEmpty()) { | 483 if (!arguments.isEmpty()) { |
| 483 reportTypeWarning(arguments.head, MessageKind.ADDITIONAL_ARGUMENT); | 484 reportTypeWarning(arguments.head, MessageKind.ADDITIONAL_ARGUMENT); |
| 484 } else if (!parameterTypes.isEmpty()) { | 485 } else if (!parameterTypes.isEmpty()) { |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 } | 843 } |
| 843 | 844 |
| 844 visitCatchBlock(CatchBlock node) { | 845 visitCatchBlock(CatchBlock node) { |
| 845 return unhandledStatement(); | 846 return unhandledStatement(); |
| 846 } | 847 } |
| 847 | 848 |
| 848 visitTypedef(Typedef node) { | 849 visitTypedef(Typedef node) { |
| 849 return unhandledStatement(); | 850 return unhandledStatement(); |
| 850 } | 851 } |
| 851 } | 852 } |
| OLD | NEW |