Skip to content

Commit 81663be

Browse files
committed
Fix @AfterMapping scope issue (close DoclerLabs/hexMachina#239)
1 parent 66bf1cd commit 81663be

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/hex/di/mapping/MappingChecker.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class MappingChecker
173173
hasAfterMappingMeta = hasAfterMappingMeta || true;
174174
//Append
175175
a.push( exp );
176-
e.expr = EBlock( a );
176+
e.expr = (macro @:mergeBlock $b{a}).expr;
177177
case _:
178178
//trace( new haxe.macro.Printer().printExpr( e ) );
179179
ExprTools.iter( e, findAfterMappingMeta );

test/hex/di/mock/owner/DependencyOwnerAfterMapping.hx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ class DependencyOwnerChildWithAfterMappingWrapped extends SuperDependencyOwner
134134
if( arg == 3 )
135135
{
136136
@AfterMapping
137+
var i = 0;
138+
i++;
137139
id = try _injector.getInstance( Interface, "id" ) catch(e:Exception) null;
138140
id2 = try _injector.getInstance( Interface, "id2" ) catch(e:Exception) null;
139141
}

0 commit comments

Comments
 (0)