Simon Krajewski 12 vuotta sitten
vanhempi
commit
7507234559
53 muutettua tiedostoa jossa 818 lisäystä ja 515 poistoa
  1. 310 9
      ast.ml
  2. 9 9
      codegen.ml
  3. 2 2
      common.ml
  4. 29 29
      dce.ml
  5. 8 8
      genas3.ml
  6. 51 51
      gencommon.ml
  7. 14 14
      gencpp.ml
  8. 19 19
      gencs.ml
  9. 30 30
      genjava.ml
  10. 2 2
      genjs.ml
  11. 11 11
      genswf.ml
  12. 12 12
      genswf9.ml
  13. 9 9
      genxml.ml
  14. 7 7
      interp.ml
  15. 2 2
      main.ml
  16. 1 1
      matcher.ml
  17. 1 1
      optimizer.ml
  18. 9 7
      parser.ml
  19. 35 35
      std/cs/Lib.hx
  20. 0 0
      std/cs/_std/Array.hx
  21. 1 1
      std/cs/_std/Math.hx
  22. 12 12
      std/cs/_std/Reflect.hx
  23. 1 1
      std/cs/_std/Std.hx
  24. 10 10
      std/cs/_std/Type.hx
  25. 1 1
      std/cs/_std/haxe/Int32.hx
  26. 1 1
      std/cs/_std/haxe/Int64.hx
  27. 7 7
      std/cs/internal/Exceptions.hx
  28. 4 4
      std/cs/internal/Function.hx
  29. 0 0
      std/cs/internal/HxObject.hx
  30. 12 12
      std/cs/internal/Null.hx
  31. 24 24
      std/cs/internal/Runtime.hx
  32. 12 12
      std/cs/internal/StringExt.hx
  33. 2 2
      std/cs/system/Exception.hx
  34. 1 1
      std/cs/system/Math.hx
  35. 10 10
      std/java/Lib.hx
  36. 3 3
      std/java/NativeArray.hx
  37. 0 0
      std/java/_std/Array.hx
  38. 12 12
      std/java/_std/Reflect.hx
  39. 3 3
      std/java/_std/Std.hx
  40. 13 13
      std/java/_std/Type.hx
  41. 1 1
      std/java/_std/haxe/Int32.hx
  42. 1 1
      std/java/_std/haxe/Int64.hx
  43. 10 10
      std/java/internal/Exceptions.hx
  44. 6 6
      std/java/internal/FieldLookup.hx
  45. 4 4
      std/java/internal/Function.hx
  46. 0 0
      std/java/internal/HxObject.hx
  47. 22 22
      std/java/internal/Runtime.hx
  48. 0 0
      std/java/internal/StringExt.hx
  49. 23 23
      tests/unit/TestCSharp.hx
  50. 11 11
      tests/unit/TestJava.hx
  51. 7 7
      type.ml
  52. 19 19
      typeload.ml
  53. 24 24
      typer.ml

+ 310 - 9
ast.ml

@@ -23,6 +23,307 @@ type pos = {
 	pmax : int;
 }
 
+module Meta = struct
+	type strict_meta =
+		| Abstract
+		| Access
+		| Alias
+		| Allow
+		| Annotation
+		| ArrayAccess
+		| AutoBuild
+		| BaseInterface
+		| Bind
+		| Bitmap
+		| Build
+		| BuildXml
+		| Class
+		| ClassCode
+		| CompilerGenerated
+		| CoreApi
+		| CoreType
+		| CppFileCode
+		| CppNamespaceCode
+		| Debug
+		| Decl
+		| DefineFeature
+		| DefParam
+		| Depend
+		| Deprecated
+		| DynamicObject
+		| Enum
+		| Expose
+		| Extern
+		| FakeEnum
+		| File
+		| Final
+		| Font
+		| From
+		| FunctionCode
+		| FunctionTailCode
+		| Generic
+		| Getter
+		| Hack
+		| HaxeGeneric
+		| HeaderClassCode
+		| HeaderCode
+		| HeaderNamespaceCode
+		| HxGen
+		| IfFeature
+		| Impl
+		| Include
+		| InitPackage
+		| Internal
+		| IsVar
+		| JavaNative
+		| Keep
+		| KeepInit
+		| KeepSub
+		| Meta
+		| Macro
+		| MaybeUsed
+		| Native
+		| NativeGen
+		| NativeGeneric
+		| NoCompletion
+		| NoDebug
+		| NoDoc
+		| NoStack
+		| NotNull
+		| NoUsing
+		| Ns
+		| Optional
+		| Overload
+		| Public
+		| PrivateAccess
+		| Protected
+		| ReadOnly
+		| RealPath
+		| Remove
+		| Require
+		| ReplaceReflection
+		| RttiInfos
+		| Runtime
+		| RuntimeValue
+		| Setter
+		| SkipCtor
+		| SkipReflection
+		| Sound
+		| Struct
+		| SuppressWarnings
+		| Synchronized
+		| Throws
+		| To
+		| Transient
+		| ValueUsed
+		| VarArgs
+		| Volatile
+		| UnifyMinDynamic
+		| Unreflective
+		| Unsafe
+		| Used
+		| Dollar of string
+		| Custom of string
+
+	let to_string = function
+		| Abstract -> ":abstract"
+		| Access -> ":access"
+		| Alias -> ":alias"
+		| Allow -> ":allow"
+		| Annotation -> ":annotation"
+		| ArrayAccess -> ":arrayAccess"
+		| AutoBuild -> ":autoBuild"
+		| BaseInterface -> ":baseInterface"
+		| Bind -> ":bind"
+		| Bitmap -> ":bitmap"
+		| Build -> ":build"
+		| BuildXml -> "buildXml"
+		| Class -> ":class"
+		| ClassCode -> ":classCode"
+		| CompilerGenerated -> ":compilerGenerated"
+		| CoreApi -> ":coreApi"
+		| CoreType -> ":coreType"
+		| CppFileCode -> ":cppFileCode"
+		| CppNamespaceCode -> ":cppNamespaceCode"
+		| Debug -> ":debug"
+		| Decl -> ":decl"
+		| DefineFeature -> ":defineFeature"
+		| DefParam -> ":defParam"
+		| Depend -> ":depend"
+		| Deprecated -> ":deprecated"
+		| DynamicObject -> ":dynamicObject"
+		| Enum -> ":enum"
+		| Expose -> ":expose"
+		| Extern -> ":extern"
+		| FakeEnum -> ":fakeEnum"
+		| File -> ":file"
+		| Final -> ":final"
+		| Font -> ":font"
+		| From -> ":from"
+		| FunctionCode -> ":functionCode"
+		| FunctionTailCode -> ":functionTailCode"
+		| Generic -> ":generic"
+		| Getter -> ":getter"
+		| Hack -> ":hack"
+		| HaxeGeneric -> ":haxeGeneric"
+		| HeaderClassCode -> ":headerClassCode"
+		| HeaderCode -> ":headerCode"
+		| HeaderNamespaceCode -> ":headerNamespaceCode"
+		| HxGen -> ":hxGen"
+		| IfFeature -> ":ifFeature"
+		| Impl -> ":impl"
+		| Include -> ":include"
+		| InitPackage -> ":initPackage"
+		| Internal -> ":internal"
+		| IsVar -> ":isVar"
+		| JavaNative -> ":javaNative"
+		| Keep -> ":keep"
+		| KeepInit -> ":keepInit"
+		| KeepSub -> ":keepSub"
+		| Meta -> ":meta"
+		| Macro -> ":macro"
+		| MaybeUsed -> ":maybeUsed"
+		| Native -> ":native"
+		| NativeGen -> ":nativeGen"
+		| NativeGeneric -> ":nativeGeneric"
+		| NoCompletion -> ":noCompletion"
+		| NoDebug -> ":noDebug"
+		| NoDoc -> ":noDoc"
+		| NoStack -> ":noStack"
+		| NotNull -> ":notNull"
+		| NoUsing -> ":noUsing"
+		| Ns -> ":ns"
+		| Optional -> ":optional"
+		| Overload -> ":overlord"
+		| Public -> ":public"
+		| PrivateAccess -> ":privateAccess"
+		| Protected -> ":protected"
+		| ReadOnly -> ":readOnly"
+		| RealPath -> ":realPath"
+		| Remove -> ":remove"
+		| Require -> ":require"
+		| ReplaceReflection -> ":replaceReflection"
+		| RttiInfos -> ":rttiInfos"
+		| Runtime -> ":runtime"
+		| RuntimeValue -> ":runtimeValue"
+		| Setter -> ":setter"
+		| SkipCtor -> ":skipCtor"
+		| SkipReflection -> ":skipReflection"
+		| Sound -> ":sound"
+		| Struct -> ":struct"
+		| SuppressWarnings -> ":suppressWarnings"
+		| Synchronized -> ":synchronized"
+		| Throws -> ":throws"
+		| To -> ":to"
+		| Transient -> ":transient"
+		| ValueUsed -> ":valueUsed"
+		| VarArgs -> ":varArgs"
+		| Volatile -> ":volatile"
+		| UnifyMinDynamic -> ":unifyMinDynamic"
+		| Unreflective -> ":unreflective"
+		| Unsafe -> ":unsafe"
+		| Used -> ":used"
+		| Dollar s -> "$" ^ s
+		| Custom s -> s
+
+	let parse = function
+		| "abstract" -> Abstract
+		| "access" -> Access
+		| "alias" -> Alias
+		| "allow" -> Allow
+		| "annotation" -> Annotation
+		| "arrayAccess" -> ArrayAccess
+		| "autoBuild" -> AutoBuild
+		| "bind" -> Bind
+		| "bitmap" -> Bitmap
+		| "build" -> Build
+		| "buildXml" -> BuildXml
+		| "classCode" -> ClassCode (* was classContents *)
+		| "coreApi" -> CoreApi
+		| "coreType" -> CoreType
+		| "cppFileCode" -> CppFileCode
+		| "cppNamespaceCode" -> CppNamespaceCode
+		| "debug" -> Debug
+		| "decl" -> Decl
+		| "defineFeature" -> DefineFeature
+		| "defParam" -> DefParam (* was defparam *)
+		| "depend" -> Depend
+		| "deprecated" -> Deprecated
+		| "expose" -> Expose
+		| "extern" -> Extern
+		| "fakeEnum" -> FakeEnum
+		| "file" -> File
+		| "final" -> Final
+		| "font" -> Font
+		| "from" -> From
+		| "functionCode" -> FunctionCode
+		| "functionTailCode" -> FunctionTailCode
+		| "generic" -> Generic
+		| "getter" -> Getter
+		| "hack" -> Hack
+		| "headerClassCode" -> HeaderClassCode
+		| "headerCode" -> HeaderCode
+		| "headerNamespaceCode" -> HeaderNamespaceCode
+		| "hxGen" -> HxGen (* was hxgen *)
+		| "ifFeature" -> IfFeature
+		| "include" -> Include
+		| "initPackage" -> InitPackage
+		| "internal" -> Internal
+		| "isVar" -> IsVar
+		| "keep" -> Keep
+		| "keepInit" -> KeepInit
+		| "keepSub" -> KeepSub
+		| "macro" -> Macro
+		| "native" -> Native
+		| "nativeGen" -> NativeGen (* was nativegen *)
+		| "noCompletion" -> NoCompletion
+		| "noDebug" -> NoDebug
+		| "noDoc" -> NoDoc
+		| "noStack" -> NoStack
+		| "notNull" -> NotNull
+		| "noUsing" -> NoUsing
+		| "ns" -> Ns
+		| "optional" -> Optional
+		| "overload" -> Overload
+		| "protected" -> Protected
+		| "public" -> Public
+		| "readOnly" -> ReadOnly (* was readonly *)
+		| "remove" -> Remove
+		| "require" -> Require
+		| "replaceReflection" -> ReplaceReflection
+		| "rttiInfos" -> RttiInfos
+		| "runtime" -> Runtime
+		| "runtimeValue" -> RuntimeValue
+		| "setter" -> Setter
+		| "skipCtor" -> SkipCtor (* was skip_ctor *)
+		| "skipReflection" -> SkipReflection
+		| "sound" -> Sound
+		| "struct" -> Struct
+		| "suppressWarnings" -> SuppressWarnings
+		| "synchronized" -> Synchronized
+		| "throws" -> Throws
+		| "to" -> To
+		| "transient" -> Transient
+		| "varArgs" -> VarArgs
+		| "volatile" -> Volatile
+		| "unifyMinDynamic" -> UnifyMinDynamic
+		| "unreflective" -> Unreflective
+		| "unsafe" -> Unsafe
+		| s -> Custom s
+
+	let from_string s =
+		if s = "" then Custom "" else match s.[0] with
+		| ':' -> parse (String.sub s 1 (String.length s - 1))
+		| '$' -> Dollar (String.sub s 1 (String.length s - 1))
+		| _ -> Custom s
+
+	(* removed
+	:functionBody -> :functionCode
+	*)
+	let has m ml = List.exists (fun (m2,_,_) -> m = m2) ml
+	let get m ml = List.find (fun (m2,_,_) -> m = m2) ml
+end
+
 type keyword =
 	| Function
 	| Class
@@ -206,7 +507,7 @@ and type_param = {
 
 and documentation = string option
 
-and metadata_entry = (string * expr list * pos)
+and metadata_entry = (Meta.strict_meta * expr list * pos)
 and metadata = metadata_entry list
 
 and access =
@@ -709,7 +1010,7 @@ let reify in_macro =
 	and to_meta m p =
 		to_array (fun (m,el,p) _ ->
 			let fields = [
-				"name", to_string m p;
+				"name", to_string (Meta.to_string m) p;
 				"params", to_expr_array el p;
 				"pos", to_pos p;
 			] in
@@ -724,7 +1025,7 @@ let reify in_macro =
 		else
 			to_obj [("file",file);("min",pmin);("max",pmax)] p
 	and to_expr_array a p = match a with
-		| [EMeta (("$a",[],_),e1),_] -> (match fst e1 with EArrayDecl el -> to_expr_array el p | _ -> e1)
+		| [EMeta ((Meta.Dollar "a",[],_),e1),_] -> (match fst e1 with EArrayDecl el -> to_expr_array el p | _ -> e1)
 		| _ -> to_array to_expr a p
 	and to_expr e _ =
 		let p = snd e in
@@ -816,18 +1117,18 @@ let reify in_macro =
 			expr "ECheckType" [loop e1; to_ctype ct p]
 		| EMeta ((m,ml,p),e1) ->
 			match m with
-			| "$" | "$e" ->
+			| Meta.Dollar ("" | "e") ->
 				e1
-			| "$a" ->
+			| Meta.Dollar "a" ->
 				expr "EArrayDecl" (match fst e1 with EArrayDecl el -> [to_expr_array el p] | _ -> [e1])
 			(* TODO: can $v and $i be implemented better? *)
-			| "$v" ->
+			| Meta.Dollar "v" ->
 				(ECall ((EField ((EField ((EField ((EConst (Ident "haxe"),p),"macro"),p),"Context"),p),"makeExpr"),p),[e; to_pos (pos e)]),p)
-			| "$i" ->
+			| Meta.Dollar "i" ->
 				(ECall ((EField ((EField ((EField ((EConst (Ident "haxe"),p),"macro"),p),"ExprTools"),p),"asIdent"),p),[e; to_pos (pos e)]),p)
-			| "$p" ->
+			| Meta.Dollar "p" ->
 				(ECall ((EField ((EField ((EField ((EConst (Ident "haxe"),p),"macro"),p),"ExprTools"),p),"toFieldExpr"),p),[e]),p)
 			| _ ->
-				expr "EMeta" [to_obj [("name",to_string m p);("params",to_expr_array ml p);("pos",to_pos p)] p;loop e1]
+				expr "EMeta" [to_obj [("name",to_string (Meta.to_string m) p);("params",to_expr_array ml p);("pos",to_pos p)] p;loop e1]
 	in
 	(fun e -> to_expr e (snd e)), to_ctype

+ 9 - 9
codegen.ml

@@ -222,7 +222,7 @@ let make_generic ctx ps pt p =
 			let path = (match follow t with
 				| TInst (ct,_) -> ct.cl_path
 				| TEnum (e,_) -> e.e_path
-				| TAbstract (a,_) when has_meta ":runtimeValue" a.a_meta -> a.a_path
+				| TAbstract (a,_) when Meta.has Meta.RuntimeValue a.a_meta -> a.a_path
 				| TMono _ -> raise (Generic_Exception (("Could not determine type for parameter " ^ s), p))
 				| t -> raise (Generic_Exception (("Type parameter must be a class or enum instance (found " ^ (s_type (print_context()) t) ^ ")"), p))
 			) in
@@ -267,7 +267,7 @@ let is_generic_parameter ctx c =
 	(* first check field parameters, then class parameters *)
 	try
 		ignore (List.assoc (snd c.cl_path) ctx.curfield.cf_params);
-		has_meta ":generic" ctx.curfield.cf_meta
+		Meta.has Meta.Generic ctx.curfield.cf_meta
 	with Not_found -> try
 		ignore(List.assoc (snd c.cl_path) ctx.type_params);
 		(match ctx.curclass.cl_kind with | KGeneric -> true | _ -> false);
@@ -453,7 +453,7 @@ let build_metadata com t =
 			(a.a_pos, ["",a.a_meta],[],[])
 	) in
 	let filter l =
-		let l = List.map (fun (n,ml) -> n, List.filter (fun (m,_,_) -> m.[0] <> ':') ml) l in
+		let l = List.map (fun (n,ml) -> n, ExtList.List.filter_map (fun (m,el,p) -> match m with Meta.Custom s -> Some (s,el,p) | _ -> None) ml) l in
 		List.filter (fun (_,ml) -> ml <> []) l
 	in
 	let meta, fields, statics = filter meta, filter fields, filter statics in
@@ -610,10 +610,10 @@ let remove_generic_base ctx t = match t with
 (* Rewrites class or enum paths if @:native metadata is set *)
 let apply_native_paths ctx t =
 	let get_real_path meta path =
-		let (_,e,mp) = get_meta ":native" meta in
+		let (_,e,mp) = Meta.get Meta.Native meta in
 		match e with
 		| [Ast.EConst (Ast.String name),p] ->
-			(":realPath",[Ast.EConst (Ast.String (s_type_path path)),p],mp),parse_path name
+			(Meta.RealPath,[Ast.EConst (Ast.String (s_type_path path)),p],mp),parse_path name
 		| _ ->
 			error "String expected" mp
 	in
@@ -636,7 +636,7 @@ let apply_native_paths ctx t =
 let add_rtti ctx t =
 	let has_rtti c =
 		let rec has_rtti_new c =
-			has_meta ":rttiInfos" c.cl_meta || match c.cl_super with None -> false | Some (csup,_) -> has_rtti_new csup
+			Meta.has Meta.RttiInfos c.cl_meta || match c.cl_super with None -> false | Some (csup,_) -> has_rtti_new csup
 		in
 		let rec has_rtti_old c =
 			List.exists (function (t,pl) ->
@@ -665,7 +665,7 @@ let add_rtti ctx t =
 let remove_extern_fields ctx t = match t with
 	| TClassDecl c ->
 		let do_remove f =
-			(not ctx.in_macro && f.cf_kind = Method MethMacro) || has_meta ":extern" f.cf_meta || has_meta ":generic" f.cf_meta
+			(not ctx.in_macro && f.cf_kind = Method MethMacro) || Meta.has Meta.Extern f.cf_meta || Meta.has Meta.Generic f.cf_meta
 		in
 		if not (Common.defined ctx.com Define.DocGen) then begin
 			c.cl_ordered_fields <- List.filter (fun f ->
@@ -775,7 +775,7 @@ let add_meta_field ctx t = match t with
 (* Removes interfaces tagged with @:remove metadata *)
 let check_remove_metadata ctx t = match t with
 	| TClassDecl c ->
-		c.cl_implements <- List.filter (fun (c,_) -> not (has_meta ":remove" c.cl_meta)) c.cl_implements;
+		c.cl_implements <- List.filter (fun (c,_) -> not (Meta.has Meta.Remove c.cl_meta)) c.cl_implements;
 	| _ ->
 		()
 
@@ -1313,7 +1313,7 @@ let handle_abstract_casts ctx e =
 		in
 		(match cf.cf_expr with
 		| Some { eexpr = TFunction fd } when cf.cf_kind = Method MethInline ->
-			let config = if has_meta ":impl" cf.cf_meta then (Some (a.a_types <> [], apply_params a.a_types pl)) else None in
+			let config = if Meta.has Meta.Impl cf.cf_meta then (Some (a.a_types <> [], apply_params a.a_types pl)) else None in
 			(match Optimizer.type_inline ctx cf fd ethis args t config p true with
 				| Some e -> e
 				| None ->

+ 2 - 2
common.ml

@@ -551,8 +551,8 @@ let rec has_feature com f =
 		| meth :: cl :: pack ->
 			let r = (try
 				let path = List.rev pack, cl in
-				(match List.find (fun t -> t_path t = path && not (has_meta ":realPath" (t_infos t).mt_meta)) com.types with
-				| t when meth = "*" -> (match t with TAbstractDecl a -> has_meta ":valueUsed" a.a_meta | _ -> has_meta ":used" (t_infos t).mt_meta)
+				(match List.find (fun t -> t_path t = path && not (Ast.Meta.has Ast.Meta.RealPath (t_infos t).mt_meta)) com.types with
+				| t when meth = "*" -> (match t with TAbstractDecl a -> Ast.Meta.has Ast.Meta.ValueUsed a.a_meta | _ -> Ast.Meta.has Ast.Meta.Used (t_infos t).mt_meta)
 				| TClassDecl c -> PMap.exists meth c.cl_statics || PMap.exists meth c.cl_fields
 				| _ -> false)
 			with Not_found ->

+ 29 - 29
dce.ml

@@ -49,7 +49,7 @@ type dce = {
 
 (* check for @:keepSub metadata, which forces @:keep on child classes *)
 let rec super_forces_keep c =
-	has_meta ":keepSub" c.cl_meta || match c.cl_super with
+	Meta.has Meta.KeepSub c.cl_meta || match c.cl_super with
 	| Some (csup,_) -> super_forces_keep csup
 	| _ -> false
 
@@ -58,7 +58,7 @@ let is_std_file dce file =
 
 (* check if a class is kept entirely *)
 let keep_whole_class dce c =
-	has_meta ":keep" c.cl_meta
+	Meta.has Meta.Keep c.cl_meta
 	|| not (dce.full || is_std_file dce c.cl_module.m_extra.m_file)
 	|| super_forces_keep c
 	|| (match c with
@@ -72,7 +72,7 @@ let keep_whole_class dce c =
 (* check if a metadata contains @:ifFeature with a used feature argument *)
 let has_used_feature com meta =
 	try
-		let _,el,_ = get_meta ":ifFeature" meta in
+		let _,el,_ = Meta.get Meta.IfFeature meta in
 		List.exists (fun e -> match fst e with
 			| EConst(String s) when Common.has_feature com s -> true
 			| _ -> false
@@ -82,8 +82,8 @@ let has_used_feature com meta =
 
 (* check if a field is kept *)
 let keep_field dce cf =
-	has_meta ":keep" cf.cf_meta
-	|| has_meta ":used" cf.cf_meta
+	Meta.has Meta.Keep cf.cf_meta
+	|| Meta.has Meta.Used cf.cf_meta
 	|| cf.cf_name = "__init__"
 	|| has_used_feature dce.com cf.cf_meta
 
@@ -92,8 +92,8 @@ let keep_field dce cf =
 (* mark a field as kept *)
 let rec mark_field dce c cf stat =
 	let add () =
-		if not (has_meta ":used" cf.cf_meta) then begin
-			cf.cf_meta <- (":used",[],cf.cf_pos) :: cf.cf_meta;
+		if not (Meta.has Meta.Used cf.cf_meta) then begin
+			cf.cf_meta <- (Meta.Used,[],cf.cf_pos) :: cf.cf_meta;
 			dce.added_fields <- (c,cf,stat) :: dce.added_fields;
 			dce.marked_fields <- cf :: dce.marked_fields
 		end
@@ -108,10 +108,10 @@ let rec mark_field dce c cf stat =
 let rec update_marked_class_fields dce c =
 	(* mark all :?used fields as surely :used now *)
 	List.iter (fun cf ->
-		if has_meta ":?used" cf.cf_meta then mark_field dce c cf true
+		if Meta.has Meta.MaybeUsed cf.cf_meta then mark_field dce c cf true
 	) c.cl_ordered_statics;
 	List.iter (fun cf ->
-		if has_meta ":?used" cf.cf_meta then mark_field dce c cf false
+		if Meta.has Meta.MaybeUsed cf.cf_meta then mark_field dce c cf false
 	) c.cl_ordered_fields;
 	(* we always have to keep super classes and implemented interfaces *)
 	(match c.cl_init with None -> () | Some init -> dce.follow_expr dce init);
@@ -119,24 +119,24 @@ let rec update_marked_class_fields dce c =
 	(match c.cl_super with None -> () | Some (csup,pl) -> mark_class dce csup)
 
 (* mark a class as kept. If the class has fields marked as @:?keep, make sure to keep them *)
-and mark_class dce c = if not (has_meta ":used" c.cl_meta) then begin
-	c.cl_meta <- (":used",[],c.cl_pos) :: c.cl_meta;
+and mark_class dce c = if not (Meta.has Meta.Used c.cl_meta) then begin
+	c.cl_meta <- (Meta.Used,[],c.cl_pos) :: c.cl_meta;
 	update_marked_class_fields dce c;
 end
 
-let rec mark_enum dce e = if not (has_meta ":used" e.e_meta) then begin
-	e.e_meta <- (":used",[],e.e_pos) :: e.e_meta;
+let rec mark_enum dce e = if not (Meta.has Meta.Used e.e_meta) then begin
+	e.e_meta <- (Meta.Used,[],e.e_pos) :: e.e_meta;
 	PMap.iter (fun _ ef -> mark_t dce ef.ef_type) e.e_constrs;
 end
 
-and mark_abstract dce a = if not (has_meta ":used" a.a_meta) then
-	a.a_meta <- (":used",[],a.a_pos) :: a.a_meta
+and mark_abstract dce a = if not (Meta.has Meta.Used a.a_meta) then
+	a.a_meta <- (Meta.Used,[],a.a_pos) :: a.a_meta
 
 (* mark a type as kept *)
 and mark_t dce t = match follow t with
 	| TInst({cl_kind = KTypeParameter tl} as c,pl) ->
-		if not (has_meta ":used" c.cl_meta) then begin
-			c.cl_meta <- (":used",[],c.cl_pos) :: c.cl_meta;
+		if not (Meta.has Meta.Used c.cl_meta) then begin
+			c.cl_meta <- (Meta.Used,[],c.cl_pos) :: c.cl_meta;
 			List.iter (mark_t dce) tl;
 		end;
 		List.iter (mark_t dce) pl
@@ -161,7 +161,7 @@ let mark_mt dce mt = match mt with
 		mark_enum dce e
 	| TAbstractDecl a ->
 		(* abstract 'feature' is defined as the abstract type beeing used as a value, not as a type *)
-		if not (has_meta ":valueUsed" a.a_meta) then a.a_meta <- (":valueUsed",[],a.a_pos) :: a.a_meta;
+		if not (Meta.has Meta.ValueUsed a.a_meta) then a.a_meta <- (Meta.ValueUsed,[],a.a_pos) :: a.a_meta;
 		mark_abstract dce a
 	| TTypeDecl _ ->
 		()
@@ -175,10 +175,10 @@ let rec mark_dependent_fields dce csup n stat =
 					let cf = PMap.find n (if stat then c.cl_statics else c.cl_fields) in
 					(* if it's clear that the class is kept, the field has to be kept as well. This is also true for
 					   extern interfaces because we cannot remove fields from them *)
-					if has_meta ":used" c.cl_meta || (csup.cl_interface && csup.cl_extern) then mark_field dce c cf stat
+					if Meta.has Meta.Used c.cl_meta || (csup.cl_interface && csup.cl_extern) then mark_field dce c cf stat
 					(* otherwise it might be kept if the class is kept later, so mark it as :?used *)
-					else if not (has_meta ":?used" cf.cf_meta) then begin
-						cf.cf_meta <- (":?used",[],cf.cf_pos) :: cf.cf_meta;
+					else if not (Meta.has Meta.MaybeUsed cf.cf_meta) then begin
+						cf.cf_meta <- (Meta.MaybeUsed,[],cf.cf_pos) :: cf.cf_meta;
 						dce.marked_maybe_fields <- cf :: dce.marked_maybe_fields;
 					end
 				with Not_found ->
@@ -210,7 +210,7 @@ let rec field dce c n stat =
 		let prefix = String.sub n 0 4 in
 		let pn = String.sub n 4 l in
 		let cf = find_field pn in
-		if not (has_meta ":used" cf.cf_meta) then begin
+		if not (Meta.has Meta.Used cf.cf_meta) then begin
 			let keep () =
 				mark_dependent_fields dce c n stat;
 				field dce c pn stat
@@ -329,7 +329,7 @@ let run com main full =
 	} in
 	begin match main with
 		| Some {eexpr = TCall({eexpr = TField(e,(FStatic(c,cf)))},_)} ->
-			cf.cf_meta <- (":keep",[],cf.cf_pos) :: cf.cf_meta
+			cf.cf_meta <- (Meta.Keep,[],cf.cf_pos) :: cf.cf_meta
 		| _ ->
 			()
 	end;
@@ -381,7 +381,7 @@ let run com main full =
 			loop (mt :: acc) l
 		| (TClassDecl c) as mt :: l ->
 			(* add :keep so subsequent filter calls do not process class fields again *)
-			c.cl_meta <- (":keep",[],c.cl_pos) :: c.cl_meta;
+			c.cl_meta <- (Meta.Keep,[],c.cl_pos) :: c.cl_meta;
  			c.cl_ordered_statics <- List.filter (fun cf ->
 				let b = keep_field dce cf in
 				if not b then begin
@@ -400,9 +400,9 @@ let run com main full =
 			) c.cl_ordered_fields;
 			(match c.cl_constructor with Some cf when not (keep_field dce cf) -> c.cl_constructor <- None | _ -> ());
 			(* we keep a class if it was used or has a used field *)
-			if has_meta ":used" c.cl_meta || c.cl_ordered_statics <> [] || c.cl_ordered_fields <> [] then loop (mt :: acc) l else begin
+			if Meta.has Meta.Used c.cl_meta || c.cl_ordered_statics <> [] || c.cl_ordered_fields <> [] then loop (mt :: acc) l else begin
 				(match c.cl_init with
-				| Some f when has_meta ":keepInit" c.cl_meta ->
+				| Some f when Meta.has Meta.KeepInit c.cl_meta ->
 					(* it means that we only need the __init__ block *)
 					c.cl_extern <- true;
 					loop (mt :: acc) l
@@ -410,7 +410,7 @@ let run com main full =
 					if dce.debug then print_endline ("[DCE] Removed class " ^ (s_type_path c.cl_path));
 					loop acc l)
 			end
- 		| (TEnumDecl e) as mt :: l when has_meta ":used" e.e_meta || has_meta ":keep" e.e_meta || e.e_extern || not (dce.full || is_std_file dce e.e_module.m_extra.m_file) ->
+ 		| (TEnumDecl e) as mt :: l when Meta.has Meta.Used e.e_meta || Meta.has Meta.Keep e.e_meta || e.e_extern || not (dce.full || is_std_file dce e.e_module.m_extra.m_file) ->
 			loop (mt :: acc) l
 		| TEnumDecl e :: l ->
 			if dce.debug then print_endline ("[DCE] Removed enum " ^ (s_type_path e.e_path));
@@ -465,7 +465,7 @@ let run com main full =
 		| (m2,_,_) :: l when m = m2 -> l
 		| x :: l -> x :: remove_meta m l
 	in
-	List.iter (fun cf -> cf.cf_meta <- remove_meta ":used" cf.cf_meta) dce.marked_fields;
-	List.iter (fun cf -> cf.cf_meta <- remove_meta ":?used" cf.cf_meta) dce.marked_maybe_fields;
+	List.iter (fun cf -> cf.cf_meta <- remove_meta Meta.Used cf.cf_meta) dce.marked_fields;
+	List.iter (fun cf -> cf.cf_meta <- remove_meta Meta.MaybeUsed cf.cf_meta) dce.marked_maybe_fields;
 
 

+ 8 - 8
genas3.ml

@@ -221,7 +221,7 @@ let rec type_str ctx t p =
 			| _ ->
 				let rec loop = function
 					| [] -> "Object"
-					| (":fakeEnum",[Ast.EConst (Ast.Ident n),_],_) :: _ ->
+					| (Ast.Meta.FakeEnum,[Ast.EConst (Ast.Ident n),_],_) :: _ ->
 						(match n with
 						| "Int" -> "int"
 						| "UInt" -> "uint"
@@ -365,8 +365,8 @@ let gen_function_header ctx name f params p =
 	print ctx "function%s(" (match name with None -> "" | Some (n,meta) ->
 		let rec loop = function
 			| [] -> n
-			| (":getter",[Ast.EConst (Ast.Ident i),_],_) :: _ -> "get " ^ i
-			| (":setter",[Ast.EConst (Ast.Ident i),_],_) :: _ -> "set " ^ i
+			| (Ast.Meta.Getter,[Ast.EConst (Ast.Ident i),_],_) :: _ -> "get " ^ i
+			| (Ast.Meta.Setter,[Ast.EConst (Ast.Ident i),_],_) :: _ -> "set " ^ i
 			| _ :: l -> loop l
 		in
 		" " ^ loop meta
@@ -922,7 +922,7 @@ and gen_value ctx e =
 		v()
 
 let final m =
-	if has_meta ":final" m then "final " else ""
+	if Ast.Meta.has Ast.Meta.Final m then "final " else ""
 
 let generate_field ctx static f =
 	newline ctx;
@@ -930,7 +930,7 @@ let generate_field ctx static f =
 	ctx.gen_uid <- 0;
 	List.iter (fun(m,pl,_) ->
 		match m,pl with
-		| ":meta", [Ast.ECall ((Ast.EConst (Ast.Ident n),_),args),_] ->
+		| Ast.Meta.Meta, [Ast.ECall ((Ast.EConst (Ast.Ident n),_),args),_] ->
 			let mk_arg (a,p) =
 				match a with
 				| Ast.EConst (Ast.String s) -> (None, s)
@@ -951,7 +951,7 @@ let generate_field ctx static f =
 			print ctx "]";
 		| _ -> ()
 	) f.cf_meta;
-	let public = f.cf_public || Hashtbl.mem ctx.get_sets (f.cf_name,static) || (f.cf_name = "main" && static) || f.cf_name = "resolve" || has_meta ":public" f.cf_meta in
+	let public = f.cf_public || Hashtbl.mem ctx.get_sets (f.cf_name,static) || (f.cf_name = "main" && static) || f.cf_name = "resolve" || Ast.Meta.has Ast.Meta.Public f.cf_meta in
 	let rights = (if static then "static " else "") ^ (if public then "public" else "protected") in
 	let p = ctx.curclass.cl_pos in
 	match f.cf_expr, f.cf_kind with
@@ -978,8 +978,8 @@ let generate_field ctx static f =
 			| TFun (args,r) ->
 				let rec loop = function
 					| [] -> f.cf_name
-					| (":getter",[Ast.EConst (Ast.String name),_],_) :: _ -> "get " ^ name
-					| (":setter",[Ast.EConst (Ast.String name),_],_) :: _ -> "set " ^ name
+					| (Ast.Meta.Getter,[Ast.EConst (Ast.String name),_],_) :: _ -> "get " ^ name
+					| (Ast.Meta.Setter,[Ast.EConst (Ast.String name),_],_) :: _ -> "set " ^ name
 					| _ :: l -> loop l
 				in
 				print ctx "function %s(" (loop f.cf_meta);

+ 51 - 51
gencommon.ml

@@ -1081,17 +1081,17 @@ let follow_module follow_func md = match md with
  *)
 let rec is_hxgen md =
   match md with
-    | TClassDecl cl -> has_meta ":hxgen" cl.cl_meta
-    | TEnumDecl e -> has_meta ":hxgen" e.e_meta
-    | TTypeDecl t -> has_meta ":hxgen" t.t_meta || ( match follow t.t_type with | TInst(cl,_) -> is_hxgen (TClassDecl cl) | TEnum(e,_) -> is_hxgen (TEnumDecl e) | _ -> false )
-    | TAbstractDecl a -> has_meta ":hxgen" a.a_meta
+    | TClassDecl cl -> Meta.has Meta.HxGen cl.cl_meta
+    | TEnumDecl e -> Meta.has Meta.HxGen e.e_meta
+    | TTypeDecl t -> Meta.has Meta.HxGen t.t_meta || ( match follow t.t_type with | TInst(cl,_) -> is_hxgen (TClassDecl cl) | TEnum(e,_) -> is_hxgen (TEnumDecl e) | _ -> false )
+    | TAbstractDecl a -> Meta.has Meta.HxGen a.a_meta
 
 let is_hxgen_t t =
   match t with
-    | TInst (cl, _) -> has_meta ":hxgen" cl.cl_meta
-    | TEnum (e, _) -> has_meta ":hxgen" e.e_meta
-    | TAbstract (a, _) -> has_meta ":hxgen" a.a_meta
-    | TType (t, _) -> has_meta ":hxgen" t.t_meta
+    | TInst (cl, _) -> Meta.has Meta.HxGen cl.cl_meta
+    | TEnum (e, _) -> Meta.has Meta.HxGen e.e_meta
+    | TAbstract (a, _) -> Meta.has Meta.HxGen a.a_meta
+    | TType (t, _) -> Meta.has Meta.HxGen t.t_meta
     | _ -> false
 
 let mt_to_t_dyn md =
@@ -1131,7 +1131,7 @@ let mk_class_field name t public pos kind params =
     cf_public = public;
     cf_pos = pos;
     cf_doc = None;
-    cf_meta = [ ":$CompilerGenerated", [], Ast.null_pos ]; (* annotate that this class field was generated by the compiler *)
+    cf_meta = [ Meta.CompilerGenerated, [], Ast.null_pos ]; (* annotate that this class field was generated by the compiler *)
     cf_kind = kind;
     cf_params = params;
     cf_expr = None;
@@ -1152,7 +1152,7 @@ let get_cl_t t =
 
 let mk_class m path pos =
   let cl = Type.mk_class m path pos in
-  cl.cl_meta <- [ ":$CompilerGenerated", [], Ast.null_pos ];
+  cl.cl_meta <- [ Meta.CompilerGenerated, [], Ast.null_pos ];
   cl
 
 type tfield_access =
@@ -1359,15 +1359,15 @@ struct
       | TClassDecl cl ->
         let rec is_hxgen_class c =
           if c.cl_extern then begin
-            if has_meta ":hxgen" c.cl_meta then true else Option.map_default (fun (c,_) -> is_hxgen_class c) false c.cl_super
+            if Meta.has Meta.HxGen c.cl_meta then true else Option.map_default (fun (c,_) -> is_hxgen_class c) false c.cl_super
           end else begin
-            if has_meta ":nativegen" c.cl_meta then Option.map_default (fun (c, _) -> is_hxgen_class c) false c.cl_super else true
+            if Meta.has Meta.NativeGen c.cl_meta then Option.map_default (fun (c, _) -> is_hxgen_class c) false c.cl_super else true
           end
         in
 
         is_hxgen_class cl
-      | TEnumDecl e -> if e.e_extern then has_meta ":hxgen" e.e_meta else not (has_meta ":nativegen" e.e_meta)
-      | TAbstractDecl a -> not (has_meta ":nativegen" a.a_meta)
+      | TEnumDecl e -> if e.e_extern then Meta.has Meta.HxGen e.e_meta else not (Meta.has Meta.NativeGen e.e_meta)
+      | TAbstractDecl a -> not (Meta.has Meta.NativeGen a.a_meta)
       | TTypeDecl t -> (* TODO see when would we use this *)
         false
 
@@ -1379,10 +1379,10 @@ struct
     let filter md =
       if is_hxgen_func md then begin
         match md with
-          | TClassDecl cl -> cl.cl_meta <- (":hxgen", [], cl.cl_pos) :: cl.cl_meta
-          | TEnumDecl e -> e.e_meta <- (":hxgen", [], e.e_pos) :: e.e_meta
-          | TTypeDecl t -> t.t_meta <- (":hxgen", [], t.t_pos) :: t.t_meta
-          | TAbstractDecl a -> a.a_meta <- (":hxgen", [], a.a_pos) :: a.a_meta
+          | TClassDecl cl -> cl.cl_meta <- (Meta.HxGen, [], cl.cl_pos) :: cl.cl_meta
+          | TEnumDecl e -> e.e_meta <- (Meta.HxGen, [], e.e_pos) :: e.e_meta
+          | TTypeDecl t -> t.t_meta <- (Meta.HxGen, [], t.t_pos) :: t.t_meta
+          | TAbstractDecl a -> a.a_meta <- (Meta.HxGen, [], a.a_pos) :: a.a_meta
       end
     in
     List.iter filter gen.gcon.types
@@ -1514,7 +1514,7 @@ struct
 
       let cur_ctor =
         match cl.cl_constructor with
-          | Some ctor when has_meta ":skip_ctor" cl.cl_meta ->
+          | Some ctor when Meta.has Meta.SkipCtor cl.cl_meta ->
             if not supports_ctor_inheritance then begin
               do_empty_only false;
             end;
@@ -3778,13 +3778,13 @@ struct
 
     let is_hxgeneric = function
       | TClassDecl(cl) ->
-        not (has_meta ":$nativegeneric" cl.cl_meta)
+        not (Meta.has Meta.NativeGeneric cl.cl_meta)
       | TEnumDecl(e) ->
-        not (has_meta ":$nativegeneric" e.e_meta)
+        not (Meta.has Meta.NativeGeneric e.e_meta)
       | TTypeDecl(t) ->
-        not (has_meta ":$nativegeneric" t.t_meta)
+        not (Meta.has Meta.NativeGeneric t.t_meta)
       | TAbstractDecl a ->
-        not (has_meta ":$nativegeneric" a.a_meta)
+        not (Meta.has Meta.NativeGeneric a.a_meta)
 
     let rec set_hxgeneric gen mds isfirst md =
       let path = t_path md in
@@ -3806,12 +3806,12 @@ struct
         match md with
           | TClassDecl(cl)  ->
             (* first see if any meta is present (already processed) *)
-            if has_meta ":$nativegeneric" cl.cl_meta then
+            if Meta.has Meta.NativeGeneric cl.cl_meta then
               Some false
-            else if has_meta ":$hxgeneric" cl.cl_meta then
+            else if Meta.has Meta.HaxeGeneric cl.cl_meta then
               Some true
             else if not (is_hxgen md) then
-              (cl.cl_meta <- (":$nativegeneric", [], cl.cl_pos) :: cl.cl_meta;
+              (cl.cl_meta <- (Meta.NativeGeneric, [], cl.cl_pos) :: cl.cl_meta;
               Some false)
             else begin
               (*
@@ -3821,14 +3821,14 @@ struct
               (* on the first pass, our job is to find any evidence that makes it not be hxgeneric. Otherwise it will be hxgeneric *)
               match cl.cl_super with
                 | Some (c,_) when is_false (set_hxgeneric gen mds isfirst (TClassDecl c)) ->
-                  cl.cl_meta <- (":$nativegeneric", [], cl.cl_pos) :: cl.cl_meta;
+                  cl.cl_meta <- (Meta.NativeGeneric, [], cl.cl_pos) :: cl.cl_meta;
                   Some false
                 | _ ->
                   (* see if it's a generic class *)
                   match cl.cl_types with
                     | [] ->
                       (* if it's not, then it will be hxgeneric *)
-                      cl.cl_meta <- (":$hxgeneric", [], cl.cl_pos) :: cl.cl_meta;
+                      cl.cl_meta <- (Meta.HaxeGeneric, [], cl.cl_pos) :: cl.cl_meta;
                       Some true
                     | _ ->
                       (* if it is, loop through all fields + statics and look for non-hxgeneric
@@ -3847,28 +3847,28 @@ struct
                               | _ -> loop cfs (* TAbstracts / Dynamics can't be generic *)
                       in
                       if loop cl.cl_ordered_fields then begin
-                        cl.cl_meta <- (":$nativegeneric", [], cl.cl_pos) :: cl.cl_meta;
+                        cl.cl_meta <- (Meta.NativeGeneric, [], cl.cl_pos) :: cl.cl_meta;
                         Some false
                       end else if isfirst && !has_unresolved then
                         None
                       else begin
-                        cl.cl_meta <- (":$hxgeneric", [], cl.cl_pos) :: cl.cl_meta;
+                        cl.cl_meta <- (Meta.HaxeGeneric, [], cl.cl_pos) :: cl.cl_meta;
                         Some true
                       end
             end
           | TEnumDecl e ->
-            if has_meta ":$nativegeneric" e.e_meta then
+            if Meta.has Meta.NativeGeneric e.e_meta then
               Some false
-            else if has_meta ":$hxgeneric" e.e_meta then
+            else if Meta.has Meta.HaxeGeneric e.e_meta then
               Some true
             else if not (is_hxgen (TEnumDecl e)) then begin
-              e.e_meta <- (":$nativegeneric", [], e.e_pos) :: e.e_meta;
+              e.e_meta <- (Meta.NativeGeneric, [], e.e_pos) :: e.e_meta;
               Some false
             end else begin
               (* if enum is not generic, then it's hxgeneric *)
               match e.e_types with
                 | [] ->
-                  e.e_meta <- (":$hxgeneric", [], e.e_pos) :: e.e_meta;
+                  e.e_meta <- (Meta.HaxeGeneric, [], e.e_pos) :: e.e_meta;
                   Some true
                 | _ ->
                   let rec loop efs =
@@ -3896,12 +3896,12 @@ struct
                   in
                   let efs = PMap.fold (fun ef acc -> ef :: acc) e.e_constrs [] in
                   if loop efs then begin
-                    e.e_meta <- (":$nativegeneric", [], e.e_pos) :: e.e_meta;
+                    e.e_meta <- (Meta.NativeGeneric, [], e.e_pos) :: e.e_meta;
                     Some false
                   end else if isfirst && !has_unresolved then
                     None
                   else begin
-                    e.e_meta <- (":$hxgeneric", [], e.e_pos) :: e.e_meta;
+                    e.e_meta <- (Meta.HaxeGeneric, [], e.e_pos) :: e.e_meta;
                     Some true
                   end
             end
@@ -4112,7 +4112,7 @@ struct
               let iface = mk_class cl.cl_module cl.cl_path cl.cl_pos in
               iface.cl_array_access <- Option.map (apply_params (cl.cl_types) (List.map (fun _ -> t_dynamic) cl.cl_types)) cl.cl_array_access;
               iface.cl_module <- cl.cl_module;
-              iface.cl_meta <- (":hxgen", [], cl.cl_pos) :: iface.cl_meta;
+              iface.cl_meta <- (Meta.HxGen, [], cl.cl_pos) :: iface.cl_meta;
               Hashtbl.add ifaces cl.cl_path iface;
 
               iface.cl_implements <- (base_generic, []) :: iface.cl_implements;
@@ -5827,7 +5827,7 @@ struct
   let collect_fields cl (methods : bool option) (statics : bool option) =
     let collected = Hashtbl.create 0 in
     let collect cf acc =
-      if has_meta ":$CompilerGenerated" cf.cf_meta || has_meta ":skipReflection" cf.cf_meta then
+      if Meta.has Meta.CompilerGenerated cf.cf_meta || Meta.has Meta.SkipReflection cf.cf_meta then
         acc
       else match methods, cf.cf_kind with
         | None, _ when not (Hashtbl.mem collected cf.cf_name) -> Hashtbl.add collected cf.cf_name true; ([cf.cf_name], cf) :: acc
@@ -6798,7 +6798,7 @@ struct
 
       let get_fields static =
         let ret = collect_fields cl ( if is_float || is_set then Some (false) else None ) (Some static) in
-        let ret = if is_set then List.filter (fun (_,cf) -> not (has_meta ":readonly" cf.cf_meta)) ret else ret in
+        let ret = if is_set then List.filter (fun (_,cf) -> not (Meta.has Meta.ReadOnly cf.cf_meta)) ret else ret in
         if is_float then
           List.filter (fun (_,cf) -> (* TODO: maybe really apply_params in cf.cf_type. The benefits would be limited, though *)
             match follow (ctx.rcf_gen.greal_type (ctx.rcf_gen.gfollow#run_f cf.cf_type)) with
@@ -7119,7 +7119,7 @@ struct
 
     (* setting it as DynamicObject makes getClass return null *)
     let get_class =
-      cl.cl_meta <- (":$DynamicObject", [], pos) :: cl.cl_meta
+      cl.cl_meta <- (Meta.DynamicObject, [], pos) :: cl.cl_meta
     in
     ignore get_class;
 
@@ -7226,7 +7226,7 @@ struct
     let cls_dyn = TInst(tclass, [t_dynamic]) in
 
     let expr, static_cfs =
-      if has_meta ":$DynamicObject" cl.cl_meta then
+      if Meta.has Meta.DynamicObject cl.cl_meta then
         mk_return (null t_dynamic pos), []
       else
         let cache_name = (gen.gmk_internal_name "hx" "class") in
@@ -7686,7 +7686,7 @@ struct
     let process_cf static cf =
       match cf.cf_kind with
         | Var _ -> ()
-        | _ when has_meta ":replaceReflection" cf.cf_meta ->
+        | _ when Meta.has Meta.ReplaceReflection cf.cf_meta ->
           let name = if String.get cf.cf_name 0 = '_' then String.sub cf.cf_name 1 (String.length cf.cf_name - 1) else cf.cf_name in
           let new_name = gen.gmk_internal_name "hx" name in
           let new_cf = mk_class_field new_name cf.cf_type cf.cf_public cf.cf_pos cf.cf_kind cf.cf_params in
@@ -7755,7 +7755,7 @@ struct
     let priority = min_dep +. 10.
 
     let default_implementation gen baseclass baseinterface basedynamic =
-      baseinterface.cl_meta <- (":$baseinterface", [], baseinterface.cl_pos) :: baseinterface.cl_meta;
+      baseinterface.cl_meta <- (Meta.BaseInterface, [], baseinterface.cl_pos) :: baseinterface.cl_meta;
       let rec run md =
         (if is_hxgen md then
           match md with
@@ -7792,8 +7792,8 @@ struct
   let configure ?slow_invoke ctx =
     let gen = ctx.rcf_gen in
     let run = (fun md -> match md with
-      | TClassDecl cl when is_hxgen md && ( not cl.cl_interface || has_meta ":$baseinterface" cl.cl_meta ) ->
-        (if has_meta ":replaceReflection" cl.cl_meta then replace_reflection ctx cl);
+      | TClassDecl cl when is_hxgen md && ( not cl.cl_interface || Meta.has Meta.BaseInterface cl.cl_meta ) ->
+        (if Meta.has Meta.ReplaceReflection cl.cl_meta then replace_reflection ctx cl);
         (implement_dynamics ctx cl);
         (if not (PMap.mem (gen.gmk_internal_name "hx" "lookupField") cl.cl_fields) then implement_final_lookup ctx cl);
         (if not (PMap.mem (gen.gmk_internal_name "hx" "getField") cl.cl_fields) then implement_get_set ctx cl);
@@ -7909,7 +7909,7 @@ struct
     let pmap_exists fn pmap = try PMap.iter (fun a b -> if fn a b then raise Exit) pmap; false with | Exit -> true
 
     let has_any_meta en =
-      let has_meta meta = List.exists (fun (name,_,_) -> (String.get name 0) <> ':') meta in
+      let has_meta meta = List.exists (fun (m,_,_) -> match m with Meta.Custom _ -> true | _ -> false) meta in
       has_meta en.e_meta || pmap_exists (fun _ ef -> has_meta ef.ef_meta) en.e_constrs
 
     let has_parameters e =
@@ -7938,9 +7938,9 @@ struct
       cl.cl_super <- Some(base_class,[]);
       cl.cl_extern <- en.e_extern;
       en.e_extern <- true;
-      en.e_meta <- (":$class", [], pos) :: en.e_meta;
+      en.e_meta <- (Meta.Class, [], pos) :: en.e_meta;
       cl.cl_module <- en.e_module;
-      cl.cl_meta <- ( ":$enum", [], pos ) :: cl.cl_meta;
+      cl.cl_meta <- ( Meta.Enum, [], pos ) :: cl.cl_meta;
       let c_types =
         if handle_type_params then
           List.map (fun (s,t) -> (s, TInst (map_param (get_cl_t t), []))) en.e_types
@@ -8006,7 +8006,7 @@ struct
             cf
         in
         cl.cl_statics <- PMap.add cf.cf_name cf cl.cl_statics;
-        cf.cf_meta <- (":alias", [ EConst( String (string_of_int old_i) ), pos ], pos) :: [];
+        cf.cf_meta <- (Meta.Alias, [ EConst( String (string_of_int old_i) ), pos ], pos) :: [];
         cf
       ) en.e_names in
       let constructs_cf = mk_class_field "constructs" (basic.tarray basic.tstring) true pos (Var { v_read = AccNormal; v_write = AccNormal }) [] in
@@ -8021,7 +8021,7 @@ struct
       cl.cl_statics <- PMap.add "constructs" constructs_cf cl.cl_statics;
 
       (if should_be_hxgen then
-        cl.cl_meta <- (":hxgen",[],cl.cl_pos) :: cl.cl_meta
+        cl.cl_meta <- (Meta.HxGen,[],cl.cl_pos) :: cl.cl_meta
       else begin
         (* create the constructor *)
         let tf_args = [ alloc_var "index" basic.tint, None; alloc_var "params" (basic.tarray t_empty), None ] in
@@ -8070,7 +8070,7 @@ struct
             convert e
           else begin
             (* take off the :hxgen meta from it, if there's any *)
-            e.e_meta <- List.filter (fun (n,_,_) -> not (n = ":hxgen")) e.e_meta;
+            e.e_meta <- List.filter (fun (n,_,_) -> not (n = Meta.HxGen)) e.e_meta;
             md
           end
         | _ -> md

+ 14 - 14
gencpp.ml

@@ -1840,7 +1840,7 @@ let gen_field ctx class_def class_name ptr_name is_static is_interface field =
 	let output = ctx.ctx_output in
 	ctx.ctx_real_this_ptr <- not is_static;
 	let remap_name = keyword_remap field.cf_name in
-	let decl = get_meta_string field.cf_meta ":decl" in
+	let decl = get_meta_string field.cf_meta Meta.Decl in
 	let has_decl = decl <> "" in
 	if (is_interface) then begin
 		(* Just the dynamic glue ... *)
@@ -1859,7 +1859,7 @@ let gen_field ctx class_def class_name ptr_name is_static is_interface field =
 		let is_void = (type_string function_def.tf_type ) = "Void" in
 		let ret = if is_void  then "(void)" else "return " in
 		let output_i = ctx.ctx_writer#write_i in
-		let dump_src = if (Type.has_meta ":noStack" field.cf_meta) then begin
+		let dump_src = if (Meta.has Meta.NoStack field.cf_meta) then begin
 			ctx.ctx_dump_stack_line <- false;
 			(fun()->())
 		end else begin
@@ -1879,8 +1879,8 @@ let gen_field ctx class_def class_name ptr_name is_static is_interface field =
 			output ")";
 			ctx.ctx_real_this_ptr <- true;
 			ctx.ctx_dynamic_this_ptr <- false;
-         let code = (get_code field.cf_meta ":functionCode") in
-         let tail_code = (get_code field.cf_meta ":functionTailCode") in
+         let code = (get_code field.cf_meta Meta.FunctionCode) in
+         let tail_code = (get_code field.cf_meta Meta.FunctionTailCode) in
 			if (has_default_values function_def.tf_args) then begin
 				ctx.ctx_writer#begin_block;
 				generate_default_values ctx function_def.tf_args "__o_";
@@ -1993,7 +1993,7 @@ let gen_member_def ctx class_def is_static is_interface field =
 			output ("Dynamic " ^ remap_name ^ "_dyn();\n" );
 		| _  ->  ( )
 	end else begin
-	let decl = get_meta_string field.cf_meta ":decl" in
+	let decl = get_meta_string field.cf_meta Meta.Decl in
 	let has_decl = decl <> "" in
    if (has_decl) then
 		output ( "      typedef " ^ decl ^ ";\n" );
@@ -2072,7 +2072,7 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
 		end
 	in
 	let add_extern_class klass =
-      let include_file = get_meta_string klass.cl_meta (if for_depends then ":depend" else ":include") in
+      let include_file = get_meta_string klass.cl_meta (if for_depends then Meta.Depend else Meta.Include) in
       if (include_file<>"") then
          add_type ( path_of_string for_depends include_file )
    in
@@ -2525,7 +2525,7 @@ let has_init_field class_def =
 	| _ -> false;;
 
 let is_macro meta =
-  Type.has_meta ":macro" meta
+  Meta.has Meta.Macro meta
 ;;
 
 
@@ -2589,12 +2589,12 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
    if (scriptable) then
       output_cpp "#include <hx/Scriptable.h>\n";
 
-	output_cpp ( get_code class_def.cl_meta ":cppFileCode" );
+	output_cpp ( get_code class_def.cl_meta Meta.CppFileCode );
 
 	gen_open_namespace output_cpp class_path;
 	output_cpp "\n";
 
-	output_cpp ( get_code class_def.cl_meta ":cppNamespaceCode" );
+	output_cpp ( get_code class_def.cl_meta Meta.CppNamespaceCode );
 
 	if (not class_def.cl_interface) then begin
 		output_cpp ("Void " ^ class_name ^ "::__construct(" ^ constructor_type_args ^ ")\n{\n");
@@ -2719,7 +2719,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
 			| _ -> true)
 		in
 
-      let reflective field = not (Type.has_meta ":unreflective" field.cf_meta) in
+      let reflective field = not (Meta.has Meta.Unreflective field.cf_meta) in
 		let reflect_fields = List.filter reflective (statics_except_meta @ class_def.cl_ordered_fields) in
 		let reflect_variables = List.filter variable_field reflect_fields in
 
@@ -2979,11 +2979,11 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
    let referenced = find_referenced_types ctx.ctx_common (TClassDecl class_def) super_deps (Hashtbl.create 0) true false scriptable in
 	List.iter ( gen_forward_decl h_file ) referenced;
 
-	output_h ( get_code class_def.cl_meta ":headerCode" );
+	output_h ( get_code class_def.cl_meta Meta.HeaderCode );
 
 	gen_open_namespace output_h class_path;
 	output_h "\n\n";
-	output_h ( get_code class_def.cl_meta ":headerNamespaceCode" );
+	output_h ( get_code class_def.cl_meta Meta.HeaderNamespaceCode );
 
 	output_h ("class " ^ class_name ^ " : public " ^ super );
 	output_h "{\n	public:\n";
@@ -3034,7 +3034,7 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
 	List.iter (gen_member_def ctx class_def false interface) class_def.cl_ordered_fields;
 	List.iter (gen_member_def ctx class_def true interface)  class_def.cl_ordered_statics;
 
-	output_h ( get_code class_def.cl_meta ":headerClassCode" );
+	output_h ( get_code class_def.cl_meta Meta.HeaderClassCode );
 
 	output_h "};\n\n";
 
@@ -3291,7 +3291,7 @@ let generate common_ctx =
 			if (is_internal || (is_macro class_def.cl_meta) ) then
 				( if debug then print_endline (" internal class " ^ name ))
 			else begin
-				build_xml := !build_xml ^ (get_code class_def.cl_meta ":buildXml");
+				build_xml := !build_xml ^ (get_code class_def.cl_meta Meta.BuildXml);
 				boot_classes := class_def.cl_path ::  !boot_classes;
 				if (has_init_field class_def) then
 					init_classes := class_def.cl_path ::  !init_classes;

+ 19 - 19
gencs.ml

@@ -39,8 +39,8 @@ let is_cs_basic_type t =
       true
     | TAbstract _ when like_float t ->
       true
-    | TEnum(e, _) when not (has_meta ":$class" e.e_meta) -> true
-    | TInst(cl, _) when has_meta ":struct" cl.cl_meta -> true
+    | TEnum(e, _) when not (Meta.has Meta.Class e.e_meta) -> true
+    | TInst(cl, _) when Meta.has Meta.Struct cl.cl_meta -> true
     | _ -> false
 
 let is_tparam t =
@@ -268,7 +268,7 @@ struct
 
     let is_struct t = (* not basic type *)
       match follow t with
-        | TInst(cl, _) when has_meta ":struct" cl.cl_meta -> true
+        | TInst(cl, _) when Meta.has Meta.Struct cl.cl_meta -> true
         | _ -> false
     in
 
@@ -490,23 +490,23 @@ let dynamic_anon = TAnon( { a_fields = PMap.empty; a_status = ref Closed } )
 let rec get_class_modifiers meta cl_type cl_access cl_modifiers =
   match meta with
     | [] -> cl_type,cl_access,cl_modifiers
-    | (":struct",[],_) :: meta -> get_class_modifiers meta "struct" cl_access cl_modifiers
-    | (":protected",[],_) :: meta -> get_class_modifiers meta cl_type "protected" cl_modifiers
-    | (":internal",[],_) :: meta -> get_class_modifiers meta cl_type "internal" cl_modifiers
+    | (Meta.Struct,[],_) :: meta -> get_class_modifiers meta "struct" cl_access cl_modifiers
+    | (Meta.Protected,[],_) :: meta -> get_class_modifiers meta cl_type "protected" cl_modifiers
+    | (Meta.Internal,[],_) :: meta -> get_class_modifiers meta cl_type "internal" cl_modifiers
     (* no abstract for now | (":abstract",[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("abstract" :: cl_modifiers)
     | (":static",[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("static" :: cl_modifiers) TODO: support those types *)
-    | (":final",[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("sealed" :: cl_modifiers)
-    | (":unsafe",[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("unsafe" :: cl_modifiers)
+    | (Meta.Final,[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("sealed" :: cl_modifiers)
+    | (Meta.Unsafe,[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("unsafe" :: cl_modifiers)
     | _ :: meta -> get_class_modifiers meta cl_type cl_access cl_modifiers
 
 let rec get_fun_modifiers meta access modifiers =
   match meta with
     | [] -> access,modifiers
-    | (":protected",[],_) :: meta -> get_fun_modifiers meta "protected" modifiers
-    | (":internal",[],_) :: meta -> get_fun_modifiers meta "internal" modifiers
-    | (":readonly",[],_) :: meta -> get_fun_modifiers meta access ("readonly" :: modifiers)
-    | (":unsafe",[],_) :: meta -> get_fun_modifiers meta access ("unsafe" :: modifiers)
-    | (":volatile",[],_) :: meta -> get_fun_modifiers meta access ("volatile" :: modifiers)
+    | (Meta.Protected,[],_) :: meta -> get_fun_modifiers meta "protected" modifiers
+    | (Meta.Internal,[],_) :: meta -> get_fun_modifiers meta "internal" modifiers
+    | (Meta.ReadOnly,[],_) :: meta -> get_fun_modifiers meta access ("readonly" :: modifiers)
+    | (Meta.Unsafe,[],_) :: meta -> get_fun_modifiers meta access ("unsafe" :: modifiers)
+    | (Meta.Volatile,[],_) :: meta -> get_fun_modifiers meta access ("volatile" :: modifiers)
     | _ :: meta -> get_fun_modifiers meta access modifiers
 
 (* this was the way I found to pass the generator context to be accessible across all functions here *)
@@ -725,7 +725,7 @@ let configure gen =
       | TMono r -> (match !r with | None -> "object" | Some t -> t_s (run_follow gen t))
       | TInst ({ cl_path = [], "String" }, []) -> "string"
       | TEnum ({ e_path = p }, params) -> ("global::" ^ path_s p)
-      | TInst (({ cl_path = p } as cl), _ :: _) when has_meta ":$enum" cl.cl_meta ->
+      | TInst (({ cl_path = p } as cl), _ :: _) when Meta.has Meta.Enum cl.cl_meta ->
         "global::" ^ path_s p
       | TInst (({ cl_path = p } as cl), params) -> (path_param_s (TClassDecl cl) p params)
       | TType (({ t_path = p } as t), params) -> (path_param_s (TTypeDecl t) p params)
@@ -1287,7 +1287,7 @@ let configure gen =
         end (* TODO see how (get,set) variable handle when they are interfaces *)
       | Method mkind ->
         let is_virtual = not is_final && match mkind with | MethInline -> false | _ when not is_new -> true | _ -> false in
-        let is_virtual = if not is_virtual || has_meta ":final" cf.cf_meta then false else is_virtual in
+        let is_virtual = if not is_virtual || Meta.has Meta.Final cf.cf_meta then false else is_virtual in
         let is_override = List.mem cf.cf_name cl.cl_overrides in
         let is_override = is_override || match cf.cf_name, follow cf.cf_type with
           | "Equals", TFun([_,_,targ], tret) ->
@@ -1298,7 +1298,7 @@ let configure gen =
           | _ -> false
         in
 
-        let is_virtual = is_virtual && not (has_meta ":final" cl.cl_meta) && not (is_interface) in
+        let is_virtual = is_virtual && not (Meta.has Meta.Final cl.cl_meta) && not (is_interface) in
         let visibility = if is_interface then "" else "public" in
 
         let visibility, modifiers = get_fun_modifiers cf.cf_meta visibility [] in
@@ -1363,7 +1363,7 @@ let configure gen =
                   t();
                   end_block w
                 end)
-              | (":functionBody", [Ast.EConst (Ast.String contents),_],_) :: tl ->
+              | (Meta.FunctionCode, [Ast.EConst (Ast.String contents),_],_) :: tl ->
                 begin_block w;
                 write w contents;
                 end_block w
@@ -1492,7 +1492,7 @@ let configure gen =
     in
 
     let clt, access, modifiers = get_class_modifiers cl.cl_meta (if cl.cl_interface then "interface" else "class") "public" [] in
-    let is_final = clt = "struct" || has_meta ":final" cl.cl_meta in
+    let is_final = clt = "struct" || Meta.has Meta.Final cl.cl_meta in
 
     print w "%s %s %s %s" access (String.concat " " modifiers) clt (change_clname (snd cl.cl_path));
     (* type parameters *)
@@ -1510,7 +1510,7 @@ let configure gen =
     let rec loop meta =
       match meta with
         | [] ->  ()
-        | (":classContents", [Ast.EConst (Ast.String contents),_],_) :: tl ->
+        | (Meta.ClassCode, [Ast.EConst (Ast.String contents),_],_) :: tl ->
           write w contents
         | _ :: tl -> loop tl
     in

+ 30 - 30
genjava.ml

@@ -617,23 +617,23 @@ let dynamic_anon = TAnon( { a_fields = PMap.empty; a_status = ref Closed } )
 let rec get_class_modifiers meta cl_type cl_access cl_modifiers =
   match meta with
     | [] -> cl_type,cl_access,cl_modifiers
-    (*| (":struct",[],_) :: meta -> get_class_modifiers meta "struct" cl_access cl_modifiers*)
-    | (":protected",[],_) :: meta -> get_class_modifiers meta cl_type "protected" cl_modifiers
-    | (":internal",[],_) :: meta -> get_class_modifiers meta cl_type "" cl_modifiers
+    (*| (Meta.Struct,[],_) :: meta -> get_class_modifiers meta "struct" cl_access cl_modifiers*)
+    | (Meta.Protected,[],_) :: meta -> get_class_modifiers meta cl_type "protected" cl_modifiers
+    | (Meta.Internal,[],_) :: meta -> get_class_modifiers meta cl_type "" cl_modifiers
     (* no abstract for now | (":abstract",[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("abstract" :: cl_modifiers)
-    | (":static",[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("static" :: cl_modifiers) TODO: support those types *)
-    | (":final",[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("final" :: cl_modifiers)
+    | (Meta.Static,[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("static" :: cl_modifiers) TODO: support those types *)
+    | (Meta.Final,[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("final" :: cl_modifiers)
     | _ :: meta -> get_class_modifiers meta cl_type cl_access cl_modifiers
 
 let rec get_fun_modifiers meta access modifiers =
   match meta with
     | [] -> access,modifiers
-    | (":protected",[],_) :: meta -> get_fun_modifiers meta "protected" modifiers
-    | (":internal",[],_) :: meta -> get_fun_modifiers meta "" modifiers
-    (*| (":readonly",[],_) :: meta -> get_fun_modifiers meta access ("readonly" :: modifiers)*)
-    (*| (":unsafe",[],_) :: meta -> get_fun_modifiers meta access ("unsafe" :: modifiers)*)
-    | (":volatile",[],_) :: meta -> get_fun_modifiers meta access ("volatile" :: modifiers)
-    | (":transient",[],_) :: meta -> get_fun_modifiers meta access ("transient" :: modifiers)
+    | (Meta.Protected,[],_) :: meta -> get_fun_modifiers meta "protected" modifiers
+    | (Meta.Internal,[],_) :: meta -> get_fun_modifiers meta "" modifiers
+    (*| (Meta.ReadOnly,[],_) :: meta -> get_fun_modifiers meta access ("readonly" :: modifiers)*)
+    (*| (Meta.Unsafe,[],_) :: meta -> get_fun_modifiers meta access ("unsafe" :: modifiers)*)
+    | (Meta.Volatile,[],_) :: meta -> get_fun_modifiers meta access ("volatile" :: modifiers)
+    | (Meta.Transient,[],_) :: meta -> get_fun_modifiers meta access ("transient" :: modifiers)
     | _ :: meta -> get_fun_modifiers meta access modifiers
 
 (* this was the way I found to pass the generator context to be accessible across all functions here *)
@@ -1444,10 +1444,10 @@ let configure gen =
                 end else begin
                   expr_s w expr;
                 end)
-              | (":throws", [Ast.EConst (Ast.String t), _], _) :: tl ->
+              | (Meta.Throws, [Ast.EConst (Ast.String t), _], _) :: tl ->
                 print w " throws %s" t;
                 loop tl
-              | (":functionBody", [Ast.EConst (Ast.String contents),_],_) :: tl ->
+              | (Meta.FunctionCode, [Ast.EConst (Ast.String contents),_],_) :: tl ->
                 begin_block w;
                 write w contents;
                 end_block w
@@ -1471,7 +1471,7 @@ let configure gen =
 
     let rec loop_meta meta acc =
       match meta with
-        | (":SuppressWarnings", [Ast.EConst (Ast.String w),_],_) :: meta -> loop_meta meta (w :: acc)
+        | (Meta.SuppressWarnings, [Ast.EConst (Ast.String w),_],_) :: meta -> loop_meta meta (w :: acc)
         | _ :: meta -> loop_meta meta acc
         | _ -> acc
     in
@@ -1506,7 +1506,7 @@ let configure gen =
     newline w;
 
     let clt, access, modifiers = get_class_modifiers cl.cl_meta (if cl.cl_interface then "interface" else "class") "public" [] in
-    let is_final = has_meta ":final" cl.cl_meta in
+    let is_final = Meta.has Meta.Final cl.cl_meta in
 
     print w "%s %s %s %s" access (String.concat " " modifiers) clt (change_clname (snd cl.cl_path));
     (* type parameters *)
@@ -1536,7 +1536,7 @@ let configure gen =
     let rec loop meta =
       match meta with
         | [] ->  ()
-        | (":classContents", [Ast.EConst (Ast.String contents),_],_) :: tl ->
+        | (Meta.ClassCode, [Ast.EConst (Ast.String contents),_],_) :: tl ->
           write w contents
         | _ :: tl -> loop tl
     in
@@ -2121,7 +2121,7 @@ let convert_param p param =
 let get_type_path ct = match ct with | CTPath p -> p | _ -> assert false
 
 let convert_java_enum p pe =
-  let meta = ref [":$javaNative", [], p] in
+  let meta = ref [Meta.JavaNative, [], p] in
   let data = ref [] in
   List.iter (fun f ->
     if List.mem JEnum f.jf_flags then
@@ -2154,16 +2154,16 @@ let convert_java_field p jc field =
     | JPrivate -> raise Exit (* private instances aren't useful on externs *)
     | JProtected -> cff_access := APrivate :: !cff_access
     | JStatic -> cff_access := AStatic :: !cff_access
-    | JFinal -> cff_meta := (":final", [], p) :: !cff_meta
-    | JSynchronized -> cff_meta := (":synchronized", [], p) :: !cff_meta
-    | JVolatile -> cff_meta := (":volatile", [], p) :: !cff_meta
-    | JTransient -> cff_meta := (":transient", [], p) :: !cff_meta
-    | JVarArgs -> cff_meta := (":varArgs", [], p) :: !cff_meta
+    | JFinal -> cff_meta := (Meta.Final, [], p) :: !cff_meta
+    | JSynchronized -> cff_meta := (Meta.Synchronized, [], p) :: !cff_meta
+    | JVolatile -> cff_meta := (Meta.Volatile, [], p) :: !cff_meta
+    | JTransient -> cff_meta := (Meta.Transient, [], p) :: !cff_meta
+    | JVarArgs -> cff_meta := (Meta.VarArgs, [], p) :: !cff_meta
     | _ -> ()
   ) field.jf_flags;
 
   List.iter (function
-    | AttrDeprecated -> cff_meta := (":deprecated", [], p) :: !cff_meta
+    | AttrDeprecated -> cff_meta := (Meta.Deprecated, [], p) :: !cff_meta
     (* TODO: pass anotations as @:meta *)
     | AttrVisibleAnnotations ann ->
       List.iter (function
@@ -2186,7 +2186,7 @@ let convert_java_field p jc field =
           "param" ^ string_of_int !i, false, Some(convert_signature p s), None
         ) args in
         let t = Option.map_default (convert_signature p) (mk_type_path ([], "Void") []) ret in
-        cff_meta := (":overload", [], p) :: !cff_meta;
+        cff_meta := (Meta.Overload, [], p) :: !cff_meta;
 
         let types = List.map (function
           | (name, Some ext, impl) ->
@@ -2228,25 +2228,25 @@ let convert_java_class p jc =
     convert_java_enum p jc
   | false ->
     let flags = ref [HExtern] in
-    let meta = ref [":$javaNative", [], p] in
+    let meta = ref [Meta.JavaNative, [], p] in
 
     List.iter (fun f -> match f with
-      | JFinal -> meta := (":final", [], p) :: !meta
+      | JFinal -> meta := (Meta.Final, [], p) :: !meta
       | JInterface -> flags := HInterface :: !flags
-      | JAbstract -> meta := (":abstract", [], p) :: !meta
-      | JAnnotation -> meta := (":annotation", [], p) :: !meta
+      | JAbstract -> meta := (Meta.Abstract, [], p) :: !meta
+      | JAnnotation -> meta := (Meta.Annotation, [], p) :: !meta
       | _ -> ()
     ) jc.cflags;
 
     (match jc.csuper with
       | TObject( (["java";"lang"], "Object"), _ ) -> ()
-      | TObject( (["haxe";"lang"], "HxObject"), _ ) -> meta := (":hxgen",[],p) :: !meta
+      | TObject( (["haxe";"lang"], "HxObject"), _ ) -> meta := (Meta.HxGen,[],p) :: !meta
       | _ -> flags := HExtends (get_type_path (convert_signature p jc.csuper)) :: !flags
     );
 
     List.iter (fun i ->
       match i with
-      | TObject ( (["haxe";"lang"], "IHxObject"), _ ) -> meta := (":hxgen",[],p) :: !meta
+      | TObject ( (["haxe";"lang"], "IHxObject"), _ ) -> meta := (Meta.HxGen,[],p) :: !meta
       | _ -> flags := HImplements (get_type_path (convert_signature p i)) :: !flags
     ) jc.cinterfaces;
 

+ 2 - 2
genjs.ml

@@ -286,7 +286,7 @@ let handle_break ctx e =
 
 let handle_expose ctx path meta =
 	let rec loop = function
-		| (":expose", args, pos) :: l when ctx.js_modern ->
+		| (Meta.Expose, args, pos) :: l when ctx.js_modern ->
 			ctx.found_expose <- true;
 			let exposed_path = (match args with
 				| [EConst (String s), _] -> s
@@ -1064,7 +1064,7 @@ let generate_type ctx = function
 		| None -> ()
 		| Some e ->
 			ctx.inits <- e :: ctx.inits);
-		if not c.cl_extern then generate_class ctx c else if has_meta ":initPackage" c.cl_meta then generate_package_create ctx c.cl_path
+		if not c.cl_extern then generate_class ctx c else if Meta.has Meta.InitPackage c.cl_meta then generate_package_create ctx c.cl_path
 	| TEnumDecl e when e.e_extern ->
 		()
 	| TEnumDecl e -> generate_enum ctx e

+ 11 - 11
genswf.ml

@@ -161,12 +161,12 @@ let build_class com c file =
 				(match ns with
 				| HNPrivate _ | HNNamespace "http://www.adobe.com/2006/flex/mx/internal" -> []
 				| HNNamespace ns ->
-					if not (c.hlc_interface || is_xml) then meta := (":ns",[String ns]) :: !meta;
+					if not (c.hlc_interface || is_xml) then meta := (Meta.Ns,[String ns]) :: !meta;
 					[APublic]
 				| HNExplicit _ | HNInternal _ | HNPublic _ ->
 					[APublic]
 				| HNStaticProtected _ | HNProtected _ ->
-					meta := (":protected",[]) :: !meta;
+					meta := (Meta.Protected,[]) :: !meta;
 					[APrivate])
 			| _ -> []
 		) in
@@ -237,7 +237,7 @@ let build_class com c file =
 							| None -> None
 							| Some v ->
 								(* add for --gen-hx-classes generation *)
-								meta := (":defparam",[String aname;v]) :: !meta;
+								meta := (Meta.DefParam,[String aname;v]) :: !meta;
 								Some (EConst v,pos)
 					in
 					(aname,!is_opt,Some t,def_val)
@@ -335,7 +335,7 @@ let build_class com c file =
 			d_name = path.tname;
 			d_doc = None;
 			d_params = [];
-			d_meta = [(":fakeEnum",[EConst (Ident !real_type),pos],pos)];
+			d_meta = [(Meta.FakeEnum,[EConst (Ident !real_type),pos],pos)];
 			d_flags = [EExtern];
 			d_data = constr;
 		} in
@@ -345,7 +345,7 @@ let build_class com c file =
 		d_name = path.tname;
 		d_doc = None;
 		d_params = [];
-		d_meta = if c.hlc_final && List.exists (fun f -> f.cff_name <> "new" && not (List.mem AStatic f.cff_access)) fields then [":final",[],pos] else [];
+		d_meta = if c.hlc_final && List.exists (fun f -> f.cff_name <> "new" && not (List.mem AStatic f.cff_access)) fields then [Meta.Final,[],pos] else [];
 		d_flags = flags;
 		d_data = fields;
 	} in
@@ -825,7 +825,7 @@ let build_swf9 com file swc =
 		| TClassDecl c ->
 			let rec loop = function
 				| [] -> acc
-				| (":font",(EConst (String file),p) :: args,_) :: l ->
+				| (Meta.Font,(EConst (String file),p) :: args,_) :: l ->
 					let ch = try open_in_bin file with _ -> error "File not found" p in
 					let ttf = Ttf.parse ch in
 					close_in ch;
@@ -844,7 +844,7 @@ let build_swf9 com file swc =
 						cd_id = !cid;
 						cd_data = data;
 					}) :: loop l
-				| (":bitmap",[EConst (String file),p],_) :: l ->
+				| (Meta.Bitmap,[EConst (String file),p],_) :: l ->
 					let data = load_file_data file p in
 					incr cid;
 					classes := { f9_cid = Some !cid; f9_classname = s_type_path c.cl_path } :: !classes;
@@ -876,7 +876,7 @@ let build_swf9 com file swc =
 						| _ -> raw()
 					) in
 					t :: loop l
-				| (":bitmap",[EConst (String dfile),p1;EConst (String afile),p2],_) :: l ->
+				| (Meta.Bitmap,[EConst (String dfile),p1;EConst (String afile),p2],_) :: l ->
 					let ddata = load_file_data dfile p1 in
 					let adata = load_file_data afile p2 in
 					(match detect_format ddata p1 with
@@ -901,12 +901,12 @@ let build_swf9 com file swc =
 					incr cid;
 					classes := { f9_cid = Some !cid; f9_classname = s_type_path c.cl_path } :: !classes;
 					tag (TBitsJPEG3 { bd_id = !cid; bd_data = ddata; bd_table = None; bd_alpha = Some amask; bd_deblock = Some 0 }) :: loop l
-				| (":file",[EConst (String file),p],_) :: l ->
+				| (Meta.File,[EConst (String file),p],_) :: l ->
 					let data = load_file_data file p in
 					incr cid;
 					classes := { f9_cid = Some !cid; f9_classname = s_type_path c.cl_path } :: !classes;
 					tag (TBinaryData (!cid,data)) :: loop l
-				| (":sound",[EConst (String file),p],_) :: l ->
+				| (Meta.Sound,[EConst (String file),p],_) :: l ->
 					let data = load_file_data file p in
 					let make_flags fmt mono freq bits =
 						let fbits = (match freq with 5512 when fmt <> 2 -> 0 | 11025 -> 1 | 22050 -> 2 | 44100 -> 3 | _ -> failwith ("Unsupported frequency " ^ string_of_int freq)) in
@@ -1108,7 +1108,7 @@ let generate com swf_header =
 						if not extern && s_type_path (t_path t) = e.f9_classname then
 							match t with
 							| TClassDecl c ->
-								if has_meta ":bind" c.cl_meta then
+								if Meta.has Meta.Bind c.cl_meta then
 									toremove := (t_path t) :: !toremove
 								else
 									error ("Class already exists in '" ^ file ^ "', use @:bind to redefine it") (t_infos t).mt_pos

+ 12 - 12
genswf9.ml

@@ -233,7 +233,7 @@ let rec type_id ctx t =
 	| TEnum (e,_) ->
 		let rec loop = function
 			| [] -> type_path ctx e.e_path
-			| (":fakeEnum",[Ast.EConst (Ast.Ident n),_],_) :: _ -> type_path ctx ([],n)
+			| (Meta.FakeEnum,[Ast.EConst (Ast.Ident n),_],_) :: _ -> type_path ctx ([],n)
 			| _ :: l -> loop l
 		in
 		loop e.e_meta
@@ -265,7 +265,7 @@ let classify ctx t =
 	| TEnum (e,_) ->
 		let rec loop = function
 			| [] -> KType (type_id ctx t)
-			| (":fakeEnum",[Ast.EConst (Ident n),_],_) :: _ ->
+			| (Meta.FakeEnum,[Ast.EConst (Ident n),_],_) :: _ ->
 				(match n with
 				| "Int" -> KInt
 				| "UInt" -> KUInt
@@ -1729,7 +1729,7 @@ and jump_expr ctx e jif =
 
 let do_debug ctx meta =
 	let old = ctx.debug in
-	ctx.debug <- (old || has_meta ":debug" meta) && not (has_meta ":noDebug" meta);
+	ctx.debug <- (old || Meta.has Meta.Debug meta) && not (Meta.has Meta.NoDebug meta);
 	(fun() -> ctx.debug <- old)
 
 let generate_method ctx fdata stat fmeta =
@@ -1917,7 +1917,7 @@ let generate_enum_init ctx e hc meta =
 let extract_meta meta =
 	let rec loop = function
 		| [] -> []
-		| (":meta",[ECall ((EConst (Ident n),_),args),_],_) :: l ->
+		| (Meta.Meta,[ECall ((EConst (Ident n),_),args),_],_) :: l ->
 			let mk_arg (a,p) =
 				match a with
 				| EConst (String s) -> (None, s)
@@ -1935,8 +1935,8 @@ let generate_field_kind ctx f c stat =
 	let method_kind() =
 		let rec loop = function
 			| [] -> f.cf_name, MK3Normal
-			| (":getter",[EConst (Ident f),_],_) :: _ -> f, MK3Getter
-			| (":setter",[EConst (Ident f),_],_) :: _ -> f, MK3Setter
+			| (Meta.Getter,[EConst (Ident f),_],_) :: _ -> f, MK3Getter
+			| (Meta.Setter,[EConst (Ident f),_],_) :: _ -> f, MK3Setter
 			| _ :: l -> loop l
 		in
 		loop f.cf_meta
@@ -1964,7 +1964,7 @@ let generate_field_kind ctx f c stat =
 			let m = generate_method ctx fdata stat f.cf_meta in
 			Some (HFMethod {
 				hlm_type = m;
-				hlm_final = stat || (has_meta ":final" f.cf_meta);
+				hlm_final = stat || (Meta.has Meta.Final f.cf_meta);
 				hlm_override = not stat && loop c name;
 				hlm_kind = kind;
 			})
@@ -2045,9 +2045,9 @@ let generate_class ctx c =
 					ident f.cf_name
 			| x :: l ->
 				match x with
-				| ((":getter" | ":setter"),[EConst (Ident f),_],_) -> ident f
-				| (":ns",[EConst (String ns),_],_) -> HMName (f.cf_name,HNNamespace ns)
-				| (":protected",[],_) -> protect()
+				| ((Meta.Getter | Meta.Setter),[EConst (Ident f),_],_) -> ident f
+				| (Meta.Ns,[EConst (String ns),_],_) -> HMName (f.cf_name,HNNamespace ns)
+				| (Meta.Protected,[],_) -> protect()
 				| _ -> loop_meta l
 		in
 		if c.cl_interface then
@@ -2182,7 +2182,7 @@ let generate_class ctx c =
 		hlc_name = name;
 		hlc_super = (if c.cl_interface then None else Some (type_path ctx (match c.cl_super with None -> [],"Object" | Some (c,_) -> c.cl_path)));
 		hlc_sealed = not (is_dynamic c);
-		hlc_final = has_meta ":final" c.cl_meta;
+		hlc_final = Meta.has Meta.Final c.cl_meta;
 		hlc_interface = c.cl_interface;
 		hlc_namespace = (match !has_protected with None -> None | Some p -> Some (HNProtected p));
 		hlc_implements = Array.of_list (List.map (fun (c,_) ->
@@ -2306,7 +2306,7 @@ let rec generate_type ctx t =
 	match t with
 	| TClassDecl c ->
 		if c.cl_path = (["flash";"_Boot"],"RealBoot") then c.cl_path <- ctx.boot;
-		if c.cl_extern && (c.cl_path <> ([],"Dynamic") || has_meta ":realPath" c.cl_meta) then
+		if c.cl_extern && (c.cl_path <> ([],"Dynamic") || Meta.has Meta.RealPath c.cl_meta) then
 			None
 		else
 			let debug = do_debug ctx c.cl_meta in

+ 9 - 9
genxml.ml

@@ -57,7 +57,7 @@ let gen_arg_name (name,opt,_) =
 let real_path path meta =
 	let rec loop = function
 		| [] -> path
-		| (":realPath",[(Ast.EConst (Ast.String s),_)],_) :: _ -> parse_path s
+		| (Meta.RealPath,[(Ast.EConst (Ast.String s),_)],_) :: _ -> parse_path s
 		| _ :: l -> loop l
 	in
 	loop meta
@@ -86,12 +86,12 @@ let rec sexpr (e,_) =
 	| _ -> "'???'"
 
 let gen_meta meta =
-	let meta = List.filter (fun (m,_,_) -> match m with ":?used" | ":realPath" -> false | _ -> true) meta in
+	let meta = List.filter (fun (m,_,_) -> match m with Meta.MaybeUsed | Meta.RealPath -> false | _ -> true) meta in
 	match meta with
 	| [] -> []
 	| _ ->
 		let nodes = List.map (fun (m,el,_) ->
-			node "m" ["n",m] (List.map (fun e -> node "e" [] [gen_string (sexpr e)]) el)
+			node "m" ["n",Meta.to_string m] (List.map (fun e -> node "e" [] [gen_string (sexpr e)]) el)
 		) meta in
 		[node "meta" [] nodes]
 
@@ -223,7 +223,7 @@ let rec write_xml ch tabs x =
 
 let generate com file =
 	let t = Common.timer "construct xml" in
-	let x = node "haxe" [] (List.map (gen_type_decl com true) (List.filter (fun t -> not (has_meta ":noDoc" (t_infos t).mt_meta)) com.types)) in
+	let x = node "haxe" [] (List.map (gen_type_decl com true) (List.filter (fun t -> not (Meta.has Meta.NoDoc (t_infos t).mt_meta)) com.types)) in
 	t();
 	let t = Common.timer "write xml" in
 	let ch = IO.output_channel (open_out_bin file) in
@@ -334,11 +334,11 @@ let generate_type com t =
 	let print_meta ml =
 		List.iter (fun (m,pl,_) ->
 			match m with
-			| ":defparam" | ":coreApi" -> ()
+			| Meta.DefParam | Meta.CoreApi -> ()
 			| _ ->
 			match pl with
-			| [] -> p "@%s " m
-			| l -> p "@%s(%s) " m (String.concat "," (List.map sexpr pl))
+			| [] -> p "@%s " (Meta.to_string m)
+			| l -> p "@%s(%s) " (Meta.to_string m) (String.concat "," (List.map sexpr pl))
 		) ml
 	in
 	let access a =
@@ -361,7 +361,7 @@ let generate_type com t =
 					List.map (fun (a,o,t) ->
 						let rec loop = function
 							| [] -> Ident "null"
-							| (":defparam",[(EConst (String p),_);(EConst v,_)],_) :: _ when p = a ->
+							| (Meta.DefParam,[(EConst (String p),_);(EConst v,_)],_) :: _ when p = a ->
 								(match v with
 								| Float "1.#QNAN" -> Float "0./*NaN*/"
 								| Float "4294967295." -> Int "0xFFFFFFFF"
@@ -443,7 +443,7 @@ let generate_type com t =
 			| TFun (args,_) -> p "(%s)" (String.concat ", " (List.map sparam (List.map (fun (a,o,t) -> a,(if o then Some (Ident "null") else None),t) args)))
 			| _ -> ());
 			p ";\n";
-		) (if has_meta ":fakeEnum" e.e_meta then sort e.e_names else e.e_names);
+		) (if Meta.has Meta.FakeEnum e.e_meta then sort e.e_names else e.e_names);
 		p "}\n"
 	| TTypeDecl t ->
 		print_meta t.t_meta;

+ 7 - 7
interp.ml

@@ -3540,7 +3540,7 @@ and encode_access a =
 
 and encode_meta_entry (m,ml,p) =
 	enc_obj [
-		"name", enc_string m;
+		"name", enc_string (Meta.to_string m);
 		"params", enc_array (List.map encode_expr ml);
 		"pos", encode_pos p;
 	]
@@ -3693,7 +3693,7 @@ and encode_expr e =
 		]
 	in
 	loop e
-	
+
 and encode_null_expr e =
 	match e with
 	| None ->
@@ -3831,7 +3831,7 @@ and decode_access v =
 	| _ -> raise Invalid_expr
 
 and decode_meta_entry v =
-	(dec_string (field v "name"), List.map decode_expr (dec_array (field v "params")), decode_pos (field v "pos"))
+	Meta.from_string (dec_string (field v "name")), List.map decode_expr (dec_array (field v "params")), decode_pos (field v "pos")
 
 and decode_meta_content v =
 	List.map decode_meta_entry (dec_array v)
@@ -3962,7 +3962,7 @@ and decode_null_expr v =
 	match field v "expr" with
 	| VNull -> None
 	| _ -> Some (decode_expr v)
-	
+
 
 (* ---------------------------------------------------------------------- *)
 (* TYPE ENCODING *)
@@ -4002,20 +4002,20 @@ let encode_meta m set =
 		"add", VFunction (Fun3 (fun k vl p ->
 			(try
 				let el = List.map decode_expr (dec_array vl) in
-				meta := (dec_string k, el, decode_pos p) :: !meta;
+				meta := (Meta.from_string (dec_string k), el, decode_pos p) :: !meta;
 				set (!meta)
 			with Invalid_expr ->
 				failwith "Invalid expression");
 			VNull
 		));
 		"remove", VFunction (Fun1 (fun k ->
-			let k = (try dec_string k with Invalid_expr -> raise Builtin_error) in
+			let k = Meta.from_string (try dec_string k with Invalid_expr -> raise Builtin_error) in
 			meta := List.filter (fun (m,_,_) -> m <> k) (!meta);
 			set (!meta);
 			VNull
 		));
 		"has", VFunction (Fun1 (fun k ->
-			let k = (try dec_string k with Invalid_expr -> raise Builtin_error) in
+			let k = Meta.from_string (try dec_string k with Invalid_expr -> raise Builtin_error) in
 			VBool (List.exists (fun (m,_,_) -> m = k) (!meta));
 		));
 	]

+ 2 - 2
main.ml

@@ -532,14 +532,14 @@ and wait_loop boot_com host port =
 						| TEnumDecl e ->
 							let rec loop acc = function
 								| [] -> ()
-								| (":realPath",[Ast.EConst (Ast.String path),_],_) :: l ->
+								| (Ast.Meta.RealPath,[Ast.EConst (Ast.String path),_],_) :: l ->
 									e.e_path <- Ast.parse_path path;
 									e.e_meta <- (List.rev acc) @ l;
 								| x :: l -> loop (x::acc) l
 							in
 							loop [] e.e_meta
 						| TAbstractDecl a ->
-							a.a_meta <- List.filter (fun (m,_,_) -> m <> ":valueUsed") a.a_meta
+							a.a_meta <- List.filter (fun (m,_,_) -> m <> Ast.Meta.ValueUsed) a.a_meta
 						| _ -> ()
 					) m.m_types;
 					Typeload.add_module ctx m p;

+ 1 - 1
matcher.ml

@@ -1023,7 +1023,7 @@ let match_expr ctx e cases def with_type p =
 		| _ ->
 			let e = type_expr ctx e Value in
 			begin match follow e.etype with
-			| TEnum(en,_) when PMap.is_empty en.e_constrs || has_meta ":fakeEnum" en.e_meta ->
+			| TEnum(en,_) when PMap.is_empty en.e_constrs || Meta.has Meta.FakeEnum en.e_meta ->
 				raise Exit
 			| _ ->
 				()

+ 1 - 1
optimizer.ml

@@ -394,7 +394,7 @@ let rec type_inline ctx cf f ethis params tret config p force =
 			let unify_func () = unify_raise ctx mt (TFun (List.map (fun e -> "",false,e.etype) params,tret)) p in
 			(match follow ethis.etype with
 			| TAnon a -> (match !(a.a_status) with
-				| Statics {cl_kind = KAbstractImpl a } when has_meta ":impl" cf.cf_meta ->
+				| Statics {cl_kind = KAbstractImpl a } when Meta.has Meta.Impl cf.cf_meta ->
 					(* TODO: we might have to unify something here *)
 					()
 				| _ -> unify_func())

+ 9 - 7
parser.ml

@@ -391,9 +391,11 @@ and parse_meta = parser
 	| [< >] -> []
 
 and meta_name = parser
-	| [< '(Const (Ident i),p) >] -> i, p
-	| [< '(Kwd k,p) >] -> s_keyword k,p
-	| [< '(DblDot,_); s >] -> let n, p = meta_name s in ":" ^ n, p
+	| [< '(Const (Ident i),p) >] -> (Meta.Custom i), p
+	| [< '(Kwd k,p) >] -> (Meta.Custom (s_keyword k)),p
+	| [< '(DblDot,_); s >] -> match s with parser
+		| [< '(Const (Ident i),p) >] -> (Meta.parse i), p
+		| [< '(Kwd k,p) >] -> (Meta.parse (s_keyword k)),p
 
 and parse_enum_flags = parser
 	| [< '(Kwd Enum,p) >] -> [] , p
@@ -500,7 +502,7 @@ and parse_type_anonymous opt = parser
 			) in
 			{
 				cff_name = name;
-				cff_meta = if opt then [":optional",[],p1] else [];
+				cff_meta = if opt then [Meta.Optional,[],p1] else [];
 				cff_access = [];
 				cff_doc = None;
 				cff_kind = FVar (Some t,None);
@@ -727,7 +729,7 @@ and parse_macro_expr p = parser
 		reify_expr (EVars vl,p1)
 	| [< e = secure_expr >] ->
 		reify_expr e
-	
+
 and expr = parser
 	| [< (name,params,p) = parse_meta_entry; s >] ->
 		(try
@@ -836,9 +838,9 @@ and expr = parser
 	| [< '(Dollar v,p); s >] -> expr_next (EConst (Ident ("$"^v)),p) s
 
 and expr_next e1 = parser
-	| [< '(BrOpen,p1) when is_dollar_ident e1; eparam = expr; '(BrClose,p2); s >] ->
+ 	| [< '(BrOpen,p1) when is_dollar_ident e1; eparam = expr; '(BrClose,p2); s >] ->
 		(match fst e1 with
-		| EConst(Ident n) -> expr_next (EMeta((n,[],snd e1),eparam), punion p1 p2) s
+		| EConst(Ident n) -> expr_next (EMeta((Meta.from_string n,[],snd e1),eparam), punion p1 p2) s
 		| _ -> assert false)
 	| [< '(Dot,p); s >] ->
 		if is_resuming p then display (EDisplay (e1,false),p);

+ 35 - 35
std/cs/Lib.hx

@@ -26,15 +26,15 @@ import cs.system.Type;
 	Platform-specific C# Library. Provides some platform-specific functions for the C# target,
 	such as conversion from haxe types to native types and vice-versa.
 **/
-class Lib 
+class Lib
 {
 	@:keep private static var decimalSeparator:String;
-	
+
 	/**
 		Changes the current culture settings to allow a consistent cross-target behavior.
 		Currently the only change made is in regard to the decimal separator, which is always set to "."
 	**/
-	@:functionBody('
+	@:functionCode('
 			System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(System.Threading.Thread.CurrentThread.CurrentCulture.Name, true);
 			decimalSeparator = ci.NumberFormat.NumberDecimalSeparator;
             ci.NumberFormat.NumberDecimalSeparator = ".";
@@ -42,25 +42,25 @@ class Lib
 	')
 	@:keep public static function applyCultureChanges():Void
 	{
-		
+
 	}
-	
+
 	/**
 		Reverts the culture changes to the default settings.
 	**/
-	@:functionBody('
+	@:functionCode('
 		System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(System.Threading.Thread.CurrentThread.CurrentCulture.Name, true);
 		System.Threading.Thread.CurrentThread.CurrentCulture = ci;
 	')
 	public static function revertDefaultCulture():Void
 	{
-		
+
 	}
-	
+
 	/**
 		Returns a native array from the supplied Array. This native array is unsafe to be written on,
 		as it may or may not be linked to the actual Array implementation.
-		
+
 		If equalLengthRequired is true, the result might be a copy of an array with the correct size.
 	**/
 	public static function nativeArray<T>(arr:Array<T>, equalLengthRequired:Bool):NativeArray<T>
@@ -76,24 +76,24 @@ class Lib
 			return ret;
 		}
 	}
-	
+
 	/**
 		Provides support for the "as" keyword in C#.
 		If the object is not of the supplied type "T", it will return null instead of rasing an exception.
-		
+
 		This function will not work with Value Types (such as Int, Float, Bool...)
 	**/
-	@:functionBody('
+	@:functionCode('
 			throw new haxe.lang.HaxeException("This function cannot be accessed at runtime");
 	')
 	@:extern public static inline function as<T>(obj:Dynamic, cl:Class<T>):T
 	{
 		return untyped __as__(obj, cl);
 	}
-	
+
 	/**
 		Returns a Class<> equivalent to the native System.Type type.
-		
+
 		Currently Haxe's Class<> is equivalent to System.Type, but this is an implementation detail.
 		This may change in the future, so use this function whenever you need to perform such conversion.
 	**/
@@ -101,10 +101,10 @@ class Lib
 	{
 		return untyped t;
 	}
-	
+
 	/**
 		Returns a System.Type equivalent to the Haxe Class<> type.
-		
+
 		Currently Haxe's Class<> is equivalent to System.Type, but this is an implementation detail.
 		This may change in the future, so use this function whenever you need to perform such conversion.
 	**/
@@ -112,7 +112,7 @@ class Lib
 	{
 		return untyped cl;
 	}
-	
+
 	/**
 		Gets the native System.Type from the supplied object. Will throw an exception in case of null being passed.
 	**/
@@ -120,7 +120,7 @@ class Lib
 	{
 		return untyped obj.GetType();
 	}
-	
+
 	/**
 		Returns a Haxe Array of a native Array.
 		It won't copy the contents of the native array, so unless any operation triggers an array resize,
@@ -130,7 +130,7 @@ class Lib
 	{
 		return untyped Array.ofNative(native);
 	}
-	
+
 	/**
 		Allocates a new Haxe Array with a predetermined size
 	**/
@@ -138,10 +138,10 @@ class Lib
 	{
 		return untyped Array.alloc(size);
 	}
-	
+
 	/**
 		Creates a "checked" block, which throws exceptions for overflows.
-		
+
 		Usage:
 			cs.Lib.checked({
 				var x = 1000;
@@ -156,19 +156,19 @@ class Lib
 	{
 		untyped __checked__(block);
 	}
-	
+
 	/**
 		Ensures that one thread does not enter a critical section of code while another thread
-		is in the critical section. If another thread attempts to enter a locked code, it 
+		is in the critical section. If another thread attempts to enter a locked code, it
 		will wait, block, until the object is released.
-		
+
 		This method only exists at compile-time, so it can't be called via reflection.
 	**/
 	@:extern public static inline function lock(obj:Dynamic, block:Dynamic):Void
 	{
 		untyped __lock__(obj, block);
 	}
-	
+
 	//Unsafe code manipulation
 	#if unsafe
 	/**
@@ -183,28 +183,28 @@ class Lib
 				//we cannot change obj1, obj2 or obj3 variables like this:
 				//obj1++;
 			});
-		
+
 		This method only exists at compile-time, so it can't be called via reflection.
 	**/
 	@:extern public static inline function fixed(block:Dynamic):Void
 	{
 		untyped __fixed__(block);
 	}
-	
+
 	/**
 		Marks the contained block as an unsafe block, meaning that it can contain unsafe code.
 		Usage:
 			cs.Lib.unsafe({
 				//unsafe code is allowed inside here
 			});
-		
+
 		This method only exists at compile-time, so it can't be called via reflection.
 	**/
 	@:extern public static inline function unsafe(block:Dynamic):Void
 	{
 		untyped __unsafe__(block);
 	}
-	
+
 	/**
 		Gets the pointer to the address of current local. Equivalent to the "&" operator in C#
 		Usage:
@@ -214,7 +214,7 @@ class Lib
 				x[0] = 42;
 			});
 			trace(x); //42
-		
+
 		This method only exists at compile-time, so it can't be called via reflection.
 		Warning: This method will only work if a local variable is passed as an argument.
 	**/
@@ -222,7 +222,7 @@ class Lib
 	{
 		return untyped __addressOf__(variable);
 	}
-	
+
 	/**
 		Gets the value of the pointer address.
 		Usage:
@@ -234,14 +234,14 @@ class Lib
 				trace(cs.Lib.valueOf(addr)); //42
 			});
 			trace(x); //42
-		
+
 		This method only exists at compile-time, so it can't be called via reflection.
 	**/
 	@:extern public static inline function valueOf<T>(pointer:cs.Pointer<T>):T
 	{
 		return untyped __valueOf__(pointer);
 	}
-	
+
 	/**
 		Transforms a managed native array into a Pointer. Must be inside a fixed statement
 		Usage:
@@ -255,14 +255,14 @@ class Lib
 				});
 			});
 			trace(x[0]); //42
-		
+
 		This method only exists at compile-time, so it can't be called via reflection.
 	**/
 	@:extern public static inline function pointerOfArray<T>(array:cs.NativeArray<T>):cs.Pointer<T>
 	{
 		return cast array;
 	}
-	
+
 	/**
 		Returns the byte size of the given struct. Only works with structs and basic types.
 	**/

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
std/cs/_std/Array.hx


+ 1 - 1
std/cs/_std/Math.hx

@@ -22,7 +22,7 @@
 package;
 import cs.system.Random;
 
-@:coreApi @:nativegen class Math
+@:coreApi @:nativeGen class Math
 {
 	public static inline function __init__():Void
 	{

+ 12 - 12
std/cs/_std/Reflect.hx

@@ -54,7 +54,7 @@ import cs.internal.Function;
 	/**
 		Tells if an object has a field set. This doesn't take into account the object prototype (class methods).
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o is haxe.lang.IHxObject)
 			return ((haxe.lang.IHxObject) o).__hx_getField(field, haxe.lang.FieldLookup.hash(field), false, true, false) != haxe.lang.Runtime.undefined;
 
@@ -68,7 +68,7 @@ import cs.internal.Function;
 	/**
 		Returns the field of an object, or null if [o] is not an object or doesn't have this field.
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o is haxe.lang.IHxObject)
 			return ((haxe.lang.IHxObject) o).__hx_getField(field, haxe.lang.FieldLookup.hash(field), false, false, false);
 
@@ -83,7 +83,7 @@ import cs.internal.Function;
 	/**
 		Set an object field value.
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o is haxe.lang.IHxObject)
 			((haxe.lang.IHxObject) o).__hx_setField(field, haxe.lang.FieldLookup.hash(field), value, false);
 		else
@@ -97,7 +97,7 @@ import cs.internal.Function;
 	/**
 		Similar to field but also supports property (might be slower).
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o is haxe.lang.IHxObject)
 			return ((haxe.lang.IHxObject) o).__hx_getField(field, haxe.lang.FieldLookup.hash(field), false, false, true);
 
@@ -111,7 +111,7 @@ import cs.internal.Function;
 	/**
 		Similar to setField but also supports property (might be slower).
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o is haxe.lang.IHxObject)
 			((haxe.lang.IHxObject) o).__hx_setField(field, haxe.lang.FieldLookup.hash(field), value, true);
 		else
@@ -125,7 +125,7 @@ import cs.internal.Function;
 	/**
 		Call a method with the given object and arguments.
 	**/
-	@:functionBody('
+	@:functionCode('
 		return ((haxe.lang.Function) func).__hx_invokeDynamic(args);
 	')
 	public static function callMethod( o : Dynamic, func : Dynamic, args : Array<Dynamic> ) : Dynamic
@@ -136,7 +136,7 @@ import cs.internal.Function;
 	/**
 		Returns the list of fields of an object, excluding its prototype (class methods).
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o is haxe.lang.IHxObject)
 		{
 			Array<object> ret = new Array<object>();
@@ -156,7 +156,7 @@ import cs.internal.Function;
 	/**
 		Tells if a value is a function or not.
 	**/
-	@:functionBody('
+	@:functionCode('
 		return f is haxe.lang.Function;
 	')
 	public static function isFunction( f : Dynamic ) : Bool
@@ -167,7 +167,7 @@ import cs.internal.Function;
 	/**
 		Generic comparison function, does not work for methods, see [compareMethods]
 	**/
-	@:functionBody('
+	@:functionCode('
 		return haxe.lang.Runtime.compare(a, b);
 	')
 	public static function compare<T>( a : T, b : T ) : Int
@@ -178,7 +178,7 @@ import cs.internal.Function;
 	/**
 		Compare two methods closures. Returns true if it's the same method of the same instance.
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (f1 == f2)
 			return true;
 
@@ -201,7 +201,7 @@ import cs.internal.Function;
 		Tells if a value is an object or not.
 
 	**/
-	@:functionBody('
+	@:functionCode('
 		return v is haxe.lang.DynamicObject;
 	')
 	public static function isObject( v : Dynamic ) : Bool
@@ -212,7 +212,7 @@ import cs.internal.Function;
 	/**
 		Delete an object field.
 	**/
-	@:functionBody('
+	@:functionCode('
 		return (o is haxe.lang.DynamicObject && ((haxe.lang.DynamicObject) o).__hx_deleteField(f, haxe.lang.FieldLookup.hash(f)));
 	')
 	public static function deleteField( o : Dynamic, f : String ) : Bool

+ 1 - 1
std/cs/_std/Std.hx

@@ -23,7 +23,7 @@ import cs.Boot;
 import cs.Lib;
 import cs.internal.Exceptions;
 
-@:coreApi @:nativegen class Std {
+@:coreApi @:nativeGen class Std {
 	public static function is( v : Dynamic, t : Dynamic ) : Bool
 	{
 		if (v == null)

+ 10 - 10
std/cs/_std/Type.hx

@@ -61,7 +61,7 @@ import cs.internal.Runtime;
 
 @:keep @:coreApi class Type {
 
-	@:functionBody('
+	@:functionCode('
 		if (o is haxe.lang.DynamicObject || o is System.Type)
 			return null;
 
@@ -72,7 +72,7 @@ import cs.internal.Runtime;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (o is System.Enum || o is haxe.lang.Enum)
 			return o.GetType();
 		return null;
@@ -180,7 +180,7 @@ import cs.internal.Runtime;
 		return createInstance(cl, []);
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (@params == null)
 		{
 			object ret = haxe.lang.Runtime.slowGetField(e, constr, false);
@@ -201,7 +201,7 @@ import cs.internal.Runtime;
 		return createEnum(e, constr[index], params);
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (c == typeof(string))
 		{
 			return haxe.lang.StringRefl.fields;
@@ -225,7 +225,7 @@ import cs.internal.Runtime;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		Array<object> ret = new Array<object>();
 
 		if (c == typeof(string))
@@ -254,7 +254,7 @@ import cs.internal.Runtime;
 		return untyped __cs__("new Array<object>(System.Enum.GetNames(e))");
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (v == null) return ValueType.TNull;
 
         System.Type t = v as System.Type;
@@ -309,7 +309,7 @@ import cs.internal.Runtime;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			if (a is haxe.lang.Enum)
 				return a.Equals(b);
 			else
@@ -320,7 +320,7 @@ import cs.internal.Runtime;
 		return untyped a.Equals(b);
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (e is System.Enum)
 			return e + "";
 		else
@@ -331,7 +331,7 @@ import cs.internal.Runtime;
 		return e.tag;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		return ( e is System.Enum ) ? new Array<object>() : ((haxe.lang.Enum) e).@params;
 	')
 	public static function enumParameters( e : EnumValue ) : Array<Dynamic> untyped
@@ -339,7 +339,7 @@ import cs.internal.Runtime;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (e is System.Enum)
 			return ((System.IConvertible) e).ToInt32(null);
 		else

+ 1 - 1
std/cs/_std/haxe/Int32.hx

@@ -23,7 +23,7 @@ package haxe;
 
 #if !haxe3
 
-@:nativegen class Int32
+@:nativeGen class Int32
 {
 	public static inline function make( a : Int, b : Int ) : Int32
 	{

+ 1 - 1
std/cs/_std/haxe/Int64.hx

@@ -25,7 +25,7 @@ using haxe.Int64;
 @:notNull @:runtimeValue private abstract NativeUInt64 => Int, <= Int {}
 
 @:coreApi
-@:nativegen class Int64
+@:nativeGen class Int64
 {
 	@:extern private static inline function asNative(i:Int64):NativeInt64 return untyped i
 	@:extern private static inline function ofNative(i:NativeInt64):Int64 return untyped i

+ 7 - 7
std/cs/internal/Exceptions.hx

@@ -23,14 +23,14 @@ package cs.internal;
 import cs.system.Exception;
 
 //should NOT be usable inside haxe code
-@:nativegen @:keep @:native("haxe.lang.HaxeException") private class HaxeException extends Exception
+@:nativeGen @:keep @:native("haxe.lang.HaxeException") private class HaxeException extends Exception
 {
 	private var obj:Dynamic;
-	
+
 	public function new(obj:Dynamic)
 	{
 		super();
-		
+
 		if (Std.is(obj, HaxeException))
 		{
 			var _obj:HaxeException = cast obj;
@@ -38,21 +38,21 @@ import cs.system.Exception;
 		}
 		this.obj = obj;
 	}
-	
+
 	public function getObject():Dynamic
 	{
 		return obj;
 	}
-	
+
 	public function toString():String
 	{
 		return "Haxe Exception: " + obj;
 	}
-	
+
 	public static function wrap(obj:Dynamic):Exception
 	{
 		if (Std.is(obj, Exception)) return obj;
-		
+
 		return new HaxeException(obj);
 	}
 }

+ 4 - 4
std/cs/internal/Function.hx

@@ -27,7 +27,7 @@ package cs.internal;
  in modules (untested).
 **/
 
-@:keep @:abstract @:nativegen @:native("haxe.lang.Function") private class Function
+@:keep @:abstract @:nativeGen @:native("haxe.lang.Function") private class Function
 {
 	function new(arity:Int, type:Int)
 	{
@@ -35,7 +35,7 @@ package cs.internal;
 	}
 }
 
-@:keep @:nativegen @:native("haxe.lang.VarArgsBase") private class VarArgsBase extends Function
+@:keep @:nativeGen @:native("haxe.lang.VarArgsBase") private class VarArgsBase extends Function
 {
 	public function __hx_invokeDynamic(dynArgs:Array<Dynamic>):Dynamic
 	{
@@ -44,7 +44,7 @@ package cs.internal;
 	}
 }
 
-@:keep @:nativegen @:native('haxe.lang.VarArgsFunction') class VarArgsFunction extends VarArgsBase
+@:keep @:nativeGen @:native('haxe.lang.VarArgsFunction') class VarArgsFunction extends VarArgsBase
 {
 	private var fun:Array<Dynamic>->Dynamic;
 
@@ -60,7 +60,7 @@ package cs.internal;
 	}
 }
 
-@:keep @:nativegen @:native('haxe.lang.Closure') class Closure extends VarArgsBase
+@:keep @:nativeGen @:native('haxe.lang.Closure') class Closure extends VarArgsBase
 {
 	private var obj:Dynamic;
 	private var field:String;

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
std/cs/internal/HxObject.hx


+ 12 - 12
std/cs/internal/Null.hx

@@ -21,7 +21,7 @@
  */
 package cs.internal;
 
-@:classContents('
+@:classCode('
 	//This function is here to be used with Reflection, when the haxe.lang.Null type is known
 	public static haxe.lang.Null<T> _ofDynamic(object obj)
 	{
@@ -37,18 +37,18 @@ package cs.internal;
 		}
 	}
 ')
-@:keep @:struct @:nativegen @:native("haxe.lang.Null") private class Nullable<T>
+@:keep @:struct @:nativeGen @:native("haxe.lang.Null") private class Nullable<T>
 {
-	
-	@:readonly public var value:T;
-	@:readonly public var hasValue:Bool;
-	
-	@:functionBody('
+
+	@:readOnly public var value:T;
+	@:readOnly public var hasValue:Bool;
+
+	@:functionCode('
 			if ( !(v is System.ValueType) && System.Object.ReferenceEquals(v, default(T)))
 			{
 				hasValue = false;
 			}
-			
+
 			this.@value = v;
 			this.hasValue = hasValue;
 	')
@@ -57,8 +57,8 @@ package cs.internal;
 		this.value = v;
 		this.hasValue = hasValue;
 	}
-	
-	@:functionBody('
+
+	@:functionCode('
 		if (obj == null)
 		{
 			return new haxe.lang.Null<D>(default(D), false);
@@ -74,8 +74,8 @@ package cs.internal;
 	{
 		return null;
 	}
-	
-	@:functionBody('
+
+	@:functionCode('
 		if (this.hasValue)
 			return value;
 		return null;

+ 24 - 24
std/cs/internal/Runtime.hx

@@ -34,9 +34,9 @@ import cs.system.Type;
  compatibility to the host language.
 **/
 
-@:nativegen
+@:nativeGen
 @:native('haxe.lang.Runtime')
-@:classContents('
+@:classCode('
 	public static object getField(haxe.lang.HxObject obj, string field, int fieldHash, bool throwErrors)
 	{
 		if (obj == null && !throwErrors) return null;
@@ -68,7 +68,7 @@ import cs.system.Type;
 {
 	public static var undefined(default, never):Dynamic = { };
 
-	@:functionBody('
+	@:functionCode('
 		return new haxe.lang.Closure(obj, field, hash);
 	')
 	public static function closure(obj:Dynamic, hash:Int, field:String):Dynamic
@@ -76,7 +76,7 @@ import cs.system.Type;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			if (System.Object.ReferenceEquals(v1, v2))
 				return true;
 			if (v1 == null || v2 == null)
@@ -130,7 +130,7 @@ import cs.system.Type;
 		return false;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			if (v1 is System.Type)
 				return typeEq(v1 as System.Type, v2 as System.Type);
 			return System.Object.ReferenceEquals(v1, v2);
@@ -140,7 +140,7 @@ import cs.system.Type;
 		return false;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		return (obj == null) ? 0.0 : (obj is double) ? (double)obj : ((System.IConvertible) obj).ToDouble(null);
 	')
 	public static function toDouble(obj:Dynamic):Float
@@ -148,7 +148,7 @@ import cs.system.Type;
 		return 0.0;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		return (obj == null) ? 0 : (obj is int) ? (int)obj : ((System.IConvertible) obj).ToInt32(null);
 	')
 	public static function toInt(obj:Dynamic):Int
@@ -156,7 +156,7 @@ import cs.system.Type;
 		return 0;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			System.IConvertible cv1 = obj as System.IConvertible;
 			if (cv1 != null)
 			{
@@ -181,7 +181,7 @@ import cs.system.Type;
 		return false;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			System.IConvertible cv1 = v1 as System.IConvertible;
 			if (cv1 != null)
 			{
@@ -232,7 +232,7 @@ import cs.system.Type;
 		return 0;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			if (v1 is string || v2 is string)
 				return Std.@string(v1) + Std.@string(v2);
 
@@ -256,7 +256,7 @@ import cs.system.Type;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 
 		if (obj == null)
 			if (throwErrors)
@@ -309,7 +309,7 @@ import cs.system.Type;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (obj == null) return false;
 		System.Type t = obj as System.Type;
 		System.Reflection.BindingFlags bf;
@@ -335,7 +335,7 @@ import cs.system.Type;
 		return false;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (obj == null)
 			throw new System.NullReferenceException("Cannot access field \'" + field + "\' of null.");
 
@@ -494,7 +494,7 @@ import cs.system.Type;
 		}
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (nullableType.ContainsGenericParameters)
 			return haxe.lang.Null<object>.ofDynamic<object>(obj);
 		return nullableType.GetMethod("_ofDynamic").Invoke(null, new object[] { obj });
@@ -504,7 +504,7 @@ import cs.system.Type;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (args == null) args = new Array<object>();
 
 		System.Reflection.BindingFlags bf;
@@ -546,7 +546,7 @@ import cs.system.Type;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		haxe.lang.HxObject hxObj = obj as haxe.lang.HxObject;
 		if (hxObj != null)
 			return hxObj.__hx_invokeField(field, (fieldHash == 0) ? haxe.lang.FieldLookup.hash(field) : fieldHash, args);
@@ -558,7 +558,7 @@ import cs.system.Type;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 
 		haxe.lang.HxObject hxObj = obj as haxe.lang.HxObject;
 		if (hxObj != null)
@@ -572,7 +572,7 @@ import cs.system.Type;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 
 		haxe.lang.HxObject hxObj = obj as haxe.lang.HxObject;
 		if (hxObj != null)
@@ -586,7 +586,7 @@ import cs.system.Type;
 		return 0.0;
 	}
 
-	@:functionBody('
+	@:functionCode('
 
 		haxe.lang.HxObject hxObj = obj as haxe.lang.HxObject;
 		if (hxObj != null)
@@ -600,7 +600,7 @@ import cs.system.Type;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 
 		haxe.lang.HxObject hxObj = obj as haxe.lang.HxObject;
 		if (hxObj != null)
@@ -627,7 +627,7 @@ import cs.system.Type;
 		return untyped obj.ToString();
 	}
 
-	@:functionBody('
+	@:functionCode('
 			if (t1 == null || t2 == null)
 				return t1 == t2;
 			string n1 = Type.getClassName(t1);
@@ -640,7 +640,7 @@ import cs.system.Type;
 	}
 
 
-	@:functionBody('
+	@:functionCode('
 		if (obj is To)
 			return (To) obj;
 		else if (obj == null)
@@ -657,7 +657,7 @@ import cs.system.Type;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		return (s1 == null ? "null" : s1) + (s2 == null ? "null" : s2);
 	')
 	public static function concat(s1:String, s2:String):String
@@ -666,7 +666,7 @@ import cs.system.Type;
 	}
 
 	//TODO: change from genericCast to getConverter, so we don't need to handle extra boxing associated with it
-	/*@:functionBody('
+	/*@:functionCode('
 		if (typeof(To).TypeHandle == typeof(double).TypeHandle)
 			return (System.Converter<object,To>) new System.Converter<object,double>(toDouble);
 		else if (typeof(To).TypeHandle == typeof(double).TypeHandle)

+ 12 - 12
std/cs/internal/StringExt.hx

@@ -23,10 +23,10 @@ package cs.internal;
 import cs.internal.Function;
 private typedef NativeString = String;
 
-@:keep @:nativegen @:native("haxe.lang.StringExt") private class StringExt
+@:keep @:nativeGen @:native("haxe.lang.StringExt") private class StringExt
 {
 
-	@:functionBody('
+	@:functionCode('
 			if ( ((uint) index) >= me.Length)
 				return null;
 			else
@@ -37,7 +37,7 @@ private typedef NativeString = String;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			if ( ((uint) index) >= me.Length)
 				return default(haxe.lang.Null<int>);
 			else
@@ -48,7 +48,7 @@ private typedef NativeString = String;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			uint sIndex = (startIndex.hasValue) ? ((uint) startIndex.@value) : 0;
 			if (sIndex >= me.Length)
 				return -1;
@@ -59,7 +59,7 @@ private typedef NativeString = String;
 		return -1;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			int sIndex = (startIndex.hasValue) ? (startIndex.@value) : (me.Length - 1);
 			if (sIndex >= me.Length)
 				sIndex = me.Length - 1;
@@ -95,7 +95,7 @@ private typedef NativeString = String;
 		return -1;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			string[] native;
 			if (delimiter.Length == 0)
 			{
@@ -113,7 +113,7 @@ private typedef NativeString = String;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			int meLen = me.Length;
 			int targetLen = meLen;
 			if (len.hasValue)
@@ -146,7 +146,7 @@ private typedef NativeString = String;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		int endIdx;
 		int len = me.Length;
 		if ( !endIndex.hasValue ) {
@@ -176,7 +176,7 @@ private typedef NativeString = String;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			return me.ToLower();
 	')
 	public static function toLowerCase(me:NativeString):NativeString
@@ -184,7 +184,7 @@ private typedef NativeString = String;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			return me.ToUpper();
 	')
 	public static function toUpperCase(me:NativeString):NativeString
@@ -197,7 +197,7 @@ private typedef NativeString = String;
 		return me;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			return new string( (char) code, 1 );
 	')
 	public static function fromCharCode(code:Int):NativeString
@@ -206,7 +206,7 @@ private typedef NativeString = String;
 	}
 }
 
-@:keep @:nativegen @:native('haxe.lang.StringRefl') private class StringRefl
+@:keep @:nativeGen @:native('haxe.lang.StringRefl') private class StringRefl
 {
 	public static var fields = ["length", "toUpperCase", "toLowerCase", "charAt", "charCodeAt", "indexOf", "lastIndexOf", "split", "substr", "substring"];
 

+ 2 - 2
std/cs/system/Exception.hx

@@ -21,9 +21,9 @@
  */
 package cs.system;
 
-@:native("System.Exception") @:nativegen extern class Exception
+@:native("System.Exception") @:nativeGen extern class Exception
 {
 	public var message:String;
-	
+
 	private function new():Void;
 }

+ 1 - 1
std/cs/system/Math.hx

@@ -21,7 +21,7 @@
  */
 package cs.system;
 
-@:native("System.Math") @:nativegen extern class Math
+@:native("System.Math") @:nativeGen extern class Math
 {
 	public static var PI(default, null) : Float;
 

+ 10 - 10
std/java/Lib.hx

@@ -26,13 +26,13 @@ package java;
 	such as conversion from haxe types to native types and vice-versa.
 **/
 //we cannot use the java package for custom classes, so we're redefining it as "haxe.java.Lib"
-@:native('haxe.java.Lib') class Lib 
+@:native('haxe.java.Lib') class Lib
 {
-	
+
 	/**
 		Returns a native array from the supplied Array. This native array is unsafe to be written on,
 		as it may or may not be linked to the actual Array implementation.
-		
+
 		If equalLengthRequired is true, the result might be a copy of an array with the correct size.
 	**/
 	public static function nativeArray<T>(arr:Array<T>, equalLengthRequired:Bool):NativeArray<T>
@@ -45,18 +45,18 @@ package java;
 			return null;
 		}
 	}
-	
+
 	/**
 		Gets the native System.Type from the supplied object. Will throw an exception in case of null being passed.
 	**/
-	@:functionBody('
+	@:functionCode('
 		return (java.lang.Class<T>) obj.getClass();
 	')
 	public static function nativeType<T>(obj:T):java.lang.Class<T>
 	{
 		return null;
 	}
-	
+
 	/**
 		Returns a Haxe Array of a native Array.
 		It won't copy the contents of the native array, so unless any operation triggers an array resize,
@@ -66,7 +66,7 @@ package java;
 	{
 		return untyped Array.ofNative(native);
 	}
-	
+
 	/**
 		Allocates a new Haxe Array with a predetermined size
 	**/
@@ -74,13 +74,13 @@ package java;
 	{
 		return untyped Array.alloc(size);
 	}
-	
+
 	/**
 		Ensures that one thread does not enter a critical section of code while another thread
-		is in the critical section. If another thread attempts to enter a locked code, it 
+		is in the critical section. If another thread attempts to enter a locked code, it
 		will wait, block, until the object is released.
 		This is the equivalent to "synchronized" in java code.
-		
+
 		This method only exists at compile-time, so it can't be called via reflection.
 	**/
 	@:extern public static inline function lock(obj:Dynamic, block:Dynamic):Void

+ 3 - 3
std/java/NativeArray.hx

@@ -26,10 +26,10 @@ package java;
  * @author waneck
  */
 
-@:nativegen extern class NativeArray<T> implements ArrayAccess<T>
+@:nativeGen extern class NativeArray<T> implements ArrayAccess<T>
 {
 	public var length(default, null):Int;
-	
+
 	public function new(len:Int):Void;
-	
+
 }

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
std/java/_std/Array.hx


+ 12 - 12
std/java/_std/Reflect.hx

@@ -55,7 +55,7 @@ import java.Boot;
 	/**
 		Tells if an object has a field set. This doesn't take into account the object prototype (class methods).
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o instanceof haxe.lang.IHxObject)
 		return ((haxe.lang.IHxObject) o).__hx_getField(field, false, true, false) != haxe.lang.Runtime.undefined;
 
@@ -69,7 +69,7 @@ import java.Boot;
 	/**
 		Returns the field of an object, or null if [o] is not an object or doesn't have this field.
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o instanceof haxe.lang.IHxObject)
 			return ((haxe.lang.IHxObject) o).__hx_getField(field, false, false, false);
 
@@ -84,7 +84,7 @@ import java.Boot;
 	/**
 		Set an object field value.
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o instanceof haxe.lang.IHxObject)
 			((haxe.lang.IHxObject) o).__hx_setField(field, value, false);
 		else
@@ -98,7 +98,7 @@ import java.Boot;
 	/**
 		Similar to field but also supports property (might be slower).
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o instanceof haxe.lang.IHxObject)
 			return ((haxe.lang.IHxObject) o).__hx_getField(field, false, false, true);
 
@@ -112,7 +112,7 @@ import java.Boot;
 	/**
 		Similar to setField but also supports property (might be slower).
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o instanceof haxe.lang.IHxObject)
 			((haxe.lang.IHxObject) o).__hx_setField(field, value, true);
 		else
@@ -126,7 +126,7 @@ import java.Boot;
 	/**
 		Call a method with the given object and arguments.
 	**/
-	@:functionBody('
+	@:functionCode('
 		return ((haxe.lang.Function) func).__hx_invokeDynamic(args);
 	')
 	public static function callMethod( o : Dynamic, func : Dynamic, args : Array<Dynamic> ) : Dynamic
@@ -137,7 +137,7 @@ import java.Boot;
 	/**
 		Returns the list of fields of an object, excluding its prototype (class methods).
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (o instanceof haxe.lang.IHxObject)
 		{
 			Array<String> ret = new Array<String>();
@@ -157,7 +157,7 @@ import java.Boot;
 	/**
 		Tells if a value is a function or not.
 	**/
-	@:functionBody('
+	@:functionCode('
 		return f instanceof haxe.lang.Function;
 	')
 	public static function isFunction( f : Dynamic ) : Bool
@@ -168,7 +168,7 @@ import java.Boot;
 	/**
 		Generic comparison function, does not work for methods, see [compareMethods]
 	**/
-	@:functionBody('
+	@:functionCode('
 		return haxe.lang.Runtime.compare(a, b);
 	')
 	public static function compare<T>( a : T, b : T ) : Int
@@ -179,7 +179,7 @@ import java.Boot;
 	/**
 		Compare two methods closures. Returns true if it's the same method of the same instance.
 	**/
-	@:functionBody('
+	@:functionCode('
 		if (f1 == f2)
 			return true;
 
@@ -203,7 +203,7 @@ import java.Boot;
 		Tells if a value is an object or not.
 
 	**/
-	@:functionBody('
+	@:functionCode('
 		return v instanceof haxe.lang.DynamicObject;
 	')
 	public static function isObject( v : Dynamic ) : Bool
@@ -214,7 +214,7 @@ import java.Boot;
 	/**
 		Delete an object field.
 	**/
-	@:functionBody('
+	@:functionCode('
 		return (o instanceof haxe.lang.DynamicObject && ((haxe.lang.DynamicObject) o).__hx_deleteField(f));
 	')
 	public static function deleteField( o : Dynamic, f : String ) : Bool

+ 3 - 3
std/java/_std/Std.hx

@@ -23,7 +23,7 @@ import java.Boot;
 import java.Lib;
 import java.internal.Exceptions;
 
-@:coreApi @:nativegen class Std {
+@:coreApi @:nativeGen class Std {
 	public static function is( v : Dynamic, t : Dynamic ) : Bool
 	{
 		if (v == null)
@@ -60,7 +60,7 @@ import java.internal.Exceptions;
 		return cast x;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (x == null) return null;
 
 		int ret = 0;
@@ -133,7 +133,7 @@ import java.internal.Exceptions;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (x == null) return java.lang.Double.NaN;
 
 		x = x.trim();

+ 13 - 13
std/java/_std/Type.hx

@@ -33,7 +33,7 @@
 
 @:keep @:coreApi class Type {
 
-	@:functionBody('
+	@:functionCode('
 		if (o instanceof haxe.lang.DynamicObject || o instanceof java.lang.Class)
 			return null;
 
@@ -44,7 +44,7 @@
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (o instanceof java.lang.Enum || o instanceof haxe.lang.Enum)
 			return o.getClass();
 		return null;
@@ -54,7 +54,7 @@
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		java.lang.Class cl = (c == null) ? null : c.getSuperclass();
 		if (cl != null && !cl.getName().equals("haxe.lang.HxObject") && !cl.getName().equals("java.lang.Object") )
 			return cl;
@@ -91,7 +91,7 @@
 		return ret;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		try {
 			if (name.indexOf(".") == -1)
 				name = "haxe.root." + name;
@@ -120,7 +120,7 @@
 		return resolveClass(name);
 	}
 
-	@:functionBody('
+	@:functionCode('
 			int len = args.length;
 			java.lang.Class[] cls = new java.lang.Class[len];
 			java.lang.Object[] objs = new java.lang.Object[len];
@@ -244,7 +244,7 @@
 		return createInstance(cl, []);
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (params == null)
 		{
 			java.lang.Object ret = haxe.lang.Runtime.slowGetField(e, constr, false);
@@ -265,7 +265,7 @@
 		return createEnum(e, constr[index], params);
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (c == java.lang.String.class)
 		{
 			return haxe.lang.StringRefl.fields;
@@ -294,7 +294,7 @@
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		Array<String> ret = new Array<String>();
 		if (c == java.lang.String.class)
 		{
@@ -330,7 +330,7 @@
 		return getClassFields(cast e);
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (v == null) return ValueType.TNull;
 
 		if (v instanceof haxe.lang.IHxObject) {
@@ -363,7 +363,7 @@
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			if (a instanceof haxe.lang.Enum)
 				return a.equals(b);
 			else
@@ -374,7 +374,7 @@
 		return a.equals(b);
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (e instanceof java.lang.Enum)
 			return ((java.lang.Enum) e).name();
 		else
@@ -385,7 +385,7 @@
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		return ( e instanceof java.lang.Enum ) ? new haxe.root.Array() : ((haxe.lang.Enum) e).params;
 	')
 	public static function enumParameters( e : EnumValue ) : Array<Dynamic> untyped
@@ -393,7 +393,7 @@
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (e instanceof java.lang.Enum)
 			return ((java.lang.Enum) e).ordinal();
 		else

+ 1 - 1
std/java/_std/haxe/Int32.hx

@@ -23,7 +23,7 @@ package haxe;
 
 #if !haxe3
 
-@:nativegen
+@:nativeGen
 class Int32
 {
 	public static inline function make( a : Int, b : Int ) : Int32

+ 1 - 1
std/java/_std/haxe/Int64.hx

@@ -24,7 +24,7 @@ using haxe.Int64;
 private typedef NativeInt64 = Int;
 
 @:coreApi
-@:nativegen class Int64
+@:nativeGen class Int64
 {
 	@:extern private static inline function asNative(i:Int64):NativeInt64 return untyped i
 	@:extern private static inline function ofNative(i:NativeInt64):Int64 return untyped i

+ 10 - 10
std/java/internal/Exceptions.hx

@@ -22,43 +22,43 @@
 package java.internal;
 import java.lang.Throwable;
 
-@:nativegen @:keep @:native("haxe.lang.HaxeException") private class HaxeException extends RuntimeException
+@:nativeGen @:keep @:native("haxe.lang.HaxeException") private class HaxeException extends RuntimeException
 {
 	private var obj:Dynamic;
-	
+
 	public function new(obj:Dynamic, msg:String, cause:Throwable)
 	{
 		super(msg, cause);
-		
+
 		if (Std.is(obj, HaxeException))
 		{
 			var _obj:HaxeException = cast obj;
 			obj = _obj.getObject();
 		}
-		
+
 		this.obj = obj;
 	}
-	
+
 	public function getObject():Dynamic
 	{
 		return obj;
 	}
-	
+
 	public function toString():String
 	{
 		return "Haxe Exception: " + obj;
 	}
-	
+
 	public static function wrap(obj:Dynamic):RuntimeException
 	{
-		if (Std.is(obj, RuntimeException)) 
+		if (Std.is(obj, RuntimeException))
 			return obj;
-		
+
 		if (Std.is(obj, String))
 			return new HaxeException(obj, obj, null);
 		else if (Std.is(obj, Throwable))
 			return new HaxeException(obj, null, obj);
-		
+
 		return new HaxeException(obj, null, null);
 	}
 }

+ 6 - 6
std/java/internal/FieldLookup.hx

@@ -23,22 +23,22 @@ package java.internal;
 
 @:native('haxe.lang.FieldLookup')
 @:keep
-@:static private class FieldLookup 
+@:static private class FieldLookup
 {
-	
-	@:functionBody('
+
+	@:functionCode('
 		return s.hashCode();
 	')
 	public static function hash(s:String):Int
 	{
 		return 0;
 	}
-	
+
 	public static function findHash(hash:String, hashs:Array<String>):Int
 	{
 		var min = 0;
 		var max = hashs.length;
-		
+
 		while (min < max)
 		{
 			var mid = Std.int((max + min) / 2); //overflow safe
@@ -55,5 +55,5 @@ package java.internal;
 		//if not found, return a negative value of where it should be inserted
 		return ~min;
 	}
-	
+
 }

+ 4 - 4
std/java/internal/Function.hx

@@ -29,7 +29,7 @@ import java.internal.Runtime;
  *
  * @author waneck
  */
-@:abstract @:nativegen @:native("haxe.lang.Function") @:keep private class Function
+@:abstract @:nativeGen @:native("haxe.lang.Function") @:keep private class Function
 {
 	function new(arity:Int, type:Int)
 	{
@@ -37,7 +37,7 @@ import java.internal.Runtime;
 	}
 }
 
-@:nativegen @:native("haxe.lang.VarArgsBase") @:keep private class VarArgsBase extends Function
+@:nativeGen @:native("haxe.lang.VarArgsBase") @:keep private class VarArgsBase extends Function
 {
 	public function __hx_invokeDynamic(dynArgs:Array<Dynamic>):Dynamic
 	{
@@ -46,7 +46,7 @@ import java.internal.Runtime;
 	}
 }
 
-@:nativegen @:native('haxe.lang.VarArgsFunction') @:keep class VarArgsFunction extends VarArgsBase
+@:nativeGen @:native('haxe.lang.VarArgsFunction') @:keep class VarArgsFunction extends VarArgsBase
 {
 	private var fun:Array<Dynamic>->Dynamic;
 
@@ -62,7 +62,7 @@ import java.internal.Runtime;
 	}
 }
 
-@:nativegen @:native('haxe.lang.Closure') @:keep class Closure extends VarArgsBase
+@:nativeGen @:native('haxe.lang.Closure') @:keep class Closure extends VarArgsBase
 {
 	private var obj:Dynamic;
 	private var field:String;

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
std/java/internal/HxObject.hx


+ 22 - 22
std/java/internal/Runtime.hx

@@ -27,8 +27,8 @@ package java.internal;
 **/
 
 @:native('haxe.lang.Runtime')
-@:nativegen
-@:classContents('
+@:nativeGen
+@:classCode('
 	public static java.lang.Object getField(haxe.lang.IHxObject obj, java.lang.String field, boolean throwErrors)
 	{
 		if (obj == null && !throwErrors) return null;
@@ -60,7 +60,7 @@ package java.internal;
 {
 	public static var undefined:Dynamic = { };
 
-	@:functionBody('
+	@:functionCode('
 	return new haxe.lang.Closure(obj, field);
 	')
 	public static function closure(obj:Dynamic, field:String):Dynamic
@@ -68,7 +68,7 @@ package java.internal;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			if (v1 == v2)
 				return true;
 			if (v1 == null || v2 == null)
@@ -95,7 +95,7 @@ package java.internal;
 		return false;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (v1 == v2)
 			return true;
 
@@ -111,7 +111,7 @@ package java.internal;
 		return false;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		return v1 == v2 || (v1 != null && v1.equals(v2));
 	')
 	public static function valEq(v1: { }, v2: { } ):Bool
@@ -119,7 +119,7 @@ package java.internal;
 		return false;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		return (obj == null) ? 0.0 : ((java.lang.Number) obj).doubleValue();
 	')
 	public static function toDouble(obj:Dynamic):Float
@@ -127,7 +127,7 @@ package java.internal;
 		return 0.0;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		return (obj == null) ? false : ((java.lang.Boolean) obj).booleanValue();
 	')
 	public static function toBool(obj:Dynamic):Bool
@@ -135,7 +135,7 @@ package java.internal;
 		return false;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		return (obj == null) ? 0 : ((java.lang.Number) obj).intValue();
 	')
 	public static function toInt(obj:Dynamic):Int
@@ -143,7 +143,7 @@ package java.internal;
 		return 0;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (obj != null && obj instanceof java.lang.Number)
 		{
 			return true;
@@ -156,7 +156,7 @@ package java.internal;
 		return false;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (obj != null && obj instanceof java.lang.Number)
 		{
 			java.lang.Number n = (java.lang.Number) obj;
@@ -170,7 +170,7 @@ package java.internal;
 		return false;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		java.lang.Class cl = null;
 		if (o instanceof java.lang.Class)
 		{
@@ -208,7 +208,7 @@ package java.internal;
 		return false;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			if (v1 == v2)
 				return 0;
 
@@ -237,7 +237,7 @@ package java.internal;
 		return 0;
 	}
 
-	@:functionBody('
+	@:functionCode('
 			if (v1 instanceof java.lang.String || v2 instanceof java.lang.String)
 				return (v1 + "") + (v2 + "");
 
@@ -259,7 +259,7 @@ package java.internal;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 
 	if (obj == null)
 		if (throwErrors)
@@ -315,7 +315,7 @@ package java.internal;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		java.lang.Class cl = null;
 		if (obj instanceof java.lang.Class)
 		{
@@ -350,7 +350,7 @@ package java.internal;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		java.lang.Class cl = null;
 		if (obj instanceof java.lang.Class)
 		{
@@ -486,7 +486,7 @@ package java.internal;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 		if (obj instanceof haxe.lang.IHxObject)
 		{
 			return ((haxe.lang.IHxObject) obj).__hx_invokeField(field, args);
@@ -499,7 +499,7 @@ package java.internal;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 
 		if (obj instanceof haxe.lang.IHxObject)
 			return ((haxe.lang.IHxObject) obj).__hx_getField(field, throwErrors, false, false);
@@ -512,7 +512,7 @@ package java.internal;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 
 		if (obj instanceof haxe.lang.IHxObject)
 			return ((haxe.lang.IHxObject) obj).__hx_getField_f(field, throwErrors, false);
@@ -525,7 +525,7 @@ package java.internal;
 		return 0.0;
 	}
 
-	@:functionBody('
+	@:functionCode('
 
 		if (obj instanceof haxe.lang.IHxObject)
 			return ((haxe.lang.IHxObject) obj).__hx_setField(field, value, false);
@@ -538,7 +538,7 @@ package java.internal;
 		return null;
 	}
 
-	@:functionBody('
+	@:functionCode('
 
 		if (obj instanceof haxe.lang.IHxObject)
 			return ((haxe.lang.IHxObject) obj).__hx_setField_f(field, value, false);

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
std/java/internal/StringExt.hx


+ 23 - 23
tests/unit/TestCSharp.hx

@@ -3,42 +3,42 @@ import haxe.Int32;
 using haxe.Int32;
 
 //C#-specific tests, like unsafe code
-class TestCSharp extends Test 
+class TestCSharp extends Test
 {
 	#if cs
-	
+
 	@:skipReflection private function refTest(i:cs.Ref<Int>):Void
 	{
 		i *= 2;
 	}
-	
+
 	@:skipReflection private function outTest(out:cs.Out<Int>, x:Int):Void
 	{
 		out = x * 2;
 	}
-	
+
 	public function testRef()
 	{
 		var i = 10;
 		refTest(i);
 		eq(i, 20);
-		
+
 		var cl:NativeClass = new HxClass();
 		cl.refTest(i);
 		eq(i, 80);
 	}
-	
+
 	public function testOut()
 	{
 		var i = 0;
 		outTest(i, 10);
 		eq(i, 20);
-		
+
 		var cl:NativeClass = new HxClass();
 		cl.outTest(i, 10);
 		eq(i, 40);
 	}
-	
+
 	public function testChecked()
 	{
 		exc(function()
@@ -52,9 +52,9 @@ class TestCSharp extends Test
 			});
 		});
 	}
-	
+
 	#if unsafe
-	
+
 	@:unsafe public function testUnsafe()
 	{
 		var x:cs.NativeArray<Int> = new cs.NativeArray(10);
@@ -66,7 +66,7 @@ class TestCSharp extends Test
 				p++;
 			}
 		});
-		
+
 		cs.Lib.fixed( {
 			var p = cs.Lib.pointerOfArray(x);
 			for (i in 0...10)
@@ -74,7 +74,7 @@ class TestCSharp extends Test
 				eq(p[i], i);
 			}
 		});
-		
+
 		var x:Int = 0;
 		var addr = cs.Lib.addressOf(x);
 		eq(cs.Lib.valueOf(addr), 0);
@@ -83,22 +83,22 @@ class TestCSharp extends Test
 		eq(cs.Lib.valueOf(addr), 42);
 		eq(addr[0], 42);
 		eq(x, 42);
-		
-		
+
+
 	}
-	
+
 	#end
-	
+
 	#end
 }
 
-@:nativegen private class NativeClass
+@:nativeGen private class NativeClass
 {
 	public function outTest(out:cs.Out<Int>, x:Int):Void
 	{
 		out = x * 2;
 	}
-	
+
 	public function refTest(i:cs.Ref<Int>):Void
 	{
 		i *= 2;
@@ -109,16 +109,16 @@ private class HxClass extends NativeClass
 {
 	public function new()
 	{
-		
+
 	}
-	
+
 	//here it would normally fail due to the added fast reflection field
-	override public function outTest(out:cs.Out<Int>, x:Int):Void 
+	override public function outTest(out:cs.Out<Int>, x:Int):Void
 	{
 		out = x * 4;
 	}
-	
-	override public function refTest(i:cs.Ref<Int>):Void 
+
+	override public function refTest(i:cs.Ref<Int>):Void
 	{
 		super.refTest(i);
 		i *= 2;

+ 11 - 11
tests/unit/TestJava.hx

@@ -3,31 +3,31 @@ package unit;
 class TestJava extends Test
 {
 	#if java
-	
+
 	function textException()
 	{
 		var native = new NativeClass();
 		var hx:NativeClass = new HxClass();
-		
+
 		exc(function() try native.excTest() catch (e:Dynamic) throw e);
 		var dyn:Dynamic = native;
 		exc(dyn.excTest);
-		
-		try 
+
+		try
 			hx.excTest()
 		catch(e:Dynamic) throw e; //shouldn't throw any exception
 	}
-	
+
 	#end
 }
 
-@:nativegen private class NativeClass
+@:nativeGen private class NativeClass
 {
 	public function new()
 	{
-		
+
 	}
-	
+
 	@:throws("java.lang.Throwable")
 	public function excTest():Void
 	{
@@ -37,10 +37,10 @@ class TestJava extends Test
 
 private class HxClass extends NativeClass
 {
-	
+
 	@:throws("java.lang.Throwable")
-	override public function excTest():Void 
+	override public function excTest():Void
 	{
-		
+
 	}
 }

+ 7 - 7
type.ml

@@ -423,7 +423,7 @@ let rec s_type ctx t =
 			(if b then "?" else "") ^ (if s = "" then "" else s ^ " : ") ^ s_fun ctx t true
 		) l) ^ " -> " ^ s_fun ctx t false
 	| TAnon a ->
-	let fl = PMap.fold (fun f acc -> ((if List.exists (function ":optional",_,_ -> true | _ -> false) f.cf_meta then " ?" else " ") ^ f.cf_name ^ " : " ^ s_type ctx f.cf_type) :: acc) a.a_fields [] in
+	let fl = PMap.fold (fun f acc -> ((if Meta.has Meta.Optional f.cf_meta then " ?" else " ") ^ f.cf_name ^ " : " ^ s_type ctx f.cf_type) :: acc) a.a_fields [] in
 		"{" ^ (if not (is_closed a) then "+" else "") ^  String.concat "," fl ^ " }"
 	| TDynamic t2 ->
 		"Dynamic" ^ s_type_params ctx (if t == t2 then [] else [t2])
@@ -614,7 +614,7 @@ let rec is_nullable ?(no_lazy=false) = function
 	| TInst ({ cl_path = ([],"Int") },[])
 	| TInst ({ cl_path = ([],"Float") },[])
 	| TEnum ({ e_path = ([],"Bool") },[]) -> false
-	| TAbstract (a,_) -> not (List.exists (fun (m2,_,_) -> m2 = ":notNull") a.a_meta)
+	| TAbstract (a,_) -> not (Meta.has Meta.NotNull a.a_meta)
 	| _ ->
 		true
 
@@ -853,7 +853,7 @@ let is_extern_field f =
 	match f.cf_kind with
 	| Method _ -> false
 	| Var { v_read = AccNormal | AccNo } | Var { v_write = AccNormal | AccNo } -> false
-	| _ -> not (has_meta ":isVar" f.cf_meta)
+	| _ -> not (Meta.has Meta.IsVar f.cf_meta)
 
 let field_type f =
 	match f.cf_params with
@@ -1046,10 +1046,10 @@ let rec unify a b =
 					then error [Missing_overload (f1, f2o.cf_type)]
 				) f2.cf_overloads;
 				(* we mark the field as :?used because it might be used through the structure *)
-				if not (has_meta ":?used" f1.cf_meta) then f1.cf_meta <- (":?used",[],f1.cf_pos) :: f1.cf_meta;
+				if not (Meta.has Meta.MaybeUsed f1.cf_meta) then f1.cf_meta <- (Meta.MaybeUsed,[],f1.cf_pos) :: f1.cf_meta;
 				(match f1.cf_kind with
 				| Method MethInline ->
-					if (c.cl_extern || has_meta ":extern" f1.cf_meta) && not (has_meta ":runtime" f1.cf_meta) then error [Has_no_runtime_field (a,n)];
+					if (c.cl_extern || Meta.has Meta.Extern f1.cf_meta) && not (Meta.has Meta.Runtime f1.cf_meta) then error [Has_no_runtime_field (a,n)];
 				| _ -> ());
 			) an.a_fields;
 			if !(an.a_status) = Opened then an.a_status := Closed;
@@ -1069,7 +1069,7 @@ let rec unify a b =
 				try
 					unify_with_access f1.cf_type f2;
 					(match !(a1.a_status) with
-					| Statics c when not (has_meta ":?used" f1.cf_meta) -> f1.cf_meta <- (":?used",[],f1.cf_pos) :: f1.cf_meta
+					| Statics c when not (Meta.has Meta.MaybeUsed f1.cf_meta) -> f1.cf_meta <- (Meta.MaybeUsed,[],f1.cf_pos) :: f1.cf_meta
 					| _ -> ());
 				with
 					Unify_error l -> error (invalid_field n :: l)
@@ -1079,7 +1079,7 @@ let rec unify a b =
 					| Opened ->
 						if not (link (ref None) a f2.cf_type) then error [];
 						a1.a_fields <- PMap.add n f2 a1.a_fields
-					| Const when has_meta ":optional" f2.cf_meta ->
+					| Const when Meta.has Meta.Optional f2.cf_meta ->
 						()
 					| _ ->
 						error [has_no_field a n];

+ 19 - 19
typeload.ml

@@ -141,11 +141,11 @@ let make_module ctx mpath file tdecls loadp =
 							);
 							f_type = Some this_t;
 						} in
-						{ f with cff_name = "_new"; cff_access = AStatic :: f.cff_access; cff_kind = FFun fu; cff_meta = (":impl",[],p) :: f.cff_meta }
+						{ f with cff_name = "_new"; cff_access = AStatic :: f.cff_access; cff_kind = FFun fu; cff_meta = (Meta.Impl,[],p) :: f.cff_meta }
 					| FFun fu when not stat ->
-						if has_meta ":from" f.cff_meta then error "@:from cast functions must be static" f.cff_pos;
+						if Meta.has Meta.From f.cff_meta then error "@:from cast functions must be static" f.cff_pos;
 						let fu = { fu with f_args = ("this",false,Some this_t,None) :: fu.f_args } in
-						{ f with cff_kind = FFun fu; cff_access = AStatic :: f.cff_access; cff_meta = (":impl",[],p) :: f.cff_meta }
+						{ f with cff_kind = FFun fu; cff_access = AStatic :: f.cff_access; cff_meta = (Meta.Impl,[],p) :: f.cff_meta }
 					| _ ->
 						f
 				) fields in
@@ -483,7 +483,7 @@ and init_meta_overloads ctx cf =
 	let overloads = ref [] in
 	cf.cf_meta <- List.filter (fun m ->
 		match m with
-		| (":overload",[(EFunction (fname,f),p)],_)  ->
+		| (Meta.Overload,[(EFunction (fname,f),p)],_)  ->
 			if fname <> None then error "Function name must not be part of @:overload" p;
 			(match f.f_expr with Some (EBlock [], _) -> () | _ -> error "Overload must only declare an empty method body {}" p);
 			let old = ctx.type_params in
@@ -744,8 +744,8 @@ let set_heritance ctx c herits p =
 	let process_meta csup =
 		List.iter (fun m ->
 			match m with
-			| ":final", _, _ -> if not (Type.has_meta ":hack" c.cl_meta || (match c.cl_kind with KTypeParameter _ -> true | _ -> false)) then error "Cannot extend a final class" p;
-			| ":autoBuild", el, p -> c.cl_meta <- (":build",el,p) :: m :: c.cl_meta
+			| Meta.Final, _, _ -> if not (Meta.has Meta.Hack c.cl_meta || (match c.cl_kind with KTypeParameter _ -> true | _ -> false)) then error "Cannot extend a final class" p;
+			| Meta.AutoBuild, el, p -> c.cl_meta <- (Meta.Build,el,p) :: m :: c.cl_meta
 			| _ -> ()
 		) csup.cl_meta
 	in
@@ -960,7 +960,7 @@ let init_core_api ctx c =
 			) fcore;
 			PMap.iter (fun i f ->
 				let p = (match f.cf_expr with None -> c.cl_pos | Some e -> e.epos) in
-				if f.cf_public && not (has_meta ":hack" f.cf_meta) && not (PMap.mem f.cf_name fcore) && not (List.mem f.cf_name c.cl_overrides) then error ("Public field " ^ i ^ " is not part of core type") p;
+				if f.cf_public && not (Meta.has Meta.Hack f.cf_meta) && not (PMap.mem f.cf_name fcore) && not (List.mem f.cf_name c.cl_overrides) then error ("Public field " ^ i ^ " is not part of core type") p;
 			) fl;
 		in
 		check_fields ccore.cl_fields c.cl_fields;
@@ -1020,7 +1020,7 @@ let rec string_list_of_expr_path (e,p) =
 
 let build_module_def ctx mt meta fvars context_init fbuild =
 	let rec loop = function
-		| (":build",args,p) :: l ->
+		| (Meta.Build,args,p) :: l ->
 			let epath, el = (match args with
 				| [ECall (epath,el),p] -> epath, el
 				| _ -> error "Invalid build parameters" p
@@ -1069,8 +1069,8 @@ let init_class ctx c p context_init herits fields =
 		| _ -> error "Class build macro must return a single variable with anonymous fields" p
 	);
 	let fields = !fields in
-	let core_api = has_meta ":coreApi" c.cl_meta in
-	let is_class_macro = has_meta ":macro" c.cl_meta in
+	let core_api = Meta.has Meta.CoreApi c.cl_meta in
+	let is_class_macro = Meta.has Meta.Macro c.cl_meta in
 	if is_class_macro && Common.defined ctx.com Define.Haxe3 then display_error ctx "Macro-class is no longer allowed in haxe3" p;
 	let fields, herits = if is_class_macro && not ctx.in_macro then begin
 		c.cl_extern <- true;
@@ -1172,7 +1172,7 @@ let init_class ctx c p context_init herits fields =
 					if ctx.com.verbose then Common.log ctx.com ("Typing " ^ (if ctx.in_macro then "macro " else "") ^ s_type_path c.cl_path ^ "." ^ cf.cf_name);
 					let e = type_var_field ctx t e stat p in
 					let e = (match cf.cf_kind with
-					| Var v when c.cl_extern || has_meta ":extern" cf.cf_meta ->
+					| Var v when c.cl_extern || Meta.has Meta.Extern cf.cf_meta ->
 						if not stat then begin
 							display_error ctx "Extern non-static variables may not be initialized" p;
 							e
@@ -1205,7 +1205,7 @@ let init_class ctx c p context_init herits fields =
 		let name = f.cff_name in
 		let p = f.cff_pos in
 		let stat = List.mem AStatic f.cff_access in
-		let extern = has_meta ":extern" f.cff_meta || c.cl_extern in
+		let extern = Meta.has Meta.Extern f.cff_meta || c.cl_extern in
 		let allow_inline() =
 			match c.cl_kind, f.cff_kind with
 			| KAbstractImpl _, _ -> true
@@ -1214,7 +1214,7 @@ let init_class ctx c p context_init herits fields =
 		in
 		let inline = List.mem AInline f.cff_access && allow_inline() in
 		let override = List.mem AOverride f.cff_access in
-		let is_macro = has_meta ":macro" f.cff_meta in
+		let is_macro = Meta.has Meta.Macro f.cff_meta in
 		if is_macro && Common.defined ctx.com Define.Haxe3 then ctx.com.warning "@:macro should now be 'macro' accessor'" p;
 		let is_macro = is_macro || List.mem AMacro f.cff_access in
 		List.iter (fun acc ->
@@ -1336,11 +1336,11 @@ let init_class ctx c p context_init herits fields =
 			(match c.cl_kind with
 				| KAbstractImpl a ->
 					let m = mk_mono() in
-					if has_meta ":from" f.cff_meta then begin
+					if Meta.has Meta.From f.cff_meta then begin
 						let t_abstract = TAbstract(a,(List.map (fun _ -> mk_mono()) a.a_types)) in
 						unify ctx t (tfun [m] t_abstract) f.cff_pos;
 						a.a_from <- (follow m, Some cf) :: a.a_from
-					end else if has_meta ":to" f.cff_meta then begin
+					end else if Meta.has Meta.To f.cff_meta then begin
 						unify ctx t (tfun [a.a_this] m) f.cff_pos;
 						a.a_to <- (follow m, Some cf) :: a.a_to
 					end
@@ -1373,7 +1373,7 @@ let init_class ctx c p context_init herits fields =
 						(match e.eexpr with
 						| TBlock [] | TBlock [{ eexpr = TConst _ }] | TConst _ | TObjectDecl [] -> ()
 						| _ -> c.cl_init <- Some e);
-					if has_meta ":defineFeature" cf.cf_meta then add_feature ctx.com (s_type_path c.cl_path ^ "." ^ cf.cf_name);
+					if Meta.has Meta.DefineFeature cf.cf_meta then add_feature ctx.com (s_type_path c.cl_path ^ "." ^ cf.cf_name);
 					cf.cf_expr <- Some (mk (TFunction f) t p);
 					cf.cf_type <- t;
 				end;
@@ -1443,7 +1443,7 @@ let init_class ctx c p context_init herits fields =
 	in
 	let rec check_require = function
 		| [] -> None
-		| (":require",conds,_) :: l ->
+		| (Meta.Require,conds,_) :: l ->
 			let rec loop = function
 				| [] -> check_require l
 				| [EConst (String _),_] -> check_require l
@@ -1745,7 +1745,7 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 				| _ -> false
 			) herits in
 			if rtti && Common.defined ctx.com Define.Haxe3 then error ("Implementing haxe.rtti.Generic is deprecated in haxe 3, please use @:generic instead") c.cl_pos;
-			has_meta ":generic" c.cl_meta || rtti
+			Meta.has Meta.Generic c.cl_meta || rtti
 		in
 		if implements_rtti() && c.cl_types <> [] then c.cl_kind <- KGeneric;
 		if c.cl_path = (["haxe";"macro"],"MacroType") then c.cl_kind <- KMacroType;
@@ -1877,7 +1877,7 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 		let is_type = ref false in
 		let load_type t =
 			let t = load_complex_type ctx p t in
-			if not (has_meta ":coreType" a.a_meta) then begin
+			if not (Meta.has Meta.CoreType a.a_meta) then begin
 				if !is_type then begin
 					(try type_eq EqStrict a.a_this t with Unify_error _ -> error "You can only declare from/to with your subtype" p);
 				end else

+ 24 - 24
typer.ml

@@ -136,7 +136,7 @@ let field_type ctx c pl f p =
 	| [] -> f.cf_type
 	| l ->
 		let monos = List.map (fun _ -> mk_mono()) l in
-		if not (has_meta ":generic" f.cf_meta) then add_constraint_checks ctx c pl f monos p;
+		if not (Meta.has Meta.Generic f.cf_meta) then add_constraint_checks ctx c pl f monos p;
 		apply_params l monos f.cf_type
 
 let class_field ctx c pl name p =
@@ -179,14 +179,14 @@ let rec can_access ctx c cf stat =
 		(try
 			(* if our common ancestor declare/override the field, then we can access it *)
 			let f = if is_constr then (match c.cl_constructor with None -> raise Not_found | Some c -> c) else PMap.find cf.cf_name (if stat then c.cl_statics else c.cl_fields) in
-			is_parent c ctx.curclass || has ":allow" c f cur_path
+			is_parent c ctx.curclass || has Meta.Allow c f cur_path
 		with Not_found ->
 			false
 		)
 		|| (match c.cl_super with
 		| Some (csup,_) -> loop csup
 		| None -> false)
-		|| has ":access" ctx.curclass ctx.curfield (make_path c cf)
+		|| has Meta.Access ctx.curclass ctx.curfield (make_path c cf)
 	in
 	let b = loop c
 	(* access is also allowed of we access a type parameter which is constrained to our (base) class *)
@@ -194,8 +194,8 @@ let rec can_access ctx c cf stat =
 		| KTypeParameter tl ->
 			List.exists (fun t -> match follow t with TInst(c,_) -> loop c | _ -> false) tl
 		| _ -> false)
-	|| (has_meta ":privateAccess" ctx.meta) in
-	if b && Common.defined ctx.com Common.Define.As3 && not (has_meta ":public" cf.cf_meta) then cf.cf_meta <- (":public",[],cf.cf_pos) :: cf.cf_meta;
+	|| (Meta.has Meta.PrivateAccess ctx.meta) in
+	if b && Common.defined ctx.com Common.Define.As3 && not (Meta.has Meta.Public cf.cf_meta) then cf.cf_meta <- (Meta.Public,[],cf.cf_pos) :: cf.cf_meta;
 	b
 
 (* removes the first argument of the class field's function type and all its overloads *)
@@ -347,7 +347,7 @@ let rec unify_min_raise ctx (el:texpr list) : t =
 			let common_types = base_types t in
 			let dyn_types = List.fold_left (fun acc t ->
 				let rec loop c =
-					has_meta ":unifyMinDynamic" c.cl_meta || (match c.cl_super with None -> false | Some (c,_) -> loop c)
+					Meta.has Meta.UnifyMinDynamic c.cl_meta || (match c.cl_super with None -> false | Some (c,_) -> loop c)
 				in
 				match t with
 				| TInst (c,params) when params <> [] && loop c ->
@@ -526,7 +526,7 @@ let rec type_module_type ctx t tparams p =
 	| TAbstractDecl { a_impl = Some c } ->
 		type_module_type ctx (TClassDecl c) tparams p
 	| TAbstractDecl a ->
-		if not (has_meta ":runtimeValue" a.a_meta) then error (s_type_path a.a_path ^ " is not a value") p;
+		if not (Meta.has Meta.RuntimeValue a.a_meta) then error (s_type_path a.a_path ^ " is not a value") p;
 		let t_tmp = {
 			t_path = fst a.a_path, "#" ^ snd a.a_path;
 			t_module = a.a_module;
@@ -567,11 +567,11 @@ let make_call ctx e params t p =
 		let is_extern = (match cl with
 			| Some { cl_extern = true } -> true
 			| Some { cl_kind = KAbstractImpl _ } -> true
-			| _ when has_meta ":extern" f.cf_meta -> true
+			| _ when Meta.has Meta.Extern f.cf_meta -> true
 			| _ -> false
 		) in
 		let config = match cl with
-			| Some ({cl_kind = KAbstractImpl _ }) when has_meta ":impl" f.cf_meta ->
+			| Some ({cl_kind = KAbstractImpl _ }) when Meta.has Meta.Impl f.cf_meta ->
 				(match if fname = "_new" then t else follow (List.hd params).etype with
 					| TAbstract(a,pl) ->
 						Some (a.a_types <> [], apply_params a.a_types pl)
@@ -636,7 +636,7 @@ let rec acc_get ctx g p =
 			else
 				error "Recursive inline is not supported" p
 		| Some { eexpr = TFunction _ } ->
-			let chk_class c = if (c.cl_extern || has_meta ":extern" f.cf_meta) && not (has_meta ":runtime" f.cf_meta) then display_error ctx "Can't create closure on an inline extern method" p in
+			let chk_class c = if (c.cl_extern || Meta.has Meta.Extern f.cf_meta) && not (Meta.has Meta.Runtime f.cf_meta) then display_error ctx "Can't create closure on an inline extern method" p in
 			(match follow e.etype with
 			| TInst (c,_) -> chk_class c
 			| TAnon a -> (match !(a.a_status) with Statics c -> chk_class c | _ -> ())
@@ -762,7 +762,7 @@ let using_field ctx mode e i p =
 				with Not_found ->
 					(try unify_raise ctx e.etype t0 p with Error (Unify _,_) -> raise Not_found); t0) in
 				if follow e.etype == t_dynamic && follow t0 != t_dynamic then raise Not_found;
-				if has_meta ":noUsing" f.cf_meta then raise Not_found;
+				if Meta.has Meta.NoUsing f.cf_meta then raise Not_found;
 				let et = type_module_type ctx (TClassDecl c) None p in
 				AKUsing (mk (TField (et,FStatic (c,f))) t p,c,f,e)
 			| _ -> raise Not_found)
@@ -1031,7 +1031,7 @@ and type_field ctx e i p mode =
 			let f = PMap.find i c.cl_statics in
 			let t = field_type ctx c [] f p in
 			let t = apply_params a.a_types pl t in
-			if not (has_meta ":impl" f.cf_meta) then (match follow t with
+			if not (Meta.has Meta.Impl f.cf_meta) then (match follow t with
 				| TFun((_,_,ta) :: _,_) -> unify ctx e.etype ta p
 				| _ -> raise Not_found);
 			let et = type_module_type ctx (TClassDecl c) None p in
@@ -1202,10 +1202,10 @@ let type_generic_function ctx (e,cf) el p =
 			cf2.cf_kind <- cf.cf_kind;
 			cf2.cf_public <- cf.cf_public;
 			let metadata = List.filter (fun (m,_,_) -> match m with
-				| ":generic" -> false
+				| Meta.Generic -> false
 				| _ -> true
 			) cf.cf_meta in
-			cf2.cf_meta <- (":noComplete",[],p) :: (":noUsing",[],p) :: metadata;
+			cf2.cf_meta <- (Meta.NoCompletion,[],p) :: (Meta.NoUsing,[],p) :: metadata;
 			cf2
 		in
 		let e = if stat then type_type ctx c.cl_path p else e in
@@ -1502,7 +1502,7 @@ and type_switch_old ctx e cases def with_type p =
 	let enum = ref None in
 	let used_cases = Hashtbl.create 0 in
 	let is_fake_enum e =
-		e.e_path = ([],"Bool") || has_meta ":fakeEnum" e.e_meta
+		e.e_path = ([],"Bool") || Meta.has Meta.FakeEnum e.e_meta
 	in
 	(match follow eval.etype with
 	| TEnum (e,_) when is_fake_enum e -> ()
@@ -1858,7 +1858,7 @@ and type_access ctx e p mode =
 				apply_params pl tl (loop (TInst (c,stl)))
 			| TInst ({ cl_path = [],"ArrayAccess" },[t]) ->
 				t
-			| TAbstract(a,tl) when has_meta ":arrayAccess" a.a_meta ->
+			| TAbstract(a,tl) when Meta.has Meta.ArrayAccess a.a_meta ->
 				loop (apply_params a.a_types tl a.a_this)
 			| _ ->
 				let pt = mk_mono() in
@@ -2103,7 +2103,7 @@ and type_expr ctx (e,p) (with_type:with_type) =
 					if ctx.with_type_resume then raise (WithTypeError (l,p)) else raise (Error (Unify l,p))
 				in
 				PMap.iter (fun n cf ->
-					if not (has_meta ":optional" cf.cf_meta) && not (PMap.mem n !fields) then unify_error [has_no_field t n] p;
+					if not (Meta.has Meta.Optional cf.cf_meta) && not (PMap.mem n !fields) then unify_error [has_no_field t n] p;
 				) a.a_fields;
 				(match !extra_fields with
 				| [] -> ()
@@ -2475,7 +2475,7 @@ and type_expr ctx (e,p) (with_type:with_type) =
 				TClassDecl c
 			| TEnum (e,_) -> TEnumDecl e
 			| _ -> assert false);
-		| TAbstract (a,params) when has_meta ":runtimeValue" a.a_meta ->
+		| TAbstract (a,params) when Meta.has Meta.RuntimeValue a.a_meta ->
 			List.iter (fun pt ->
 				if follow pt != t_dynamic then error "Cast type parameters must be Dynamic" p;
 			) params;
@@ -2533,7 +2533,7 @@ and type_expr ctx (e,p) (with_type:with_type) =
 			| TAbstract({a_impl = Some c} as a,pl) ->
 				ctx.m.module_using <- c :: ctx.m.module_using;
 				PMap.fold (fun f acc ->
-					if f.cf_name <> "_new" && can_access ctx c f true && has_meta ":impl" f.cf_meta then begin
+					if f.cf_name <> "_new" && can_access ctx c f true && Meta.has Meta.Impl f.cf_meta then begin
 						let f = prepare_using_field f in
 						let t = apply_params a.a_types pl (follow f.cf_type) in
 						PMap.add f.cf_name { f with cf_public = true; cf_type = opt_type t } acc
@@ -2563,7 +2563,7 @@ and type_expr ctx (e,p) (with_type:with_type) =
 				let acc = ref (loop acc l) in
 				let rec dup t = Type.map dup t in
 				List.iter (fun f ->
-					if not (has_meta ":noUsing" f.cf_meta) then
+					if not (Meta.has Meta.NoUsing f.cf_meta) then
 					let f = { f with cf_type = opt_type f.cf_type } in
 					match follow (field_type ctx c [] f p) with
 					| TFun((_,_,TType({t_path=["haxe";"macro"], ("ExprOf"|"ExprRequire")}, [t])) :: args, ret)
@@ -2581,7 +2581,7 @@ and type_expr ctx (e,p) (with_type:with_type) =
 		in
 		let use_methods = loop PMap.empty ctx.m.module_using in
 		let fields = PMap.fold (fun f acc -> PMap.add f.cf_name f acc) fields use_methods in
-		let fields = PMap.fold (fun f acc -> if has_meta ":noComplete" f.cf_meta then acc else f :: acc) fields [] in
+		let fields = PMap.fold (fun f acc -> if Meta.has Meta.NoCompletion f.cf_meta then acc else f :: acc) fields [] in
 		let t = (if iscall then
 			match follow e.etype with
 			| TFun _ -> e.etype
@@ -2695,7 +2695,7 @@ and build_call ctx acc el (with_type:with_type) p =
 			| _ -> error (s_type (print_context()) t ^ " cannot be called") p
 		) in
 		make_call ctx (mk (TField (ethis,fmode)) t p) params (match tfunc with TFun(_,r) -> r | _ -> assert false) p
-	| AKUsing (et,cl,ef,eparam) when has_meta ":generic" ef.cf_meta ->
+	| AKUsing (et,cl,ef,eparam) when Meta.has Meta.Generic ef.cf_meta ->
 		(match et.eexpr with
 		| TField(ec,_) ->
 			let el,t,e = type_generic_function ctx (ec,ef) (Interp.make_ast eparam :: el) p in
@@ -2727,7 +2727,7 @@ and build_call ctx acc el (with_type:with_type) p =
 			(match ctx.g.do_macro ctx MExpr c.cl_path f.cf_name el p with
 			| None -> (fun() -> type_expr ctx (EConst (Ident "null"),p) Value)
 			| Some (EVars vl,p) -> (fun() -> type_vars ctx vl p true)
-			| Some e -> (fun() -> type_expr ctx (EMeta((":privateAccess",[],snd e),e),snd e) with_type))
+			| Some e -> (fun() -> type_expr ctx (EMeta((Meta.PrivateAccess,[],snd e),e),snd e) with_type))
 		| _ ->
 			(* member-macro call : since we will make a static call, let's found the actual class and not its subclass *)
 			(match follow ethis.etype with
@@ -2769,7 +2769,7 @@ and build_call ctx acc el (with_type:with_type) p =
 					None
 			) in
 			(match fopts,acc with
-				| Some (_,cf),AKField({eexpr = TField(e,_)},_,_) when has_meta ":generic" cf.cf_meta ->
+				| Some (_,cf),AKField({eexpr = TField(e,_)},_,_) when Meta.has Meta.Generic cf.cf_meta ->
 					type_generic_function ctx (e,cf) el p
 				| _ ->
 					let el, tfunc = unify_call_params ctx fopts el args r p false in

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä