HaxeFoundation / HaxeFoundation/haxe

Macro reification of abstract/final class/interface

Open
#10,060 3 comments 3 reactions 0 assignees View on GitHub
platform-macro
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Tried doing an abstract or final class through macro reification, but using modifiers doesn't work:
```haxe
macro abstract class A {};
macro final class B {};
macro abstract interface C {};
macro final interface D {};
```
but got the error `Expected expression` for `abstract` and `Missing ;` for `final`.

As a workaround I can fix the `Typedefinition.kind` after the fact.
```haxe
var cls = macro class A {
abstract function test():Void;
}
cls.kind = TDClass(null, [], false, false, true);
```
but it's a bit hacky.

Might be out of scope, but I get the same error if I try to make an abstact, enum or enum abstract:
```haxe
macro abstract A(Int) {};
macro enum abstract B(Int) {};
macro enum C {};
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.