#18051: Do not use `var` in a for-loop, or where type is not obvious

(cherry picked from commit e59fad3924)
This commit is contained in:
Xavier Cho 2018-04-17 07:33:42 +09:00 committed by Hein-Pieter van Braam
parent 72bcacf2b6
commit d330bee1c2
7 changed files with 22 additions and 22 deletions

View File

@ -335,7 +335,7 @@ namespace Godot
bool over = false; bool over = false;
bool under = false; bool under = false;
for (var i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
if (plane.DistanceTo(points[i]) > 0) if (plane.DistanceTo(points[i]) > 0)
over = true; over = true;
@ -351,7 +351,7 @@ namespace Godot
real_t min = 0f; real_t min = 0f;
real_t max = 1f; real_t max = 1f;
for (var i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
real_t seg_from = from[i]; real_t seg_from = from[i];
real_t seg_to = to[i]; real_t seg_to = to[i];

View File

@ -221,9 +221,9 @@ namespace Godot
{ {
var orth = this; var orth = this;
for (var i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
for (var j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
{ {
real_t v = orth[i, j]; real_t v = orth[i, j];
@ -238,7 +238,7 @@ namespace Godot
} }
} }
for (var i = 0; i < 24; i++) for (int i = 0; i < 24; i++)
{ {
if (orthoBases[i] == orth) if (orthoBases[i] == orth)
return i; return i;
@ -413,8 +413,8 @@ namespace Godot
(_x[2] - _z[0]) * inv_s (_x[2] - _z[0]) * inv_s
); );
} else { } else {
var s = Mathf.Sqrt(-_x[0] - _y[1] + _z[2] + 1.0f) * 2f; real_t s = Mathf.Sqrt(-_x[0] - _y[1] + _z[2] + 1.0f) * 2f;
var inv_s = 1f / s; real_t inv_s = 1f / s;
return new Quat( return new Quat(
(_x[2] + _z[0]) * inv_s, (_x[2] + _z[0]) * inv_s,
(_y[2] + _z[1]) * inv_s, (_y[2] + _z[1]) * inv_s,

View File

@ -339,7 +339,7 @@ namespace Godot
{ {
int ig = 0; int ig = 0;
for (var i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
int c = str[i + ofs]; int c = str[i + ofs];
int v; int v;
@ -378,7 +378,7 @@ namespace Godot
var ret = string.Empty; var ret = string.Empty;
for (var i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
char[] c = { (char)0, (char)0 }; char[] c = { (char)0, (char)0 };
int lv = v & 0xF; int lv = v & 0xF;

View File

@ -47,7 +47,7 @@ namespace Godot
sb.Append("<"); sb.Append("<");
for (var j = 0; j < genericParams.Length; j++) for (int j = 0; j < genericParams.Length; j++)
{ {
if (j > 0) if (j > 0)
sb.Append(", "); sb.Append(", ");
@ -64,7 +64,7 @@ namespace Godot
ParameterInfo[] parameter = methodBase.GetParameters(); ParameterInfo[] parameter = methodBase.GetParameters();
for (var i = 0; i < parameter.Length; i++) for (int i = 0; i < parameter.Length; i++)
{ {
if (i > 0) if (i > 0)
sb.Append(", "); sb.Append(", ");

View File

@ -93,7 +93,7 @@ namespace Godot
{ {
var ret = new int[length]; var ret = new int[length];
for (var i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {
ret[i] = i; ret[i] = i;
} }
@ -108,7 +108,7 @@ namespace Godot
var ret = new int[to - from]; var ret = new int[to - from];
for (var i = from; i < to; i++) for (int i = from; i < to; i++)
{ {
ret[i - from] = i; ret[i - from] = i;
} }
@ -136,7 +136,7 @@ namespace Godot
if (increment > 0) if (increment > 0)
{ {
int idx = 0; int idx = 0;
for (var i = from; i < to; i += increment) for (int i = from; i < to; i += increment)
{ {
ret[idx++] = i; ret[idx++] = i;
} }
@ -144,7 +144,7 @@ namespace Godot
else else
{ {
int idx = 0; int idx = 0;
for (var i = from; i > to; i += increment) for (int i = from; i > to; i += increment)
{ {
ret[idx++] = i; ret[idx++] = i;
} }

View File

@ -9,7 +9,7 @@ namespace Godot
{ {
var ret = new Dictionary<object, object>(); var ret = new Dictionary<object, object>();
for (var i = 0; i < keys.Length; i++) for (int i = 0; i < keys.Length; i++)
{ {
ret.Add(keys[i], values[i]); ret.Add(keys[i], values[i]);
} }

View File

@ -84,7 +84,7 @@ namespace Godot
{ {
var b = new string[instance.Length - 1]; var b = new string[instance.Length - 1];
for (var i = 0; i < b.Length; i++) for (int i = 0; i < b.Length; i++)
{ {
b[i] = instance.Substring(i, 2); b[i] = instance.Substring(i, 2);
} }
@ -144,7 +144,7 @@ namespace Godot
string aux = instance.Replace("_", " ").ToLower(); string aux = instance.Replace("_", " ").ToLower();
var cap = string.Empty; var cap = string.Empty;
for (var i = 0; i < aux.GetSliceCount(" "); i++) for (int i = 0; i < aux.GetSliceCount(" "); i++)
{ {
string slice = aux.GetSlicec(' ', i); string slice = aux.GetSlicec(' ', i);
if (slice.Length > 0) if (slice.Length > 0)
@ -446,7 +446,7 @@ namespace Godot
if (len == 0) if (len == 0)
return false; return false;
for (var i = 0; i < len; i++) for (int i = 0; i < len; i++)
{ {
if (i == 0) if (i == 0)
{ {
@ -485,7 +485,7 @@ namespace Godot
if (ip.Length != 4) if (ip.Length != 4)
return false; return false;
for (var i = 0; i < ip.Length; i++) for (int i = 0; i < ip.Length; i++)
{ {
string n = ip[i]; string n = ip[i];
if (!n.IsValidInteger()) if (!n.IsValidInteger())
@ -813,9 +813,9 @@ namespace Godot
float sum = src_size + tgt_size; float sum = src_size + tgt_size;
float inter = 0; float inter = 0;
for (var i = 0; i < src_size; i++) for (int i = 0; i < src_size; i++)
{ {
for (var j = 0; j < tgt_size; j++) for (int j = 0; j < tgt_size; j++)
{ {
if (srcBigrams[i] == tgtBigrams[j]) if (srcBigrams[i] == tgtBigrams[j])
{ {