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

Side by Side Diff: dart/frog/leg/typechecker.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/leg/tree/unparser.dart ('k') | dart/frog/presubmit.py » ('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 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 Type visitNodeList(NodeList node) { 212 Type visitNodeList(NodeList node) {
213 for (Link<Node> link = node.nodes; !link.isEmpty(); link = link.tail) { 213 for (Link<Node> link = node.nodes; !link.isEmpty(); link = link.tail) {
214 type(link.head); 214 type(link.head);
215 } 215 }
216 } 216 }
217 217
218 Type visitOperator(Operator node) { 218 Type visitOperator(Operator node) {
219 return types.dynamicType; 219 return types.dynamicType;
220 } 220 }
221 221
222 Type visitParameter(Parameter node) {
223 return null;
224 }
225
226 checkAssignable(Node node, Type s, Type t) { 222 checkAssignable(Node node, Type s, Type t) {
227 if (!types.isAssignable(s, t)) { 223 if (!types.isAssignable(s, t)) {
228 var error = CompilerError.notAssignable(s, t); 224 var error = CompilerError.notAssignable(s, t);
229 compiler.reportWarning(node, error); 225 compiler.reportWarning(node, error);
230 } 226 }
231 } 227 }
232 228
233 Type visitReturn(Return node) { 229 Type visitReturn(Return node) {
234 Type expressionType = type(node.expression); 230 Type expressionType = type(node.expression);
235 checkAssignable(node, expectedReturnType, expressionType); 231 checkAssignable(node, expectedReturnType, expressionType);
(...skipping 18 matching lines...) Expand all
254 link = link.tail) { 250 link = link.tail) {
255 Node initialization = link.head; 251 Node initialization = link.head;
256 if (initialization is Send) { 252 if (initialization is Send) {
257 checkAssignable(node, type, nonVoidType(link.head)); 253 checkAssignable(node, type, nonVoidType(link.head));
258 } else if (initialization is !Identifier) { 254 } else if (initialization is !Identifier) {
259 compiler.cancel('unexpected node type for variable initialization'); 255 compiler.cancel('unexpected node type for variable initialization');
260 } 256 }
261 } 257 }
262 } 258 }
263 } 259 }
OLDNEW
« no previous file with comments | « dart/frog/leg/tree/unparser.dart ('k') | dart/frog/presubmit.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698