Simon Krajewski 2 роки тому
батько
коміт
c1eaf1f3a3

+ 8 - 66
src-json/define.json

@@ -37,24 +37,11 @@
 		"define": "core-api",
 		"doc": "Defined in the core API context."
 	},
-	{
-		"name": "CoreApiSerialize",
-		"define": "core-api-serialize",
-		"doc": "Mark some generated core API classes with the `Serializable` attribute on C#.",
-		"platforms": ["cs"]
-	},
 	{
 		"name": "Cppia",
 		"define": "cppia",
 		"doc": "Generate cpp instruction assembly."
 	},
-	{
-		"name": "CsVer",
-		"define": "cs-ver",
-		"doc": "The C# version to target.",
-		"platforms": ["cs"],
-		"params": ["version"]
-	},
 	{
 		"name": "NoCppiaAst",
 		"define": "nocppiaast",
@@ -101,12 +88,6 @@
 		"doc": "GenCPP experimental linking.",
 		"platforms": ["cpp"]
 	},
-	{
-		"name": "DllImport",
-		"define": "dll-import",
-		"doc": "Handle Haxe-generated .NET DLL imports.",
-		"platforms": ["cs"]
-	},
 	{
 		"name": "DocGen",
 		"define": "doc-gen",
@@ -140,12 +121,6 @@
 		"doc": "Use slow path for interface closures to save space.",
 		"platforms": ["cpp"]
 	},
-	{
-		"name": "EraseGenerics",
-		"define": "erase-generics",
-		"doc": "Erase generic classes on C#.",
-		"platforms": ["cs"]
-	},
 	{
 		"name": "EvalCallStackDepth",
 		"define": "eval-call-stack-depth",
@@ -193,7 +168,7 @@
 		"name": "FastCast",
 		"define": "fast-cast",
 		"doc": "Enables an experimental casts cleanup on C# and Java.",
-		"platforms": ["cs", "java"]
+		"platforms": ["java"]
 	},
 	{
 		"name": "Fdb",
@@ -224,7 +199,7 @@
 		"name": "ForceLibCheck",
 		"define": "force-lib-check",
 		"doc": "Force the compiler to check `--net-lib` and `--java-lib` added classes (internal).",
-		"platforms": ["cs", "java"]
+		"platforms": ["java"]
 	},
 	{
 		"name": "ForceNativeProperty",
@@ -236,7 +211,7 @@
 		"name": "GencommonDebug",
 		"define": "gencommon-debug",
 		"doc": "GenCommon internal.",
-		"platforms": ["cs", "java"]
+		"platforms": ["java"]
 	},
 	{
 		"name": "Haxe3Compat",
@@ -388,7 +363,7 @@
 		"name": "KeepOldOutput",
 		"define": "keep-old-output",
 		"doc": "Keep old source files in the output directory.",
-		"platforms": ["cs", "java"]
+		"platforms": ["java"]
 	},
 	{
 		"name": "LoopUnrollMaxCost",
@@ -427,27 +402,6 @@
 		"define": "macro-times",
 		"doc": "Display per-macro timing when used with `--times`."
 	},
-	{
-		"name": "NetVer",
-		"define": "net-ver",
-		"doc": "Sets the .NET version to be targeted.",
-		"platforms": ["cs"],
-		"params": ["version: 20-50"]
-	},
-	{
-		"name": "NetcoreVer",
-		"define": "netcore-ver",
-		"doc": "Sets the .NET core version to be targeted",
-		"platforms": ["cs"],
-		"params": ["version: x.x.x"]
-	},
-	{
-		"name": "NetTarget",
-		"define": "net-target",
-		"doc": "Sets the .NET target. `netcore` (.NET core), `xbox`, `micro` (Micro Framework), `compact` (Compact Framework) are some valid values. (default: `net`)",
-		"platforms": ["cs"],
-		"params": ["name"]
-	},
 	{
 		"name": "NekoSource",
 		"define": "neko-source",
@@ -478,7 +432,7 @@
 		"name": "NoCompilation",
 		"define": "no-compilation",
 		"doc": "Disable final compilation.",
-		"platforms": ["cs", "java", "cpp", "hl"]
+		"platforms": ["java", "cpp", "hl"]
 	},
 	{
 		"name": "NoDebug",
@@ -513,12 +467,6 @@
 		"doc": "Don't substitute positions of inlined expressions with the position of the place of inlining.",
 		"links": ["https://haxe.org/manual/class-field-inline.html"]
 	},
-	{
-		"name": "NoRoot",
-		"define": "no-root",
-		"doc": "Generate top-level types into the `haxe.root` namespace.",
-		"platforms": ["cs"]
-	},
 	{
 		"name": "NoMacroCache",
 		"define": "no-macro-cache",
@@ -578,13 +526,13 @@
 		"name": "RealPosition",
 		"define": "real-position",
 		"doc": "Disables Haxe source mapping when targetting C#, removes position comments in Java and Php output.",
-		"platforms": ["cs", "java", "php"]
+		"platforms": ["java", "php"]
 	},
 	{
 		"name": "ReplaceFiles",
 		"define": "replace-files",
 		"doc": "GenCommon internal.",
-		"platforms": ["cs", "java"]
+		"platforms": ["java"]
 	},
 	{
 		"name": "RetainUntypedMeta",
@@ -624,7 +572,7 @@
 		"name": "StdEncodingUtf8",
 		"define": "std-encoding-utf8",
 		"doc": "Force utf8 encoding for stdin, stdout and stderr",
-		"platforms": ["java", "cs", "python"]
+		"platforms": ["java", "python"]
 	},
 	{
 		"name": "Swc",
@@ -703,12 +651,6 @@
 		"doc": "Defined for all system platforms.",
 		"reserved": true
 	},
-	{
-		"name": "Unsafe",
-		"define": "unsafe",
-		"doc": "Allow unsafe code when targeting C#.",
-		"platforms": ["cs"]
-	},
 	{
 		"name": "UseNekoc",
 		"define": "use-nekoc",

+ 17 - 104
src-json/meta.json

@@ -9,7 +9,7 @@
 		"name": "Abstract",
 		"metadata": ":abstract",
 		"doc": "Sets the underlying class implementation as `abstract`.",
-		"platforms": ["java", "cs"]
+		"platforms": ["java"]
 	},
 	{
 		"name": "Access",
@@ -52,20 +52,6 @@
 		"targets": ["TAbstract", "TAbstractField"],
 		"links": ["https://haxe.org/manual/types-abstract-array-access.html"]
 	},
-	{
-		"name": "AssemblyMeta",
-		"metadata": ":cs.assemblyMeta",
-		"doc": "Used to declare a native C# assembly attribute",
-		"platforms": ["cs"],
-		"targets": ["TClass"]
-	},
-	{
-		"name": "AssemblyStrict",
-		"metadata": ":cs.assemblyStrict",
-		"doc": "Used to declare a native C# assembly attribute; is type checked",
-		"platforms": ["cs"],
-		"targets": ["TClass"]
-	},
 	{
 		"name": "Ast",
 		"metadata": ":ast",
@@ -102,13 +88,6 @@
 		"targets": ["TClass"],
 		"links": ["https://haxe.org/manual/target-flash-resources.html"]
 	},
-	{
-		"name": "BridgeProperties",
-		"metadata": ":bridgeProperties",
-		"doc": "Creates native property bridges for all Haxe properties in this class.",
-		"platforms": ["cs"],
-		"targets": ["TClass"]
-	},
 	{
 		"name": "Build",
 		"metadata": ":build",
@@ -140,7 +119,7 @@
 		"name": "Class",
 		"metadata": ":class",
 		"doc": "Used internally to annotate an enum that will be generated as a class.",
-		"platforms": ["java", "cs"],
+		"platforms": ["java"],
 		"targets": ["TEnum"],
 		"internal": true
 	},
@@ -148,7 +127,7 @@
 		"name": "ClassCode",
 		"metadata": ":classCode",
 		"doc": "Used to inject platform-native code into a class.",
-		"platforms": ["java", "cs"],
+		"platforms": ["java"],
 		"targets": ["TClass"]
 	},
 	{
@@ -201,21 +180,6 @@
 		"doc": "",
 		"platforms": ["cpp"]
 	},
-	{
-		"name": "CsNative",
-		"metadata": ":csNative",
-		"doc": "Automatically added by `--net-lib` on classes generated from .NET DLL files.",
-		"platforms": ["cs"],
-		"targets": ["TClass", "TEnum"],
-		"internal": true
-	},
-	{
-		"name": "CsUsing",
-		"metadata": ":cs.using",
-		"doc": "Add using directives to your module",
-		"platforms": ["cs"],
-		"targets": ["TClass"]
-	},
 	{
 		"name": "Dce",
 		"metadata": ":dce",
@@ -243,13 +207,6 @@
 		"platforms": ["flash"],
 		"internal": true
 	},
-	{
-		"name": "Delegate",
-		"metadata": ":delegate",
-		"doc": "Automatically added by `--net-lib` on delegates.",
-		"platforms": ["cs"],
-		"targets": ["TAbstract"]
-	},
 	{
 		"name": "Depend",
 		"metadata": ":depend",
@@ -277,7 +234,7 @@
 		"name": "DynamicObject",
 		"metadata": ":dynamicObject",
 		"doc": "Used internally to identify the Dynamic Object implementation.",
-		"platforms": ["java", "cs"],
+		"platforms": ["java"],
 		"targets": ["TClass"],
 		"internal": true
 	},
@@ -301,13 +258,6 @@
 		"targets": ["TClass"],
 		"internal": true
 	},
-	{
-		"name": "Event",
-		"metadata": ":event",
-		"doc": "Automatically added by `--net-lib` on events. Has no effect on types compiled by Haxe.",
-		"platforms": ["cs"],
-		"targets": ["TClassField"]
-	},
 	{
 		"name": "Exhaustive",
 		"metadata": ":exhaustive",
@@ -425,7 +375,7 @@
 		"name": "FunctionCode",
 		"metadata": ":functionCode",
 		"doc": "Used to inject platform-native code into a function.",
-		"platforms": ["cpp", "java", "cs"]
+		"platforms": ["cpp", "java"]
 	},
 	{
 		"name": "FunctionTailCode",
@@ -478,14 +428,6 @@
 		"doc": "Used by the typer to mark fields that have untyped expressions.",
 		"internal": true
 	},
-	{
-		"name": "HaxeGeneric",
-		"metadata": ":haxeGeneric",
-		"doc": "Used internally to annotate non-native generic classes.",
-		"platforms": ["cs"],
-		"targets": ["TClass", "TEnum"],
-		"internal": true
-	},
 	{
 		"name": "HeaderClassCode",
 		"metadata": ":headerClassCode",
@@ -527,7 +469,7 @@
 		"name": "HxGen",
 		"metadata": ":hxGen",
 		"doc": "Annotates that an extern class was generated by Haxe.",
-		"platforms": ["java", "cs"],
+		"platforms": ["java"],
 		"targets": ["TClass", "TEnum"]
 	},
 	{
@@ -600,7 +542,7 @@
 		"name": "Internal",
 		"metadata": ":internal",
 		"doc": "Generates the annotated field/class with 'internal' access.",
-		"platforms": ["java", "cs"],
+		"platforms": ["java"],
 		"targets": ["TClass", "TEnum", "TClassField"]
 	},
 	{
@@ -686,7 +628,7 @@
 		"name": "LibType",
 		"metadata": ":libType",
 		"doc": "Used by `--net-lib` and `--java-lib` to mark a class that should not be checked (overrides, interfaces, etc) by the type loader.",
-		"platforms": ["java", "cs"],
+		"platforms": ["java"],
 		"targets": ["TClass"],
 		"internal": true
 	},
@@ -759,24 +701,16 @@
 		"name": "NativeChildren",
 		"metadata": ":nativeChildren",
 		"doc": "Annotates that all children from a type should be treated as if it were an extern definition - platform native.",
-		"platforms": ["java", "cs"],
+		"platforms": ["java"],
 		"targets": ["TClass"]
 	},
 	{
 		"name": "NativeGen",
 		"metadata": ":nativeGen",
 		"doc": "Annotates that a type should be treated as if it were an extern definition - platform native.",
-		"platforms": ["java", "cs", "python"],
+		"platforms": ["java", "python"],
 		"targets": ["TClass", "TEnum"]
 	},
-	{
-		"name": "NativeGeneric",
-		"metadata": ":nativeGeneric",
-		"doc": "Used internally to annotate native generic classes.",
-		"platforms": ["cs"],
-		"targets": ["TClass", "TEnum"],
-		"internal": true
-	},
 	{
 		"name": "NativeProperty",
 		"metadata": ":nativeProperty",
@@ -982,7 +916,7 @@
 		"name": "Private",
 		"metadata": ":private",
 		"doc": "Marks a class field as being private.",
-		"platforms": ["cs"],
+		"platforms": ["java"],
 		"targets": ["TClassField"]
 	},
 	{
@@ -995,14 +929,7 @@
 		"name": "Protected",
 		"metadata": ":protected",
 		"doc": "Marks a class field as being protected.",
-		"platforms": ["cs", "java", "flash"],
-		"targets": ["TClassField"]
-	},
-	{
-		"name": "Property",
-		"metadata": ":property",
-		"doc": "Marks a field to be compiled as a native C# property.",
-		"platforms": ["cs"],
+		"platforms": ["java", "flash"],
 		"targets": ["TClassField"]
 	},
 	{
@@ -1011,13 +938,6 @@
 		"doc": "Marks a class field, class or expression as pure (side-effect free).",
 		"targets": ["TClass", "TClassField", "TExpr"]
 	},
-	{
-		"name": "ReadOnly",
-		"metadata": ":readOnly",
-		"doc": "Generates a field with the `readonly` native keyword.",
-		"platforms": ["cs"],
-		"targets": ["TClassField"]
-	},
 	{
 		"name": "RealPath",
 		"metadata": ":realPath",
@@ -1097,14 +1017,14 @@
 		"name": "SkipCtor",
 		"metadata": ":skipCtor",
 		"doc": "Used internally to generate a constructor as if it were a native type (no `__hx_ctor`).",
-		"platforms": ["java", "cs"],
+		"platforms": ["java"],
 		"internal": true
 	},
 	{
 		"name": "SkipReflection",
 		"metadata": ":skipReflection",
 		"doc": "Used internally to annotate a field that shouldn't have its reflection data generated.",
-		"platforms": ["java", "cs"],
+		"platforms": ["java"],
 		"targets": ["TClassField"],
 		"internal": true
 	},
@@ -1145,13 +1065,13 @@
 		"name": "Strict",
 		"metadata": ":strict",
 		"doc": "Used to declare a native C# attribute or a native Java metadata; is type checked.",
-		"platforms": ["java", "cs"]
+		"platforms": ["java"]
 	},
 	{
 		"name": "Struct",
 		"metadata": ":struct",
 		"doc": "Marks a class definition as a struct.",
-		"platforms": ["cs", "hl"],
+		"platforms": ["hl"],
 		"targets": ["TClass"]
 	},
 	{
@@ -1238,7 +1158,7 @@
 		"name": "Volatile",
 		"metadata": ":volatile",
 		"doc": "",
-		"platforms": ["java", "cs"]
+		"platforms": ["java"]
 	},
 	{
 		"name": "UnifyMinDynamic",
@@ -1252,13 +1172,6 @@
 		"doc": "",
 		"platforms": ["cpp"]
 	},
-	{
-		"name": "Unsafe",
-		"metadata": ":unsafe",
-		"doc": "Declares a class, or a method with the C#'s `unsafe` flag.",
-		"platforms": ["cs"],
-		"targets": ["TClass", "TClassField"]
-	},
 	{
 		"name": "Used",
 		"metadata": ":used",

+ 0 - 1321
src/codegen/dotnet.ml

@@ -1,1321 +0,0 @@
-(*
-	The Haxe Compiler
-	Copyright (C) 2005-2019  Haxe Foundation
-
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
-
-	This program is distributed in the hope that it will be useful,
-	but WITHOUT ANY WARRANTY; without even the implied warranty of
-	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-	GNU General Public License for more details.
-
-	You should have received a copy of the GNU General Public License
-	along with this program; if not, write to the Free Software
-	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*)
-open ExtString
-open Common
-open Globals
-open Ast
-open IlData
-open IlMeta
-open NativeLibraries
-
-(* see http://msdn.microsoft.com/en-us/library/2sk3x8a7(v=vs.71).aspx *)
-let cs_binops =
-	[Ast.OpAdd, "op_Addition";
-	Ast.OpSub, "op_Subtraction";
-	Ast.OpMult, "op_Multiply";
-	Ast.OpDiv, "op_Division";
-	Ast.OpMod, "op_Modulus";
-	Ast.OpXor, "op_ExclusiveOr";
-	Ast.OpOr, "op_BitwiseOr";
-	Ast.OpAnd, "op_BitwiseAnd";
-	Ast.OpBoolAnd, "op_LogicalAnd";
-	Ast.OpBoolOr, "op_LogicalOr";
-	Ast.OpAssign, "op_Assign";
-	Ast.OpShl, "op_LeftShift";
-	Ast.OpShr, "op_RightShift";
-	Ast.OpShr, "op_SignedRightShift";
-	Ast.OpUShr, "op_UnsignedRightShift";
-	Ast.OpEq, "op_Equality";
-	Ast.OpGt, "op_GreaterThan";
-	Ast.OpLt, "op_LessThan";
-	Ast.OpNotEq, "op_Inequality";
-	Ast.OpGte, "op_GreaterThanOrEqual";
-	Ast.OpLte, "op_LessThanOrEqual";
-	Ast.OpAssignOp Ast.OpMult, "op_MultiplicationAssignment";
-	Ast.OpAssignOp Ast.OpSub, "op_SubtractionAssignment";
-	Ast.OpAssignOp Ast.OpXor, "op_ExclusiveOrAssignment";
-	Ast.OpAssignOp Ast.OpShl, "op_LeftShiftAssignment";
-	Ast.OpAssignOp Ast.OpMod, "op_ModulusAssignment";
-	Ast.OpAssignOp Ast.OpAdd, "op_AdditionAssignment";
-	Ast.OpAssignOp Ast.OpAnd, "op_BitwiseAndAssignment";
-	Ast.OpAssignOp Ast.OpOr, "op_BitwiseOrAssignment";
-	(* op_Comma *)
-	Ast.OpAssignOp Ast.OpDiv, "op_DivisionAssignment";]
-
-let cs_unops =
-	[Ast.Decrement, "op_Decrement";
-	Ast.Increment, "op_Increment";
-	Ast.Neg, "op_UnaryNegation";
-	Ast.Not, "op_LogicalNot";
-	Ast.NegBits, "op_OnesComplement"]
-
-let netname_to_hx name =
-	let len = String.length name in
-	let chr = String.get name 0 in
-	String.make 1 (Char.uppercase chr) ^ (String.sub name 1 (len-1))
-
-(* -net-lib implementation *)
-
-type net_lib_ctx = {
-	nstd : bool;
-	ncom : Common.context;
-	nil : IlData.ilctx;
-}
-
-let is_haxe_keyword = function
-	| "cast" | "extern" | "function" | "in" | "typedef" | "using" | "var" | "untyped" | "inline" -> true
-	| _ -> false
-
-let hxpath_to_net ctx path =
-	try
-		Hashtbl.find ctx.ncom.net_path_map path
-	with
-	 | Not_found ->
-			[],[],"Not_found"
-
-let add_cs = function
-	| "haxe" :: ns -> "haxe" :: ns
-	| "std" :: ns -> "std" :: ns
-	| "cs" :: ns -> "cs" :: ns
-	| "system" :: ns -> "cs" :: "system" :: ns
-	| ns -> ns
-
-let escape_chars =
-	String.replace_chars (fun chr ->
-		if (chr >= 'a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z') || (chr >= '0' && chr <= '9') || chr = '_' then
-			Char.escaped chr
-		else
-			"_x" ^ (string_of_int (Char.code chr)) ^ "_")
-
-let netcl_to_hx cl =
-	let cl = if String.length cl > 0 && String.get cl 0 >= 'a' && String.get cl 0 <= 'z' then
-			Char.escaped (Char.uppercase (String.get cl 0)) ^ (String.sub cl 1 (String.length cl - 1))
-		else
-			cl
-	in
-	try
-		let cl, nargs = String.split cl "`" in
-		(escape_chars cl) ^ "_" ^ nargs
-	with | Invalid_string ->
-		escape_chars cl
-
-let netpath_to_hx std = function
-	| [],[], cl -> [], netcl_to_hx cl
-	| ns,[], cl ->
-		let ns = (List.map (fun s -> String.lowercase (escape_chars s)) ns) in
-		add_cs ns, netcl_to_hx cl
-	| ns,(nhd :: ntl as nested), cl ->
-		let nested = List.map (netcl_to_hx) nested in
-		let ns = (List.map (fun s -> String.lowercase (escape_chars s)) ns) @ [nhd] in
-		add_cs ns, String.concat "_" nested ^ "_" ^ netcl_to_hx cl
-
-let lookup_ilclass std com ilpath =
-	let path = netpath_to_hx std ilpath in
-	List.fold_right (fun net_lib acc ->
-		match acc with
-		| None -> net_lib#lookup path
-		| Some p -> acc
-	) com.native_libs.net_libs None
-
-let discard_nested = function
-	| (ns,_),cl -> (ns,[]),cl
-
-let mk_type_path ctx path params =
-	let pack, sub, name = match path with
-		| ns,[], cl ->
-			ns, None, netcl_to_hx cl
-		| ns, (nhd :: ntl as nested), cl ->
-			let nhd = netcl_to_hx nhd in
-			let nested = List.map (netcl_to_hx) nested in
-			ns, Some (String.concat "_" nested ^ "_" ^ netcl_to_hx cl), nhd
-	in
-	CTPath {
-		tpackage = fst (netpath_to_hx ctx.nstd (pack,[],""));
-		Ast.tname = name;
-		tparams = params;
-		tsub = sub;
-	}
-
-let raw_type_path ctx path params =
-	{
-		tpackage = fst path;
-		Ast.tname = snd path;
-		tparams = params;
-		tsub = None;
-	}
-
-let rec convert_signature ctx p = function
-	| LVoid ->
-		mk_type_path ctx ([],[],"Void") []
-	| LBool ->
-		mk_type_path ctx ([],[],"Bool") []
-	| LChar ->
-		mk_type_path ctx (["cs";"types"],[],"Char16") []
-	| LInt8 ->
-		mk_type_path ctx (["cs";"types"],[],"Int8") []
-	| LUInt8 ->
-		mk_type_path ctx (["cs";"types"],[],"UInt8") []
-	| LInt16 ->
-		mk_type_path ctx (["cs";"types"],[],"Int16") []
-	| LUInt16 ->
-		mk_type_path ctx (["cs";"types"],[],"UInt16") []
-	| LInt32 ->
-		mk_type_path ctx ([],[],"Int") []
-	| LUInt32 ->
-		mk_type_path ctx ([],[],"UInt") []
-	| LInt64 ->
-		mk_type_path ctx (["haxe"],[],"Int64") []
-	| LUInt64 ->
-		mk_type_path ctx (["cs";"types"],[],"UInt64") []
-	| LFloat32 ->
-		mk_type_path ctx ([],[],"Single") []
-	| LFloat64 ->
-		mk_type_path ctx ([],[],"Float") []
-	| LString ->
-		mk_type_path ctx (["std"],[],"String") []
-	| LObject ->
-		mk_type_path ctx ([],[],"Dynamic") []
-	| LPointer s | LManagedPointer s ->
-		mk_type_path ctx (["cs"],[],"Pointer") [ TPType (convert_signature ctx p s,null_pos) ]
-	| LTypedReference ->
-		mk_type_path ctx (["cs";"system"],[],"TypedReference") []
-	| LIntPtr ->
-		mk_type_path ctx (["cs";"system"],[],"IntPtr") []
-	| LUIntPtr ->
-		mk_type_path ctx (["cs";"system"],[],"UIntPtr") []
-	| LValueType (s,args) | LClass (s,args) ->
-		mk_type_path ctx s (List.map (fun s -> TPType (convert_signature ctx p s,null_pos)) args)
-	| LTypeParam i ->
-		mk_type_path ctx ([],[],"T" ^ string_of_int i) []
-	| LMethodTypeParam i ->
-		mk_type_path ctx ([],[],"M" ^ string_of_int i) []
-	| LVector s ->
-		mk_type_path ctx (["cs"],[],"NativeArray") [TPType (convert_signature ctx p s,null_pos)]
-	(* | LArray of ilsig_norm * (int option * int option) array *)
-	| LMethod (_,ret,args) ->
-		CTFunction (List.map (fun v -> convert_signature ctx p v,null_pos) args, (convert_signature ctx p ret,null_pos))
-	| _ -> mk_type_path ctx ([],[], "Dynamic") []
-
-let ilpath_s = function
-	| ns,[], name -> s_type_path (ns,name)
-	| [],nested,name -> String.concat "." nested ^ "." ^ name
-	| ns, nested, name -> String.concat "." ns ^ "." ^ String.concat "." nested ^ "." ^ name
-
-let get_cls = function
-	| _,_,c -> c
-
-let has_attr expected_name expected_ns ilcls =
-	let check_flag name ns = (name = expected_name && ns = expected_ns) in
-	List.exists (fun a ->
-		match a.ca_type with
-			| TypeRef r ->
-				check_flag r.tr_name r.tr_namespace
-			| TypeDef d ->
-				check_flag d.td_name d.td_namespace
-			| Method m ->
-				(match m.m_declaring with
-					| Some d ->
-						check_flag d.td_name d.td_namespace
-					| _ -> false)
-			| MemberRef r ->
-				(match r.memr_class with
-					| TypeRef r ->
-						check_flag r.tr_name r.tr_namespace
-					| TypeDef d ->
-						check_flag d.td_name d.td_namespace
-					| _ -> false)
-			| _ ->
-				false
-	) ilcls.cattrs
-
-(* TODO: When possible on Haxe, use this to detect flag enums, and make an abstract with @:op() *)
-(* that behaves like an enum, and with an enum as its underlying type *)
-let enum_is_flag = has_attr "FlagsAttribute" ["System"]
-
-let is_compiler_generated = has_attr "CompilerGeneratedAttribute" ["System"; "Runtime"; "CompilerServices"]
-
-let convert_ilenum ctx p ?(is_flag=false) ilcls =
-	let meta = ref [
-		Meta.Native, [EConst (String (ilpath_s ilcls.cpath,SDoubleQuotes) ), p], p;
-		Meta.CsNative, [], p;
-	] in
-
-	let data = ref [] in
-	List.iter (fun f -> match f.fname with
-		| "value__" -> ()
-		| _ when not (List.mem CStatic f.fflags.ff_contract) -> ()
-		| _ ->
-			let meta, const = match f.fconstant with
-				| Some IChar i
-				| Some IByte i
-				| Some IShort i ->
-					[Meta.CsNative, [EConst (Int (string_of_int i, None) ), p], p ], Int64.of_int i
-				| Some IInt i ->
-					[Meta.CsNative, [EConst (Int (Int32.to_string i, None) ), p], p ], Int64.of_int32 i
-				| Some IFloat32 f | Some IFloat64 f ->
-					[], Int64.of_float f
-				| Some IInt64 i ->
-					[], i
-				| _ ->
-					[], Int64.zero
-			in
-			data := ( { ec_name = f.fname,null_pos; ec_doc = None; ec_meta = meta; ec_args = []; ec_pos = p; ec_params = []; ec_type = None; }, const) :: !data;
-	) ilcls.cfields;
-	let data = List.stable_sort (fun (_,i1) (_,i2) -> Int64.compare i1 i2) (List.rev !data) in
-
-	let _, c = netpath_to_hx ctx.nstd ilcls.cpath in
-	let name = netname_to_hx c in
-	EEnum {
-		d_name = (if is_flag then name ^ "_FlagsEnum" else name),null_pos;
-		d_doc = None;
-		d_params = []; (* enums never have type parameters *)
-		d_meta = !meta;
-		d_flags = [EExtern];
-		d_data = List.map fst data;
-	}
-
-let rec has_unmanaged = function
-	| LPointer _ -> true
-	| LManagedPointer s -> has_unmanaged s
-	| LValueType (p,pl) -> List.exists (has_unmanaged) pl
-	| LClass (p,pl) -> List.exists (has_unmanaged) pl
-	| LVector s -> has_unmanaged s
-	| LArray (s,a) -> has_unmanaged s
-	| LMethod (c,r,args) -> has_unmanaged r || List.exists (has_unmanaged) args
-	| _ -> false
-
-let convert_ilfield ctx p field =
-	if not (Common.defined ctx.ncom Define.Unsafe) && has_unmanaged field.fsig.snorm then raise Exit;
-	let p = { p with pfile =	p.pfile ^" (" ^field.fname ^")" } in
-	let cff_doc = None in
-	let cff_pos = p in
-	let cff_meta = ref [] in
-	let cff_name = match field.fname with
-		| name when String.length name > 5 ->
-				(match String.sub name 0 5 with
-				| "__hx_" -> raise Exit
-				| _ -> name)
-		| name -> name
-	in
-	let cff_access = match field.fflags.ff_access with
-		| FAFamily | FAFamOrAssem -> (APrivate,null_pos)
-		| FAPublic -> (APublic,null_pos)
-		| _ -> raise Exit (* private instances aren't useful on externs *)
-	in
-	let readonly, acc = List.fold_left (fun (readonly,acc) -> function
-		| CStatic -> readonly, (AStatic,null_pos) :: acc
-		| CInitOnly | CLiteral -> true, acc
-		| _ -> readonly,acc
-	) (false,[cff_access]) field.fflags.ff_contract in
-	if Common.raw_defined ctx.ncom "net_loader_debug" then
-		Printf.printf "\t%sfield %s : %s\n" (if List.mem_assoc AStatic acc then "static " else "") cff_name (IlMetaDebug.ilsig_s field.fsig.ssig);
-	let kind = match readonly with
-		| true ->
-			cff_meta := (Meta.ReadOnly, [], cff_pos) :: !cff_meta;
-			FProp (("default",null_pos), ("never",null_pos), Some (convert_signature ctx p field.fsig.snorm,null_pos), None)
-		| false ->
-			FVar (Some (convert_signature ctx p field.fsig.snorm,null_pos), None)
-	in
-	let cff_name, cff_meta =
-		if String.get cff_name 0 = '%' then
-			let name = (String.sub cff_name 1 (String.length cff_name - 1)) in
-			"_" ^ name,
-			(Meta.Native, [EConst (String (name,SDoubleQuotes) ), cff_pos], cff_pos) :: !cff_meta
-		else
-			cff_name, !cff_meta
-	in
-	{
-		cff_name = cff_name,null_pos;
-		cff_doc = cff_doc;
-		cff_pos = cff_pos;
-		cff_meta = cff_meta;
-		cff_access = acc;
-		cff_kind = kind;
-	}
-
-let convert_ilevent ctx p ev =
-	let p = { p with pfile =	p.pfile ^" (" ^ev.ename ^")" } in
-	let name = ev.ename in
-	let kind = FVar (Some (convert_signature ctx p ev.esig.snorm,null_pos), None) in
-	let meta = [Meta.Event, [], p; Meta.Keep,[],p; Meta.SkipReflection,[],p] in
-	let acc = [APrivate,null_pos] in
-	let add_m acc m = match m with
-		| None -> acc
-		| Some (name,flags) ->
-			if List.mem (CMStatic) flags.mf_contract then
-				(AStatic,null_pos) :: acc
-			else
-				acc
-	in
-	if Common.raw_defined ctx.ncom "net_loader_debug" then
-		Printf.printf "\tevent %s : %s\n" name (IlMetaDebug.ilsig_s ev.esig.ssig);
-	let acc = add_m acc ev.eadd in
-	let acc = add_m acc ev.eremove in
-	let acc = add_m acc ev.eraise in
-	{
-		cff_name = name,null_pos;
-		cff_doc = None;
-		cff_pos = p;
-		cff_meta = meta;
-		cff_access = acc;
-		cff_kind = kind;
-	}
-
-let convert_ilmethod ctx p is_interface m is_explicit_impl =
-	if not (Common.defined ctx.ncom Define.Unsafe) && has_unmanaged m.msig.snorm then raise Exit;
-	let force_check = Common.defined ctx.ncom Define.ForceLibCheck in
-	let p = { p with pfile =	p.pfile ^" (" ^m.mname ^")" } in
-	let cff_doc = None in
-	let cff_pos = p in
-	let cff_name = match m.mname with
-		| ".ctor" -> "new"
-		| ".cctor"-> raise Exit (* __init__ field *)
-		| "Finalize" -> raise Exit (* destructor (~ClassName) *)
-		| "Equals" | "GetHashCode" -> raise Exit
-		| name when String.length name > 5 ->
-				(match String.sub name 0 5 with
-				| "__hx_" -> raise Exit
-				| _ -> name)
-		| name -> name
-	in
-	let meta = [] in
-	let acc, meta = match m.mflags.mf_access with
-		| FAFamily | FAFamOrAssem ->
-			(APrivate,null_pos), ((Meta.Protected, [], p) :: meta)
-		| FAPublic -> (APublic,null_pos), meta
-		| _ ->
-			if Common.raw_defined ctx.ncom "net_loader_debug" then
-				Printf.printf "\tmethod %s (skipped) : %s\n" cff_name (IlMetaDebug.ilsig_s m.msig.ssig);
-			raise Exit
-	in
-	let is_static = ref false in
-	let acc, is_final = List.fold_left (fun (acc,is_final) -> function
-		| CMStatic when cff_name <> "new" -> is_static := true; (AStatic,null_pos) :: acc, is_final
-		| CMVirtual when is_final = None -> acc, Some false
-		| CMFinal -> acc, Some true
-		| _ -> acc, is_final
-	) ([acc],None) m.mflags.mf_contract in
-	let acc = (AOverload,p) :: acc in
-	if Common.raw_defined ctx.ncom "net_loader_debug" then
-		Printf.printf "\t%smethod %s : %s\n" (if !is_static then "static " else "") cff_name (IlMetaDebug.ilsig_s m.msig.ssig);
-
-	let acc = match is_final with
-		| None | Some true when not force_check && not !is_static ->
-			(AFinal,null_pos) :: acc
-		| _ ->
-			acc
-	in
-	let meta = if is_explicit_impl then
-			(Meta.NoCompletion,[],p) :: (Meta.SkipReflection,[],p) :: meta
-		else
-			meta
-	in
-	(* let meta = if List.mem OSynchronized m.mflags.mf_interop then *)
-	(*	(Meta.Synchronized,[],p) :: meta *)
-	(* else *)
-	(*	meta *)
-	(* in *)
-
-	let rec change_sig = function
-		| LManagedPointer s -> LManagedPointer (change_sig s)
-		| LPointer s -> LPointer (change_sig s)
-		| LValueType (p,pl) -> LValueType(p, List.map change_sig pl)
-		| LClass (p,pl) -> LClass(p, List.map change_sig pl)
-		| LTypeParam i -> LObject
-		| LVector s -> LVector (change_sig s)
-		| LArray (s,a) -> LArray (change_sig s, a)
-		| LMethod (c,r,args) -> LMethod (c, change_sig r, List.map change_sig args)
-		| p -> p
-	in
-	let change_sig = if !is_static then change_sig else (fun s -> s) in
-
-	let ret =
-		if String.length cff_name > 4 && String.sub cff_name 0 4 = "set_" then
-			match m.mret.snorm, m.margs with
-			| LVoid, [_,_,s] ->
-				s.snorm
-			| _ -> m.mret.snorm
-		else
-			m.mret.snorm
-	in
-
-	let kind =
-		let args = List.map (fun (name,flag,s) ->
-			let t = match s.snorm with
-				| LManagedPointer s ->
-					let is_out = List.mem POut flag.pf_io && not (List.mem PIn flag.pf_io) in
-					let name = if is_out then "Out" else "Ref" in
-					mk_type_path ctx (["cs"],[],name) [ TPType (convert_signature ctx p s,null_pos) ]
-				| _ ->
-					convert_signature ctx p (change_sig s.snorm)
-			in
-			(name,null_pos),false,[],Some (t,null_pos),None) m.margs
-		in
-		let ret = convert_signature ctx p (change_sig ret) in
-		let types = List.map (fun t ->
-			{
-				tp_name = "M" ^ string_of_int t.tnumber,null_pos;
-				tp_params = [];
-				tp_constraints = None;
-				tp_default = None;
-				tp_meta = [];
-			}
-		) m.mtypes in
-		FFun {
-			f_params = types;
-			f_args = args;
-			f_type = Some (ret,null_pos);
-			f_expr = None;
-		}
-	in
-	let cff_name, cff_meta =
-		if String.get cff_name 0 = '%' then
-			let name = (String.sub cff_name 1 (String.length cff_name - 1)) in
-			"_" ^ name,
-			(Meta.Native, [EConst (String (name,SDoubleQuotes) ), cff_pos], cff_pos) :: meta
-		else
-			cff_name, meta
-	in
-	let acc = match m.moverride with
-		| None ->
-			if not is_interface && List.mem IAbstract m.mflags.mf_impl then (AAbstract,null_pos) :: acc else acc
-		| _ when cff_name = "new" -> acc
-		| Some (path,s) -> match lookup_ilclass ctx.nstd ctx.ncom path with
-			| Some ilcls when not (List.mem SInterface ilcls.cflags.tdf_semantics) ->
-				(AOverride,null_pos) :: acc
-			| None when ctx.ncom.verbose ->
-				print_endline ("(net-lib) A referenced assembly for path " ^ ilpath_s path ^ " was not found");
-				acc
-			| _ -> acc
-	in
-	{
-		cff_name = cff_name,null_pos;
-		cff_doc = cff_doc;
-		cff_pos = cff_pos;
-		cff_meta = cff_meta;
-		cff_access = acc;
-		cff_kind = kind;
-	}
-
-let convert_ilprop ctx p prop is_explicit_impl =
-	if not (Common.defined ctx.ncom Define.Unsafe) && has_unmanaged prop.psig.snorm then raise Exit;
-	let p = { p with pfile =	p.pfile ^" (" ^prop.pname ^")" } in
-	let pmflags = match prop.pget, prop.pset with
-		| Some(_,fl1), _ -> Some fl1
-		| _, Some(_,fl2) -> Some fl2
-		| _ -> None
-	in
-	let cff_access = match pmflags with
-		| Some { mf_access = FAFamily | FAFamOrAssem } -> (APrivate,null_pos)
-		| Some { mf_access = FAPublic } -> (APublic,null_pos)
-		| _ -> raise Exit (* non-public / protected fields don't interest us *)
-	in
-	let access acc = acc.mf_access in
-	let cff_access = match pmflags with
-		| Some m when List.mem CMStatic m.mf_contract ->
-			[AStatic,null_pos;cff_access]
-		| _ -> [cff_access]
-	in
-	let get = match prop.pget with
-		| None -> "never"
-		| Some(s,_) when String.length s <= 4 || String.sub s 0 4 <> "get_" ->
-			raise Exit (* special (?) getter; not used *)
-		| Some(_,m) when access m <> FAPublic -> (match access m with
-			| FAFamily
-			| FAFamOrAssem -> "null"
-			| _ -> "never")
-		| Some _ -> "get"
-	in
-	let set = match prop.pset with
-		| None -> "never"
-		| Some(s,_) when String.length s <= 4 || String.sub s 0 4 <> "set_" ->
-			raise Exit (* special (?) getter; not used *)
-		| Some(_,m) when access m <> FAPublic -> (match access m with
-			| FAFamily
-			| FAFamOrAssem -> "never"
-			| _ -> "never");
-		| Some _ -> "set"
-	in
-	if Common.raw_defined ctx.ncom "net_loader_debug" then
-		Printf.printf "\tproperty %s (%s,%s) : %s\n" prop.pname get set (IlMetaDebug.ilsig_s prop.psig.ssig);
-	let ilsig = match prop.psig.snorm with
-		| LMethod (_,ret,[]) -> ret
-		| s -> raise Exit
-	in
-
-	let meta = if is_explicit_impl then
-			[ Meta.NoCompletion,[],p; Meta.SkipReflection,[],p ]
-		else
-			[]
-	in
-
-	let kind =
-		FProp ((get,null_pos), (set,null_pos), Some(convert_signature ctx p ilsig,null_pos), None)
-	in
-	{
-		cff_name = prop.pname,null_pos;
-		cff_doc = None;
-		cff_pos = p;
-		cff_meta = meta;
-		cff_access = cff_access;
-		cff_kind = kind;
-	}
-
-let get_type_path ctx ct = match ct with | CTPath p -> p | _ -> die "" __LOC__
-
-let is_explicit ctx ilcls i =
-	let s = match i with
-		| LClass(path,_) | LValueType(path,_) -> ilpath_s path
-		| _ -> die "" __LOC__
-	in
-	let len = String.length s in
-	List.exists (fun m ->
-		String.length m.mname > len && String.sub m.mname 0 len = s
-	) ilcls.cmethods
-
-let mke e p = (e,p)
-
-let mk_special_call name p args =
-	mke (ECast( mke (EUntyped( mke (ECall( mke (EConst(Ident name)) p, args )) p )) p , None)) p
-
-let mk_this_call name p args =
-	mke (ECall( mke (efield(mke (EConst(Ident "this")) p ,name)) p, args )) p
-
-let mk_metas metas p =
-	List.map (fun m -> m,[],p) metas
-
-let mk_abstract_fun name p kind metas acc =
-	let metas = mk_metas metas p in
-	{
-		cff_name = name,null_pos;
-		cff_doc = None;
-		cff_pos = p;
-		cff_meta = metas;
-		cff_access = acc;
-		cff_kind = kind;
-	}
-
-let convert_fun_arg ctx p = function
-	| LManagedPointer s ->
-		mk_type_path ctx (["cs"],[],"Ref") [ TPType (convert_signature ctx p s,null_pos) ],p
-	| s ->
-		convert_signature ctx p s,p
-
-let convert_fun ctx p ret args =
-	let args = List.map (convert_fun_arg ctx p) args in
-	CTFunction(args, (convert_signature ctx p ret,null_pos))
-
-let get_clsname ctx cpath =
-	match netpath_to_hx ctx.nstd cpath with
-		| (_,n) -> n
-
-let convert_delegate ctx p ilcls =
-	let p = { p with pfile =	p.pfile ^" (abstract delegate)" } in
-	(* will have the following methods: *)
-	(* - new (haxeType:Func) *)
-	(* - FromHaxeFunction(haxeType) *)
-	(* - Invoke() *)
-	(* - AsDelegate():Super *)
-	(* - @:op(A+B) Add(d:absType) *)
-	(* - @:op(A-B) Remove(d:absType) *)
-	let abs_type = mk_type_path ctx (ilcls.cpath) (List.map (fun t -> TPType (mk_type_path ctx ([],[],"T" ^ string_of_int t.tnumber) [],null_pos)) ilcls.ctypes) in
-	let invoke = List.find (fun m -> m.mname = "Invoke") ilcls.cmethods in
-	let ret = invoke.mret.snorm in
-	let args = List.map (fun (_,_,s) -> s.snorm) invoke.margs in
-	let haxe_type = convert_fun ctx p ret args in
-	let types = List.map (fun t ->
-		{
-			tp_name = ("T" ^ string_of_int t.tnumber),null_pos;
-			tp_params = [];
-			tp_constraints = None;
-			tp_default = None;
-			tp_meta = [];
-		}
-	) ilcls.ctypes in
-	let mk_op_fn op name p =
-		let fn_name = List.assoc op cs_binops in
-		let clsname = match ilcls.cpath with
-			| (ns,inner,n) -> get_clsname ctx (ns,inner,"Delegate_"^n)
-		in
-		let expr = (ECall( (efield( (EConst(Ident (clsname)),p), fn_name ),p), [(EConst(Ident"arg1"),p);(EConst(Ident"arg2"),p)]),p) in
-		FFun {
-			f_params = types;
-			f_args = [("arg1",null_pos),false,[],Some (abs_type,null_pos),None;("arg2",null_pos),false,[],Some (abs_type,null_pos),None];
-			f_type = Some (abs_type,null_pos);
-			f_expr = Some ( (EReturn (Some expr), p) );
-		}
-	in
-	let mk_op op name =
-		let p = { p with pfile = p.pfile ^" (op " ^ name ^ ")" } in
-		{
-			cff_name = name,null_pos;
-			cff_doc = None;
-			cff_pos = p;
-			cff_meta = [ Meta.Op, [ (EBinop(op, (EConst(Ident"A"),p), (EConst(Ident"B"),p)),p) ], p ];
-			cff_access = [APublic,null_pos;AInline,null_pos;AStatic,null_pos;AExtern,null_pos];
-			cff_kind = mk_op_fn op name p;
-		}
-	in
-	let params = (List.map (fun s ->
-		TPType (mk_type_path ctx ([],[],fst s.tp_name) [],null_pos)
-	) types) in
-	let underlying_type = match ilcls.cpath with
-		| ns,inner,name ->
-			mk_type_path ctx (ns,inner,"Delegate_" ^ name) params
-	in
-
-	let fn_new = FFun {
-		f_params = [];
-		f_args = [("hxfunc",null_pos),false,[],Some (haxe_type,null_pos),None];
-		f_type = None;
-		f_expr = Some ( EBinop(Ast.OpAssign, (EConst(Ident "this"),p), (mk_special_call "__delegate__" p [EConst(Ident "hxfunc"),p]) ), p );
-	} in
-	let fn_from_hx = FFun {
-		f_params = types;
-		f_args = [("hxfunc",null_pos),false,[],Some (haxe_type,null_pos),None];
-		f_type = Some( mk_type_path ctx ilcls.cpath params,null_pos );
-		f_expr = Some( EReturn( Some (mk_special_call "__delegate__" p [EConst(Ident "hxfunc"),p] )), p);
-	} in
-	let fn_asdel = FFun {
-		f_params = [];
-		f_args = [];
-		f_type = None;
-		f_expr = Some(
-			EReturn( Some ( EConst(Ident "this"), p ) ), p
-		);
-	} in
-	let fn_new = mk_abstract_fun "new" p fn_new [] [APublic,null_pos;AInline,null_pos;AExtern,null_pos] in
-	let fn_from_hx = mk_abstract_fun "FromHaxeFunction" p fn_from_hx [Meta.From] [APublic,null_pos;AInline,null_pos;AStatic,null_pos;AExtern,null_pos] in
-	let fn_asdel = mk_abstract_fun "AsDelegate" p fn_asdel [] [APublic,null_pos;AInline,null_pos;AExtern,null_pos] in
-	let _, c = netpath_to_hx ctx.nstd ilcls.cpath in
-	EAbstract {
-		d_name = netname_to_hx c,null_pos;
-		d_doc = None;
-		d_params = types;
-		d_meta = mk_metas [Meta.Delegate; Meta.Forward] p;
-		d_flags = [AbOver (underlying_type,null_pos)];
-		d_data = [fn_new;fn_from_hx;fn_asdel;mk_op Ast.OpAdd "Add";mk_op Ast.OpSub "Remove"];
-	}
-
-let convert_ilclass ctx p ?(delegate=false) ilcls = match ilcls.csuper with
-	| Some { snorm = LClass ((["System"],[],"Enum"),[]) } ->
-		convert_ilenum ctx p ilcls
-	| _ ->
-		let flags = ref [HExtern] in
-		(* todo: instead of CsNative, use more specific definitions *)
-		if Common.raw_defined ctx.ncom "net_loader_debug" then begin
-			let sup = match ilcls.csuper with | None -> [] | Some c -> [IlMetaDebug.ilsig_s c.ssig] in
-			let sup = sup @ List.map (fun i -> IlMetaDebug.ilsig_s i.ssig) ilcls.cimplements in
-			print_endline ("converting " ^ ilpath_s ilcls.cpath ^ " : " ^ (String.concat ", " sup))
-		end;
-		let meta = ref [Meta.CsNative, [], p; Meta.Native, [EConst (String (ilpath_s ilcls.cpath,SDoubleQuotes) ), p], p] in
-		let force_check = Common.defined ctx.ncom Define.ForceLibCheck in
-		if not force_check then
-			meta := (Meta.LibType,[],p) :: !meta;
-
-		let is_interface = ref false in
-		let is_abstract = ref false in
-		let is_sealed = ref false in
-		List.iter (fun f -> match f with
-			| SSealed ->
-				flags := HFinal :: !flags;
-				is_sealed := true
-			| SInterface ->
-				is_interface := true;
-				flags := HInterface :: !flags
-			| SAbstract ->
-				meta := (Meta.Abstract, [], p) :: !meta;
-				is_abstract := true;
-			| _ -> ()
-		) ilcls.cflags.tdf_semantics;
-
-		(* static class = abstract sealed class - in this case we don't want an abstract flag *)
-		if !is_abstract && not !is_interface && not !is_sealed then flags := HAbstract :: !flags;
-
-		(* (match ilcls.cflags.tdf_vis with *)
-		(*	| VPublic | VNestedFamOrAssem | VNestedFamily -> () *)
-		(*	| _ -> raise Exit); *)
-		(match ilcls.csuper with
-			| Some { snorm = LClass ( (["System"],[],"Object"), [] ) } -> ()
-			| Some ({ snorm = LClass ( (["System"],[],"ValueType"), [] ) } as s) ->
-				flags := HExtends (get_type_path ctx (convert_signature ctx p s.snorm),null_pos) :: !flags;
-				meta := (Meta.Struct,[],p) :: !meta
-			| Some { snorm = LClass ( (["haxe";"lang"],[],"HxObject"), [] ) } ->
-				meta := (Meta.HxGen,[],p) :: !meta
-			| Some s ->
-				flags := HExtends (get_type_path ctx (convert_signature ctx p s.snorm),null_pos) :: !flags
-			| _ -> ());
-
-			let has_explicit_ifaces = ref false in
-			List.iter (fun i ->
-				match i.snorm with
-				| LClass ( (["haxe";"lang"],[], "IHxObject"), _ ) ->
-					meta := (Meta.HxGen,[],p) :: !meta
-				(* | i when is_explicit ctx ilcls i -> () *)
-				| i ->
-					if is_explicit ctx ilcls i then has_explicit_ifaces := true;
-					flags := if !is_interface then
-						HExtends (get_type_path ctx (convert_signature ctx p i),null_pos) :: !flags
-					else
-						HImplements (get_type_path ctx (convert_signature ctx p i),null_pos) :: !flags
-			) ilcls.cimplements;
-			(* this is needed because of explicit interfaces. see http://msdn.microsoft.com/en-us/library/aa288461(v=vs.71).aspx *)
-			(* explicit interfaces can't be mapped into Haxe in any way - since their fields can't be accessed directly, but they still implement that interface *)
-			if !has_explicit_ifaces && force_check then (* do not check on this specific case *)
-				meta := (Meta.LibType,[],p) :: !meta;
-
-			(* ArrayAccess *)
-			ignore (List.exists (function
-			| { psig = { snorm = LMethod(_,ret,[v]) } } ->
-				flags := if !is_interface then
-					(HExtends( raw_type_path ctx ([],"ArrayAccess") [ TPType (convert_signature ctx p ret,null_pos) ],null_pos) :: !flags)
-				else
-					(HImplements( raw_type_path ctx ([],"ArrayAccess") [ TPType (convert_signature ctx p ret,null_pos) ],null_pos) :: !flags);
-				true
-			| _ -> false) ilcls.cprops);
-
-			let fields = ref [] in
-			let run_fields fn f =
-				List.iter (fun f ->
-					try
-						fields := fn f :: !fields
-					with
-						| Exit -> ()
-				) f
-			in
-			let meths = if !is_interface then
-					List.filter (fun m -> m.moverride = None) ilcls.cmethods
-				else
-					ilcls.cmethods
-			in
-			run_fields (fun m ->
-				convert_ilmethod ctx p !is_interface m (List.exists (fun m2 -> m != m2 && String.get m2.mname 0 <> '.' && String.ends_with m2.mname ("." ^ m.mname)) meths)
-			) meths;
-			run_fields (convert_ilfield ctx p) ilcls.cfields;
-			run_fields (fun prop ->
-				convert_ilprop ctx p prop (List.exists (fun p2 -> prop != p2 && String.get p2.pname 0 <> '.' && String.ends_with p2.pname ("." ^ prop.pname)) ilcls.cprops)
-			) ilcls.cprops;
-			run_fields (convert_ilevent ctx p) ilcls.cevents;
-
-			let params = List.map (fun p ->
-				{
-					tp_name = "T" ^ string_of_int p.tnumber,null_pos;
-					tp_params = [];
-					tp_constraints = None;
-					tp_default = None;
-					tp_meta = [];
-				}) ilcls.ctypes
-			in
-
-			if delegate then begin
-				(* add op_Addition and op_Subtraction *)
-				let path = ilcls.cpath in
-				let thist = mk_type_path ctx path (List.map (fun t -> TPType (mk_type_path ctx ([],[],"T" ^ string_of_int t.tnumber) [],null_pos)) ilcls.ctypes) in
-				let op name =
-					{
-						cff_name = name,null_pos;
-						cff_doc = None;
-						cff_pos = p;
-						cff_meta = [];
-						cff_access = [APublic,null_pos;AStatic,null_pos];
-						cff_kind = FFun {
-							f_params = params;
-							f_args = [("arg1",null_pos),false,[],Some (thist,null_pos),None;("arg2",null_pos),false,[],Some (thist,null_pos),None];
-							f_type = Some (thist,null_pos);
-							f_expr = None;
-						};
-					}
-				in
-				fields := op "op_Addition" :: op "op_Subtraction" :: !fields;
-			end;
-			let path = match ilcls.cpath with
-				| ns,inner,name when delegate ->
-					ns,inner,"Delegate_"^name
-				| _ -> ilcls.cpath
-			in
-			let _, c = netpath_to_hx ctx.nstd path in
-			EClass {
-				d_name = netname_to_hx c,null_pos;
-				d_doc = None;
-				d_params = params;
-				d_meta = !meta;
-				d_flags = !flags;
-				d_data = !fields;
-			}
-
-type il_any_field =
-	| IlField of ilfield
-	| IlMethod of ilmethod
-	| IlProp of ilprop
-
-let get_fname = function
-	| IlField f -> f.fname
-	| IlMethod m -> m.mname
-	| IlProp p -> p.pname
-
-let is_static = function
-	| IlField f ->
-		List.mem CStatic f.fflags.ff_contract
-	| IlMethod m ->
-		List.mem CMStatic m.mflags.mf_contract
-	| IlProp p ->
-		List.exists (function
-		 | None -> false
-		 | Some (_,m) -> List.mem CMStatic m.mf_contract
-		) [p.pget;p.pset]
-	(* | _ -> false *)
-
-let change_name name = function
-	| IlField f -> IlField { f with fname = name }
-	| IlMethod m -> IlMethod { m with mname = name }
-	| IlProp p -> IlProp { p with pname = name }
-
-let compatible_methods m1 m2 = match m1,m2 with
-	| IlMethod { msig = { snorm = LMethod(_,ret1,args1) } }, IlMethod { msig = { snorm = LMethod(_,ret2,args2) } } ->
-		ret1 = ret2 && args1 = args2
-	| _ -> false
-
-let ilcls_from_ilsig ctx ilsig =
-	let path, params = match ilsig with
-		| LClass(path, params) | LValueType(path, params) ->
-			path, params
-		| LObject ->
-			(["System"],[],"Object"),[]
-		| _ -> raise Not_found (* all other types won't appear as superclass *)
-	in
-	match lookup_ilclass ctx.nstd ctx.ncom path with
-	| None -> raise Not_found
-	| Some c ->
-		c, params
-
-let rec ilapply_params params = function
-	| LManagedPointer s -> LManagedPointer (ilapply_params params s)
-	| LPointer s -> LPointer (ilapply_params params s)
-	| LValueType (p,pl) -> LValueType(p, List.map (ilapply_params params) pl)
-	| LClass (p,pl) -> LClass(p, List.map (ilapply_params params) pl)
-	| LTypeParam i ->
-		List.nth params i (* TODO: maybe i - 1? *)
-	| LVector s -> LVector (ilapply_params params s)
-	| LArray (s,a) -> LArray (ilapply_params params s, a)
-	| LMethod (c,r,args) -> LMethod (c, ilapply_params params r, List.map (ilapply_params params) args)
-	| p -> p
-
-let ilcls_with_params ctx cls params =
-	match cls.ctypes with
-	| [] -> cls
-	| _ ->
-		{ cls with
-			cfields = List.map (fun f -> { f with fsig = { f.fsig with snorm = ilapply_params params f.fsig.snorm } }) cls.cfields;
-			cmethods = List.map (fun m -> { m with
-				msig = { m.msig with snorm = ilapply_params params m.msig.snorm };
-				margs = List.map (fun (n,f,s) -> (n,f,{ s with snorm = ilapply_params params s.snorm })) m.margs;
-				mret = { m.mret with snorm = ilapply_params params m.mret.snorm };
-			}) cls.cmethods;
-			cprops = List.map (fun p -> { p with psig = { p.psig with snorm = ilapply_params params p.psig.snorm } }) cls.cprops;
-			csuper = Option.map (fun s -> { s with snorm = ilapply_params params s.snorm } ) cls.csuper;
-			cimplements = List.map (fun s -> { s with snorm = ilapply_params params s.snorm } ) cls.cimplements;
-		}
-
-let rec compatible_params t1 t2 = match t1,t2 with
-	| LManagedPointer(s1), LManagedPointer(s2) -> compatible_params s1 s2
-	| LManagedPointer(s1), s2 | s1, LManagedPointer(s2) ->
-		compatible_params s1 s2
-	| _ -> t1 = t2
-
-let compatible_methods m1 m2 = match m1, m2 with
-	| LMethod(_,r1,a1), LMethod(_,r2,a2) -> (try
-		List.for_all2 (fun a1 a2 -> compatible_params a1 a2) a1 a2
-	with | Invalid_argument _ ->
-		false)
-	| _ -> false
-
-let compatible_field f1 f2 = match f1, f2 with
-	| IlMethod { msig = { snorm = LMethod(_,_,a1) } },
-		IlMethod { msig = { snorm = LMethod(_,_,a2) } } ->
-			a1 = a2
-	| IlProp p1, IlProp p2 ->
-			(* p1.psig.snorm = p2.psig.snorm *)
-			true
-	| IlField f1, IlField f2 ->
-			(* f1.fsig.snorm = f2.fsig.snorm *)
-			true
-	| _ -> false
-
-let get_all_fields cls =
-	let all_fields = List.map (fun f -> IlField f, cls.cpath, f.fname, List.mem CStatic f.fflags.ff_contract) cls.cfields in
-	let all_fields = all_fields @ List.map (fun m -> IlMethod m, cls.cpath, m.mname, List.mem CMStatic m.mflags.mf_contract) cls.cmethods in
-	let all_fields = all_fields @ List.map (fun p -> IlProp p, cls.cpath, p.pname, is_static (IlProp p)) cls.cprops in
-	all_fields
-
-let normalize_ilcls ctx cls =
-	let force_check = Common.defined ctx.ncom Define.ForceLibCheck in
-	(* first filter out overloaded fields of same signature *)
-	let rec loop acc = function
-		| [] -> acc
-		| m :: cmeths ->
-			let static = List.mem CMStatic m.mflags.mf_contract in
-			if List.exists (fun m2 -> m.mname = m2.mname && List.mem CMStatic m2.mflags.mf_contract = static && compatible_methods m.msig.snorm m2.msig.snorm) cmeths then
-				loop acc cmeths
-			else
-				loop (m :: acc) cmeths
-	in
-	let meths = loop [] cls.cmethods in
-	(* fix overrides *)
-	(* get only the methods that aren't declared as override, but may be *)
-	let meths = List.map (fun v -> ref v) meths in
-	let no_overrides = List.filter (fun m ->
-		let m = !m in
-		not (List.mem CMStatic m.mflags.mf_contract)
-	) meths in
-	let no_overrides = ref no_overrides in
-
-	let all_fields = ref [] in
-	let all_events_name = Hashtbl.create 0 in
-	(* avoid naming collision between events and functions *)
-	let add_cls_events_collision cls =
-		List.iter (fun m -> if not (List.mem CMStatic m.mflags.mf_contract) then Hashtbl.replace all_events_name m.mname true) cls.cmethods;
-		List.iter (fun p -> if not (is_static (IlProp p)) then Hashtbl.replace all_events_name p.pname true) cls.cprops;
-	in
-
-	let rec loop cls = try
-		match cls.csuper with
-		| Some { snorm = LClass((["System"],[],"Object"),_) }
-		| Some { snorm = LObject } ->
-			let cls, params = ilcls_from_ilsig ctx LObject in
-			let cls = ilcls_with_params ctx cls params in
-			all_fields := get_all_fields cls @ !all_fields;
-		| None -> ()
-		| Some s ->
-			let cls, params = ilcls_from_ilsig ctx s.snorm in
-			let cls = ilcls_with_params ctx cls params in
-			if force_check then no_overrides := List.filter (fun v ->
-				let m = !v in
-				let is_override_here = List.exists (fun m2 ->
-					m2.mname = m.mname && not (List.mem CMStatic m2.mflags.mf_contract) && compatible_methods m.msig.snorm m2.msig.snorm
-				) cls.cmethods in
-				if is_override_here then v := { m with moverride = Some(cls.cpath, m.mname) };
-				not is_override_here
-			) !no_overrides;
-			all_fields := get_all_fields cls @ !all_fields;
-
-			add_cls_events_collision cls;
-			List.iter (fun ev -> Hashtbl.replace all_events_name ev.ename true) cls.cevents;
-
-			loop cls
-		with | Not_found -> ()
-	in
-	loop cls;
-
-	add_cls_events_collision cls;
-	if force_check then List.iter (fun v -> v := { !v with moverride = None }) !no_overrides;
-	let added = ref [] in
-
-	let current_all = ref (get_all_fields cls @ !all_fields) in
-	(* look for interfaces and add missing implementations (some methods' implementation is optional) *)
-	let rec loop_interface cls iface = try
-		match iface.snorm with
-		| LClass((["System"],[],"Object"),_) | LObject -> ()
-		| LClass(path,_) when path = cls.cpath -> ()
-		| s ->
-			let cif, params = ilcls_from_ilsig ctx s in
-			let cif = ilcls_with_params ctx cif params in
-			List.iter (function
-				| (f,_,name,false) as ff ->
-					(* look for compatible fields *)
-					if not (List.exists (function
-						| (f2,_,name2,false) when (name = name2 || String.ends_with name2 ("." ^ name)) -> (* consider explicit implementations as implementations *)
-							compatible_field f f2
-						| _ -> false
-					) !current_all) then begin
-						current_all := ff :: !current_all;
-						added := ff :: !added
-					end else
-						(* ensure it's public *)
-						List.iter (fun mref -> match !mref with
-							| m when m.mname = name && compatible_field f (IlMethod m) ->
-								mref := { m with mflags = { m.mflags with mf_access = FAPublic } }
-							| _ -> ()
-						) meths
-				| _ -> ()
-			) (get_all_fields cif);
-			List.iter (loop_interface cif) cif.cimplements
-		with | Not_found -> ()
-	in
-	if not (List.mem SAbstract cls.cflags.tdf_semantics) then List.iter (loop_interface cls) cls.cimplements;
-	let added = List.map (function
-		| (IlMethod m,a,name,b) when m.mflags.mf_access <> FAPublic ->
-			(IlMethod { m with mflags = { m.mflags with mf_access = FAPublic } },a,name,b)
-		| (IlField f,a,name,b) when f.fflags.ff_access <> FAPublic ->
-			(IlField { f with fflags = { f.fflags with ff_access = FAPublic } },a,name,b)
-		| s -> s
-	) !added in
-
-	(* filter out properties that were already declared *)
-	let props = if force_check then List.filter (function
-			| p ->
-				let static = is_static (IlProp p) in
-				let name = p.pname in
-				not (List.exists (function (IlProp _,_,n,s) -> s = static && name = n | _ -> false) !all_fields)
-			(* | _ -> false *)
-		) cls.cprops
-		else
-			cls.cprops
-	in
-	let cls = { cls with cmethods = List.map (fun v -> !v) meths; cprops = props } in
-
-	let clsfields = (get_all_fields cls) @ added in
-	let super_fields = !all_fields in
-	all_fields := clsfields @ !all_fields;
-	let refclsfields = (List.map (fun v -> ref v) clsfields) in
-	(* search static / non-static name clash *)
-	(* change field name to not collide with haxe keywords *)
-	let fold_field acc v =
-		let f, p, name, is_static = !v in
-		let change, copy = match name with
-		| _ when is_haxe_keyword name ->
-			true, false
-		| _ ->
-			((is_static && List.exists (function | (f,_,n,false) -> name = n | _ -> false) !all_fields) ||
-			(not is_static && match f with (* filter methods that have the same name as fields *)
-			| IlMethod _ ->
-				List.exists (function | ( (IlProp _ | IlField _),_,n,false) -> name = n | _ -> false) super_fields ||
-				List.exists (function | ( (IlProp _ | IlField _),_,n,s) -> name = n | _ -> false) clsfields
-			| _ -> false)), true
-		in
-		if change then begin
-			let name = "%" ^ name in
-			let changed = change_name name f, p, name, is_static in
-			if not copy then
-				v := changed;
-			if copy then
-				v :: ref changed :: acc
-			else
-				v :: acc
-		end else
-			v :: acc
-	in
-	let refclsfields = List.fold_left fold_field [] refclsfields in
-
-	let rec fold (fields,methods,props) f = match !f with
-		| IlField f,_,_,_ -> f :: fields,methods,props
-		| IlMethod m,_,_,_ -> fields,m :: methods,props
-		| IlProp p,_,_,_ -> fields,methods,p :: props
-	in
-	let fields, methods, props = List.fold_left fold ([],[],[]) refclsfields in
-	{ cls with
-		cfields = fields;
-		cprops = props;
-		cmethods = methods;
-		cevents = List.filter (fun ev -> not (Hashtbl.mem all_events_name ev.ename)) cls.cevents;
-	}
-
-let add_net_std com file =
-	com.net_std <- file :: com.net_std
-
-class net_library com name file_path std = object(self)
-	inherit [net_lib_type,unit] native_library name file_path
-
-	val mutable ilctx = None
-	val cache = Hashtbl.create 0
-
-	method private netpath_to_hx =
-		netpath_to_hx std
-
-	method load =
-		let r = PeReader.create_r (open_in_bin file_path) com.defines.Define.values in
-		let ctx = PeReader.read r in
-		let clr_header = PeReader.read_clr_header ctx in
-		let cache = IlMetaReader.create_cache () in
-		let meta = IlMetaReader.read_meta_tables ctx clr_header cache in
-		close_in (r.PeReader.ch);
-		if Common.raw_defined com "net_loader_debug" then
-			print_endline ("for lib " ^ file_path);
-		let il_typedefs = Hashtbl.copy meta.il_typedefs in
-		Hashtbl.clear meta.il_typedefs;
-
-		Hashtbl.iter (fun _ td ->
-			let path = IlMetaTools.get_path (TypeDef td) in
-			if Common.raw_defined com "net_loader_debug" then
-				Printf.printf "found %s\n" (s_type_path (self#netpath_to_hx path));
-			Hashtbl.replace com.net_path_map (self#netpath_to_hx path) path;
-			Hashtbl.replace meta.il_typedefs path td
-		) il_typedefs;
-		let meta = { nstd = std; ncom = com; nil = meta } in
-		ilctx <- Some meta
-
-	method get_ctx = match ilctx with
-		| None ->
-			self#load;
-			self#get_ctx
-		| Some ctx ->
-			ctx
-
-	method close =
-		()
-
-	method list_modules =
-		Hashtbl.fold (fun path _ acc -> match path with
-			| _,_ :: _, _ -> acc
-			| _ -> self#netpath_to_hx path :: acc) (self#get_ctx).nil.il_typedefs []
-
-	method lookup path : net_lib_type =
-		try
-			Hashtbl.find cache path
-		with | Not_found -> try
-			let ctx = self#get_ctx in
-			let ns, n, cl = hxpath_to_net ctx path in
-			let cls = IlMetaTools.convert_class ctx.nil (ns,n,cl) in
-			let cls = normalize_ilcls ctx cls in
-			Hashtbl.add cache path (Some cls);
-			Some cls
-		with | Not_found ->
-			Hashtbl.add cache path None;
-			None
-
-	method build (path : path) (p : pos) : Ast.package option =
-		let p = { pfile = file_path ^ " @ " ^ s_type_path path; pmin = 0; pmax = 0; } in
-		let pack = match fst path with | ["haxe";"root"] -> [] | p -> p in
-		let cp = ref [] in
-		let rec build path = try
-			if Common.raw_defined com "net_loader_debug" then
-				Printf.printf "looking up %s\n" (s_type_path path);
-			match self#lookup path with
-			| Some({csuper = Some{snorm = LClass( (["System"],[],("Delegate"|"MulticastDelegate")),_)}} as cls)
-				when List.mem SSealed cls.cflags.tdf_semantics ->
-				let ctx = self#get_ctx in
-				let hxcls = convert_ilclass ctx p ~delegate:true cls in
-				let delegate = convert_delegate ctx p cls in
-				cp := (hxcls,p) :: (delegate,p) :: !cp;
-				List.iter (fun ilpath ->
-					let path = netpath_to_hx std ilpath in
-					build path
-				) cls.cnested
-			| Some cls when not (is_compiler_generated cls) ->
-				let ctx = self#get_ctx in
-				let hxcls = convert_ilclass ctx p cls in
-				cp := (hxcls,p) :: !cp;
-				List.iter (fun ilpath ->
-					let path = netpath_to_hx std ilpath in
-					build path
-				) cls.cnested
-			| _ -> ()
-		with | Not_found | Exit ->
-			()
-		in
-		build path;
-		match !cp with
-			| [] -> None
-			| cp -> Some (pack,cp)
-
-	method get_data = ()
-
-	initializer
-		if std then self#add_flag FlagIsStd
-end
-
-let add_net_lib com file std extern =
-	let real_file = if Sys.file_exists file then
-		file
-	else try Common.find_file com file with
-		| Not_found -> try Common.find_file com (file ^ ".dll") with
-		| Not_found ->
-			failwith (".NET lib " ^ file ^ " not found")
-	in
-	let net_lib = new net_library com file real_file std in
-	if extern then net_lib#add_flag FlagIsExtern;
-	com.native_libs.net_libs <- (net_lib :> (net_lib_type,unit) native_library) :: com.native_libs.net_libs;
-	CommonCache.handle_native_lib com net_lib
-
-let before_generate com =
-	(* netcore version *)
-	let netcore_ver = try Some(Common.defined_value com Define.NetcoreVer) with Not_found -> None in
-
-	(* net version *)
-	let net_ver =
-		try
-			let ver = Common.defined_value com Define.NetVer in
-			try int_of_string ver with Failure _ -> raise (Arg.Bad "Invalid value for -D net-ver. Expected format: xx (e.g. 20, 35, 40, 45, 50)")
-		with Not_found when netcore_ver != None ->
-			(* 4.7 was released around .NET core 2.1 *)
-			(* Note: better version mapping should be implemented some day,
-			 * unless we just wait for .NET unification in october 2020 *)
-			Common.define_value com Define.NetVer "47";
-			47
-		| Not_found ->
-			Common.define_value com Define.NetVer "20";
-			20
-	in
-	if net_ver < 20 then
-		failwith (
-			".NET version is defined to target .NET "
-			^ string_of_int net_ver
-			^ ", but the compiler can only output code to versions equal or superior to .NET 2.0 (defined as 20)"
-		);
-	let rec loop = function
-		| v :: acc when v <= net_ver ->
-			Common.raw_define com ("NET_" ^ string_of_int v);
-			loop acc
-		| _ -> ()
-	in
-	loop [20;21;30;35;40;45;50];
-
-	(* net target *)
-	let net_target = try
-			String.lowercase (Common.defined_value com Define.NetTarget)
-		with | Not_found ->
-			"net"
-	in
-	Common.define_value com Define.NetTarget net_target;
-	Common.raw_define com net_target;
-
-	(* std dirs *)
-	let stds = match com.net_std with
-		| [] -> ["netlib"]
-		| s -> s
-	in
-	(* look for all dirs that have the digraph NET_TARGET-NET_VER *)
-	let digraph = match net_target with
-	| "netcore" ->
-		(match netcore_ver with
-		| None -> failwith (".NET target is defined as netcore but -D netcore-ver is missing");
-		| Some(ver) -> net_target ^ "-" ^ ver);
-	| _ -> net_target ^ "-" ^ string_of_int net_ver in
-
-	let matched = ref [] in
-	List.iter (fun f -> try
-		let f = Common.find_file com (f ^ "/" ^ digraph) in
-		matched := (f, Unix.opendir f) :: !matched
-	with | _ -> ()) stds;
-
-	if !matched = [] then failwith (
-		"No .NET std lib directory with the pattern '" ^ digraph ^ "' was found in the -net-std search path. " ^
-		"Try updating the hxcs lib to the latest version, or specifying another -net-std path.");
-	List.iter (fun (path,f) ->
-		let rec loop () =
-			try
-				let f = Unix.readdir f in
-				let finsens = String.lowercase f in
-				if String.ends_with finsens ".dll" then
-					add_net_lib com (path ^ "/" ^ f) true false ();
-				loop()
-			with | End_of_file ->
-				Unix.closedir f
-		in
-		loop()
-	) !matched

+ 0 - 6
src/compiler/args.ml

@@ -81,9 +81,6 @@ let parse_args com =
 			Common.define com Define.Cppia;
 			set_platform com Cpp file;
 		),"<file>","generate Cppia bytecode into target file");
-		("Target",["--cs"],["-cs"],Arg.String (fun dir ->
-			set_platform com Cs dir;
-		),"<directory>","generate C# code into target directory");
 		("Target",["--java"],["-java"],Arg.String (fun dir ->
 			set_platform com Java dir;
 		),"<directory>","generate Java code into target directory");
@@ -214,9 +211,6 @@ let parse_args com =
 		("Target-specific",["--net-lib"],["-net-lib"],Arg.String (fun file ->
 			add_native_lib file false;
 		),"<file>[@std]","add an external .NET DLL file");
-		("Target-specific",["--net-std"],["-net-std"],Arg.String (fun file ->
-			Dotnet.add_net_std com file
-		),"<file>","add a root std .NET DLL search path");
 		("Target-specific",["--c-arg"],["-c-arg"],Arg.String (fun arg ->
 			com.c_args <- arg :: com.c_args
 		),"<arg>","pass option <arg> to the native Java/C# compiler");

+ 0 - 3
src/compiler/compiler.ml

@@ -120,9 +120,6 @@ module Setup = struct
 				if Common.defined com Define.Cppia then
 					actx.classes <- (Path.parse_path "cpp.cppia.HostClasses" ) :: actx.classes;
 				"cpp"
-			| Cs ->
-				Dotnet.before_generate com;
-				add_std "cs"; "cs"
 			| Java ->
 				Java.before_generate com;
 				if defined com Define.Jvm then begin

+ 1 - 3
src/compiler/generate.ml

@@ -51,7 +51,7 @@ let generate ctx tctx ext actx =
 	begin match com.platform with
 		| Neko | Hl | Eval when actx.interp -> ()
 		| Cpp when Common.defined com Define.Cppia -> ()
-		| Cpp | Cs | Php -> Path.mkdir_from_path (com.file ^ "/.")
+		| Cpp | Php -> Path.mkdir_from_path (com.file ^ "/.")
 		| Java when not actx.jvm_flag -> Path.mkdir_from_path (com.file ^ "/.")
 		| _ -> Path.mkdir_from_path com.file
 	end;
@@ -80,8 +80,6 @@ let generate ctx tctx ext actx =
 			Gencpp.generate,"cpp"
 		| Java ->
 			Genjvm.generate actx.jvm_flag,"java"
-		| Cs ->
-			assert false
 		| Python ->
 			Genpy.generate,"python"
 		| Hl ->

+ 0 - 29
src/context/common.ml

@@ -512,7 +512,6 @@ let short_platform_name = function
 	| Flash -> "swf"
 	| Php -> "php"
 	| Cpp -> "cpp"
-	| Cs -> "cs"
 	| Java -> "jav"
 	| Python -> "py"
 	| Hl -> "hl"
@@ -671,34 +670,6 @@ let get_config com =
 			};
 			pf_supports_atomics = true;
 		}
-	| Cs ->
-		{
-			default_config with
-			pf_capture_policy = CPWrapRef;
-			pf_pad_nulls = true;
-			pf_overload = true;
-			pf_supports_threads = true;
-			pf_supports_rest_args = true;
-			pf_this_before_super = false;
-			pf_exceptions = { default_config.pf_exceptions with
-				ec_native_throws = [
-					["cs";"system"],"Exception";
-					["haxe"],"Exception";
-				];
-				ec_native_catches = [
-					["cs";"system"],"Exception";
-					["haxe"],"Exception";
-				];
-				ec_wildcard_catch = (["cs";"system"],"Exception");
-				ec_base_throw = (["cs";"system"],"Exception");
-				ec_special_throw = fun e -> e.eexpr = TIdent "__rethrow__"
-			};
-			pf_scoping = {
-				vs_scope = FunctionScope;
-				vs_flags = [NoShadowing]
-			};
-			pf_supports_atomics = true;
-		}
 	| Java ->
 		{
 			default_config with

+ 0 - 9
src/context/nativeLibraryHandler.ml

@@ -36,14 +36,5 @@ let add_native_lib com file is_extern = match com.platform with
 			) (Sys.readdir file))
 		else
 			add file
-	| Globals.Cs ->
-		let file, is_std = match ExtString.String.nsplit file "@" with
-			| [file] ->
-				file,false
-			| [file;"std"] ->
-				file,true
-			| _ -> failwith ("unsupported file@`std` format: " ^ file)
-		in
-		Dotnet.add_net_lib com file is_std is_extern
 	| pf ->
 		failwith (Printf.sprintf "Target %s does not support native libraries (trying to load %s)" (platform_name pf) file);

+ 0 - 4
src/core/globals.ml

@@ -21,7 +21,6 @@ type platform =
 	| Flash
 	| Php
 	| Cpp
-	| Cs
 	| Java
 	| Python
 	| Hl
@@ -65,7 +64,6 @@ let platforms = [
 	Flash;
 	Php;
 	Cpp;
-	Cs;
 	Java;
 	Python;
 	Hl;
@@ -81,7 +79,6 @@ let platform_name = function
 	| Flash -> "flash"
 	| Php -> "php"
 	| Cpp -> "cpp"
-	| Cs -> "cs"
 	| Java -> "java"
 	| Python -> "python"
 	| Hl -> "hl"
@@ -95,7 +92,6 @@ let parse_platform = function
 	| "flash" -> Flash
 	| "php" -> Php
 	| "cpp" -> Cpp
-	| "cs" -> Cs
 	| "java" -> Java
 	| "python" -> Python
 	| "hl" -> Hl

+ 4 - 4
src/filters/capturedVars.ml

@@ -44,7 +44,7 @@ let captured_vars com e =
 
 	let impl = match com.platform with
 	(* optimized version for C#/Java - use native arrays *)
-	| Cs | Java ->
+	| Java ->
 		let cnativearray =
 			match (List.find (fun md -> match md with
 					| TClassDecl ({ cl_path = ["cs"|"java"],"NativeArray" }) -> true
@@ -129,7 +129,7 @@ let captured_vars com e =
 			let rec browse = function
 				| Block f | Loop f | Function f -> f browse
 				| Use ({ v_extra = Some({v_params = _ :: _}) })
-				| Assign ({ v_extra = Some({v_params = _ :: _}) }) when com.platform = Cs || (com.platform = Java && not (Common.defined com Define.Jvm)) ->
+				| Assign ({ v_extra = Some({v_params = _ :: _}) }) when (com.platform = Java && not (Common.defined com Define.Jvm)) ->
 					(* Java and C# deal with functions with type parameters in a different way *)
 					(* so they do should not be wrapped *)
 					()
@@ -220,7 +220,7 @@ let captured_vars com e =
 					f (collect_vars false);
 					decr depth;
 				| Use ({ v_extra = Some({v_params = _ :: _}) })
-				| Assign ({ v_extra = Some({v_params = _ :: _}) }) when com.platform = Cs || (com.platform = Java && not (Common.defined com Define.Jvm)) ->
+				| Assign ({ v_extra = Some({v_params = _ :: _}) }) when (com.platform = Java && not (Common.defined com Define.Jvm)) ->
 					(* Java/C# use a special handling for functions with type parmaters *)
 					()
 				| Declare v ->
@@ -257,7 +257,7 @@ let captured_vars com e =
 		| Declare v ->
 			vars := PMap.add v.v_id !depth !vars;
 		| Use ({ v_extra = Some({v_params = _ :: _}) })
-		| Assign ({ v_extra = Some({v_params = _ :: _}) }) when com.platform = Cs || (com.platform = Java && not (Common.defined com Define.Jvm)) ->
+		| Assign ({ v_extra = Some({v_params = _ :: _}) }) when (com.platform = Java && not (Common.defined com Define.Jvm)) ->
 			()
 		| Use v ->
 			(try

+ 3 - 3
src/filters/exceptions.ml

@@ -162,7 +162,7 @@ let rec contains_throw_or_try e =
 	Check if expression represents an exception wrapped with `haxe.Exception.thrown`
 *)
 let is_wrapped_exception e =
-	match e.eexpr with 
+	match e.eexpr with
 	| TMeta ((Meta.WrappedException, _, _), _) -> true
 	| _ -> false
 
@@ -196,7 +196,7 @@ let throw_native ctx e_thrown t p =
 	let e_native =
 		if requires_wrapped_throw ctx e_thrown then
 			let thrown = haxe_exception_static_call ctx "thrown" [e_thrown] p in
-			let wrapped = 
+			let wrapped =
 				if is_dynamic ctx.base_throw_type then thrown
 				else mk_cast thrown ctx.base_throw_type p
 			in
@@ -522,7 +522,7 @@ let catch_native ctx catches t p =
 let filter tctx =
 	let stub e = e in
 	match tctx.com.platform with (* TODO: implement for all targets *)
-	| Php | Js | Java | Cs | Python | Lua | Eval | Neko | Flash | Hl | Cpp ->
+	| Php | Js | Java | Python | Lua | Eval | Neko | Flash | Hl | Cpp ->
 		let config = tctx.com.config.pf_exceptions in
 		let tp (pack,name) =
 			match List.rev pack with

+ 2 - 56
src/filters/filters.ml

@@ -547,7 +547,7 @@ let add_meta_field com t = match t with
 			let cf = mk_field ~static:true "__meta__" e.etype e.epos null_pos in
 			cf.cf_expr <- Some e;
 			let can_deal_with_interface_metadata () = match com.platform with
-				| Cs | Java -> false
+				| Java -> false
 				| _ -> true
 			in
 			if (has_class_flag c CInterface) && not (can_deal_with_interface_metadata()) then begin
@@ -565,55 +565,6 @@ let add_meta_field com t = match t with
 	| _ ->
 		()
 
-(*
-	C# events have special semantics:
-	if we have an @:event var field, there should also be add_<name> and remove_<name> methods,
-	this filter checks for their existence and also adds some metadata for analyzer and C# generator
-*)
-let check_cs_events com t = match t with
-	| TClassDecl cl when not (has_class_flag cl CExtern) ->
-		let check fields f =
-			match f.cf_kind with
-			| Var { v_read = AccNormal; v_write = AccNormal } when Meta.has Meta.Event f.cf_meta && not (has_class_field_flag f CfPostProcessed) ->
-				if (has_class_field_flag f CfPublic) then typing_error "@:event fields must be private" f.cf_pos;
-
-				(* prevent generating reflect helpers for the event in gencommon *)
-				f.cf_meta <- (Meta.SkipReflection, [], f.cf_pos) :: f.cf_meta;
-
-				(* type for both add and remove methods *)
-				let tmeth = (tfun [f.cf_type] com.basic.tvoid) in
-
-				let process_event_method name =
-					let m = try PMap.find name fields with Not_found -> typing_error ("Missing event method: " ^ name) f.cf_pos in
-
-					(* check method signature *)
-					begin
-						try
-							type_eq EqStrict m.cf_type tmeth
-						with Unify_error el ->
-							List.iter (fun e -> com.error (unify_error_msg (print_context()) e) m.cf_pos) el
-					end;
-
-					(*
-						add @:pure(false) to prevent purity inference, because empty add/remove methods
-						have special meaning here and they are always impure
-					*)
-					m.cf_meta <- (Meta.Pure,[EConst(Ident "false"),f.cf_pos],f.cf_pos) :: (Meta.Custom ":cs_event_impl",[],f.cf_pos) :: m.cf_meta;
-
-					(* add @:keep to event methods if the event is kept *)
-					if Meta.has Meta.Keep f.cf_meta && not (Meta.has Meta.Keep m.cf_meta) then
-						m.cf_meta <- (Dce.mk_keep_meta f.cf_pos) :: m.cf_meta;
-				in
-				process_event_method ("add_" ^ f.cf_name);
-				process_event_method ("remove_" ^ f.cf_name)
-			| _ ->
-				()
-		in
-		List.iter (check cl.cl_fields) cl.cl_ordered_fields;
-		List.iter (check cl.cl_statics) cl.cl_ordered_statics
-	| _ ->
-		()
-
 (* Removes interfaces tagged with @:remove metadata *)
 let check_remove_metadata t = match t with
 	| TClassDecl c ->
@@ -752,7 +703,7 @@ let destruction tctx detail_times main locals =
 		check_private_path tctx;
 		apply_native_paths;
 		add_rtti com;
-		(match com.platform with | Java | Cs -> (fun _ -> ()) | _ -> (fun mt -> add_field_inits tctx.curclass.cl_path locals com mt));
+		(match com.platform with | Java -> (fun _ -> ()) | _ -> (fun mt -> add_field_inits tctx.curclass.cl_path locals com mt));
 		(match com.platform with Hl -> (fun _ -> ()) | _ -> add_meta_field com);
 		check_void_field;
 		(match com.platform with | Cpp -> promote_first_interface_to_super | _ -> (fun _ -> ()));
@@ -968,11 +919,6 @@ let run com tctx main =
 	(* PASS 1.5: pre-analyzer type filters *)
 	let filters =
 		match com.platform with
-		| Cs ->
-			[
-				check_cs_events tctx.com;
-				DefaultArguments.run com;
-			]
 		| Java ->
 			[
 				DefaultArguments.run com;

+ 1 - 1
src/macro/macroApi.ml

@@ -2084,7 +2084,7 @@ let macro_api ccom get_api =
 			let arg = decode_string arg in
 			let com = ccom() in
 			(match com.platform with
-			| Globals.Java | Globals.Cs | Globals.Cpp ->
+			| Globals.Java | Globals.Cpp ->
 				com.c_args <- arg :: com.c_args
 			| _ -> failwith "Unsupported platform");
 			vnull

+ 4 - 6
src/optimization/analyzerTexpr.ml

@@ -124,7 +124,7 @@ let rec can_be_used_as_value com e =
 	in
 	try
 		begin match com.platform,e.eexpr with
-			| (Cs | Cpp | Java | Flash | Lua),TConst TNull -> raise Exit
+			| (Cpp | Java | Flash | Lua),TConst TNull -> raise Exit
 			| _ -> ()
 		end;
 		loop e;
@@ -510,9 +510,7 @@ module Fusion = struct
 		in
 		let e1 = skip e1 in
 		let e2 = skip e2 in
-		is_assign_op op && target_handles_assign_ops com e3 && Texpr.equal e1 e2 && not (has_side_effect e1) && match com.platform with
-			| Cs when is_null e1.etype || is_null e2.etype -> false (* C# hates OpAssignOp on Null<T> *)
-			| _ -> true
+		is_assign_op op && target_handles_assign_ops com e3 && Texpr.equal e1 e2 && not (has_side_effect e1)
 
 	let apply actx e =
 		let config = actx.AnalyzerTypes.config in
@@ -773,7 +771,7 @@ module Fusion = struct
 						{e with eexpr = TCall(e1,el)}
 					| TObjectDecl fl ->
 						(* The C# generator has trouble with evaluation order in structures (#7531). *)
-						let el = (match com.platform with Cs -> handle_el' | _ -> handle_el) (List.map snd fl) in
+						let el = handle_el (List.map snd fl) in
 						if not !found && (has_state_write ir || has_any_field_write ir) then raise Exit;
 						{e with eexpr = TObjectDecl (List.map2 (fun (s,_) e -> s,e) fl el)}
 					| TArrayDecl el ->
@@ -1004,7 +1002,7 @@ module Cleanup = struct
 			| _,TConst (TBool false) -> optimize_binop {e with eexpr = TBinop(OpBoolAnd,e1,e2)} OpBoolAnd e1 e2
 			| _,TBlock [] -> {e with eexpr = TIf(e1,e2,None)}
 			| _ -> match (Texpr.skip e2).eexpr with
-				| TBlock [] when com.platform <> Cs ->
+				| TBlock [] ->
 					let e1' = mk (TUnop(Not,Prefix,e1)) e1.etype e1.epos in
 					let e1' = optimize_unop e1' Not Prefix e1 in
 					{e with eexpr = TIf(e1',e3,None)}

+ 3 - 16
src/optimization/inline.ml

@@ -19,21 +19,10 @@ let mk_untyped_call name p params =
 
 let api_inline2 com c field params p =
 	match c.cl_path, field, params with
-	| ([],"Type"),"enumIndex",[{ eexpr = TField (_,FEnum (en,f)) }] -> (match com.platform with
-		| Cs when en.e_extern && not (Meta.has Meta.HxGen en.e_meta) ->
-			(* We don't want to optimize enums from external sources; as they might change unexpectedly *)
-			(* and since native C# enums don't have the concept of index - they have rather a value, *)
-			(* which can't be mapped to a native API - this kind of substitution is dangerous *)
-			None
-		| _ ->
-			Some (mk (TConst (TInt (Int32.of_int f.ef_index))) com.basic.tint p))
+	| ([],"Type"),"enumIndex",[{ eexpr = TField (_,FEnum (en,f)) }] ->
+		Some (mk (TConst (TInt (Int32.of_int f.ef_index))) com.basic.tint p)
 	| ([],"Type"),"enumIndex",[{ eexpr = TCall({ eexpr = TField (_,FEnum (en,f)) },pl) }] when List.for_all (fun e -> not (has_side_effect e)) pl ->
-		(match com.platform with
-			| Cs when en.e_extern && not (Meta.has Meta.HxGen en.e_meta) ->
-				(* see comment above *)
-				None
-			| _ ->
-				Some (mk (TConst (TInt (Int32.of_int f.ef_index))) com.basic.tint p))
+		Some (mk (TConst (TInt (Int32.of_int f.ef_index))) com.basic.tint p)
 	| ([],"Std"),"int",[{ eexpr = TConst (TInt _) } as e] ->
 		Some { e with epos = p }
 	| ([],"String"),"fromCharCode",[{ eexpr = TConst (TInt i) }] when i > 0l && i < 128l ->
@@ -178,10 +167,8 @@ let api_inline ctx c field params p =
 			Some (Texpr.Builder.fcall (make_static_this c p) "__implements" [o;t] tbool p)
 		else
 			Some (Texpr.Builder.fcall (eJsSyntax()) "instanceof" [o;t] tbool p)
-	| (["cs" | "java"],"Lib"),("nativeArray"),[{ eexpr = TArrayDecl args } as edecl; _]
 	| (["haxe";"ds";"_Vector"],"Vector_Impl_"),("fromArrayCopy"),[{ eexpr = TArrayDecl args } as edecl] -> (try
 			let platf = match ctx.com.platform with
-				| Cs -> "cs"
 				| Java -> "java"
 				| _ -> raise Exit
 			in

+ 0 - 1
src/optimization/optimizer.ml

@@ -327,7 +327,6 @@ let reduce_control_flow com e = match e.eexpr with
 		let require_cast = match com.platform with
 			| Cpp | Flash -> true
 			| Java -> defined com Define.Jvm
-			| Cs -> defined com Define.EraseGenerics || defined com Define.FastCast
 			| _ -> false
 		in
 		Texpr.reduce_unsafe_casts ~require_cast e e.etype

+ 4 - 25
src/typing/strictMeta.ml

@@ -51,10 +51,7 @@ let rec process_meta_argument ?(toplevel=true) ctx expr = match expr.eexpr with
 		process_meta_argument ~toplevel ctx e
 	| TTypeExpr md when toplevel ->
 		let p = expr.epos in
-		if ctx.com.platform = Cs then
-			(ECall( (EConst(Ident "typeof"), p), [get_native_repr md expr.epos] ), p)
-		else
-			(efield(get_native_repr md expr.epos, "class"), p)
+		(efield(get_native_repr md expr.epos, "class"), p)
 	| TTypeExpr md ->
 		get_native_repr md expr.epos
 	| _ ->
@@ -67,7 +64,6 @@ let handle_fields ctx fields_to_check with_type_expr =
 		let field = (efield(with_type_expr,name), pos) in
 		let fieldexpr = (EConst(Ident name),pos) in
 		let left_side = match ctx.com.platform with
-			| Cs -> field
 			| Java -> (ECall(field,[]),pos)
 			| _ -> die "" __LOC__
 		in
@@ -93,14 +89,6 @@ let get_strict_meta ctx meta params pos =
 		| [ECall(ef, el),p] ->
 			let tpath = field_to_type_path ctx.com ef in
 			begin match pf with
-			| Cs ->
-				let el, fields = match List.rev el with
-					| (EObjectDecl(decl),_) :: el ->
-						List.rev el, decl
-					| _ ->
-						el, []
-				in
-				(ENew((tpath,snd ef), el), p), fields, CTPath tpath
 			| Java ->
 				let fields = match el with
 				| [EObjectDecl(fields),_] ->
@@ -117,16 +105,10 @@ let get_strict_meta ctx meta params pos =
 			end
 		| [EConst(Ident i),p as expr] ->
 			let tpath = { tpackage=[]; tname=i; tparams=[]; tsub=None } in
-			if pf = Cs then
-				(ENew((tpath,p), []), p), [], CTPath tpath
-			else
-				expr, [], CTPath tpath
+			expr, [], CTPath tpath
 		| [ (EField(_),p as field) ] ->
 			let tpath = field_to_type_path ctx.com field in
-			if pf = Cs then
-				(ENew((tpath,p), []), p), [], CTPath tpath
-			else
-				field, [], CTPath tpath
+			field, [], CTPath tpath
 		| _ ->
 			display_error ctx.com "A @:strict metadata must contain exactly one parameter. Please check the documentation for more information" pos;
 			raise Exit
@@ -139,12 +121,9 @@ let get_strict_meta ctx meta params pos =
 let check_strict_meta ctx metas =
 	let pf = ctx.com.platform in
 	match pf with
-		| Cs | Java ->
+		| Java ->
 			let ret = ref [] in
 			List.iter (function
-				| Meta.AssemblyStrict,params,pos -> (try
-					ret := get_strict_meta ctx Meta.AssemblyMeta params pos :: !ret
-				with | Exit -> ())
 				| Meta.Strict,params,pos -> (try
 					ret := get_strict_meta ctx Meta.Meta params pos :: !ret
 				with | Exit -> ())

+ 3 - 7
src/typing/typeloadCheck.ml

@@ -169,7 +169,6 @@ let check_overriding ctx c f =
 	match c.cl_super with
 	| None ->
 		if has_class_field_flag f CfOverride then display_error ctx.com ("Field " ^ f.cf_name ^ " is declared 'override' but doesn't override any field") f.cf_pos
-	| _ when (has_class_flag c CExtern) && Meta.has Meta.CsNative c.cl_meta -> () (* -net-lib specific: do not check overrides on extern CsNative classes *)
 	| Some (csup,params) ->
 		let p = f.cf_name_pos in
 		let i = f.cf_name in
@@ -395,11 +394,9 @@ module Inheritance = struct
 						valid_redefinition ctx map1 map2 f2 t2 f (apply_params intf.cl_params params f.cf_type)
 					with
 						Unify_error l ->
-							if not (Meta.has Meta.CsNative c.cl_meta && (has_class_flag c CExtern)) then begin
-								display_error ctx.com ("Field " ^ f.cf_name ^ " has different type than in " ^ s_type_path intf.cl_path) p;
-								display_error ~depth:1 ctx.com (compl_msg "Interface field is defined here") f.cf_pos;
-								located_display_error ~depth:1 ctx.com (compl_located_msg (error_msg p (Unify l)));
-							end
+							display_error ctx.com ("Field " ^ f.cf_name ^ " has different type than in " ^ s_type_path intf.cl_path) p;
+							display_error ~depth:1 ctx.com (compl_msg "Interface field is defined here") f.cf_pos;
+							located_display_error ~depth:1 ctx.com (compl_located_msg (error_msg p (Unify l)));
 				)
 			with Not_found ->
 				if (has_class_flag c CAbstract) && is_method() then begin
@@ -435,7 +432,6 @@ module Inheritance = struct
 	let check_interfaces ctx c =
 		match c.cl_path with
 		| "Proxy" :: _ , _ -> ()
-		| _ when (has_class_flag c CExtern) && Meta.has Meta.CsNative c.cl_meta -> ()
 		| _ ->
 		List.iter (fun (intf,params) ->
 			let missing = DynArray.create () in

+ 2 - 4
src/typing/typeloadFields.ml

@@ -553,7 +553,7 @@ let create_class_context c context_init p =
 	in
 	let is_lib = Meta.has Meta.LibType c.cl_meta in
 	(* a native type will skip one check: the static vs non-static field *)
-	let is_native = Meta.has Meta.JavaNative c.cl_meta || Meta.has Meta.CsNative c.cl_meta in
+	let is_native = Meta.has Meta.JavaNative c.cl_meta in
 	let rec extends_public c =
 		Meta.has Meta.PublicFields c.cl_meta ||
 		match c.cl_super with
@@ -852,9 +852,7 @@ module TypeBinding = struct
 		if not fctx.is_static && not cctx.is_lib then begin match get_declared cf.cf_name c.cl_super with
 				| None -> ()
 				| Some (csup,_) ->
-					(* this can happen on -net-lib generated classes if a combination of explicit interfaces and variables with the same name happens *)
-					if not ((has_class_flag csup CInterface) && Meta.has Meta.CsNative c.cl_meta) then
-						display_error ctx.com ("Redefinition of variable " ^ cf.cf_name ^ " in subclass is not allowed. Previously declared at " ^ (s_type_path csup.cl_path) ) cf.cf_name_pos
+					display_error ctx.com ("Redefinition of variable " ^ cf.cf_name ^ " in subclass is not allowed. Previously declared at " ^ (s_type_path csup.cl_path) ) cf.cf_name_pos
 		end
 
 	let bind_var_expression ctx cctx fctx cf e =

+ 3 - 8
src/typing/typeloadModule.ml

@@ -447,7 +447,7 @@ module TypeLevel = struct
 		delay ctx PBuildClass (fun() -> ignore(c.cl_build()));
 		if Meta.has Meta.InheritDoc c.cl_meta then
 				delay ctx PConnectField (fun() -> InheritDoc.build_class_doc ctx c);
-		if (ctx.com.platform = Java || ctx.com.platform = Cs) && not (has_class_flag c CExtern) then
+		if (ctx.com.platform = Java) && not (has_class_flag c CExtern) then
 			delay ctx PTypeField (fun () ->
 				let metas = StrictMeta.check_strict_meta ctx c.cl_meta in
 				if metas <> [] then c.cl_meta <- metas @ c.cl_meta;
@@ -535,7 +535,7 @@ module TypeLevel = struct
 		if !is_flat then e.e_meta <- (Meta.FlatEnum,[],null_pos) :: e.e_meta;
 		if Meta.has Meta.InheritDoc e.e_meta then
 			delay ctx PConnectField (fun() -> InheritDoc.build_enum_doc ctx e);
-		if (ctx.com.platform = Java || ctx.com.platform = Cs) && not e.e_extern then
+		if (ctx.com.platform = Java) && not e.e_extern then
 			delay ctx PTypeField (fun () ->
 				let metas = StrictMeta.check_strict_meta ctx e.e_meta in
 				e.e_meta <- metas @ e.e_meta;
@@ -590,12 +590,7 @@ module TypeLevel = struct
 			| None -> Monomorph.bind r tt;
 			| Some _ -> die "" __LOC__);
 		| _ -> die "" __LOC__);
-		TypeloadFields.build_module_def ctx (TTypeDecl t) t.t_meta (fun _ -> []) context_init (fun _ -> ());
-		if ctx.com.platform = Cs && t.t_meta <> [] then
-			delay ctx PTypeField (fun () ->
-				let metas = StrictMeta.check_strict_meta ctx t.t_meta in
-				if metas <> [] then t.t_meta <- metas @ t.t_meta;
-			)
+		TypeloadFields.build_module_def ctx (TTypeDecl t) t.t_meta (fun _ -> []) context_init (fun _ -> ())
 
 	let init_abstract ctx context_init a d p =
 		if ctx.is_display_file && DisplayPosition.display_position#enclosed_in (pos d.d_name) then

+ 16 - 21
src/typing/typer.ml

@@ -322,28 +322,23 @@ let rec type_ident_raise ctx i p mode with_type =
 		AKExpr (mk (TConst TSuper) t p)
 	| "null" ->
 		let acc =
-			(* Hack for #10787 *)
-			if ctx.com.platform = Cs then
-				AKExpr (null (spawn_monomorph ctx p) p)
-			else begin
-				let tnull () = ctx.t.tnull (spawn_monomorph ctx p) in
-				let t = match with_type with
-					| WithType.WithType(t,_) ->
-						begin match follow t with
-						| TMono r ->
-							(* If our expected type is a monomorph, bind it to Null<?>. *)
-							Monomorph.do_bind r (tnull())
-						| _ ->
-							(* Otherwise there's no need to create a monomorph, we can just type the null literal
-							the way we expect it. *)
-							()
-						end;
-						t
+			let tnull () = ctx.t.tnull (spawn_monomorph ctx p) in
+			let t = match with_type with
+				| WithType.WithType(t,_) ->
+					begin match follow t with
+					| TMono r ->
+						(* If our expected type is a monomorph, bind it to Null<?>. *)
+						Monomorph.do_bind r (tnull())
 					| _ ->
-						tnull()
-				in
-				AKExpr (null t p)
-			end
+						(* Otherwise there's no need to create a monomorph, we can just type the null literal
+						the way we expect it. *)
+						()
+					end;
+					t
+				| _ ->
+					tnull()
+			in
+			AKExpr (null t p)
 		in
 		if mode = MGet then acc else AKNo(acc,p)
 	| _ ->