Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: dart/frog/leg/elements/elements.dart

Issue 8497011: Parse formal parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased, frogsh, type warning Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/frog/frogsh ('k') | dart/frog/leg/scanner/listener.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « dart/frog/frogsh ('k') | dart/frog/leg/scanner/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698