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

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

Issue 10558023: New treatment of native methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tests added Created 8 years, 6 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/ssa/builder.dart ('k') | tests/compiler/dart2js/parser_helper.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) 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 } 594 }
595 return type; 595 return type;
596 } 596 }
597 597
598 Type visitOperator(Operator node) { 598 Type visitOperator(Operator node) {
599 fail(node, 'internal error'); 599 fail(node, 'internal error');
600 } 600 }
601 601
602 /** Dart Programming Language Specification: 11.10 Return */ 602 /** Dart Programming Language Specification: 11.10 Return */
603 Type visitReturn(Return node) { 603 Type visitReturn(Return node) {
604 if (node.getBeginToken().stringValue === 'native') {
605 return StatementType.RETURNING;
606 }
607
604 final expression = node.expression; 608 final expression = node.expression;
605 final isVoidFunction = (expectedReturnType === types.voidType); 609 final isVoidFunction = (expectedReturnType === types.voidType);
606 610
607 // Executing a return statement return e; [...] It is a static type warning 611 // Executing a return statement return e; [...] It is a static type warning
608 // if the type of e may not be assigned to the declared return type of the 612 // if the type of e may not be assigned to the declared return type of the
609 // immediately enclosing function. 613 // immediately enclosing function.
610 if (expression !== null) { 614 if (expression !== null) {
611 final expressionType = analyze(expression); 615 final expressionType = analyze(expression);
612 if (isVoidFunction 616 if (isVoidFunction
613 && !types.isAssignable(expressionType, types.voidType)) { 617 && !types.isAssignable(expressionType, types.voidType)) {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 } 772 }
769 773
770 visitCatchBlock(CatchBlock node) { 774 visitCatchBlock(CatchBlock node) {
771 return unhandledStatement(); 775 return unhandledStatement();
772 } 776 }
773 777
774 visitTypedef(Typedef node) { 778 visitTypedef(Typedef node) {
775 return unhandledStatement(); 779 return unhandledStatement();
776 } 780 }
777 } 781 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | tests/compiler/dart2js/parser_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698