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

Unified Diff: pkg/analyzer/lib/src/dart/constant/evaluation.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, 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 | « pkg/analyzer/lib/src/dart/ast/utilities.dart ('k') | pkg/analyzer/lib/src/dart/element/element.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/constant/evaluation.dart
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index 7f0a7b8d2bf87d4d756f480b7661038160b0df1f..5c5a74d0852581724a24c46f06e05a022e0182ee 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -85,10 +85,9 @@ class ConstantEvaluationEngine {
*/
ConstantEvaluationEngine(this.typeProvider, this._declaredVariables,
{ConstantEvaluationValidator validator, TypeSystem typeSystem})
- : validator = validator != null
- ? validator
- : new ConstantEvaluationValidator_ForProduction(),
- typeSystem = typeSystem != null ? typeSystem : new TypeSystemImpl();
+ : validator =
+ validator ?? new ConstantEvaluationValidator_ForProduction(),
+ typeSystem = typeSystem ?? new TypeSystemImpl();
/**
* Check that the arguments to a call to fromEnvironment() are correct. The
@@ -1476,7 +1475,7 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
*/
void _error(AstNode node, ErrorCode code) {
_errorReporter.reportErrorForNode(
- code == null ? CompileTimeErrorCode.INVALID_CONSTANT : code, node);
+ code ?? CompileTimeErrorCode.INVALID_CONSTANT, node);
}
/**
@@ -1929,8 +1928,7 @@ class EvaluationResult {
* compile time constant if the errors would have been reported by other parts
* of the analysis engine.
*/
- List<AnalysisError> get errors =>
- _errors == null ? AnalysisError.NO_ERRORS : _errors;
+ List<AnalysisError> get errors => _errors ?? AnalysisError.NO_ERRORS;
/**
* Return `true` if the expression is a compile-time constant expression that
@@ -1973,7 +1971,7 @@ class EvaluationResultImpl {
final DartObjectImpl value;
EvaluationResultImpl(this.value, [List<AnalysisError> errors]) {
- this._errors = errors == null ? <AnalysisError>[] : errors;
+ this._errors = errors ?? <AnalysisError>[];
}
List<AnalysisError> get errors => _errors;
« no previous file with comments | « pkg/analyzer/lib/src/dart/ast/utilities.dart ('k') | pkg/analyzer/lib/src/dart/element/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698