Skip to content

Commit

Permalink
Merge pull request #10 from kLabz/feature/quick-env-add
Browse files Browse the repository at this point in the history
Add env.add(pack.to.Module) macro sugar
  • Loading branch information
jeremyfa authored Dec 7, 2021
2 parents 94c2cb3 + f5d18f5 commit 60e79f1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions interpret/Env.hx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ class Env {

} //addDefaultModules

/** Helper to simplify usual addModule() calls */
public macro function add(ethis, typePath:haxe.macro.Expr):haxe.macro.Expr {
return macro $ethis.addModule(
$v{haxe.macro.ExprTools.toString(typePath)},
interpret.DynamicModule.fromStatic($typePath)
);
}

/** Add dynamic module */
public function addModule(typePath:String, module:DynamicModule):Void {

Expand Down

0 comments on commit 60e79f1

Please sign in to comment.