Remove unnecessary null check in getPropertyValue

CSSStyleDeclaration.getPropertyValue returns a non-nullable string.
It will also return an empty string if the property is not found. Since
getPropertyValue returns the value of the native getPropertyValue, the
null check should be removed.

Change-Id: I9846553d3f9fcd68cbd15b9c39d2104cab594b7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136413
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This commit is contained in:
Srujan Gaddam
2020-02-20 20:49:26 +00:00
committed by commit-bot@chromium.org
parent dc1e57c2df
commit a42c072017
6 changed files with 4 additions and 10 deletions
@@ -15,5 +15,4 @@ WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|1476|39|5|The left
WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|8384|60|5|The left operand can't be null, so the right operand is never executed.
WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/developer/developer.dart|315|25|23|The left operand can't be null, so the right operand is never executed.
WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/html/dart2js/html_dart2js.dart|4076|25|2|The left operand can't be null, so the right operand is never executed.
WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/io/io.dart|9167|16|1|The left operand can't be null, so the right operand is never executed.
@@ -20,5 +20,4 @@ WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|8384|60|5|The left
WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/collection/collection.dart|1076|46|13|The left operand can't be null, so the right operand is never executed.
WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/developer/developer.dart|332|25|23|The left operand can't be null, so the right operand is never executed.
WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/html/dart2js/html_dart2js.dart|4076|25|2|The left operand can't be null, so the right operand is never executed.
WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/io/io.dart|9167|16|1|The left operand can't be null, so the right operand is never executed.
+1 -2
View File
@@ -3685,8 +3685,7 @@ class CssStyleDeclaration extends Interceptor with CssStyleDeclarationBase {
///
/// Please note the property name uses camelCase, not-hyphens.
String getPropertyValue(String propertyName) {
var propValue = _getPropertyValueHelper(propertyName);
return propValue ?? '';
return _getPropertyValueHelper(propertyName);
}
String _getPropertyValueHelper(String propertyName) {
+1 -2
View File
@@ -4072,8 +4072,7 @@ class CssStyleDeclaration extends Interceptor with CssStyleDeclarationBase {
///
/// Please note the property name uses camelCase, not-hyphens.
String getPropertyValue(String propertyName) {
var propValue = _getPropertyValueHelper(propertyName);
return propValue ?? '';
return _getPropertyValueHelper(propertyName);
}
String _getPropertyValueHelper(String propertyName) {
+1 -2
View File
@@ -125,8 +125,7 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME $EXTENDS with
///
/// Please note the property name uses camelCase, not-hyphens.
String getPropertyValue(String propertyName) {
var propValue = _getPropertyValueHelper(propertyName);
return propValue ?? '';
return _getPropertyValueHelper(propertyName);
}
String _getPropertyValueHelper(String propertyName) {
@@ -27,8 +27,7 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME $EXTENDS with
///
/// Please note the property name uses camelCase, not-hyphens.
String getPropertyValue(String propertyName) {
var propValue = _getPropertyValueHelper(propertyName);
return propValue ?? '';
return _getPropertyValueHelper(propertyName);
}
String _getPropertyValueHelper(String propertyName) {