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

Unified Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2971453002: Avoid string interpolation in templates. (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/lib/src/compiler/code_generator.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
index 6f2c2d1cd8dedcb5c0079afd775497b6c1cd194a..ac043391ee084b76d59d85547599100cd9b13607 100644
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
@@ -3583,9 +3583,8 @@ class CodeGenerator extends Object
if (_doubleEqIsIdentity(left, right)) {
return _emitJSDoubleEq(args, negated: negated);
}
- var bang = negated ? '!' : '';
- return js.call(
- "${bang}#", new JS.Call(_emitTopLevelName(_coreIdentical), args));
+ var code = negated ? '!#' : '#';
+ return js.call(code, new JS.Call(_emitTopLevelName(_coreIdentical), args));
}
/// Emits a function call, to a top-level function, local function, or
@@ -4183,7 +4182,6 @@ class CodeGenerator extends Object
return _emitCoreIdenticalCall([left, right], negated: negated);
}
- var bang = op.type == TokenType.BANG_EQ ? '!' : '';
var leftElement = leftType.element;
// If either is null, we can use simple equality.
@@ -4205,12 +4203,12 @@ class CodeGenerator extends Object
leftType is FunctionType ||
isNullable(left)) {
// Fall back to equality for now.
- var code = '${bang}#.equals(#, #)';
+ var code = negated ? '!#.equals(#, #)' : '#.equals(#, #)';
return js.call(code, [_runtimeModule, _visit(left), _visit(right)]);
}
var name = _emitMemberName('==', type: leftType);
- var code = '${bang}#[#](#)';
+ var code = negated ? '!#[#](#)' : '#[#](#)';
return js.call(code, [_visit(left), name, _visit(right)]);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698