mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
[Core] Use Vector
for MethodInfo::arguments
This commit is contained in:
parent
cae3d722a3
commit
d9721954e6
18 changed files with 107 additions and 124 deletions
|
@ -1640,13 +1640,12 @@ void GDScriptAnalyzer::resolve_annotation(GDScriptParser::AnnotationNode *p_anno
|
|||
|
||||
const MethodInfo &annotation_info = parser->valid_annotations[p_annotation->name].info;
|
||||
|
||||
const List<PropertyInfo>::Element *E = annotation_info.arguments.front();
|
||||
for (int i = 0; i < p_annotation->arguments.size(); i++) {
|
||||
for (int64_t i = 0, j = 0; i < p_annotation->arguments.size(); i++) {
|
||||
GDScriptParser::ExpressionNode *argument = p_annotation->arguments[i];
|
||||
const PropertyInfo &argument_info = E->get();
|
||||
const PropertyInfo &argument_info = annotation_info.arguments[j];
|
||||
|
||||
if (E->next() != nullptr) {
|
||||
E = E->next();
|
||||
if (j + 1 < annotation_info.arguments.size()) {
|
||||
++j;
|
||||
}
|
||||
|
||||
reduce_expression(argument);
|
||||
|
@ -3323,28 +3322,24 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
|
|||
|
||||
bool types_match = true;
|
||||
|
||||
{
|
||||
List<PropertyInfo>::ConstIterator arg_itr = info.arguments.begin();
|
||||
for (int i = 0; i < p_call->arguments.size(); ++arg_itr, ++i) {
|
||||
GDScriptParser::DataType par_type = type_from_property(*arg_itr, true);
|
||||
GDScriptParser::DataType arg_type = p_call->arguments[i]->get_datatype();
|
||||
if (!is_type_compatible(par_type, arg_type, true)) {
|
||||
types_match = false;
|
||||
break;
|
||||
for (int64_t i = 0; i < p_call->arguments.size(); ++i) {
|
||||
GDScriptParser::DataType par_type = type_from_property(info.arguments[i], true);
|
||||
GDScriptParser::DataType arg_type = p_call->arguments[i]->get_datatype();
|
||||
if (!is_type_compatible(par_type, arg_type, true)) {
|
||||
types_match = false;
|
||||
break;
|
||||
#ifdef DEBUG_ENABLED
|
||||
} else {
|
||||
if (par_type.builtin_type == Variant::INT && arg_type.builtin_type == Variant::FLOAT && builtin_type != Variant::INT) {
|
||||
parser->push_warning(p_call, GDScriptWarning::NARROWING_CONVERSION, function_name);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (par_type.builtin_type == Variant::INT && arg_type.builtin_type == Variant::FLOAT && builtin_type != Variant::INT) {
|
||||
parser->push_warning(p_call, GDScriptWarning::NARROWING_CONVERSION, function_name);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (types_match) {
|
||||
List<PropertyInfo>::ConstIterator arg_itr = info.arguments.begin();
|
||||
for (int i = 0; i < p_call->arguments.size(); ++arg_itr, ++i) {
|
||||
GDScriptParser::DataType par_type = type_from_property(*arg_itr, true);
|
||||
for (int64_t i = 0; i < p_call->arguments.size(); ++i) {
|
||||
GDScriptParser::DataType par_type = type_from_property(info.arguments[i], true);
|
||||
if (p_call->arguments[i]->is_constant) {
|
||||
update_const_expression_builtin_type(p_call->arguments[i], par_type, "pass");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue