summaryrefslogtreecommitdiffstats
path: root/core/object/script_language_extension.h
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2023-12-24 13:44:21 +0100
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-04-10 14:49:34 +0200
commit64146cb7f35b57b0974b82845674d58f9f3480b6 (patch)
treebbfae7eca9992c0dcdf2ee237dd56f9d742d6c77 /core/object/script_language_extension.h
parent1f0f81049fc470fe10ddb64086c94b9c595ec81f (diff)
downloadredot-engine-64146cb7f35b57b0974b82845674d58f9f3480b6.tar.gz
[Core] Add iteration support to `Array`
Diffstat (limited to 'core/object/script_language_extension.h')
-rw-r--r--core/object/script_language_extension.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/core/object/script_language_extension.h b/core/object/script_language_extension.h
index 1db322526d..cc6b729ae8 100644
--- a/core/object/script_language_extension.h
+++ b/core/object/script_language_extension.h
@@ -319,8 +319,8 @@ public:
}
if (r_errors != nullptr && ret.has("errors")) {
Array errors = ret["errors"];
- for (int i = 0; i < errors.size(); i++) {
- Dictionary err = errors[i];
+ for (const Variant &error : errors) {
+ Dictionary err = error;
ERR_CONTINUE(!err.has("line"));
ERR_CONTINUE(!err.has("column"));
ERR_CONTINUE(!err.has("message"));
@@ -339,8 +339,8 @@ public:
if (r_warnings != nullptr && ret.has("warnings")) {
ERR_FAIL_COND_V(!ret.has("warnings"), false);
Array warnings = ret["warnings"];
- for (int i = 0; i < warnings.size(); i++) {
- Dictionary warn = warnings[i];
+ for (const Variant &warning : warnings) {
+ Dictionary warn = warning;
ERR_CONTINUE(!warn.has("start_line"));
ERR_CONTINUE(!warn.has("end_line"));
ERR_CONTINUE(!warn.has("leftmost_column"));
@@ -402,8 +402,8 @@ public:
if (r_options != nullptr && ret.has("options")) {
Array options = ret["options"];
- for (int i = 0; i < options.size(); i++) {
- Dictionary op = options[i];
+ for (const Variant &var : options) {
+ Dictionary op = var;
CodeCompletionOption option;
ERR_CONTINUE(!op.has("kind"));
option.kind = CodeCompletionKind(int(op["kind"]));
@@ -502,8 +502,8 @@ public:
}
if (p_values != nullptr && ret.has("values")) {
Array values = ret["values"];
- for (int i = 0; i < values.size(); i++) {
- p_values->push_back(values[i]);
+ for (const Variant &value : values) {
+ p_values->push_back(value);
}
}
}
@@ -522,8 +522,8 @@ public:
}
if (p_values != nullptr && ret.has("values")) {
Array values = ret["values"];
- for (int i = 0; i < values.size(); i++) {
- p_values->push_back(values[i]);
+ for (const Variant &value : values) {
+ p_values->push_back(value);
}
}
}
@@ -549,8 +549,8 @@ public:
}
if (p_values != nullptr && ret.has("values")) {
Array values = ret["values"];
- for (int i = 0; i < values.size(); i++) {
- p_values->push_back(values[i]);
+ for (const Variant &value : values) {
+ p_values->push_back(value);
}
}
}
@@ -562,9 +562,9 @@ public:
TypedArray<Dictionary> ret;
GDVIRTUAL_REQUIRED_CALL(_debug_get_current_stack_info, ret);
Vector<StackInfo> sret;
- for (int i = 0; i < ret.size(); i++) {
+ for (const Variant &var : ret) {
StackInfo si;
- Dictionary d = ret[i];
+ Dictionary d = var;
ERR_CONTINUE(!d.has("file"));
ERR_CONTINUE(!d.has("func"));
ERR_CONTINUE(!d.has("line"));
@@ -595,8 +595,8 @@ public:
virtual void get_public_functions(List<MethodInfo> *p_functions) const override {
TypedArray<Dictionary> ret;
GDVIRTUAL_REQUIRED_CALL(_get_public_functions, ret);
- for (int i = 0; i < ret.size(); i++) {
- MethodInfo mi = MethodInfo::from_dict(ret[i]);
+ for (const Variant &var : ret) {
+ MethodInfo mi = MethodInfo::from_dict(var);
p_functions->push_back(mi);
}
}
@@ -615,8 +615,8 @@ public:
virtual void get_public_annotations(List<MethodInfo> *p_annotations) const override {
TypedArray<Dictionary> ret;
GDVIRTUAL_REQUIRED_CALL(_get_public_annotations, ret);
- for (int i = 0; i < ret.size(); i++) {
- MethodInfo mi = MethodInfo::from_dict(ret[i]);
+ for (const Variant &var : ret) {
+ MethodInfo mi = MethodInfo::from_dict(var);
p_annotations->push_back(mi);
}
}