| 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 #library('elements'); | 5 #library('elements'); |
| 6 | 6 |
| 7 #import('../tree/tree.dart'); | 7 #import('../tree/tree.dart'); |
| 8 #import('../scanner/scannerlib.dart'); | 8 #import('../scanner/scannerlib.dart'); |
| 9 #import('../leg.dart'); // TODO(karlklose): we only need type. | 9 #import('../leg.dart'); // TODO(karlklose): we only need type. |
| 10 #import('../util/util.dart'); | 10 #import('../util/util.dart'); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 FunctionType computeType(Compiler compiler, types) { | 53 FunctionType computeType(Compiler compiler, types) { |
| 54 if (type != null) return type; | 54 if (type != null) return type; |
| 55 | 55 |
| 56 FunctionExpression node = parseNode(compiler, compiler); | 56 FunctionExpression node = parseNode(compiler, compiler); |
| 57 Type returnType = getType(node.returnType, types); | 57 Type returnType = getType(node.returnType, types); |
| 58 if (returnType === null) compiler.cancel('unknown type $returnType'); | 58 if (returnType === null) compiler.cancel('unknown type $returnType'); |
| 59 LinkBuilder<Type> parameterTypes = new LinkBuilder<Type>(); | 59 LinkBuilder<Type> parameterTypes = new LinkBuilder<Type>(); |
| 60 for (var link = node.parameters.nodes; !link.isEmpty(); link = link.tail) { | 60 for (var link = node.parameters.nodes; !link.isEmpty(); link = link.tail) { |
| 61 compiler.cancel('parameters not supported.'); | 61 compiler.cancel('parameters not supported.'); |
| 62 var parameter = link.head; | 62 VariableDefinitions parameter = link.head; |
| 63 parameterTypes.addLast(getType(parameter.typeAnnotation, types)); | 63 parameterTypes.addLast(getType(parameter.type, types)); |
| 64 } | 64 } |
| 65 type = new FunctionType(returnType, parameterTypes.toLink()); | 65 type = new FunctionType(returnType, parameterTypes.toLink()); |
| 66 return type; | 66 return type; |
| 67 } | 67 } |
| 68 } | 68 } |
| OLD | NEW |