Use putIfAbsent in InheritanceManager._reportError.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2537643004 .
This commit is contained in:
Paul Berry 2016-11-29 12:07:10 -08:00
parent 86866a3116
commit af89793c11

View file

@ -669,11 +669,8 @@ class InheritanceManager {
if (ignoreErrors) {
return;
}
HashSet<AnalysisError> errorSet = _errorsInClassElement[classElt];
if (errorSet == null) {
errorSet = new HashSet<AnalysisError>();
_errorsInClassElement[classElt] = errorSet;
}
HashSet<AnalysisError> errorSet = _errorsInClassElement.putIfAbsent(
classElt, () => new HashSet<AnalysisError>());
errorSet.add(new AnalysisError(classElt.source, classElt.nameOffset,
classElt.nameLength, errorCode, arguments));
}