Skip to content

Commit 8d0649c

Browse files
committed
Rename indexVariable to loopIndexVariable
1 parent e4a4859 commit 8d0649c

29 files changed

+206
-172
lines changed

Core/GDCore/Events/Builtin/ForEachChildVariableEvent.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ void ForEachChildVariableEvent::SerializeTo(SerializerElement& element) const {
9595
if (HasVariables()) {
9696
variables.SerializeTo(element.AddChild("variables"));
9797
}
98-
if (!indexVariableName.empty()) {
99-
element.AddChild("indexVariable").SetStringValue(indexVariableName);
98+
if (!loopIndexVariableName.empty()) {
99+
element.AddChild("loopIndexVariable").SetStringValue(loopIndexVariableName);
100100
}
101101
}
102102

@@ -121,9 +121,9 @@ void ForEachChildVariableEvent::UnserializeFrom(gd::Project& project,
121121
variables.UnserializeFrom(element.GetChild("variables"));
122122
}
123123

124-
indexVariableName =
125-
element.HasChild("indexVariable")
126-
? element.GetChild("indexVariable").GetStringValue()
124+
loopIndexVariableName =
125+
element.HasChild("loopIndexVariable")
126+
? element.GetChild("loopIndexVariable").GetStringValue()
127127
: "";
128128
}
129129

Core/GDCore/Events/Builtin/ForEachChildVariableEvent.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ class GD_CORE_API ForEachChildVariableEvent : public gd::BaseEvent {
9393
*/
9494
void SetKeyIteratorVariableName(gd::String newName) { keyIteratorVariableName = newName; };
9595

96-
const gd::String& GetIndexVariableName() const { return indexVariableName; }
97-
void SetIndexVariableName(const gd::String& name) { indexVariableName = name; }
96+
const gd::String& GetLoopIndexVariableName() const { return loopIndexVariableName; }
97+
void SetLoopIndexVariableName(const gd::String& name) { loopIndexVariableName = name; }
9898

9999
virtual std::vector<const gd::InstructionsList*> GetAllConditionsVectors()
100100
const;
@@ -120,7 +120,7 @@ class GD_CORE_API ForEachChildVariableEvent : public gd::BaseEvent {
120120
gd::InstructionsList actions;
121121
gd::EventsList events;
122122
VariablesContainer variables;
123-
gd::String indexVariableName;
123+
gd::String loopIndexVariableName;
124124
};
125125

126126
} // namespace gd

Core/GDCore/Events/Builtin/ForEachEvent.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ void ForEachEvent::SerializeTo(SerializerElement& element) const {
8282
if (HasVariables()) {
8383
variables.SerializeTo(element.AddChild("variables"));
8484
}
85-
if (!indexVariableName.empty()) {
86-
element.AddChild("indexVariable").SetStringValue(indexVariableName);
85+
if (!loopIndexVariableName.empty()) {
86+
element.AddChild("loopIndexVariable").SetStringValue(loopIndexVariableName);
8787
}
8888
}
8989

@@ -107,9 +107,9 @@ void ForEachEvent::UnserializeFrom(gd::Project& project,
107107
variables.UnserializeFrom(element.GetChild("variables"));
108108
}
109109

110-
indexVariableName =
111-
element.HasChild("indexVariable")
112-
? element.GetChild("indexVariable").GetStringValue()
110+
loopIndexVariableName =
111+
element.HasChild("loopIndexVariable")
112+
? element.GetChild("loopIndexVariable").GetStringValue()
113113
: "";
114114
}
115115

Core/GDCore/Events/Builtin/ForEachEvent.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ class GD_CORE_API ForEachEvent : public gd::BaseEvent {
5656
objectsToPick = gd::Expression(objectsToPick_);
5757
};
5858

59-
const gd::String& GetIndexVariableName() const { return indexVariableName; }
60-
void SetIndexVariableName(const gd::String& name) { indexVariableName = name; }
59+
const gd::String& GetLoopIndexVariableName() const { return loopIndexVariableName; }
60+
void SetLoopIndexVariableName(const gd::String& name) { loopIndexVariableName = name; }
6161

6262
virtual std::vector<const gd::InstructionsList*> GetAllConditionsVectors()
6363
const;
@@ -80,7 +80,7 @@ class GD_CORE_API ForEachEvent : public gd::BaseEvent {
8080
gd::InstructionsList actions;
8181
gd::EventsList events;
8282
VariablesContainer variables;
83-
gd::String indexVariableName;
83+
gd::String loopIndexVariableName;
8484
};
8585

8686
} // namespace gd

Core/GDCore/Events/Builtin/RepeatEvent.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ void RepeatEvent::SerializeTo(SerializerElement& element) const {
8383
if (HasVariables()) {
8484
variables.SerializeTo(element.AddChild("variables"));
8585
}
86-
if (!indexVariableName.empty()) {
87-
element.AddChild("indexVariable").SetStringValue(indexVariableName);
86+
if (!loopIndexVariableName.empty()) {
87+
element.AddChild("loopIndexVariable").SetStringValue(loopIndexVariableName);
8888
}
8989
}
9090

@@ -110,9 +110,9 @@ void RepeatEvent::UnserializeFrom(gd::Project& project,
110110
variables.UnserializeFrom(element.GetChild("variables"));
111111
}
112112

113-
indexVariableName =
114-
element.HasChild("indexVariable")
115-
? element.GetChild("indexVariable").GetStringValue()
113+
loopIndexVariableName =
114+
element.HasChild("loopIndexVariable")
115+
? element.GetChild("loopIndexVariable").GetStringValue()
116116
: "";
117117
}
118118

Core/GDCore/Events/Builtin/RepeatEvent.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class GD_CORE_API RepeatEvent : public gd::BaseEvent {
5050
repeatNumberExpression = gd::Expression(repeatNumberExpression_);
5151
};
5252

53-
const gd::String& GetIndexVariableName() const { return indexVariableName; }
54-
void SetIndexVariableName(const gd::String& name) { indexVariableName = name; }
53+
const gd::String& GetLoopIndexVariableName() const { return loopIndexVariableName; }
54+
void SetLoopIndexVariableName(const gd::String& name) { loopIndexVariableName = name; }
5555

5656
virtual std::vector<gd::InstructionsList*> GetAllConditionsVectors();
5757
virtual std::vector<gd::InstructionsList*> GetAllActionsVectors();
@@ -74,7 +74,7 @@ class GD_CORE_API RepeatEvent : public gd::BaseEvent {
7474
gd::InstructionsList actions;
7575
EventsList events;
7676
VariablesContainer variables;
77-
gd::String indexVariableName;
77+
gd::String loopIndexVariableName;
7878

7979
bool repeatNumberExpressionSelected;
8080
};

Core/GDCore/Events/Builtin/WhileEvent.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ void WhileEvent::SerializeTo(SerializerElement& element) const {
5959
if (HasVariables()) {
6060
variables.SerializeTo(element.AddChild("variables"));
6161
}
62-
if (!indexVariableName.empty()) {
63-
element.AddChild("indexVariable").SetStringValue(indexVariableName);
62+
if (!loopIndexVariableName.empty()) {
63+
element.AddChild("loopIndexVariable").SetStringValue(loopIndexVariableName);
6464
}
6565
}
6666

@@ -88,9 +88,9 @@ void WhileEvent::UnserializeFrom(gd::Project& project,
8888
variables.UnserializeFrom(element.GetChild("variables"));
8989
}
9090

91-
indexVariableName =
92-
element.HasChild("indexVariable")
93-
? element.GetChild("indexVariable").GetStringValue()
91+
loopIndexVariableName =
92+
element.HasChild("loopIndexVariable")
93+
? element.GetChild("loopIndexVariable").GetStringValue()
9494
: "";
9595
}
9696

Core/GDCore/Events/Builtin/WhileEvent.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ class GD_CORE_API WhileEvent : public gd::BaseEvent {
6161

6262
bool HasInfiniteLoopWarning() const { return infiniteLoopWarning; }
6363

64-
const gd::String& GetIndexVariableName() const { return indexVariableName; }
65-
void SetIndexVariableName(const gd::String& name) { indexVariableName = name; }
64+
const gd::String& GetLoopIndexVariableName() const { return loopIndexVariableName; }
65+
void SetLoopIndexVariableName(const gd::String& name) { loopIndexVariableName = name; }
6666

6767
virtual std::vector<gd::InstructionsList*> GetAllConditionsVectors();
6868
virtual std::vector<gd::InstructionsList*> GetAllActionsVectors();
@@ -85,7 +85,7 @@ class GD_CORE_API WhileEvent : public gd::BaseEvent {
8585
///< de/activate infinite loop warning when the
8686
///< user create the event
8787
gd::VariablesContainer variables;
88-
gd::String indexVariableName;
88+
gd::String loopIndexVariableName;
8989

9090
int GetConditionsHeight() const;
9191
int GetActionsHeight() const;

GDJS/GDJS/Extensions/Builtin/CommonInstructionsExtension.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,13 @@ CommonInstructionsExtension::CommonInstructionsExtension() {
444444
localVariablesInitializationCode);
445445
}
446446

447-
const bool hasIndexVariable = !event.GetIndexVariableName().empty();
447+
const bool hasIndexVariable = !event.GetLoopIndexVariableName().empty();
448448
gd::String whileIndexVar;
449449
gd::String indexVariableAccessor;
450450
if (hasIndexVariable) {
451451
whileIndexVar = "whileIndex" + gd::String::From(context.GetContextDepth());
452452
indexVariableAccessor = codeGenerator.GenerateAnyOrSceneVariableGetter(
453-
event.GetIndexVariableName(), context);
453+
event.GetLoopIndexVariableName(), context);
454454
}
455455

456456
// Prepare codes
@@ -559,13 +559,13 @@ CommonInstructionsExtension::CommonInstructionsExtension() {
559559
bool valueIteratorExists =
560560
!event.GetValueIteratorVariableName().empty();
561561
bool keyIteratorExists = !event.GetKeyIteratorVariableName().empty();
562-
const bool hasIndexVariable = !event.GetIndexVariableName().empty();
562+
const bool hasIndexVariable = !event.GetLoopIndexVariableName().empty();
563563
gd::String childIndexVar;
564564
gd::String indexVariableAccessor;
565565
if (hasIndexVariable) {
566566
childIndexVar = "childIndex" + gd::String::From(context.GetContextDepth());
567567
indexVariableAccessor = codeGenerator.GenerateAnyOrSceneVariableGetter(
568-
event.GetIndexVariableName(), parentContext);
568+
event.GetLoopIndexVariableName(), parentContext);
569569
}
570570

571571
// clang-format off
@@ -738,11 +738,11 @@ CommonInstructionsExtension::CommonInstructionsExtension() {
738738
"repeatCount" + gd::String::From(context.GetContextDepth());
739739
gd::String repeatIndexVar =
740740
"repeatIndex" + gd::String::From(context.GetContextDepth());
741-
const bool hasIndexVariable = !event.GetIndexVariableName().empty();
741+
const bool hasIndexVariable = !event.GetLoopIndexVariableName().empty();
742742
gd::String indexVariableAccessor;
743743
if (hasIndexVariable) {
744744
indexVariableAccessor = codeGenerator.GenerateAnyOrSceneVariableGetter(
745-
event.GetIndexVariableName(), context);
745+
event.GetLoopIndexVariableName(), context);
746746
}
747747
outputCode += localVariablesInitializationCode;
748748
outputCode +=
@@ -836,11 +836,11 @@ CommonInstructionsExtension::CommonInstructionsExtension() {
836836
codeGenerator.GetCodeNamespaceAccessor() + "forEachObjects" +
837837
gd::String::From(context.GetContextDepth());
838838
codeGenerator.AddGlobalDeclaration(forEachObjectsList + " = [];\n");
839-
const bool hasIndexVariable = !event.GetIndexVariableName().empty();
839+
const bool hasIndexVariable = !event.GetLoopIndexVariableName().empty();
840840
gd::String indexVariableAccessor;
841841
if (hasIndexVariable) {
842842
indexVariableAccessor = codeGenerator.GenerateAnyOrSceneVariableGetter(
843-
event.GetIndexVariableName(), context);
843+
event.GetLoopIndexVariableName(), context);
844844
}
845845

846846
outputCode += localVariablesInitializationCode;

GDevelop.js/Bindings/Bindings.idl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,7 @@ interface InitialInstance {
14961496

14971497
boolean HasAnyOverriddenProperty([Const, Ref] gdObject obj);
14981498
boolean HasAnyOverriddenPropertyForBehavior([Const, Ref] Behavior behavior);
1499-
1499+
15001500
boolean HasBehaviorOverridingNamed([Const] DOMString name);
15011501
Behavior AddNewBehaviorOverriding([Ref] Project project, [Const] DOMString type, [Const] DOMString name);
15021502
[Ref] Behavior GetBehaviorOverriding([Const] DOMString name);
@@ -2487,8 +2487,8 @@ interface RepeatEvent {
24872487
[Ref] InstructionsList GetActions();
24882488
void SetRepeatExpressionPlainString([Const] DOMString expr);
24892489
[Const, Ref] Expression GetRepeatExpression();
2490-
[Const, Ref] DOMString GetIndexVariableName();
2491-
void SetIndexVariableName([Const] DOMString name);
2490+
[Const, Ref] DOMString GetLoopIndexVariableName();
2491+
void SetLoopIndexVariableName([Const] DOMString name);
24922492
};
24932493
RepeatEvent implements BaseEvent;
24942494

@@ -2498,8 +2498,8 @@ interface WhileEvent {
24982498
[Ref] InstructionsList GetConditions();
24992499
[Ref] InstructionsList GetWhileConditions();
25002500
[Ref] InstructionsList GetActions();
2501-
[Const, Ref] DOMString GetIndexVariableName();
2502-
void SetIndexVariableName([Const] DOMString name);
2501+
[Const, Ref] DOMString GetLoopIndexVariableName();
2502+
void SetLoopIndexVariableName([Const] DOMString name);
25032503
};
25042504
WhileEvent implements BaseEvent;
25052505

@@ -2510,8 +2510,8 @@ interface ForEachEvent {
25102510
[Const, Ref] DOMString GetObjectToPick();
25112511
[Ref] InstructionsList GetConditions();
25122512
[Ref] InstructionsList GetActions();
2513-
[Const, Ref] DOMString GetIndexVariableName();
2514-
void SetIndexVariableName([Const] DOMString name);
2513+
[Const, Ref] DOMString GetLoopIndexVariableName();
2514+
void SetLoopIndexVariableName([Const] DOMString name);
25152515
};
25162516
ForEachEvent implements BaseEvent;
25172517

@@ -2527,8 +2527,8 @@ interface ForEachChildVariableEvent {
25272527
void SetIterableVariableName([Const] DOMString newName);
25282528
void SetKeyIteratorVariableName([Const] DOMString newName);
25292529
void SetValueIteratorVariableName([Const] DOMString newName);
2530-
[Const, Ref] DOMString GetIndexVariableName();
2531-
void SetIndexVariableName([Const] DOMString name);
2530+
[Const, Ref] DOMString GetLoopIndexVariableName();
2531+
void SetLoopIndexVariableName([Const] DOMString name);
25322532
};
25332533
ForEachChildVariableEvent implements BaseEvent;
25342534

0 commit comments

Comments
 (0)