feat(compiler): add native class support with export annotations

- Introduce LibraryExportedNative class with #[Native] attribute
- Add LibraryHiddenNative class with #[NoExport] and #[Native] attributes
- Create stub file for native class definitions
- Implement StubNativePoint class with native annotation and basic properties
- Add length method to StubNativePoint for geometric calculations
- Enable compiler support for native class annotations
master
韩天峰 2 days ago
parent 2471ed1db7
commit 00420215b3
  1. 7
      phpunit/code/compiler_api/library_exported_native.php
  2. 13
      phpunit/code/compiler_api/library_hidden_native.php
  3. 10
      phpunit/code/native-class-stub.stub.php

@ -0,0 +1,7 @@
<?php
#[Native]
final class LibraryExportedNative
{
public int $value = 0;
}

@ -0,0 +1,13 @@
<?php
#[NoExport]
#[Native]
final class LibraryHiddenNative
{
public int $value = 0;
}
function library_visible_value(): int
{
return 42;
}

@ -0,0 +1,10 @@
<?php
#[Native]
final class StubNativePoint
{
public float $x = 0.0;
public float $y = 0.0;
public function length(): float {}
}
Loading…
Cancel
Save