-
-
Notifications
You must be signed in to change notification settings - Fork 657
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] add test for custom target and macro com API limitations
- Loading branch information
Showing
4 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import haxe.macro.Compiler; | ||
import haxe.macro.Context; | ||
import haxe.macro.Type; | ||
|
||
class InitMacro { | ||
static function setup() { | ||
switch (Compiler.getConfiguration().platform) { | ||
case CustomTarget("mylang"): {} | ||
case _: throw "this shouldnt happen."; | ||
} | ||
|
||
Context.onAfterTyping(check); | ||
} | ||
|
||
static function check(types:Array<ModuleType>) { | ||
for (m in types) { | ||
switch (m) { | ||
case TClassDecl(_.get() => c): | ||
for (f in c.fields.get()) f.expr(); | ||
|
||
case _: | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
function main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-main Main2 | ||
--custom-target mylang=out | ||
--macro InitMacro.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package mylang; | ||
|
||
class Init { | ||
public static function init() { | ||
} | ||
} |