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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart

Issue 669693002: Support unreachable code in blocks in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.ir_builder; 5 library dart2js.ir_builder;
6 6
7 import '../constants/expressions.dart'; 7 import '../constants/expressions.dart';
8 import '../constants/values.dart' show PrimitiveConstantValue; 8 import '../constants/values.dart' show PrimitiveConstantValue;
9 import '../dart_backend/dart_backend.dart' show DartBackend; 9 import '../dart_backend/dart_backend.dart' show DartBackend;
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 // 590 //
591 // Return without a subexpression is translated as if it were return null. 591 // Return without a subexpression is translated as if it were return null.
592 assert(isOpen); 592 assert(isOpen);
593 if (value == null) { 593 if (value == null) {
594 value = buildNullLiteral(); 594 value = buildNullLiteral();
595 } 595 }
596 add(new ir.InvokeContinuation(state.returnContinuation, [value])); 596 add(new ir.InvokeContinuation(state.returnContinuation, [value]));
597 _current = null; 597 _current = null;
598 } 598 }
599 599
600 /// Create a blocks of [statements] by applying [build] to all reachable
601 /// statements.
602 // TODO(johnniwinther): Type [statements] as `Iterable` when `NodeList` uses
603 // `List` instead of `Link`.
604 void buildBlock(var statements, build(statement)) {
605 // Build(Block(stamements), C) = C'
606 // where C' = statements.fold(Build, C)
607 assert(isOpen);
608 for (var statement in statements) {
609 build(statement);
610 if (!isOpen) return;
611 }
612 }
613
614
600 // Build(BreakStatement L, C) = C[InvokeContinuation(...)] 615 // Build(BreakStatement L, C) = C[InvokeContinuation(...)]
601 // 616 //
602 // The continuation and arguments are filled in later after translating 617 // The continuation and arguments are filled in later after translating
603 // the body containing the break. 618 // the body containing the break.
604 bool buildBreak(JumpTarget target) { 619 bool buildBreak(JumpTarget target) {
605 return buildJumpInternal(target, state.breakCollectors); 620 return buildJumpInternal(target, state.breakCollectors);
606 } 621 }
607 622
608 // Build(ContinueStatement L, C) = C[InvokeContinuation(...)] 623 // Build(ContinueStatement L, C) = C[InvokeContinuation(...)]
609 // 624 //
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 index = 0; 856 index = 0;
842 for (int i = 0; i < environment.length; ++i) { 857 for (int i = 0; i < environment.length; ++i) {
843 if (common[i] == null) { 858 if (common[i] == null) {
844 environment.index2value[i] = parameters[index++]; 859 environment.index2value[i] = parameters[index++];
845 } 860 }
846 } 861 }
847 862
848 return join; 863 return join;
849 } 864 }
850 } 865 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698