| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 void check(Node tree, Map<Node, Element> elements) { | 9 void check(Node tree, Map<Node, Element> elements) { |
| 10 measure(() { | 10 measure(() { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 Type visitIdentifier(Identifier node) { | 114 Type visitIdentifier(Identifier node) { |
| 115 fail(node); | 115 fail(node); |
| 116 } | 116 } |
| 117 | 117 |
| 118 Type visitSend(Send node) { | 118 Type visitSend(Send node) { |
| 119 Element target = elements[node]; | 119 Element target = elements[node]; |
| 120 if (target !== null) { | 120 if (target !== null) { |
| 121 // TODO(karlklose): Move that to a function that also | 121 // TODO(karlklose): Move that to a function that also |
| 122 // calculates FunctionTypes for other target types. | 122 // calculates FunctionTypes for other target types. |
| 123 FunctionType funType = target.type; | 123 FunctionType funType = target.computeType(compiler, types); |
| 124 Link<Type> formals = funType.parameterTypes; | 124 Link<Type> formals = funType.parameterTypes; |
| 125 Link<Node> arguments = node.arguments; | 125 Link<Node> arguments = node.arguments; |
| 126 while ((!formals.isEmpty()) && (!arguments.isEmpty())) { | 126 while ((!formals.isEmpty()) && (!arguments.isEmpty())) { |
| 127 compiler.cancel('parameters not supported.'); | 127 compiler.cancel('parameters not supported.'); |
| 128 var argumentType = visit(arguments.head); | 128 var argumentType = visit(arguments.head); |
| 129 if (!types.isAssignable(formals.head, argumentType)) { | 129 if (!types.isAssignable(formals.head, argumentType)) { |
| 130 var warning = CompilerError.NOT_ASSIGNABLE(argumentType, | 130 var warning = CompilerError.NOT_ASSIGNABLE(argumentType, |
| 131 formals.head); | 131 formals.head); |
| 132 compiler.reportWarning(node, warning); | 132 compiler.reportWarning(node, warning); |
| 133 } | 133 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 compiler.cancel('unsupported type ${node.typeName}'); | 200 compiler.cancel('unsupported type ${node.typeName}'); |
| 201 } | 201 } |
| 202 return types.VOID; | 202 return types.VOID; |
| 203 } | 203 } |
| 204 | 204 |
| 205 Type visitVariableDefinitions(VariableDefinitions node) { | 205 Type visitVariableDefinitions(VariableDefinitions node) { |
| 206 // TODO(karlklose): Implement this. | 206 // TODO(karlklose): Implement this. |
| 207 return types.VOID; | 207 return types.VOID; |
| 208 } | 208 } |
| 209 } | 209 } |
| OLD | NEW |