Chromium Code Reviews| 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) : types = new Types(), super(compiler); | 6 TypeCheckerTask(Compiler compiler) : types = new Types(), super(compiler); |
| 7 String get name() => "Type checker"; | 7 String get name() => "Type checker"; |
| 8 Types types; | 8 Types types; |
| 9 | 9 |
| 10 void check(Node tree, TreeElements elements) { | 10 void check(Node tree, TreeElements elements) { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 Link<Type> analyzeArguments(Link<Node> arguments) { | 300 Link<Type> analyzeArguments(Link<Node> arguments) { |
| 301 LinkBuilder<Type> builder = new LinkBuilder<Type>(); | 301 LinkBuilder<Type> builder = new LinkBuilder<Type>(); |
| 302 while(!arguments.isEmpty()) { | 302 while(!arguments.isEmpty()) { |
| 303 builder.addLast(analyze(arguments.head)); | 303 builder.addLast(analyze(arguments.head)); |
| 304 arguments = arguments.tail; | 304 arguments = arguments.tail; |
| 305 } | 305 } |
| 306 return builder.toLink(); | 306 return builder.toLink(); |
| 307 } | 307 } |
| 308 | 308 |
| 309 Type visitSend(Send node) { | 309 Type visitSend(Send node) { |
| 310 Identifier selector = node.selector; | 310 Identifier selector = node.selector.asIdentifier(); |
| 311 if (selector === null) { | |
|
kasperl
2012/01/05 07:01:52
Use node.selector.isClosureCall or isClosureInvoca
floitsch
2012/01/05 12:18:38
Done.
| |
| 312 // Closure invocation. | |
| 313 // TODO(karlklose): Finish implementation; | |
|
kasperl
2012/01/05 07:01:52
; -> .
floitsch
2012/01/05 12:18:38
Done.
| |
| 314 return types.dynamicType; | |
| 315 } | |
| 311 String name = selector.source.stringValue; | 316 String name = selector.source.stringValue; |
| 312 | 317 |
| 313 if (node.isOperator) { | 318 if (node.isOperator) { |
| 314 final Node firstArgument = node.receiver; | 319 final Node firstArgument = node.receiver; |
| 315 final Type firstArgumentType = analyze(node.receiver); | 320 final Type firstArgumentType = analyze(node.receiver); |
| 316 final arguments = node.arguments; | 321 final arguments = node.arguments; |
| 317 final Node secondArgument = arguments.isEmpty() ? null : arguments.head; | 322 final Node secondArgument = arguments.isEmpty() ? null : arguments.head; |
| 318 final Type secondArgumentType = analyzeWithDefault(secondArgument, null); | 323 final Type secondArgumentType = analyzeWithDefault(secondArgument, null); |
| 319 | 324 |
| 320 if (name === '+' || name === '=' || name === '-' | 325 if (name === '+' || name === '=' || name === '-' |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 614 } | 619 } |
| 615 | 620 |
| 616 visitCatchBlock(CatchBlock node) { | 621 visitCatchBlock(CatchBlock node) { |
| 617 compiler.unimplemented('visitCatchBlock', node: node); | 622 compiler.unimplemented('visitCatchBlock', node: node); |
| 618 } | 623 } |
| 619 | 624 |
| 620 visitTypedef(Typedef node) { | 625 visitTypedef(Typedef node) { |
| 621 compiler.unimplemented('visitTypedef', node: node); | 626 compiler.unimplemented('visitTypedef', node: node); |
| 622 } | 627 } |
| 623 } | 628 } |
| OLD | NEW |