Skip to content

Commit dab7f6b

Browse files
Aditi-1400RafaelGSS
authored andcommitted
tools: check for std::vector<v8::Local> in lint
PR-URL: #58497 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent 2990f17 commit dab7f6b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tools/cpplint.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6475,6 +6475,19 @@ def CheckItemIndentationInNamespace(filename, raw_lines_no_comments, linenum,
64756475
error(filename, linenum, 'runtime/indentation_namespace', 4,
64766476
'Do not indent within a namespace')
64776477

6478+
def CheckLocalVectorUsage(filename, lines, error):
6479+
"""Logs an error if std::vector<v8::Local<T>> is used.
6480+
Args:
6481+
filename: The name of the current file.
6482+
lines: An array of strings, each representing a line of the file.
6483+
error: The function to call with any errors found.
6484+
"""
6485+
for linenum, line in enumerate(lines):
6486+
if (Search(r'\bstd::vector<v8::Local<[^>]+>>', line) or
6487+
Search(r'\bstd::vector<Local<[^>]+>>', line)):
6488+
error(filename, linenum, 'runtime/local_vector', 5,
6489+
'Do not use std::vector<v8::Local<T>>. '
6490+
'Use v8::LocalVector<T> instead.')
64786491

64796492
def ProcessLine(filename, file_extension, clean_lines, line,
64806493
include_state, function_state, nesting_state, error,
@@ -6645,6 +6658,8 @@ def ProcessFileData(filename, file_extension, lines, error,
66456658

66466659
CheckInlineHeader(filename, include_state, error)
66476660

6661+
CheckLocalVectorUsage(filename, lines, error)
6662+
66486663
def ProcessConfigOverrides(filename):
66496664
""" Loads the configuration files and processes the config overrides.
66506665

0 commit comments

Comments
 (0)