2
0
Эх сурвалжийг харах

use different metadata to avoid over-optimization

Simon Krajewski 9 жил өмнө
parent
commit
8f71c596f5

+ 1 - 1
src/optimization/filters.ml

@@ -117,7 +117,7 @@ let check_local_vars_init e =
 		| TVar (v,eo) ->
 			begin
 				match eo with
-				| None when Meta.has Meta.CompilerGenerated v.v_meta ->
+				| None when Meta.has Meta.InlineConstructorVariable v.v_meta ->
 					()
 				| None ->
 					declared := v.v_id :: !declared;

+ 1 - 1
src/optimization/optimizer.ml

@@ -1437,7 +1437,7 @@ let inline_constructors ctx e =
 	let add_field_var v s t =
 		let ii = IntMap.find v.v_id !vars in
 		let v' = alloc_var (Printf.sprintf "%s_%s" v.v_name s) t v.v_pos in
-		v'.v_meta <- (Meta.CompilerGenerated,[],v.v_pos) :: v'.v_meta;
+		v'.v_meta <- (Meta.InlineConstructorVariable,[],v.v_pos) :: v'.v_meta;
 		ii.ii_fields <- PMap.add s v' ii.ii_fields;
 		v'
 	in

+ 1 - 0
src/syntax/ast.ml

@@ -102,6 +102,7 @@ module Meta = struct
 		| ImplicitCast
 		| Include
 		| InitPackage
+		| InlineConstructorVariable
 		| Internal
 		| IsVar
 		| JavaCanonical

+ 1 - 0
src/typing/common.ml

@@ -503,6 +503,7 @@ module MetaInfo = struct
 		| ImplicitCast -> ":implicitCast",("Generated automatically on the AST when an implicit abstract cast happens",[Internal; UsedOn TExpr])
 		| Include -> ":include",("",[Platform Cpp])
 		| InitPackage -> ":initPackage",("?",[])
+		| InlineConstructorVariable -> ":inlineConstructorVariable",("Internally used to mark variables that come from inlined constructors",[Internal])
 		| Meta.Internal -> ":internal",("Generates the annotated field/class with 'internal' access",[Platforms [Java;Cs]; UsedOnEither[TClass;TEnum;TClassField]])
 		| IsVar -> ":isVar",("Forces a physical field to be generated for properties that otherwise would not require one",[UsedOn TClassField])
 		| JavaCanonical -> ":javaCanonical",("Used by the Java target to annotate the canonical path of the type",[HasParam "Output type package";HasParam "Output type name";UsedOnEither [TClass;TEnum]; Platform Java])