Title: [227532] trunk/Tools
Revision
227532
Author
ddkil...@apple.com
Date
2018-01-24 10:11:13 -0800 (Wed, 24 Jan 2018)

Log Message

check-webkit-style reports false-positive whitespace/braces warning about blocks with return types as arguments in Objective-C
<https://webkit.org/b/182015>
<rdar://problem/36449728>

Reviewed by Tim Horton.

* Scripts/webkitpy/style/checkers/cpp.py:
(regex_for_lambdas_and_blocks): Update regex to include
optional return type for block argument in Objective-C.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(WebKitStyleTest.test_braces): Add test.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (227531 => 227532)


--- trunk/Tools/ChangeLog	2018-01-24 18:10:29 UTC (rev 227531)
+++ trunk/Tools/ChangeLog	2018-01-24 18:11:13 UTC (rev 227532)
@@ -1,3 +1,17 @@
+2018-01-24  David Kilzer  <ddkil...@apple.com>
+
+        check-webkit-style reports false-positive whitespace/braces warning about blocks with return types as arguments in Objective-C
+        <https://webkit.org/b/182015>
+        <rdar://problem/36449728>
+
+        Reviewed by Tim Horton.
+
+        * Scripts/webkitpy/style/checkers/cpp.py:
+        (regex_for_lambdas_and_blocks): Update regex to include
+        optional return type for block argument in Objective-C.
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+        (WebKitStyleTest.test_braces): Add test.
+
 2018-01-24  Ms2ger  <ms2...@igalia.com>
 
         WPE-focused test gardening.

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (227531 => 227532)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2018-01-24 18:10:29 UTC (rev 227531)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2018-01-24 18:11:13 UTC (rev 227532)
@@ -1241,7 +1241,7 @@
 
 def regex_for_lambdas_and_blocks(line, line_number, file_state, error):
     cpp_result = search(r'\s\[.*?\]\s', line)
-    objc_result = search(r'(\s\^\s?\(.*?\)\s?|\^\s*\{|:\^\s?\(.*?\)\s\{)', line)
+    objc_result = search(r'(\s\^\s?\(.*?\)\s?|\^\s*\{|:\^(\s|\w+)?\(.*?\)\s\{)', line)
     if cpp_result:
         group = cpp_result.group()
         targ_error = None

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (227531 => 227532)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2018-01-24 18:10:29 UTC (rev 227531)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2018-01-24 18:11:13 UTC (rev 227532)
@@ -4566,6 +4566,10 @@
             '    Value1,\n'
             '    Value2\n'
             '};', '')
+        self.assert_multi_line_lint(
+            '[delegate setPolicyForURL:^_WKWebsitePolicy(NSURL *url) {\n'
+            '    return _WKWebsitePolicyDoIt;\n'
+            '}];', '', file_name='foo.mm')
 
         # 3. One-line control clauses should not use braces unless
         #    comments are included or a single statement spans multiple
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to