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

Side by Side Diff: lib/compiler/implementation/typechecker.dart

Issue 10270010: Remove getType; use the resolver instead. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 7 months 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 | « lib/compiler/implementation/resolver.dart ('k') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 static final bool LOG_FAILURES = false; 9 static final bool LOG_FAILURES = false;
10 10
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 return type; 571 return type;
572 } 572 }
573 573
574 Type visitOperator(Operator node) { 574 Type visitOperator(Operator node) {
575 fail(node, 'internal error'); 575 fail(node, 'internal error');
576 } 576 }
577 577
578 /** Dart Programming Language Specification: 11.10 Return */ 578 /** Dart Programming Language Specification: 11.10 Return */
579 Type visitReturn(Return node) { 579 Type visitReturn(Return node) {
580 final expression = node.expression; 580 final expression = node.expression;
581 final isVoidFunction = (expectedReturnType === types.voidType); 581 final isVoidFunction =
582 (expectedReturnType.element === compiler.types.voidType.element);
582 583
583 // Executing a return statement return e; [...] It is a static type warning 584 // Executing a return statement return e; [...] It is a static type warning
584 // if the type of e may not be assigned to the declared return type of the 585 // if the type of e may not be assigned to the declared return type of the
585 // immediately enclosing function. 586 // immediately enclosing function.
586 if (expression !== null) { 587 if (expression !== null) {
587 final expressionType = analyze(expression); 588 final expressionType = analyze(expression);
588 if (isVoidFunction 589 if (isVoidFunction
589 && !types.isAssignable(expressionType, types.voidType)) { 590 && !types.isAssignable(expressionType, types.voidType)) {
590 reportTypeWarning(expression, MessageKind.RETURN_VALUE_IN_VOID, 591 reportTypeWarning(expression, MessageKind.RETURN_VALUE_IN_VOID,
591 [expressionType]); 592 [expressionType]);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 } 729 }
729 730
730 visitCatchBlock(CatchBlock node) { 731 visitCatchBlock(CatchBlock node) {
731 fail(node); 732 fail(node);
732 } 733 }
733 734
734 visitTypedef(Typedef node) { 735 visitTypedef(Typedef node) {
735 fail(node); 736 fail(node);
736 } 737 }
737 } 738 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698