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

Side by Side Diff: pkg/analysis_server/lib/plugin/protocol/protocol.dart

Issue 1941793002: Use null aware operators to clean up code (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /** 5 /**
6 * Support for client code that needs to interact with the requests, responses 6 * Support for client code that needs to interact with the requests, responses
7 * and notifications that are part of the analysis server's wire protocol. 7 * and notifications that are part of the analysis server's wire protocol.
8 */ 8 */
9 library analysis_server.plugin.protocol.protocol; 9 library analysis_server.plugin.protocol.protocol;
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 */ 153 */
154 final int clientRequestTime; 154 final int clientRequestTime;
155 155
156 /** 156 /**
157 * Initialize a newly created [Request] to have the given [id] and [method] 157 * Initialize a newly created [Request] to have the given [id] and [method]
158 * name. If [params] is supplied, it is used as the "params" map for the 158 * name. If [params] is supplied, it is used as the "params" map for the
159 * request. Otherwise an empty "params" map is allocated. 159 * request. Otherwise an empty "params" map is allocated.
160 */ 160 */
161 Request(this.id, this.method, 161 Request(this.id, this.method,
162 [Map<String, Object> params, this.clientRequestTime]) 162 [Map<String, Object> params, this.clientRequestTime])
163 : _params = params != null ? params : new HashMap<String, Object>(); 163 : _params = params ?? new HashMap<String, Object>();
164 164
165 /** 165 /**
166 * Return a request parsed from the given json, or `null` if the [data] is 166 * Return a request parsed from the given json, or `null` if the [data] is
167 * not a valid json representation of a request. The [data] is expected to 167 * not a valid json representation of a request. The [data] is expected to
168 * have the following format: 168 * have the following format:
169 * 169 *
170 * { 170 * {
171 * 'clientRequestTime': millisecondsSinceEpoch 171 * 'clientRequestTime': millisecondsSinceEpoch
172 * 'id': String, 172 * 'id': String,
173 * 'method': methodName, 173 * 'method': methodName,
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 jsonObject[ID] = id; 575 jsonObject[ID] = id;
576 if (error != null) { 576 if (error != null) {
577 jsonObject[ERROR] = error.toJson(); 577 jsonObject[ERROR] = error.toJson();
578 } 578 }
579 if (_result != null) { 579 if (_result != null) {
580 jsonObject[RESULT] = _result; 580 jsonObject[RESULT] = _result;
581 } 581 }
582 return jsonObject; 582 return jsonObject;
583 } 583 }
584 } 584 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698