| Index: pkg/compiler/lib/src/cps_ir/cps_fragment.dart
|
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_fragment.dart b/pkg/compiler/lib/src/cps_ir/cps_fragment.dart
|
| index cc06b498c2f77e038b62b7ce2b03870a4900de10..7e62fa5f7066885056dc925b13754bfa4039e0ee 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/cps_fragment.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/cps_fragment.dart
|
| @@ -189,31 +189,39 @@ class CpsFragment {
|
|
|
| /// Branch on [condition].
|
| ///
|
| - /// Returns a new fragment for the 'then' branch.
|
| + /// Returns a new fragment for the 'then' branch, or the 'else' branch
|
| + /// if [negate] is true.
|
| ///
|
| - /// The 'else' branch becomes the new hole.
|
| - CpsFragment ifTruthy(Primitive condition) {
|
| + /// The other branch becomes the new hole.
|
| + CpsFragment branch(Primitive condition,
|
| + {bool negate: false,
|
| + bool strict: false}) {
|
| Continuation trueCont = new Continuation(<Parameter>[]);
|
| Continuation falseCont = new Continuation(<Parameter>[]);
|
| put(new LetCont.two(trueCont, falseCont,
|
| - new Branch.loose(condition, trueCont, falseCont)));
|
| - context = falseCont;
|
| - return new CpsFragment(sourceInformation, trueCont);
|
| + new Branch(condition, trueCont, falseCont, strict: strict)));
|
| + if (negate) {
|
| + context = trueCont;
|
| + return new CpsFragment(sourceInformation, falseCont);
|
| + } else {
|
| + context = falseCont;
|
| + return new CpsFragment(sourceInformation, trueCont);
|
| + }
|
| }
|
|
|
| /// Branch on [condition].
|
| ///
|
| + /// Returns a new fragment for the 'then' branch.
|
| + ///
|
| + /// The 'else' branch becomes the new hole.
|
| + CpsFragment ifTruthy(Primitive condition) => branch(condition);
|
| +
|
| + /// Branch on [condition].
|
| + ///
|
| /// Returns a new fragment for the 'else' branch.
|
| ///
|
| /// The 'then' branch becomes the new hole.
|
| - CpsFragment ifFalsy(Primitive condition) {
|
| - Continuation trueCont = new Continuation(<Parameter>[]);
|
| - Continuation falseCont = new Continuation(<Parameter>[]);
|
| - put(new LetCont.two(trueCont, falseCont,
|
| - new Branch.loose(condition, trueCont, falseCont)));
|
| - context = trueCont;
|
| - return new CpsFragment(sourceInformation, falseCont);
|
| - }
|
| + CpsFragment ifFalsy(Primitive condition) => branch(condition, negate: true);
|
|
|
| /// Create a new empty continuation and bind it here.
|
| ///
|
|
|