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

Unified Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10140027: Avoid "=== true" inside code by calling a function that does this for us. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change copyright year. Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/codegen.dart
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index 80b33d877bd0d91a9b482af6b36236578973d5fa..f0e5720df00e755b250ae8d7f5fdad9725c0d2b4 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -127,6 +127,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
final Equivalence<HPhi> phiEquivalence;
Element equalsNullElement;
+ Element boolifiedEqualsNullElement;
int indent = 0;
int expectedPrecedence = JSPrecedence.STATEMENT_PRECEDENCE;
HGraph currentGraph;
@@ -176,8 +177,10 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
// Create a namespace for temporaries.
prefixes[TEMPORARY_PREFIX] = 0;
- equalsNullElement =
- compiler.builder.interceptors.getEqualsNullInterceptor();
+ Interceptors interceptors = compiler.builder.interceptors;
+ equalsNullElement = interceptors.getEqualsNullInterceptor();
+ boolifiedEqualsNullElement =
+ interceptors.getBoolifiedVersionOf(equalsNullElement);
}
abstract visitTypeGuard(HTypeGuard node);
@@ -849,7 +852,8 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
buffer.add(' === ');
use(node.right, JSPrecedence.RELATIONAL_PRECEDENCE);
endExpression(JSPrecedence.EQUALITY_PRECEDENCE);
- } else if (node.element === equalsNullElement) {
+ } else if (node.element === equalsNullElement ||
+ node.element === boolifiedEqualsNullElement) {
beginExpression(JSPrecedence.CALL_PRECEDENCE);
use(node.target, JSPrecedence.CALL_PRECEDENCE);
buffer.add('(');
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698