forked from HaxeFoundation/haxe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[typer] Delay typer creation to after init macros (HaxeFoundation#11323)
* Move global_metadata to common context * Revert "Move global_metadata to common context" This reverts commit 319e074. * [typer] delay typer init to after init macros * [debug] add compiler stage debug * [typer] fix macro context when no init macros * [typer] promote macro api to full api after init macros * [typer] remove CTyperCreated stage * [display] restore DisplayProcessing * [typer] rework after init macro * [typer] fix macro api context when no init macros * [macro] don't reset static prototype after init macros * small cleanup * Remove MacroLight, simplify init macro context creation * Reduce diff * Cleanup interp cache handling * [custom targets] enable macro cache before setting up targets * [tests] add test for custom target and macro com API limitations --------- Co-authored-by: Simon Krajewski <[email protected]>
- Loading branch information
Showing
13 changed files
with
118 additions
and
71 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
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
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
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
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
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
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
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
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
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() { | ||
} | ||
} |