瀏覽代碼

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

Aleksandr Kuzmenko 6 年之前
父節點
當前提交
d44d032a74
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/typing/forLoop.ml

+ 5 - 2
src/typing/forLoop.ml

@@ -94,8 +94,11 @@ module IterationKind = struct
 				try_acc acc;
 			with Not_found ->
 				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
 		e1,pt