Skip to content

Commit a42c072

Browse files
srujzscommit-bot@chromium.org
authored andcommitted
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 <[email protected]> Commit-Queue: Srujan Gaddam <[email protected]>
1 parent dc1e57c commit a42c072

File tree

6 files changed

+4
-10
lines changed

6 files changed

+4
-10
lines changed

pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|1476|39|5|The left
1515
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.
1616
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.
1717
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.
18-
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.
1918
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.

pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|8384|60|5|The left
2020
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.
2121
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.
2222
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.
23-
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.
2423
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.

sdk/lib/html/dart2js/html_dart2js.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3685,8 +3685,7 @@ class CssStyleDeclaration extends Interceptor with CssStyleDeclarationBase {
36853685
///
36863686
/// Please note the property name uses camelCase, not-hyphens.
36873687
String getPropertyValue(String propertyName) {
3688-
var propValue = _getPropertyValueHelper(propertyName);
3689-
return propValue ?? '';
3688+
return _getPropertyValueHelper(propertyName);
36903689
}
36913690

36923691
String _getPropertyValueHelper(String propertyName) {

sdk_nnbd/lib/html/dart2js/html_dart2js.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4072,8 +4072,7 @@ class CssStyleDeclaration extends Interceptor with CssStyleDeclarationBase {
40724072
///
40734073
/// Please note the property name uses camelCase, not-hyphens.
40744074
String getPropertyValue(String propertyName) {
4075-
var propValue = _getPropertyValueHelper(propertyName);
4076-
return propValue ?? '';
4075+
return _getPropertyValueHelper(propertyName);
40774076
}
40784077

40794078
String _getPropertyValueHelper(String propertyName) {

tools/dom/scripts/css_code_generator.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ def GenerateCssTemplateFile():
125125
///
126126
/// Please note the property name uses camelCase, not-hyphens.
127127
String getPropertyValue(String propertyName) {
128-
var propValue = _getPropertyValueHelper(propertyName);
129-
return propValue ?? '';
128+
return _getPropertyValueHelper(propertyName);
130129
}
131130
132131
String _getPropertyValueHelper(String propertyName) {

tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME $EXTENDS with
2727
///
2828
/// Please note the property name uses camelCase, not-hyphens.
2929
String getPropertyValue(String propertyName) {
30-
var propValue = _getPropertyValueHelper(propertyName);
31-
return propValue ?? '';
30+
return _getPropertyValueHelper(propertyName);
3231
}
3332

3433
String _getPropertyValueHelper(String propertyName) {

0 commit comments

Comments
 (0)