소스 검색

force the usage of iterator() over get_length + arrayAccess when we have a custom abstract iterator defined (close #7659)

ncannasse 6 년 전
부모
커밋
ee4df650f0
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      src/typing/forLoop.ml

+ 1 - 0
src/typing/forLoop.ml

@@ -97,6 +97,7 @@ module IterationKind = struct
 		| _,TAbstract({a_impl = Some c} as a,tl) ->
 		| _,TAbstract({a_impl = Some c} as a,tl) ->
 			begin try
 			begin try
 				let cf_length = PMap.find "get_length" c.cl_statics in
 				let cf_length = PMap.find "get_length" c.cl_statics in
+				if PMap.exists "iterator" c.cl_statics then raise Not_found;
 				let get_length e p =
 				let get_length e p =
 					make_static_call ctx c cf_length (apply_params a.a_params tl) [e] ctx.com.basic.tint p
 					make_static_call ctx c cf_length (apply_params a.a_params tl) [e] ctx.com.basic.tint p
 				in
 				in