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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2954253002: Add type inference for while and do loops. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.body_builder; 5 library fasta.body_builder;
6 6
7 import '../fasta_codes.dart' 7 import '../fasta_codes.dart'
8 show 8 show
9 FastaMessage, 9 FastaMessage,
10 codeConstFieldWithoutInitializer, 10 codeConstFieldWithoutInitializer,
(...skipping 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 Token doKeyword, Token whileKeyword, Token endToken) { 2484 Token doKeyword, Token whileKeyword, Token endToken) {
2485 debugEvent("DoWhileStatement"); 2485 debugEvent("DoWhileStatement");
2486 Expression condition = popForValue(); 2486 Expression condition = popForValue();
2487 Statement body = popStatement(); 2487 Statement body = popStatement();
2488 JumpTarget continueTarget = exitContinueTarget(); 2488 JumpTarget continueTarget = exitContinueTarget();
2489 JumpTarget breakTarget = exitBreakTarget(); 2489 JumpTarget breakTarget = exitBreakTarget();
2490 if (continueTarget.hasUsers) { 2490 if (continueTarget.hasUsers) {
2491 body = new LabeledStatement(body); 2491 body = new LabeledStatement(body);
2492 continueTarget.resolveContinues(body); 2492 continueTarget.resolveContinues(body);
2493 } 2493 }
2494 Statement result = new DoStatement(body, condition); 2494 Statement result = new KernelDoStatement(body, condition);
2495 if (breakTarget.hasUsers) { 2495 if (breakTarget.hasUsers) {
2496 result = new LabeledStatement(result); 2496 result = new LabeledStatement(result);
2497 breakTarget.resolveBreaks(result); 2497 breakTarget.resolveBreaks(result);
2498 } 2498 }
2499 exitLoopOrSwitch(result); 2499 exitLoopOrSwitch(result);
2500 } 2500 }
2501 2501
2502 @override 2502 @override
2503 void beginForInExpression(Token token) { 2503 void beginForInExpression(Token token) {
2504 enterLocalScope(scope.parent); 2504 enterLocalScope(scope.parent);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 void endWhileStatement(Token whileKeyword, Token endToken) { 2630 void endWhileStatement(Token whileKeyword, Token endToken) {
2631 debugEvent("WhileStatement"); 2631 debugEvent("WhileStatement");
2632 Statement body = popStatement(); 2632 Statement body = popStatement();
2633 Expression condition = popForValue(); 2633 Expression condition = popForValue();
2634 JumpTarget continueTarget = exitContinueTarget(); 2634 JumpTarget continueTarget = exitContinueTarget();
2635 JumpTarget breakTarget = exitBreakTarget(); 2635 JumpTarget breakTarget = exitBreakTarget();
2636 if (continueTarget.hasUsers) { 2636 if (continueTarget.hasUsers) {
2637 body = new LabeledStatement(body); 2637 body = new LabeledStatement(body);
2638 continueTarget.resolveContinues(body); 2638 continueTarget.resolveContinues(body);
2639 } 2639 }
2640 Statement result = new WhileStatement(condition, body); 2640 Statement result = new KernelWhileStatement(condition, body);
2641 if (breakTarget.hasUsers) { 2641 if (breakTarget.hasUsers) {
2642 result = new LabeledStatement(result); 2642 result = new LabeledStatement(result);
2643 breakTarget.resolveBreaks(result); 2643 breakTarget.resolveBreaks(result);
2644 } 2644 }
2645 exitLoopOrSwitch(result); 2645 exitLoopOrSwitch(result);
2646 } 2646 }
2647 2647
2648 @override 2648 @override
2649 void handleEmptyStatement(Token token) { 2649 void handleEmptyStatement(Token token) {
2650 debugEvent("EmptyStatement"); 2650 debugEvent("EmptyStatement");
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
3688 if (starToken == null) { 3688 if (starToken == null) {
3689 return AsyncMarker.Async; 3689 return AsyncMarker.Async;
3690 } else { 3690 } else {
3691 assert(identical(starToken.stringValue, "*")); 3691 assert(identical(starToken.stringValue, "*"));
3692 return AsyncMarker.AsyncStar; 3692 return AsyncMarker.AsyncStar;
3693 } 3693 }
3694 } else { 3694 } else {
3695 return internalError("Unknown async modifier: $asyncToken"); 3695 return internalError("Unknown async modifier: $asyncToken");
3696 } 3696 }
3697 } 3697 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698