Allow whitespaces in warning-ignore comments

(cherry picked from commit 7a0dfc04aa)
This commit is contained in:
Timo Schwarzer 2019-03-17 18:42:59 +01:00 committed by Rémi Verschelde
parent 0e7de28b8d
commit e31d6367ea
2 changed files with 7 additions and 6 deletions

View File

@ -534,13 +534,14 @@ void GDScriptTokenizerText::_advance() {
} }
} }
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
if (comment.begins_with("#warning-ignore:")) { String comment_content = comment.trim_prefix("#").trim_prefix(" ");
String code = comment.get_slice(":", 1); if (comment_content.begins_with("warning-ignore:")) {
String code = comment_content.get_slice(":", 1);
warning_skips.push_back(Pair<int, String>(line, code.strip_edges().to_lower())); warning_skips.push_back(Pair<int, String>(line, code.strip_edges().to_lower()));
} else if (comment.begins_with("#warning-ignore-all:")) { } else if (comment_content.begins_with("warning-ignore-all:")) {
String code = comment.get_slice(":", 1); String code = comment_content.get_slice(":", 1);
warning_global_skips.insert(code.strip_edges().to_lower()); warning_global_skips.insert(code.strip_edges().to_lower());
} else if (comment.strip_edges() == "#warnings-disable") { } else if (comment_content.strip_edges() == "warnings-disable") {
ignore_warnings = true; ignore_warnings = true;
} }
#endif // DEBUG_ENABLED #endif // DEBUG_ENABLED