소스 검색

[jvm] fix FAnon typing

Simon Krajewski 5 년 전
부모
커밋
dd8006dbe8
1개의 변경된 파일12개의 추가작업 그리고 2개의 파일을 삭제
  1. 12 2
      src/generators/genjvm.ml

+ 12 - 2
src/generators/genjvm.ml

@@ -543,7 +543,12 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 			cast();
 		in
 		match gctx.anon_identification#identify true t with
-		| Some {t_path=path} ->
+		| Some td ->
+			let cf = match follow td.t_type with
+				| TAnon an -> PMap.find cf.cf_name an.a_fields
+				| _ -> assert false
+			in
+			let path = td.t_path in
 			code#dup;
 			code#instanceof path;
 			jm#if_then_else
@@ -642,7 +647,12 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 		| TField(e1,FAnon cf) ->
 			self#texpr rvalue_any e1;
 			begin match gctx.anon_identification#identify true e1.etype with
-			| Some {t_path=path} ->
+			| Some td ->
+				let cf = match follow td.t_type with
+					| TAnon an -> PMap.find cf.cf_name an.a_fields
+					| _ -> assert false
+				in
+				let path = td.t_path in
 				code#dup;
 				code#instanceof path;
 				let jsig_cf = self#vtype cf.cf_type in