Explorar o código

respect `@:mergeBlock` from syntax/macros too (see #3921)

Simon Krajewski %!s(int64=10) %!d(string=hai) anos
pai
achega
ccfbadcdbf
Modificáronse 2 ficheiros con 6 adicións e 1 borrados
  1. 1 1
      common.ml
  2. 5 0
      typer.ml

+ 1 - 1
common.ml

@@ -429,7 +429,7 @@ module MetaInfo = struct
 		| Meta -> ":meta",("Internally used to mark a class field as being the metadata field",[])
 		| Macro -> ":macro",("(deprecated)",[])
 		| MaybeUsed -> ":maybeUsed",("Internally used by DCE to mark fields that might be kept",[Internal])
-		| MergeBlock -> ":mergeBlock",("Internally used by typer to mark block that should be merged into the outer scope",[Internal])
+		| MergeBlock -> ":mergeBlock",("Merge the annotated block into the current scope",[UsedOn TExpr])
 		| MultiType -> ":multiType",("Specifies that an abstract chooses its this-type from its @:to functions",[UsedOn TAbstract; HasParam "Relevant type parameters"])
 		| Native -> ":native",("Rewrites the path of a class or enum during generation",[HasParam "Output type path";UsedOnEither [TClass;TEnum]])
 		| NativeChildren -> ":nativeChildren",("Annotates that all children from a type should be treated as if it were an extern definition - platform native",[Platforms [Java;Cs]; UsedOn TClass])

+ 5 - 0
typer.ml

@@ -3524,6 +3524,11 @@ and type_expr ctx (e,p) (with_type:with_type) =
 			| (Meta.Analyzer,_,_) ->
 				let e = e() in
 				{e with eexpr = TMeta(m,e)}
+			| (Meta.MergeBlock,_,_) ->
+				begin match fst e1 with
+				| EBlock el -> type_block ctx el with_type p
+				| _ -> e()
+				end
 			| (Meta.StoredTypedExpr,_,_) ->
 				let id = match e1 with (EConst (Int s),_) -> int_of_string s | _ -> assert false in
 				get_stored_typed_expr ctx.com id