Browse Source

don't try `iterator()` twice if resolved to dynamic access (#7363)

Aleksandr Kuzmenko 6 năm trước cách đây
mục cha
commit
d44d032a74
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 5 2
      src/typing/forLoop.ml

+ 5 - 2
src/typing/forLoop.ml

@@ -94,8 +94,11 @@ module IterationKind = struct
 				try_acc acc;
 				try_acc acc;
 			with Not_found ->
 			with Not_found ->
 				try_last_resort (fun () ->
 				try_last_resort (fun () ->
-					let acc = type_field ({do_resume = resume;allow_resolve = false}) ctx e s e.epos MCall in
-					try_acc acc
+					match !dynamic_iterator with
+					| Some e -> e
+					| None ->
+						let acc = type_field ({do_resume = resume;allow_resolve = false}) ctx e s e.epos MCall in
+						try_acc acc
 				)
 				)
 		in
 		in
 		e1,pt
 		e1,pt