You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Small fixes to static analyzer bugs
This commit is contained in:
@@ -406,9 +406,10 @@ public:
|
||||
csi.resize(_debug_call_stack_pos);
|
||||
for (int i = 0; i < _debug_call_stack_pos; i++) {
|
||||
csi.write[_debug_call_stack_pos - i - 1].line = _call_stack[i].line ? *_call_stack[i].line : 0;
|
||||
if (_call_stack[i].function)
|
||||
if (_call_stack[i].function) {
|
||||
csi.write[_debug_call_stack_pos - i - 1].func = _call_stack[i].function->get_name();
|
||||
csi.write[_debug_call_stack_pos - i - 1].file = _call_stack[i].function->get_script()->get_path();
|
||||
csi.write[_debug_call_stack_pos - i - 1].file = _call_stack[i].function->get_script()->get_path();
|
||||
}
|
||||
}
|
||||
return csi;
|
||||
}
|
||||
|
||||
@@ -2165,7 +2165,6 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p
|
||||
static void _find_call_arguments(const GDScriptCompletionContext &p_context, const GDScriptCompletionIdentifier &p_base, const StringName &p_method, int p_argidx, bool p_static, Set<String> &r_result, String &r_arghint) {
|
||||
Variant base = p_base.value;
|
||||
GDScriptParser::DataType base_type = p_base.type;
|
||||
bool _static = false;
|
||||
|
||||
while (base_type.has_type) {
|
||||
switch (base_type.kind) {
|
||||
@@ -2176,12 +2175,10 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!_static) {
|
||||
for (int i = 0; i < base_type.class_type->functions.size(); i++) {
|
||||
if (base_type.class_type->functions[i]->name == p_method) {
|
||||
r_arghint = _make_arguments_hint(base_type.class_type->functions[i], p_argidx);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < base_type.class_type->functions.size(); i++) {
|
||||
if (base_type.class_type->functions[i]->name == p_method) {
|
||||
r_arghint = _make_arguments_hint(base_type.class_type->functions[i], p_argidx);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +282,6 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
||||
|
||||
switch (tokenizer->get_token()) {
|
||||
case GDScriptTokenizer::TK_CURSOR: {
|
||||
completion_cursor = StringName();
|
||||
completion_type = COMPLETION_GET_NODE;
|
||||
completion_class = current_class;
|
||||
completion_function = current_function;
|
||||
@@ -2864,8 +2863,6 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
|
||||
lv->assign_op = op;
|
||||
lv->assign = assigned;
|
||||
|
||||
lv->assign_op = op;
|
||||
|
||||
if (!_end_statement()) {
|
||||
_set_error("Expected end of statement (var)");
|
||||
return;
|
||||
@@ -6179,8 +6176,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
|
||||
return DataType();
|
||||
}
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (var_op == Variant::OP_DIVIDE && argument_a_type.has_type && argument_a_type.kind == DataType::BUILTIN && argument_a_type.builtin_type == Variant::INT &&
|
||||
argument_b_type.has_type && argument_b_type.kind == DataType::BUILTIN && argument_b_type.builtin_type == Variant::INT) {
|
||||
if (var_op == Variant::OP_DIVIDE && argument_a_type.kind == DataType::BUILTIN && argument_a_type.builtin_type == Variant::INT &&
|
||||
argument_b_type.kind == DataType::BUILTIN && argument_b_type.builtin_type == Variant::INT) {
|
||||
_add_warning(GDScriptWarning::INTEGER_DIVISION, op->line);
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
@@ -6889,10 +6886,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (current_function && !for_completion && !is_static && p_call->arguments[0]->type == Node::TYPE_SELF && current_function->_static) {
|
||||
if (current_function && current_function->_static && p_call->arguments[0]->type == Node::TYPE_SELF) {
|
||||
_set_error("Can't call non-static function from a static function.", p_call->line);
|
||||
return DataType();
|
||||
}
|
||||
_set_error("Can't call non-static function from a static function.", p_call->line);
|
||||
return DataType();
|
||||
}
|
||||
|
||||
if (check_types && !is_static && !is_initializer && base_type.is_meta_type) {
|
||||
|
||||
Reference in New Issue
Block a user