diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-04-21 16:19:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-21 16:19:53 +0200 |
commit | 4f03e302a7aacd73760d592410502396588a0c1d (patch) | |
tree | e5a1aa464cb48133ccbb1d4e4ba95ac0270b8f6e | |
parent | a5a9bf6a19a2f0b6b8efab32bc465e8eef6f4f55 (diff) | |
parent | 62280c3d47bf4cda3775013b1676a2b651e18756 (diff) |
Merge pull request #38041 from ThakeeNathees/class-name-check-enhance
GDScript class name existance check enhanced
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 3ce56248e4..7e8d2b0436 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -3673,6 +3673,12 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { _set_error("A constant named \"" + String(name) + "\" already exists in the outer class scope (at line" + itos(outer_class->constant_expressions[name].expression->line) + ")."); return; } + for (int i = 0; i < outer_class->variables.size(); i++) { + if (outer_class->variables[i].identifier == name) { + _set_error("A variable named \"" + String(name) + "\" already exists in the outer class scope (at line " + itos(outer_class->variables[i].line) + ")."); + return; + } + } outer_class = outer_class->owner; } |