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

Side by Side Diff: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart

Issue 3007783004: Handle switch continue (Closed)
Patch Set: Updated cf. comment Created 3 years, 3 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
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 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../closure.dart'; 7 import '../closure.dart';
8 import '../common.dart'; 8 import '../common.dart';
9 import '../compiler.dart'; 9 import '../compiler.dart';
10 import '../constants/expressions.dart'; 10 import '../constants/expressions.dart';
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 : super(builder, target) { 614 : super(builder, target) {
615 // The switch case indices must match those computed in 615 // The switch case indices must match those computed in
616 // [KernelSsaBuilder.buildSwitchCaseConstants]. 616 // [KernelSsaBuilder.buildSwitchCaseConstants].
617 // Switch indices are 1-based so we can bypass the synthetic loop when no 617 // Switch indices are 1-based so we can bypass the synthetic loop when no
618 // cases match simply by branching on the index (which defaults to null). 618 // cases match simply by branching on the index (which defaults to null).
619 // TODO 619 // TODO
620 int switchIndex = 1; 620 int switchIndex = 1;
621 for (ir.SwitchCase switchCase in switchStatement.cases) { 621 for (ir.SwitchCase switchCase in switchStatement.cases) {
622 JumpTarget continueTarget = 622 JumpTarget continueTarget =
623 localsMap.getJumpTargetForSwitchCase(switchCase); 623 localsMap.getJumpTargetForSwitchCase(switchCase);
624 assert(continueTarget is KernelJumpTarget); 624 if (continueTarget != null) {
625 targetIndexMap[continueTarget] = switchIndex; 625 targetIndexMap[continueTarget] = switchIndex;
626 assert(builder.jumpTargets[continueTarget] == null); 626 assert(builder.jumpTargets[continueTarget] == null);
627 builder.jumpTargets[continueTarget] = this; 627 builder.jumpTargets[continueTarget] = this;
628 }
628 switchIndex++; 629 switchIndex++;
629 } 630 }
630 } 631 }
631 } 632 }
632 633
633 class KernelAstTypeInferenceMap implements KernelToTypeInferenceMap { 634 class KernelAstTypeInferenceMap implements KernelToTypeInferenceMap {
634 final KernelAstAdapter _astAdapter; 635 final KernelAstAdapter _astAdapter;
635 636
636 KernelAstTypeInferenceMap(this._astAdapter); 637 KernelAstTypeInferenceMap(this._astAdapter);
637 638
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 TypeMask selectorTypeOf(Selector selector, TypeMask mask) { 745 TypeMask selectorTypeOf(Selector selector, TypeMask mask) {
745 return TypeMaskFactory.inferredTypeForSelector( 746 return TypeMaskFactory.inferredTypeForSelector(
746 selector, mask, _globalInferenceResults); 747 selector, mask, _globalInferenceResults);
747 } 748 }
748 749
749 TypeMask typeFromNativeBehavior( 750 TypeMask typeFromNativeBehavior(
750 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { 751 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) {
751 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); 752 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld);
752 } 753 }
753 } 754 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/jump_handler.dart ('k') | tests/compiler/dart2js/closure/closure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698