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

Side by Side Diff: pkg/analyzer/lib/src/task/strong/info.dart

Issue 1933763002: Use null-aware operators to clean up the code (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Additional clean-up 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
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/checker.dart ('k') | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// Defines static information collected by the type checker and used later by 5 /// Defines static information collected by the type checker and used later by
6 /// emitters to generate code. 6 /// emitters to generate code.
7 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be 7 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be
8 // refactored to fit into analyzer. 8 // refactored to fit into analyzer.
9 library analyzer.src.task.strong.info; 9 library analyzer.src.task.strong.info;
10 10
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 : super(rules, expression); 205 : super(rules, expression);
206 DartType get convertedType => DynamicTypeImpl.instance; 206 DartType get convertedType => DynamicTypeImpl.instance;
207 String get message => '{0} requires dynamic invoke'; 207 String get message => '{0} requires dynamic invoke';
208 208
209 @override 209 @override
210 String get name => 'STRONG_MODE_DYNAMIC_INVOKE'; 210 String get name => 'STRONG_MODE_DYNAMIC_INVOKE';
211 211
212 toErrorCode() => new HintCode(name, message); 212 toErrorCode() => new HintCode(name, message);
213 213
214 /// Whether this [node] is the target of a dynamic operation. 214 /// Whether this [node] is the target of a dynamic operation.
215 static bool get(AstNode node) { 215 static bool get(AstNode node) => node.getProperty(_propertyName) ?? false;
216 var value = node.getProperty(_propertyName);
217 return value != null ? value : false;
218 }
219 216
220 /// Sets whether this node is the target of a dynamic operation. 217 /// Sets whether this node is the target of a dynamic operation.
221 static bool set(AstNode node, bool value) { 218 static bool set(AstNode node, bool value) {
222 // Free the storage for things that aren't dynamic. 219 // Free the storage for things that aren't dynamic.
223 if (value == false) value = null; 220 if (value == false) value = null;
224 node.setProperty(_propertyName, value); 221 node.setProperty(_propertyName, value);
225 return value; 222 return value;
226 } 223 }
227 } 224 }
228 225
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 super(expression); 538 super(expression);
542 539
543 @override 540 @override
544 List<Object> get arguments => [node, baseType, expectedType]; 541 List<Object> get arguments => [node, baseType, expectedType];
545 @override 542 @override
546 String get message => 'Type check failed: {0} ({1}) is not of type {2}'; 543 String get message => 'Type check failed: {0} ({1}) is not of type {2}';
547 544
548 @override 545 @override
549 String get name => 'STRONG_MODE_STATIC_TYPE_ERROR'; 546 String get name => 'STRONG_MODE_STATIC_TYPE_ERROR';
550 } 547 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/checker.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698