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

Unified Diff: lib/src/codegen/js_codegen.dart

Issue 1253143003: use some null aware ops (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 5 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: lib/src/codegen/js_codegen.dart
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
index 7a12f96bfebf4859c86819807ac461429831ca57..8a769573489637c8247f625e89d4fc13b699bf65 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -211,7 +211,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
var program = <JS.Statement>[
js.statement("dart_library.library(#, #, #, #, #)", [
js.string(jsPath, "'"),
- jsDefaultValue != null ? jsDefaultValue : new JS.LiteralNull(),
+ jsDefaultValue ?? new JS.LiteralNull(),
js.commentExpression(
"Imports", new JS.ArrayInitializer(imports, multiline: true)),
js.commentExpression("Lazy imports",
@@ -1859,7 +1859,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
var value = _visit(node.initializer);
// explicitly initialize to null, to avoid getting `undefined`.
// TODO(jmesserly): do this only for vars that aren't definitely assigned.
- return value != null ? value : new JS.LiteralNull();
+ return value ?? new JS.LiteralNull();
}
void _flushLazyFields(List<JS.Statement> body) {
@@ -2547,13 +2547,13 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
@override
visitBreakStatement(BreakStatement node) {
var label = node.label;
- return new JS.Break(label != null ? label.name : null);
+ return new JS.Break(label?.name);
}
@override
visitContinueStatement(ContinueStatement node) {
var label = node.label;
- return new JS.Continue(label != null ? label.name : null);
+ return new JS.Continue(label?.name);
}
@override
« 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