diff options
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 6 | ||||
-rw-r--r-- | modules/gdscript/gdscript_function.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 51 |
3 files changed, 54 insertions, 5 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 7433c4a5bc..50d8289fd1 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -2082,7 +2082,11 @@ static void _find_identifiers_in_base(const GDScriptCompletionContext &p_context if (!p_only_functions) { List<PropertyInfo> members; - tmp.get_property_list(&members); + if (p_base.value.get_type() != Variant::NIL) { + p_base.value.get_property_list(&members); + } else { + tmp.get_property_list(&members); + } for (List<PropertyInfo>::Element *E = members.front(); E; E = E->next()) { if (String(E->get().name).find("/") == -1) { diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 8445eee1fa..37177a8cfd 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -1821,8 +1821,6 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) { state.result = Variant(); if (completed) { - _clear_stack(); - if (first_state.is_valid()) { first_state->emit_signal("completed", ret); } else { diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index fbb5f91139..0e498f6895 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -3167,7 +3167,6 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { if (error_set) { return; } - p_block->has_return = cf_while->body->has_return; p_block->statements.push_back(cf_while); } break; case GDScriptTokenizer::TK_CF_FOR: { @@ -3308,7 +3307,6 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { if (error_set) { return; } - p_block->has_return = cf_for->body->has_return; p_block->statements.push_back(cf_for); } break; case GDScriptTokenizer::TK_CF_CONTINUE: { @@ -4123,6 +4121,14 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { sig.name = tokenizer->get_token_identifier(); sig.emissions = 0; sig.line = tokenizer->get_token_line(); + + for (int i = 0; i < current_class->_signals.size(); i++) { + if (current_class->_signals[i].name == sig.name) { + _set_error("The signal \"" + sig.name + "\" already exists in this class (at line: " + itos(current_class->_signals[i].line) + ")."); + return; + } + } + tokenizer->advance(); if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_OPEN) { @@ -7948,6 +7954,47 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) { } } + // Signals + DataType base = p_class->base_type; + + while (base.kind == DataType::CLASS) { + ClassNode *base_class = base.class_type; + for (int i = 0; i < p_class->_signals.size(); i++) { + for (int j = 0; j < base_class->_signals.size(); j++) { + if (p_class->_signals[i].name == base_class->_signals[j].name) { + _set_error("The signal \"" + p_class->_signals[i].name + "\" already exists in a parent class.", p_class->_signals[i].line); + return; + } + } + } + base = base_class->base_type; + } + + StringName native; + if (base.kind == DataType::GDSCRIPT || base.kind == DataType::SCRIPT) { + Ref<Script> scr = base.script_type; + if (scr.is_valid() && scr->is_valid()) { + native = scr->get_instance_base_type(); + for (int i = 0; i < p_class->_signals.size(); i++) { + if (scr->has_script_signal(p_class->_signals[i].name)) { + _set_error("The signal \"" + p_class->_signals[i].name + "\" already exists in a parent class.", p_class->_signals[i].line); + return; + } + } + } + } else if (base.kind == DataType::NATIVE) { + native = base.native_type; + } + + if (native != StringName()) { + for (int i = 0; i < p_class->_signals.size(); i++) { + if (ClassDB::has_signal(native, p_class->_signals[i].name)) { + _set_error("The signal \"" + p_class->_signals[i].name + "\" already exists in a parent class.", p_class->_signals[i].line); + return; + } + } + } + // Inner classes for (int i = 0; i < p_class->subclasses.size(); i++) { current_class = p_class->subclasses[i]; |