Changeset 252433 in webkit
- Timestamp:
- Nov 13, 2019, 2:56:54 PM (7 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/webkitpy/style/checkers/cpp.py (modified) (2 diffs)
-
Scripts/webkitpy/style/checkers/cpp_unittest.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r252430 r252433 1 2019-11-13 Megan Gardner <megan_gardner@apple.com> 2 3 check-webkit-style: fix false errors for obj-c method calls in range-based for statements using colon syntax 4 https://bugs.webkit.org/show_bug.cgi?id=204142 5 6 Reviewed by Jonathan Bedard. 7 8 Allow for the existance of an obj-c method call in a range-based for statement that also uses colons. 9 Do not allow colons between square brackets to trigger the error. 10 Also add a test for this specific case. 11 12 * Scripts/webkitpy/style/checkers/cpp.py: 13 (check_spacing): 14 * Scripts/webkitpy/style/checkers/cpp_unittest.py: 15 (WebKitStyleTest.test_spacing): 16 1 17 2019-11-13 Aakash Jain <aakash_jain@apple.com> 2 18 -
trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py
r249906 r252433 1979 1979 # We don't want: "if ( foo)" or "if ( foo )". 1980 1980 # Exception: "for ( ; foo; bar)" and "for (foo; bar; )" are allowed. 1981 # Exception: "for (foo n in [foo bar:baz])" is allowed because of obj-c method calls 1981 1982 matched = search(r'\b(?P<statement>if|for|while|switch)\s*\((?P<remainder>.*)$', line) 1982 1983 if matched: … … 1984 1985 condition, rest = up_to_unmatched_closing_paren(matched.group('remainder')) 1985 1986 if condition is not None: 1986 if statement == 'for' and search(r'(?:[^ :]:[^:]|[^:]:[^ :])', condition) :1987 error(line_number, 'whitespace/colon', 4, 'Missing space around : in range-based for statement')1987 if statement == 'for' and search(r'(?:[^ :]:[^:]|[^:]:[^ :])', condition) and not search(r'\[[^\]]+:[^\]]*\]', condition): 1988 error(line_number, 'whitespace/colon', 4, 'Missing space around : in range-based for statement') 1988 1989 condition_match = search(r'(?P<leading>[ ]*)(?P<separator>.).*[^ ]+(?P<trailing>[ ]*)', condition) 1989 1990 if condition_match: -
trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
r249906 r252433 4361 4361 4362 4362 self.assert_multi_line_lint( 4363 ' for (foo *bar in [foo bar:baz])\n' 4364 ' process(bar);\n', 4365 '', 4366 'foo.mm') 4367 4368 self.assert_multi_line_lint( 4363 4369 ' for (const Vector& vector: vectors)\n' 4364 4370 ' process(vector);\n',
Note:
See TracChangeset
for help on using the changeset viewer.