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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 737353002: cps-ir: Implement boolean conversion in and use it to implement '&&', '||', and '?:'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase to new test infrastructure. Created 6 years, 1 month 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 | « no previous file | pkg/compiler/lib/src/js_backend/codegen/codegen.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) 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 // IrNodes are kept in a separate library to have precise control over their 5 // IrNodes are kept in a separate library to have precise control over their
6 // dependencies on other parts of the system. 6 // dependencies on other parts of the system.
7 library dart2js.ir_nodes; 7 library dart2js.ir_nodes;
8 8
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../constants/values.dart' as values show ConstantValue; 10 import '../constants/values.dart' as values show ConstantValue;
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 /// If `true`, [body] and [returnContinuation] are `null` and [localConstants] 573 /// If `true`, [body] and [returnContinuation] are `null` and [localConstants]
574 /// is empty. 574 /// is empty.
575 bool get isAbstract => body == null; 575 bool get isAbstract => body == null;
576 } 576 }
577 577
578 List<Reference<Primitive>> _referenceList(Iterable<Primitive> definitions) { 578 List<Reference<Primitive>> _referenceList(Iterable<Primitive> definitions) {
579 return definitions.map((e) => new Reference<Primitive>(e)).toList(); 579 return definitions.map((e) => new Reference<Primitive>(e)).toList();
580 } 580 }
581 581
582 abstract class Visitor<T> { 582 abstract class Visitor<T> {
583 const Visitor();
584
583 T visit(Node node) => node.accept(this); 585 T visit(Node node) => node.accept(this);
584 // Abstract classes. 586 // Abstract classes.
585 T visitNode(Node node) => null; 587 T visitNode(Node node) => null;
586 T visitExpression(Expression node) => visitNode(node); 588 T visitExpression(Expression node) => visitNode(node);
587 T visitDefinition(Definition node) => visitNode(node); 589 T visitDefinition(Definition node) => visitNode(node);
588 T visitPrimitive(Primitive node) => visitDefinition(node); 590 T visitPrimitive(Primitive node) => visitDefinition(node);
589 T visitCondition(Condition node) => visitNode(node); 591 T visitCondition(Condition node) => visitNode(node);
590 592
591 // Concrete classes. 593 // Concrete classes.
592 T visitFunctionDefinition(FunctionDefinition node) => visitNode(node); 594 T visitFunctionDefinition(FunctionDefinition node) => visitNode(node);
(...skipping 23 matching lines...) Expand all
616 T visitParameter(Parameter node) => visitPrimitive(node); 618 T visitParameter(Parameter node) => visitPrimitive(node);
617 T visitContinuation(Continuation node) => visitDefinition(node); 619 T visitContinuation(Continuation node) => visitDefinition(node);
618 620
619 // Conditions. 621 // Conditions.
620 T visitIsTrue(IsTrue node) => visitCondition(node); 622 T visitIsTrue(IsTrue node) => visitCondition(node);
621 } 623 }
622 624
623 /// Recursively visits the entire CPS term, and calls abstract `process*` 625 /// Recursively visits the entire CPS term, and calls abstract `process*`
624 /// (i.e. `processLetPrim`) functions in pre-order. 626 /// (i.e. `processLetPrim`) functions in pre-order.
625 abstract class RecursiveVisitor extends Visitor { 627 abstract class RecursiveVisitor extends Visitor {
628 const RecursiveVisitor();
629
626 // Ensures that RecursiveVisitor contains overrides for all relevant nodes. 630 // Ensures that RecursiveVisitor contains overrides for all relevant nodes.
627 // As a rule of thumb, nodes with structure to traverse should be overridden 631 // As a rule of thumb, nodes with structure to traverse should be overridden
628 // with the appropriate visits in this class (for example, visitLetCont), 632 // with the appropriate visits in this class (for example, visitLetCont),
629 // while leaving other nodes for subclasses (i.e., visitLiteralList). 633 // while leaving other nodes for subclasses (i.e., visitLiteralList).
630 visitNode(Node node) { 634 visitNode(Node node) {
631 throw "RecursiveVisitor is stale, add missing visit overrides"; 635 throw "RecursiveVisitor is stale, add missing visit overrides";
632 } 636 }
633 637
634 processReference(Reference ref) {} 638 processReference(Reference ref) {}
635 639
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 release(node.parameters[i]); 949 release(node.parameters[i]);
946 } 950 }
947 } 951 }
948 952
949 void visitIsTrue(IsTrue node) { 953 void visitIsTrue(IsTrue node) {
950 visitReference(node.value); 954 visitReference(node.value);
951 } 955 }
952 956
953 } 957 }
954 958
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/codegen/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698