| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent afdb362 commit 11ebb04
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6489,6 +6489,26 @@ def CheckLocalVectorUsage(filename, lines, error): | |||
| 6489 | 6489 | 'Do not use std::vector<v8::Local<T>>. ' | |
| 6490 | 6490 | 'Use v8::LocalVector<T> instead.') | |
| 6491 | 6491 | ||
| 6492 | + def CheckStringValueUsage(filename, lines, error): | ||
| 6493 | + """Logs an error if v8's String::Value/Utf8Value are used. | ||
| 6494 | + Args: | ||
| 6495 | + filename: The name of the current file. | ||
| 6496 | + lines: An array of strings, each representing a line of the file. | ||
| 6497 | + error: The function to call with any errors found. | ||
| 6498 | + """ | ||
| 6499 | + if filename.startswith('test/') or filename.startswith('test\\'): | ||
| 6500 | + return # Skip test files, where Node.js headers may not be available | ||
| 6501 | + | ||
| 6502 | + for linenum, line in enumerate(lines): | ||
| 6503 | + if Search(r'\bString::Utf8Value\b', line): | ||
| 6504 | + error(filename, linenum, 'runtime/v8_string_value', 5, | ||
| 6505 | + 'Do not use v8::String::Utf8Value. ' | ||
| 6506 | + 'Use node::Utf8Value instead.') | ||
| 6507 | + if Search(r'\bString::Value\b', line): | ||
| 6508 | + error(filename, linenum, 'runtime/v8_string_value', 5, | ||
| 6509 | + 'Do not use v8::String::Value. ' | ||
| 6510 | + 'Use node::TwoByteValue instead.') | ||
| 6511 | + | ||
| 6492 | 6512 | def ProcessLine(filename, file_extension, clean_lines, line, | |
| 6493 | 6513 | include_state, function_state, nesting_state, error, | |
| 6494 | 6514 | extra_check_functions=None): | |
@@ -6660,6 +6680,8 @@ def ProcessFileData(filename, file_extension, lines, error, | |||
| 6660 | 6680 | ||
| 6661 | 6681 | CheckLocalVectorUsage(filename, lines, error) | |
| 6662 | 6682 | ||
| 6683 | + CheckStringValueUsage(filename, lines, error) | ||
| 6684 | + | ||
| 6663 | 6685 | def ProcessConfigOverrides(filename): | |
| 6664 | 6686 | """ Loads the configuration files and processes the config overrides. | |
| 6665 | 6687 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments