Improve ScriptLanguage get keyword API.

This commit is contained in:
Yufeng Ying 2025-01-15 21:47:43 +08:00
parent 34f005d810
commit 1384e82c2c
13 changed files with 87 additions and 123 deletions

View file

@ -2731,9 +2731,9 @@ void GDScriptLanguage::frame() {
}
/* EDITOR FUNCTIONS */
void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
Vector<String> GDScriptLanguage::get_reserved_words() const {
// Please keep alphabetical order within categories.
static const char *_reserved_words[] = {
static const Vector<String> ret = {
// Control flow.
"break",
"continue",
@ -2786,15 +2786,9 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"preload",
// Types (highlighter uses type color instead).
"void",
nullptr,
};
const char **w = _reserved_words;
while (*w) {
p_words->push_back(*w);
w++;
}
return ret;
}
bool GDScriptLanguage::is_control_flow_keyword(const String &p_keyword) const {