Ver Fonte

[java/cs] TNull fix

Caue Waneck há 13 anos atrás
pai
commit
dbde2073b7
2 ficheiros alterados com 49 adições e 1 exclusões
  1. 47 1
      gencommon.ml
  2. 2 0
      gencs.ml

+ 47 - 1
gencommon.ml

@@ -8611,7 +8611,7 @@ struct
         let nullable_var = mk_temp gen var.v_name (basic.tnull var.v_type) in
         let const_t = match const with 
           | TString _ -> basic.tstring | TInt _ -> basic.tint | TFloat _ -> basic.tfloat 
-          | TNull _ -> var.v_type | TBool _ -> basic.tbool | _ -> assert false 
+          | TNull -> var.v_type | TBool _ -> basic.tbool | _ -> assert false 
         in
         (* var v = (temp_var == null) ? const : cast temp_var; *)
         block := 
@@ -8790,6 +8790,52 @@ struct
   
 end;;
 
+(* ******************************************* *)
+(* Global Namespace Change *)
+(* ******************************************* *)
+
+(*
+  
+  For some parts of the Haxe API implementation, we need to access some
+  otherwise private packages. One of the way to do it is with the 
+  __global__ magic. Like Flash9, it will be accessed like that:
+  __global__("path.to.class").
+  In order to not interfere with normal code, we need to run this filter
+  as the first filter run by expression filters.
+  
+  dependencies:
+    Must be the first expression filter to be run
+  
+*
+
+module GlobalNamespaceChange =
+struct
+
+  let name = "global_namespace"
+  
+  let priority = max_dep
+  
+  let default_implementation gen =
+    let rec run e =
+      match e.eexpr with 
+        | TArray({ eexpr = TLocal { v_name = "__global__" } }, { eexpr = TConst(TString str) }) ->
+          let path = match List.rev (ExtString.String.nsplit f ".") with
+            | [] -> assert false
+            | cl :: pack -> (List.rev pack, cl)
+          in
+          (try
+            match Hashtbl.find path with
+              | TClassDecl cl -> 
+          with | Not_found -> gen.gcon.error ("Package not found: " ^  str) e.epos)
+    in
+    run
+  
+  let configure gen (mapping_func:texpr->texpr) =
+    let map e = Some(mapping_func e) in
+    gen.gsyntax_filters#add ~name:name ~priority:(PCustom priority) map
+  
+end;;
+*)
 (*
 (* ******************************************* *)
 (* Example *)

+ 2 - 0
gencs.ml

@@ -1375,6 +1375,8 @@ let configure gen =
   
   let closure_func = ReflectionCFs.implement_closure_cl rcf_ctx ( get_cl (Hashtbl.find gen.gtypes (["haxe";"lang"],"Closure")) ) in
   
+  ReflectionCFs.implement_varargs_cl rcf_ctx ( get_cl (get_type gen (["haxe";"lang"], "VarArgsBase")) );
+  
   ReflectionCFs.configure rcf_ctx;
   
   let objdecl_fn = ReflectionCFs.implement_dynamic_object_ctor rcf_ctx dynamic_object in