فهرست منبع

(Cpp) redefine follow to follow away abstract types

Simon Krajewski 11 سال پیش
والد
کامیت
f6c22c12f7
1فایلهای تغییر یافته به همراه11 افزوده شده و 1 حذف شده
  1. 11 1
      gencpp.ml

+ 11 - 1
gencpp.ml

@@ -26,6 +26,16 @@ open Common
 
 let unsupported p = error "This expression cannot be generated to Cpp" p
 
+(*
+    Generators do not care about non-core-type abstracts, so let us follow them
+    away by default.
+*)
+let rec follow t = match Type.follow t with
+	| TAbstract(a,tl) when not (Meta.has Meta.CoreType a.a_meta) ->
+		follow (Codegen.Abstract.get_underlying_type a tl)
+	| t ->
+		t
+
 (*
   Code for generating source files.
   It manages creating diretories, indents, blocks and only modifying files
@@ -313,7 +323,7 @@ let has_meta_key meta key =
 
 let get_field_access_meta field_access key =
 match field_access with
-	| FInstance(_,class_field) 
+	| FInstance(_,class_field)
 	| FStatic(_,class_field) -> get_meta_string class_field.cf_meta key
 	| _ -> ""
 ;;