HaxeFoundation / HaxeFoundation/haxe
[js] Metadata is set after __init__
Open
discussion
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
@foo class Test {
static function __init__()
trace(haxe.rtti.Meta.getType(Test)); // {}
static function main() {
trace("Haxe is great!");
}
}
```
That's because the generated JavaScript will look like this:
```js
console.log("tests/Test.hx:3:",haxe_rtti_Meta.getType(Test));
Test.__meta__ = { obj : { foo : null}};
```
Since runtime metadata may online contain constants, it should be safe to initialize all of it before all `__init__` calls.
Contributor guide
Assessment
This issue has not been assessed yet.