Ver código fonte

[php] fixed Array.remove for --no-opt (closes #9143)

Aleksandr Kuzmenko 5 anos atrás
pai
commit
e8498617f5
1 arquivos alterados com 4 adições e 4 exclusões
  1. 4 4
      std/php/_std/Array.hx

+ 4 - 4
std/php/_std/Array.hx

@@ -127,14 +127,14 @@ final class Array<T> implements ArrayAccess<Int, T> implements IteratorAggregate
 
 	public function remove(x:T):Bool {
 		var result = false;
-		Syntax.foreach(arr, function(index:Int, value:T) {
-			if (value == x) {
+		for(index in 0...length) {
+			if (arr[index] == x) {
 				Global.array_splice(arr, index, 1);
 				length--;
 				result = true;
-				Syntax.code('break');
+				break;
 			}
-		});
+		}
 		return result;
 	}